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

调试

parent 1b884197
......@@ -179,7 +179,7 @@
#{projectId}
</foreach>
<if test="firstDayOfMonth != null">
work_day >= #{firstDayOfMonth}
AND work_day >= date(#{firstDayOfMonth})
</if>
group by `type`,dept_id, project_id
</select>
......
......@@ -236,24 +236,28 @@ public class StatisticsServiceImpl implements StatisticsService {
Date firstDayOfMonth = DateUtil.getFirstDayOfMonth(now);
//本月第一天到当日的日期集合
List<Date> workDays = DateUtil.getDatesBetweenTwoDate(firstDayOfMonth, now);
//除去周末和节假日
//除去周末
Iterator<Date> iterator = workDays.iterator();
while (iterator.hasNext()) {
Date next = iterator.next();
if (workHolidayService.isHoliday(next)) {
int week = DateUtil.getWeek(iterator.next());
if (week == 6 || week == 7) {
iterator.remove();
}
}
//获取当月的节日和周末上班日期
List<WorkHoliday> specialDates = workHolidayMapper.getByDate(firstDayOfMonth, now);
if (CollectionUtil.isNotEmpty(specialDates)) {
for (WorkHoliday specialDate : specialDates) {
//获取的是工作日
if (specialDate.getDayType().equals(HolidayTypeEnum.WORKING_DAY.getCode())) {
//在本月应上班集合中加上这天,一般都是放假前后的周末调整上班
List<Date> isWorkDays = DateUtil.getDatesBetweenTwoDate(specialDate.getDayStart(), specialDate.getDayEnd());
workDays.addAll(isWorkDays);
}
if (CollectionUtil.isEmpty(specialDates)) {
return workDays;
}
for (WorkHoliday specialDate : specialDates) {
List<Date> isWorkDays = DateUtil.getDatesBetweenTwoDate(specialDate.getDayStart(), specialDate.getDayEnd());
//获取的是工作日
if (specialDate.getDayType().equals(HolidayTypeEnum.WORKING_DAY.getCode())) {
//在本月应上班集合中加上这天,一般都是放假前后的周末调整上班
workDays.addAll(isWorkDays);
}else {
//否则就除去假日
workDays.removeAll(isWorkDays);
}
}
return workDays;
......
......@@ -15,6 +15,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -57,7 +58,7 @@ public class StatisticsController extends BaseController {
@ApiOperation(value = "获取负责项目工时汇总", notes = "获取负责项目工时汇总")
@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);
if (userId == 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