| | |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import javax.validation.Valid; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static java.util.stream.Collectors.groupingBy; |
| | |
| | | @Autowired |
| | | private PositionService positionService; |
| | | |
| | | |
| | | @Autowired |
| | | private PlanService planService; |
| | | |
| | | @Autowired |
| | | private ScreenAccountService screenAccountService; |
| | | |
| | | |
| | | @ApiOperation(value = "获取项目/委托方列表",response = LoginNameVo.class) |
| | | @GetMapping("/getLoginNameVoList") |
| | | public R<List<LoginNameVo>> getProjectList(@RequestParam Integer userId) { |
| | | ScreenAccount screenAccount = screenAccountService.getById(userId); |
| | | String clientProjectIds = screenAccount.getClientProjectIds(); |
| | | if(screenAccount.getType()==1){ |
| | | // 委托方 |
| | | List<LoginNameVo> list = screenAccountService.getLoginClient(clientProjectIds); |
| | | return R.ok(list); |
| | | }else { |
| | | // 项目 |
| | | List<LoginNameVo> list = screenAccountService.getLoginProject(clientProjectIds); |
| | | return R.ok(list); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | projectVo.setCheckTime(task.getUpdateTime()); |
| | | } |
| | | List<DeviceCountVo> list = deviceUsageService.getProjectDeviceCount(id); |
| | | list.forEach(item->{ |
| | | DeviceType value = DeviceType.values()[item.getType()]; |
| | | item.setName(value.getDesc()); |
| | | }); |
| | | projectVo.setDeviceCountVos(list); |
| | | return R.ok(projectVo); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "获取隐患详情") |
| | | @GetMapping("/getHiddenDangerDetail/{problemId}") |
| | | public R<?> getHiddenDangerDetail(@PathVariable Integer problemId) { |
| | | var record = recordService.getHiddenDangerDetail(problemId); |
| | | @ApiOperation(value = "获取隐患详情",response = ProblemVo.class) |
| | | @GetMapping("/getHiddenDangerDetail/{id}") |
| | | public R<ProblemVo> getHiddenDangerDetail(@PathVariable Integer id) { |
| | | ProblemVo record = recordService.getHiddenDangerDetail(id); |
| | | return R.ok(record); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "获取设备详情检查列表",response = DeviceDetailCheckListVo.class) |
| | | @ApiOperation(value = "获取检查计划列表",response = DeviceDetailCheckListVo.class) |
| | | @PostMapping("/getDeviceDetailCheckList") |
| | | public R<Page<DeviceDetailCheckListVo>> getDeviceDetailCheckList(@RequestBody DeviceDetailCheckListQuery query) { |
| | | Page<DeviceDetailCheckListVo> page = new Page<>(query.getPageNum(), query.getPageSize()); |
| | |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "获取设备详情检查资料列表") |
| | | @ApiOperation(value = "获取检查资料列表") |
| | | @GetMapping("/getDeviceDetailCheckPlanList") |
| | | public R<List<Check>> getDeviceDetailCheckPlanList(@RequestParam Integer planId) { |
| | | List<Check> list = checkService.list(new LambdaQueryWrapper<Check>().eq(Check::getPlanId,planId).orderByDesc(Check::getTime)); |
| | | if(!list.isEmpty()){ |
| | | List<Integer> planIds = list.stream().map(Check::getPlanId).toList(); |
| | | List<Plan> plans = planService.listByIds(planIds); |
| | | |
| | | List<Integer> projectIds = list.stream().map(Check::getProjectId).toList(); |
| | | List<Project> projects = projectService.listByIds(projectIds); |
| | | list.forEach(check -> { |
| | | check.setPlanName(Objects.requireNonNull(plans.stream().filter(plan -> plan.getId().equals(check.getPlanId())).findFirst().orElse(null)).getName()); |
| | | check.setProjectName(Objects.requireNonNull(projects.stream().filter(project -> project.getId().equals(check.getProjectId())).findFirst().orElse(null)).getName()); |
| | | }); |
| | | } |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取设备详情检查资料详情") |
| | | |
| | | @ApiOperation(value = "获取检查资料详情") |
| | | @GetMapping("/getDeviceDetailCheckPlanDetail") |
| | | public R<Check> getDeviceDetailCheckPlanDetail(@RequestParam Integer id) { |
| | | Check check = checkService.getDeviceDetailCheckPlanDetail(id); |
| | | return R.ok(check); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "获取大屏人员在岗信息") |
| | |
| | | List<Plan> list = planService.list(new LambdaQueryWrapper<Plan>().eq(Plan::getDeleted, false)); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "获取人员在岗列表",response = ProjectPersonOnDutyListVo.class) |
| | | @PostMapping("/getProjectOnDutyList") |
| | |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取项目重大风险源详情") |
| | | @GetMapping("/getProjectDangerousSourceDetail/{id}") |
| | | public R<?> getProjectDangerousSourceDetail(@PathVariable Integer id) { |
| | | ProjectInfo projectInfo = projectInfoService.getById(id); |
| | | return R.ok(projectInfo); |
| | | } |
| | | |
| | | @ApiOperation(value = "设备类型") |
| | | @GetMapping("/deviceTypes") |
| | | public R<?> deviceTypeOptions(@RequestParam(value = "title", required = false) String title) { |
| | |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "大屏风险趋势") |
| | | @PostMapping("/getProjectDangerousTrend") |
| | | public R<List<ProjectDangerousTrendVo>> getProjectDangerousTrend(@RequestBody @Valid ProjectDangerousTrendQuery query) { |
| | | List<ProjectDangerousTrendVo> list = projectInfoService.getProjectDangerousTrend(query); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取项目列表") |
| | | @GetMapping("/list") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "clientId", value = "委托方ID", dataType = "int", paramType = "query"), |
| | | @ApiImplicitParam(name = "projectName", value = "项目名称", dataType = "string", paramType = "query") |
| | | }) |
| | | public R<List<Project>> getList(Integer clientId, String projectName) { |
| | | LambdaQueryWrapper<Project> wrapper = new LambdaQueryWrapper<Project>().eq(Project::getDeleted, false); |
| | | if(clientId!=null){ |
| | | wrapper.eq(Project::getClientId, clientId); |
| | | } |
| | | if(projectName!=null && !projectName.isEmpty()){ |
| | | wrapper.like(Project::getName, projectName); |
| | | } |
| | | List<Project> list = projectService.list(wrapper); |
| | | return R.ok(list); |
| | | |
| | | } |
| | | } |