| | |
| | | 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.*; |
| | |
| | | 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; |
| | |
| | | private SysUserMapper sysUserMapper; |
| | | @Autowired |
| | | private TProjectDeptMapper projectDeptMapper; |
| | | @Autowired |
| | | private TInspectorMapper inspectorMapper; |
| | | @Autowired |
| | | private TInspectorDetailMapper inspectorDetailMapper; |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<TaskListVO> pageList(TaskListQuery query) { |
| | |
| | | ) |
| | | )) |
| | | .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()); |
| | | if (tProjectDept1!=null){ |
| | | temp.setDeptName(tProjectDept1.getProjectName()+">"+tProjectDept.getProjectName()); |
| | | } |
| | | }else{ |
| | | if (tProjectDept!=null){ |
| | | temp.setDeptName(tProjectDept.getProjectName()); |
| | | } |
| | | } |
| | | }else{ |
| | | TDept tDept = deptMapper.selectById(sysUser.getDeptId()); |
| | |
| | | |
| | | @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)); |
| | |
| | | ) |
| | | )) |
| | | .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) { |
| | | 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){ |
| | |
| | | taskUserListVO.setDistance(taskUserListVO.getDistance().divide(new BigDecimal("1000"),2, RoundingMode.HALF_DOWN)); |
| | | }else{ |
| | | taskUserListVO.setDistance(new BigDecimal("0")); |
| | | } |
| | | }else{ |
| | | 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<>(); |
| | |
| | | return this.baseMapper.getTaskByIds(collect1,lon,lat); |
| | | } |
| | | |
| | | @Override |
| | | public List<TInspector> indexInspector(IndexDTO dto) { |
| | | return this.baseMapper.indexInspector(dto); |
| | | } |
| | | |
| | | |
| | | } |