diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/statistical/StatisticalController.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/statistical/StatisticalController.java index 5ff869bd..4eb6aa85 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/statistical/StatisticalController.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/statistical/StatisticalController.java @@ -52,26 +52,10 @@ public class StatisticalController { @PostMapping("/statisticalInformation") @ApiOperation("农场数据统计接口") public CommonResult statisticalInformation(@RequestBody RequestDTO searchDTO){ - LocalDateTime currentTime = LocalDateTime.now(); - LocalDateTime beforeTime ; - if (searchDTO.getTimeSearch() == 1){ - //本周 - DateTime time = DateUtil.beginOfWeek(new Date()); - String timeStr = DateUtil.format(time, DatePattern.NORM_DATETIME_PATTERN); - beforeTime = LocalDateTimeUtil.parse(timeStr, DatePattern.NORM_DATETIME_PATTERN); - }else if (searchDTO.getTimeSearch() == 2){ - //前一个月 - beforeTime = LocalDateTimeUtil.offset(currentTime, -30, ChronoUnit.DAYS); - }else{ - //前三个月 - beforeTime = LocalDateTimeUtil.offset(currentTime, -90, ChronoUnit.DAYS); - } - TimeLimitDTO time = FarmTimeUtil.getStartTimeAndEndTime(searchDTO.getTimeEnum()); - StatisticalVo vo = new StatisticalVo(); //获取时间内的所有工时记录 - List workList = workHourMapper.selectList(Wrappers.lambdaQuery().ge(WorkHourDO::getCreateTime, beforeTime).le(WorkHourDO::getCreateTime, currentTime)); + List workList = workHourMapper.selectList(Wrappers.lambdaQuery().ge(WorkHourDO::getCreateTime, time.getStartTime()).le(WorkHourDO::getCreateTime, time.getEndTime())); //工时的userId List workUserIdList = workList.stream().map(WorkHourDO::getUserId).collect(Collectors.toList()); //获取工时所有人信息 diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/statistical/dto/RequestDTO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/statistical/dto/RequestDTO.java index d53c097d..12bae641 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/statistical/dto/RequestDTO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/statistical/dto/RequestDTO.java @@ -9,9 +9,6 @@ public class RequestDTO { private static final long serialVersionUID = 1L; - @ApiModelProperty("统计查询时间 1本周 2一个月 3三个月") - private Integer timeSearch; - @ApiModelProperty("便捷时间查询 3本周 6一个月 7三个月") private FarmTimeEnum timeEnum; } \ No newline at end of file