| | |
| | | import com.ruoyi.doublePrevention.service.baseService.PreventReportConfigService;
|
| | | import com.ruoyi.doublePrevention.vo.ResultVO;
|
| | | import com.ruoyi.project.system.user.domain.User;
|
| | | import com.ruoyi.project.tr.riskList.domain.RiskList;
|
| | | import com.ruoyi.project.tr.riskList.service.IRiskListService;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.util.ObjectUtils;
|
| | |
| | | private PreventOverhaulLogRepository overhaulLogRepository;
|
| | | @Autowired
|
| | | private PreventReportConfigService preventReportConfigService;
|
| | | @Autowired
|
| | | private IRiskListService iRiskListService;
|
| | |
|
| | |
|
| | | @Override
|
| | |
| | | List<PreventOverhaulLog> preventOverhaulLogs = overhaulLogRepository.selectOverhaulLogPage(overhaulLogReqBO);
|
| | | List<PreventOverhaulLog> result = page.getResult();
|
| | |
|
| | | resultVO.setData(result);
|
| | | List<PreventOverhaulLogRespDTO> preventOverhaulLogRespDTOS = BeanCopyUtils.copyBeanList(result, PreventOverhaulLogRespDTO.class);
|
| | |
|
| | | List<RiskList> riskUnitLists = iRiskListService.getRiskUnitLists();
|
| | | for (PreventOverhaulLogRespDTO overhaulLog : preventOverhaulLogRespDTOS) {
|
| | | for (RiskList riskUnit : riskUnitLists) {
|
| | | if (overhaulLog.getRiskUnitId() == riskUnit.getRiskListId()){
|
| | | overhaulLog.setRiskUnitName(riskUnit.getRiskListName());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | resultVO.setData(preventOverhaulLogRespDTOS);
|
| | | resultVO.setCount((int) page.getTotal());
|
| | | resultVO.setPageNum(page.getPageNum());
|
| | | resultVO.setPageSize(page.getPageSize());
|
| | |
| | | ResultVO resultVO = new ResultVO<>();
|
| | | resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
|
| | |
|
| | | if (insertReqBO.getHazardCode().isEmpty()){
|
| | | throw new RuntimeException("风险分析对象编码为空");
|
| | | }
|
| | |
|
| | | if (ObjectUtils.isEmpty(insertReqBO.getRiskUnitId())){
|
| | | throw new RuntimeException("安全风险分析单元为空");
|
| | | }
|
| | |
| | | preventOverhaulLog.setGmtCreate(date);
|
| | | preventOverhaulLog.setLastEditUserName(sysUser.getUserName());
|
| | | preventOverhaulLog.setGmtModitify(date);
|
| | | preventOverhaulLog.setRiskUnitId(null);// todo 暂时未设置
|
| | |
|
| | | //todo 对所属企业id和uuid没有进行设置
|
| | | PreventReportConfig reportConfigById = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG_RISK_ANA_UNIT.getCode());
|
| | |
| | | ResultVO resultVO = new ResultVO<>();
|
| | | resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
|
| | |
|
| | | if (updateReqBO.getHazardCode().isEmpty()){
|
| | | resultVO.setMsg("风险分析对象编码");
|
| | | return resultVO;
|
| | | resultVO.setCode("200");
|
| | | resultVO.setMsg("保存成功");
|
| | |
|
| | | if (ObjectUtils.isEmpty(updateReqBO.getId())){
|
| | | throw new RuntimeException("所选记录不能为空");
|
| | | }
|
| | | PreventOverhaulLog overhaulLogById = overhaulLogRepository.getOverhaulLogById(updateReqBO.getId());
|
| | | if (ObjectUtils.isEmpty(overhaulLogById)){
|
| | | throw new RuntimeException("记录不存在或已被被删除");
|
| | | }
|
| | | if (ObjectUtils.isEmpty(updateReqBO.getRiskUnitId())){
|
| | | resultVO.setMsg("所属安全风险分析单元");
|
| | | return resultVO;
|
| | | throw new RuntimeException("安全风险分析单元为空");
|
| | | }
|
| | | if (ObjectUtils.isEmpty(updateReqBO.getStopStartTime())){
|
| | | resultVO.setMsg("装置停用或者检维修开始时间");
|
| | | return resultVO;
|
| | | throw new RuntimeException("装置停用或者检维修开始时间为空");
|
| | | }
|
| | | if (ObjectUtils.isEmpty(updateReqBO.getStopEndTime())){
|
| | | resultVO.setMsg("装置停用或者检维修结束时间");
|
| | | return resultVO;
|
| | | throw new RuntimeException("装置停用或者检维修结束时间为空");
|
| | | }
|
| | | if (updateReqBO.getStopReason().isEmpty()){
|
| | | resultVO.setMsg("描述停用原因");
|
| | | return resultVO;
|
| | | throw new RuntimeException("停用原因为空");
|
| | | }
|
| | |
|
| | | Date date = new Date();
|
| | |
| | | preventOverhaulLog.setDeleteStatus((byte) 0);
|
| | | preventOverhaulLog.setLastEditUserName(sysUser.getUserName());
|
| | | preventOverhaulLog.setGmtModitify(date);
|
| | | preventOverhaulLog.setRiskUnitId(null);// todo 暂时未设置
|
| | | preventOverhaulLog.setLastEditUserName(sysUser.getUserName());
|
| | | preventOverhaulLog.setGmtModitify(date);
|
| | |
|
| | |
|
| | | //todo 对所属企业id和uuid没有进行设置
|
| | |
| | | preventOverhaulLog.setReportSwitch(SyncEnum.REPORT_OFF.getCode());
|
| | | }
|
| | |
|
| | | int result = overhaulLogRepository.updateOverhaulLog(updateReqBO);
|
| | | int result = overhaulLogRepository.updateOverhaulLog(preventOverhaulLog);
|
| | | if (result < 1){
|
| | | throw new RuntimeException("操作失败");
|
| | | }
|
| | |
|
| | | resultVO.setCount(result);
|
| | | resultVO.setCode("200");
|
| | | resultVO.setMsg("保存成功");
|
| | |
|
| | | return resultVO;
|
| | | }
|