修改
This commit is contained in:
+1
-17
@@ -52,26 +52,10 @@ public class StatisticalController {
|
|||||||
@PostMapping("/statisticalInformation")
|
@PostMapping("/statisticalInformation")
|
||||||
@ApiOperation("农场数据统计接口")
|
@ApiOperation("农场数据统计接口")
|
||||||
public CommonResult<StatisticalVo> statisticalInformation(@RequestBody RequestDTO searchDTO){
|
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());
|
TimeLimitDTO time = FarmTimeUtil.getStartTimeAndEndTime(searchDTO.getTimeEnum());
|
||||||
|
|
||||||
StatisticalVo vo = new StatisticalVo();
|
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
|
//工时的userId
|
||||||
List<Long> workUserIdList = workList.stream().map(WorkHourDO::getUserId).collect(Collectors.toList());
|
List<Long> workUserIdList = workList.stream().map(WorkHourDO::getUserId).collect(Collectors.toList());
|
||||||
//获取工时所有人信息
|
//获取工时所有人信息
|
||||||
|
|||||||
-3
@@ -9,9 +9,6 @@ public class RequestDTO {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ApiModelProperty("统计查询时间 1本周 2一个月 3三个月")
|
|
||||||
private Integer timeSearch;
|
|
||||||
|
|
||||||
@ApiModelProperty("便捷时间查询 3本周 6一个月 7三个月")
|
@ApiModelProperty("便捷时间查询 3本周 6一个月 7三个月")
|
||||||
private FarmTimeEnum timeEnum;
|
private FarmTimeEnum timeEnum;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user