Browse Source

修復錯誤

zyh
小久哥 3 years ago
parent
commit
f42644e836
  1. 12
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/statistical/StatisticalController.java

12
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/statistical/StatisticalController.java

@ -4,6 +4,7 @@ import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.farm.controller.admin.statistical.dto.RequestDTO; import cn.iocoder.yudao.module.farm.controller.admin.statistical.dto.RequestDTO;
import cn.iocoder.yudao.module.farm.controller.admin.statistical.vo.*; import cn.iocoder.yudao.module.farm.controller.admin.statistical.vo.*;
@ -56,6 +57,12 @@ public class StatisticalController {
StatisticalVo vo = new StatisticalVo(); StatisticalVo vo = new StatisticalVo();
//获取时间内的所有工时记录 //获取时间内的所有工时记录
List<WorkHourDO> workList = workHourMapper.selectList(Wrappers.<WorkHourDO>lambdaQuery().ge(WorkHourDO::getCreateTime, time.getStartTime()).le(WorkHourDO::getCreateTime, time.getEndTime())); List<WorkHourDO> workList = workHourMapper.selectList(Wrappers.<WorkHourDO>lambdaQuery().ge(WorkHourDO::getCreateTime, time.getStartTime()).le(WorkHourDO::getCreateTime, time.getEndTime()));
//工时统计 条形图
List<WorkMsg> workMsgList = new ArrayList<>();
if (ObjectUtil.isEmpty(workList)){
vo.setWorkMsgList(workMsgList);
}else{
//工时的userId //工时的userId
List<Long> workUserIdList = workList.stream().map(WorkHourDO::getUserId).collect(Collectors.toList()); List<Long> workUserIdList = workList.stream().map(WorkHourDO::getUserId).collect(Collectors.toList());
//获取工时所有人信息 //获取工时所有人信息
@ -64,8 +71,7 @@ public class StatisticalController {
Map<Long, List<WorkHourDO>> workMap = workList.stream().collect(Collectors.groupingBy(WorkHourDO::getUserId)); Map<Long, List<WorkHourDO>> workMap = workList.stream().collect(Collectors.groupingBy(WorkHourDO::getUserId));
Iterator<Map.Entry<Long, List<WorkHourDO>>> iterator = workMap.entrySet().iterator(); Iterator<Map.Entry<Long, List<WorkHourDO>>> iterator = workMap.entrySet().iterator();
//工时统计 条形图
List<WorkMsg> workMsgList = new ArrayList<>();
while (iterator.hasNext()){ while (iterator.hasNext()){
Entry<Long, List<WorkHourDO>> entry = iterator.next(); Entry<Long, List<WorkHourDO>> entry = iterator.next();
Long userId = entry.getKey(); Long userId = entry.getKey();
@ -79,6 +85,8 @@ public class StatisticalController {
} }
workMsgList = workMsgList.stream().sorted(Comparator.comparing(WorkMsg::getHour).reversed()).collect(Collectors.toList()); workMsgList = workMsgList.stream().sorted(Comparator.comparing(WorkMsg::getHour).reversed()).collect(Collectors.toList());
vo.setWorkMsgList(workMsgList); vo.setWorkMsgList(workMsgList);
}
//任务数据 //任务数据

Loading…
Cancel
Save