| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.icbc.hsm.utils.StringUtil; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.dto.EditHiddenDangerResponsiblePersonDto; |
| | | import com.ruoyi.system.enums.DeviceType; |
| | |
| | | import com.ruoyi.system.query.*; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.*; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.parsing.Problem; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | |
| | | if(task!=null){ |
| | | 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); |
| | | } |
| | | |
| | |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | @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("/list") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "clientId", value = "委托方ID", dataType = "int", paramType = "query"), |
| | | @ApiImplicitParam(name = "projectName", value = "项目名称", dataType = "string", paramType = "query"), |
| | | @ApiImplicitParam(name = "startDate", value = "开始日期", dataType = "date", paramType = "query"), |
| | | @ApiImplicitParam(name = "endDate", value = "结束日期", dataType = "date", paramType = "query"), |
| | | @ApiImplicitParam(name = "projectCategory", value = "项目类型 ongoing-在建工程,fixed-固定资产 ", dataType = "string", paramType = "query") |
| | | }) |
| | | public R<List<Project>> getList(@RequestParam("clientId") Integer clientId, String projectName, |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate, |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate, |
| | | @RequestParam("projectCategory") String projectCategory) { |
| | | LambdaQueryWrapper<Project> queryWrapper = new LambdaQueryWrapper<Project>().eq(Project::getDeleted, false); |
| | | if (clientId != null) { |
| | | queryWrapper.eq(Project::getClientId, clientId); |
| | | } |
| | | if (projectName != null && !projectName.isEmpty()) { |
| | | queryWrapper.like(Project::getName, projectName); |
| | | } |
| | | if (Objects.isNull(startDate)) { |
| | | // 获取本月日期 |
| | | Date date = new Date(); |
| | | startDate = DateUtil.beginOfMonth(date); |
| | | } |
| | | Date finalStartDate = startDate; |
| | | queryWrapper.and(wrapper -> wrapper |
| | | .eq(Project::getStatus, 1) // 在建项目 |
| | | .or(w -> w |
| | | .eq(Project::getStatus, 2) // 已完成项目 |
| | | .ge(Project::getSuccessTime, finalStartDate) // 完成时间 >= 开始日期// 完成时间 <= 结束日期 |
| | | )); |
| | | if ("ongoing".equals(projectCategory)) { |
| | | queryWrapper.ne(Project::getType, 2); |
| | | } else if ("fixed".equals(projectCategory)) { |
| | | queryWrapper.eq(Project::getType, 2); |
| | | } |
| | | List<Project> list = projectService.list(queryWrapper); |
| | | return R.ok(list); |
| | | |
| | | } |
| | | } |