| | |
| | | |
| | | TProjectDept projectDept = projectDeptService.getById(sysUser.getDeptId()); |
| | | if (projectDept != null) { |
| | | if (!"0".equals(projectDept.getParentId())) { |
| | | if ("0".equals(projectDept.getParentId())) { |
| | | // 查询片区下的所有人员 |
| | | users = sysUsers.stream().filter(e -> e.getDeptId() |
| | | .equals(projectDept.getId()) |
| | |
| | | } else { |
| | | TDept dept = deptService.getById(sysUser.getDeptId()); |
| | | if (dept != null) { |
| | | if (!dept.getDeptName().equals("公司")) { |
| | | users = sysUsers.stream().filter(e -> e.getDeptId() |
| | | if (!dept.getDeptName().contains("公司")) { |
| | | users = sysUsers.stream().filter(e -> (e.getDeptId() |
| | | .equals(sysUser.getDeptId()) |
| | | && e.getStatus().equals("0") |
| | | && e.getDeptType() == 1).collect(Collectors.toList()); |
| | | && e.getStatus().equals("0")) |
| | | || e.getDeptType() == 1).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | List<TTaskDetail> status3 = taskDetails.stream().filter(e -> e.getClearStatus() == 1).collect(Collectors.toList()); |
| | | List<TTaskDetail> status4 = taskDetails.stream().filter(e -> e.getClearStatus() == 2).collect(Collectors.toList()); |
| | | if (status3.size() + status4.size() != 0) { |
| | | BigDecimal divide = new BigDecimal(status3.size() + status4.size()) |
| | | .divide(new BigDecimal(status3.size()), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)); |
| | | if (!status3.isEmpty()) { |
| | | BigDecimal divide = new BigDecimal(status3.size() ) |
| | | .divide(new BigDecimal(status3.size()+ status4.size()), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)); |
| | | res.setRate(divide); |
| | | } else { |
| | | res.setRate(new BigDecimal(0)); |
| | |
| | | taskTodayVO.setLocationLon(tLocation.getLocationLon()); |
| | | taskTodayVO.setLocationLat(tLocation.getLocationLat()); |
| | | taskTodayVO.setLocationName(tLocation.getLocationName()); |
| | | // todo |
| | | if(StringUtils.hasLength(dto.getLon())){ |
| | | Map<String, String> distance = amapApiClient.getDistance(dto.getLon() + "," + dto.getLat(), tLocation.getLocationLon() + "," + tLocation.getLocationLat(), 1); |
| | | if (distance != null) { |
| | |
| | | } |
| | | todayTask.add(taskTodayVO); |
| | | } |
| | | // 将todayTask进行排序 优先根据status状态排序,优先展示未执行、超时、待整改、待确认、整改完成、已完成,然后状态一样再根据距离排序 |
| | | sortTodayTasks(todayTask); |
| | | res.setTodayTask(todayTask); |
| | | List<TaskTomorrowVO> tomorrowTask = new ArrayList<>(); |
| | | |
| | |
| | | } |
| | | return R.ok(res); |
| | | } |
| | | public static void sortTodayTasks(List<TaskTodayVO> taskList) { |
| | | Map<Integer, Integer> statusOrder = new HashMap<>(); |
| | | statusOrder.put(1, 0); |
| | | statusOrder.put(2, 1); |
| | | statusOrder.put(4, 2); |
| | | statusOrder.put(3, 3); |
| | | statusOrder.put(5, 4); |
| | | statusOrder.put(6, 5); |
| | | |
| | | taskList.sort(Comparator.comparingInt((TaskTodayVO o) -> statusOrder.getOrDefault(o.getStatus(), Integer.MAX_VALUE)).thenComparing(TaskTodayVO::getDistance)); |
| | | } |
| | | |
| | | } |
| | | |