Commit b32177f8 authored by nie'hong's avatar nie'hong

调试

parent 1b884197
...@@ -179,7 +179,7 @@ ...@@ -179,7 +179,7 @@
#{projectId} #{projectId}
</foreach> </foreach>
<if test="firstDayOfMonth != null"> <if test="firstDayOfMonth != null">
work_day >= #{firstDayOfMonth} AND work_day >= date(#{firstDayOfMonth})
</if> </if>
group by `type`,dept_id, project_id group by `type`,dept_id, project_id
</select> </select>
......
...@@ -236,24 +236,28 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -236,24 +236,28 @@ public class StatisticsServiceImpl implements StatisticsService {
Date firstDayOfMonth = DateUtil.getFirstDayOfMonth(now); Date firstDayOfMonth = DateUtil.getFirstDayOfMonth(now);
//本月第一天到当日的日期集合 //本月第一天到当日的日期集合
List<Date> workDays = DateUtil.getDatesBetweenTwoDate(firstDayOfMonth, now); List<Date> workDays = DateUtil.getDatesBetweenTwoDate(firstDayOfMonth, now);
//除去周末和节假日 //除去周末
Iterator<Date> iterator = workDays.iterator(); Iterator<Date> iterator = workDays.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
Date next = iterator.next(); int week = DateUtil.getWeek(iterator.next());
if (workHolidayService.isHoliday(next)) { if (week == 6 || week == 7) {
iterator.remove(); iterator.remove();
} }
} }
//获取当月的节日和周末上班日期 //获取当月的节日和周末上班日期
List<WorkHoliday> specialDates = workHolidayMapper.getByDate(firstDayOfMonth, now); List<WorkHoliday> specialDates = workHolidayMapper.getByDate(firstDayOfMonth, now);
if (CollectionUtil.isNotEmpty(specialDates)) { if (CollectionUtil.isEmpty(specialDates)) {
for (WorkHoliday specialDate : specialDates) { return workDays;
//获取的是工作日 }
if (specialDate.getDayType().equals(HolidayTypeEnum.WORKING_DAY.getCode())) { for (WorkHoliday specialDate : specialDates) {
//在本月应上班集合中加上这天,一般都是放假前后的周末调整上班 List<Date> isWorkDays = DateUtil.getDatesBetweenTwoDate(specialDate.getDayStart(), specialDate.getDayEnd());
List<Date> isWorkDays = DateUtil.getDatesBetweenTwoDate(specialDate.getDayStart(), specialDate.getDayEnd()); //获取的是工作日
workDays.addAll(isWorkDays); if (specialDate.getDayType().equals(HolidayTypeEnum.WORKING_DAY.getCode())) {
} //在本月应上班集合中加上这天,一般都是放假前后的周末调整上班
workDays.addAll(isWorkDays);
}else {
//否则就除去假日
workDays.removeAll(isWorkDays);
} }
} }
return workDays; return workDays;
......
...@@ -15,6 +15,7 @@ import io.swagger.annotations.ApiImplicitParam; ...@@ -15,6 +15,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -57,7 +58,7 @@ public class StatisticsController extends BaseController { ...@@ -57,7 +58,7 @@ public class StatisticsController extends BaseController {
@ApiOperation(value = "获取负责项目工时汇总", notes = "获取负责项目工时汇总") @ApiOperation(value = "获取负责项目工时汇总", notes = "获取负责项目工时汇总")
@GetMapping("/getCurrentMonthWorkTimeCollect") @GetMapping("/getCurrentMonthWorkTimeCollect")
public List<WorkTimeAndCostCollect> getWorkTimeCollect(Integer userId, Date startTime) { public List<WorkTimeAndCostCollect> getWorkTimeCollect(Integer userId,@DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime) {
log.info("WorkUserController[]getCurrentMonthWorkTimeCollect[]input.param" + userId,startTime); log.info("WorkUserController[]getCurrentMonthWorkTimeCollect[]input.param" + userId,startTime);
if (userId == null) { if (userId == null) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL); throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment