| | |
| | | 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) { |