|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.date.DatePattern;
|
|
|
|
|
import cn.hutool.core.date.DateTime; |
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
import cn.hutool.core.date.LocalDateTimeUtil; |
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
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.vo.*; |
|
|
|
@ -56,6 +57,12 @@ public class StatisticalController {
|
|
|
|
|
StatisticalVo vo = new StatisticalVo(); |
|
|
|
|
//获取时间内的所有工时记录
|
|
|
|
|
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
|
|
|
|
|
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)); |
|
|
|
|
Iterator<Map.Entry<Long, List<WorkHourDO>>> iterator = workMap.entrySet().iterator(); |
|
|
|
|
|
|
|
|
|
//工时统计 条形图
|
|
|
|
|
List<WorkMsg> workMsgList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
while (iterator.hasNext()){ |
|
|
|
|
Entry<Long, List<WorkHourDO>> entry = iterator.next(); |
|
|
|
|
Long userId = entry.getKey(); |
|
|
|
@ -79,6 +85,8 @@ public class StatisticalController {
|
|
|
|
|
} |
|
|
|
|
workMsgList = workMsgList.stream().sorted(Comparator.comparing(WorkMsg::getHour).reversed()).collect(Collectors.toList()); |
|
|
|
|
vo.setWorkMsgList(workMsgList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//任务数据
|
|
|
|
|