|
|
|
@ -52,26 +52,10 @@ public class StatisticalController {
|
|
|
|
|
@PostMapping("/statisticalInformation") |
|
|
|
|
@ApiOperation("农场数据统计接口") |
|
|
|
|
public CommonResult<StatisticalVo> 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<WorkHourDO> workList = workHourMapper.selectList(Wrappers.<WorkHourDO>lambdaQuery().ge(WorkHourDO::getCreateTime, beforeTime).le(WorkHourDO::getCreateTime, currentTime)); |
|
|
|
|
List<WorkHourDO> workList = workHourMapper.selectList(Wrappers.<WorkHourDO>lambdaQuery().ge(WorkHourDO::getCreateTime, time.getStartTime()).le(WorkHourDO::getCreateTime, time.getEndTime())); |
|
|
|
|
//工时的userId
|
|
|
|
|
List<Long> workUserIdList = workList.stream().map(WorkHourDO::getUserId).collect(Collectors.toList()); |
|
|
|
|
//获取工时所有人信息
|
|
|
|
|