无关风月
15 小时以前 02bb94e413f6950b9786c5ee86c0937bc20f8ae8
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/WorkbenchesController.java
@@ -204,6 +204,10 @@
                    }
                    query.setProjectId(projectIds);
                }
                // 巡检员数
                Integer totalEmployeeNum = sysUserService.selectUserCount(query.getProjectId(),deptType);
                map.put("totalEmployeeNum", totalEmployeeNum);
            }else {
                // 公司人员
                // 查询自己的任务列表
@@ -218,6 +222,9 @@
                        query.setProjectId(projectIds);
                    }
                }
                // 巡检员数
                Integer totalEmployeeNum = sysUserService.selectUserCount(query.getProjectId(),1);
                map.put("totalEmployeeNum", totalEmployeeNum+1);
            }
            // 查询片区
@@ -283,6 +290,16 @@
                list.addAll(taskList);
            }
            list = list.stream().distinct().collect(Collectors.toList());
            // 巡检员数
            if(CollectionUtils.isEmpty(query.getProjectId())){
                Integer totalEmployeeNum = sysUserService.selectUserCount(query.getProjectId(),deptType);
                Integer totalEmployeeNum1 = sysUserService.selectUserCount(query.getProjectId(),1);
                map.put("totalEmployeeNum", totalEmployeeNum+totalEmployeeNum1);
            }else {
                Integer totalEmployeeNum = sysUserService.selectUserCount(query.getProjectId(),1);
                map.put("totalEmployeeNum", totalEmployeeNum);
            }
        }
        // 查询任务相关数据
@@ -294,11 +311,11 @@
        map.put("waitTaskNum", list.stream().filter(tTask -> tTask.getStatus() == 1).count());
        // 总计员工数
        Integer totalEmployeeNum = sysUserService.selectUserCount(null,deptType);
        if (deptType != 1) {
            totalEmployeeNum = totalEmployeeNum + 1;
        }
        map.put("totalEmployeeNum", totalEmployeeNum);
//        Integer totalEmployeeNum = sysUserService.selectUserCount(null,deptType);
//        if (deptType != 1) {
//            totalEmployeeNum = totalEmployeeNum + 1;
//        }
//        map.put("totalEmployeeNum", totalEmployeeNum);
        // 今日请假员工数量
        List<TLeave> leaves = leaveService.list(Wrappers.lambdaQuery(TLeave.class)
@@ -499,6 +516,22 @@
                && task.getStatus() != 3 && task.getStatus() != 4).collect(Collectors.toList());
        if(CollectionUtils.isEmpty(tasks)){
            taskSituationVO.setPassRate(BigDecimal.ZERO);
            for (long i = 0; i <= daysBetween; i++) {
                TaskSituationDayVO taskSituationDayVO = new TaskSituationDayVO();
                if(i == 0){
                    format = localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
                }else {
                    format = DateUtils.stringToLocalDate(format).plusDays(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
                }
                taskSituationDayVO.setTaskTime(format);
                // 任务数
                taskSituationDayVO.setTaskNum(0);
                // 完成数
                taskSituationDayVO.setCompletedNum(0);
                taskSituationDayVO.setCompleteRate(BigDecimal.ZERO);
                taskSituationDayVOList.add(taskSituationDayVO);
            }
            taskSituationVO.setTaskSituationDayVO(taskSituationDayVOList);
            return R.ok(taskSituationVO);
        }
        List<String> taskIds = tasks.stream().map(TTask::getId).collect(Collectors.toList());
@@ -541,7 +574,7 @@
            if(tTasks.isEmpty()){
                taskSituationDayVO.setCompleteRate(BigDecimal.ZERO);
            }else {
                taskSituationDayVO.setCompleteRate(new BigDecimal(qualifiedWarnChild).divide(new BigDecimal(tTasks.size()), 2, RoundingMode.HALF_DOWN));
                taskSituationDayVO.setCompleteRate(new BigDecimal(qualifiedWarnChild).divide(new BigDecimal(taskSituationDayVO.getCompletedNum()), 2, RoundingMode.HALF_DOWN));
            }
            taskSituationDayVOList.add(taskSituationDayVO);
        }