From 53d014edd19f57125c355abe71ec5b478500e610 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期二, 05 八月 2025 09:57:40 +0800 Subject: [PATCH] 保洁巡检所有代码 --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTaskCleanServiceImpl.java | 84 ++++++++++++++++++++++++++++++++++------- 1 files changed, 69 insertions(+), 15 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTaskCleanServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTaskCleanServiceImpl.java index 564c2d3..74b310a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTaskCleanServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTaskCleanServiceImpl.java @@ -9,6 +9,7 @@ import com.ruoyi.common.utils.DateUtils; import com.ruoyi.system.applet.dto.IndexDTO; import com.ruoyi.system.applet.query.TaskUserListQuery; +import com.ruoyi.system.applet.vo.InspectorUserListVO; import com.ruoyi.system.applet.vo.TaskUserListVO; import com.ruoyi.system.mapper.*; import com.ruoyi.system.model.*; @@ -19,6 +20,7 @@ import com.ruoyi.system.vo.system.ProgressListVO; import com.ruoyi.system.vo.system.TLocationTaskListVO; import com.ruoyi.system.vo.system.TaskListVO; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -51,6 +53,11 @@ private SysUserMapper sysUserMapper; @Autowired private TProjectDeptMapper projectDeptMapper; + @Autowired + private TInspectorMapper inspectorMapper; + @Autowired + private TInspectorDetailMapper inspectorDetailMapper; + @Override public PageInfo<TaskListVO> pageList(TaskListQuery query) { @@ -73,17 +80,20 @@ ) )) .values()); - for (TaskListVO temp : list) { SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(temp.getPatrolInspector())); if(sysUser!=null){ if ( sysUser.getDeptType() == 1){ TProjectDept tProjectDept = projectDeptMapper.selectById(sysUser.getDeptId()); - if (!tProjectDept.getParentId().equals("0")){ + if (tProjectDept!=null&&!tProjectDept.getParentId().equals("0")){ TProjectDept tProjectDept1 = projectDeptMapper.selectById(tProjectDept.getParentId()); - temp.setDeptName(tProjectDept1.getProjectName()+">"+tProjectDept.getProjectName()); + if (tProjectDept1!=null){ + temp.setDeptName(tProjectDept1.getProjectName()+">"+tProjectDept.getProjectName()); + } }else{ - temp.setDeptName(tProjectDept.getProjectName()); + if (tProjectDept!=null){ + temp.setDeptName(tProjectDept.getProjectName()); + } } }else{ TDept tDept = deptMapper.selectById(sysUser.getDeptId()); @@ -105,8 +115,17 @@ @Override public PageInfo<TaskUserListVO> pageListUser(TaskUserListQuery query) { + List<TTask> taskList = this.baseMapper.selectList(null); + List<TInspector> inspectors = inspectorMapper.selectList(null); PageInfo<TaskUserListVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); List<TaskUserListVO> list = this.baseMapper.pageListUser(query); + // 督察任务 + List<InspectorUserListVO> list1 = this.baseMapper.pageListUserInspector(query); + for (InspectorUserListVO inspectorUserListVO : list1) { + TaskUserListVO taskUserListVO = new TaskUserListVO(); + BeanUtils.copyProperties(inspectorUserListVO,taskUserListVO); + list.add(taskUserListVO); + } List<TTaskDetail> taskDetails = taskDetailMapper.selectList(Wrappers.lambdaQuery(TTaskDetail.class) .eq(TTaskDetail::getHandleType,1) .orderByDesc(TTaskDetail::getCreateTime)); @@ -119,22 +138,52 @@ ) )) .values()); + List<TInspectorDetail> inspectorDetails = inspectorDetailMapper.selectList(Wrappers.lambdaQuery(TInspectorDetail.class) + .eq(TInspectorDetail::getHandleType,1) + .orderByDesc(TInspectorDetail::getCreateTime)); + inspectorDetails = new ArrayList<>(inspectorDetails.stream() + .collect(Collectors.groupingBy( + TInspectorDetail::getInspectorId, + Collectors.collectingAndThen( + Collectors.toList(), + listAll -> listAll.get(0) + ) + )) + .values()); for (TaskUserListVO taskUserListVO : list) { - TTaskDetail tTaskDetail = taskDetails.stream().filter(e -> e.getTaskId().equals(taskUserListVO.getId())) - .findFirst().orElse(null); - if (tTaskDetail!=null){ - if (tTaskDetail.getClearStatus()==1){ - taskUserListVO.setStatus(5); + TTask tTask = taskList.stream().filter(e -> e.getId().equals(taskUserListVO.getId())).findFirst().orElse(null); + if (tTask!=null){ + TTaskDetail tTaskDetail = taskDetails.stream().filter(e -> e.getTaskId().equals(taskUserListVO.getId())) + .findFirst().orElse(null); + if (tTaskDetail!=null){ + if (tTaskDetail.getClearStatus()==1){ + taskUserListVO.setStatus(5); - }else{ - taskUserListVO.setStatus(4); + }else{ + taskUserListVO.setStatus(4); + } } - } - if (taskUserListVO.getDistance()!=null){ - taskUserListVO.setDistance(taskUserListVO.getDistance().divide(new BigDecimal("1000"),2, RoundingMode.HALF_DOWN)); + if (taskUserListVO.getDistance()!=null){ + taskUserListVO.setDistance(taskUserListVO.getDistance().divide(new BigDecimal("1000"),2, RoundingMode.HALF_DOWN)); + }else{ + taskUserListVO.setDistance(new BigDecimal("0")); + } }else{ - taskUserListVO.setDistance(new BigDecimal("0")); + TInspectorDetail tTaskDetail = inspectorDetails.stream().filter(e -> e.getInspectorId().equals(taskUserListVO.getId())) + .findFirst().orElse(null); + if (tTaskDetail!=null){ + if (tTaskDetail.getClearStatus()==1){ + taskUserListVO.setStatus(5); + }else{ + taskUserListVO.setStatus(4); + } + } + if (taskUserListVO.getDistance()!=null){ + taskUserListVO.setDistance(taskUserListVO.getDistance().divide(new BigDecimal("1000"),2, RoundingMode.HALF_DOWN)); + }else{ + taskUserListVO.setDistance(new BigDecimal("0")); + } } } List<TaskUserListVO> res = new ArrayList<>(); @@ -243,5 +292,10 @@ return this.baseMapper.getTaskByIds(collect1,lon,lat); } + @Override + public List<TInspector> indexInspector(IndexDTO dto) { + return this.baseMapper.indexInspector(dto); + } + } -- Gitblit v1.7.1