liujie
2026-04-09 f4f653b1f69eae7eee5249b9f41e43bdf3239aa1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectController.java
@@ -184,6 +184,23 @@
        return R.ok(hiddenDangerVo);
    }
    @ApiOperation(value = "获取项目所有隐患数量",response = HiddenDangerVo.class)
    @GetMapping("/getProjectHiddenDangerCountAll/{id}")
    public R<HiddenDangerVo> getProjectHiddenDangerCountAll(@PathVariable Integer id) {
        HiddenDangerVo hiddenDangerVo = new HiddenDangerVo();
        List<Task> list = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getProjectId, id));
        if(!list.isEmpty()){
            List<Integer> taskIds = list.stream().map(Task::getId).collect(Collectors.toList());
            // 0是一级隐患
            List<Record> records = recordService.list(new LambdaQueryWrapper<Record>().eq(Record::getDeleted, 0).in(Record::getCheckTaskId, taskIds));
            hiddenDangerVo.setSerious(records.size());
            int rectified = records.stream().filter(Record::getReformed).collect(Collectors.toList()).size();
            hiddenDangerVo.setRectified(rectified);
            hiddenDangerVo.setUnRectified(records.size()-rectified);
        }
        return R.ok(hiddenDangerVo);
    }
    @ApiOperation(value = "获取设备数量",response = DeviceCountVo.class)
    @GetMapping("/getProjectDeviceCount/{id}")
    public R<List<DeviceCountVo>> getProjectDeviceCount(@PathVariable Integer id) {
@@ -312,12 +329,25 @@
    @ApiOperation(value = "获取计划下拉框信息",response = Plan.class)
    @GetMapping("/getPlanList")
    public R<List<Plan>> getPlanList() {
        List<Plan> list = planService.list(new LambdaQueryWrapper<Plan>().eq(Plan::getDeleted, false));
    public R<List<Plan>> getPlanList(Integer projectId) {
        List<Plan> list = planService.list(new LambdaQueryWrapper<Plan>().eq(projectId!=null,Plan::getProjectId,projectId).eq(Plan::getDeleted, false));
        return R.ok(list);
    }
    @ApiOperation(value = "获取计划下拉框信息",response = Plan.class)
    @GetMapping("/getPlanListFromOnDuty")
    public R<List<Plan>> getPlanListFromOnDuty(Integer projectId) {
        List<OnDuty> list = onDutyService.list(new LambdaQueryWrapper<OnDuty>().eq(OnDuty::getProjectId, projectId));
        if(list.isEmpty()){
            return R.ok(new ArrayList<>());
        }
        List<Integer> ids = list.stream().map(OnDuty::getPlanId).toList();
        List<Plan> resultList = planService.list(new LambdaQueryWrapper<Plan>().in(Plan::getId,ids).eq(Plan::getDeleted, false));
        return R.ok(resultList);
    }
    @ApiOperation(value = "获取人员在岗列表",response = ProjectPersonOnDutyListVo.class)
    @PostMapping("/getProjectOnDutyList")
    public R<Page<ProjectPersonOnDutyListVo>> getProjectOnDutyList(@RequestBody @Valid ProjectPersonListQuery query) {