From faee962a89c0b2379be11e66b6ada1e0379c9144 Mon Sep 17 00:00:00 2001
From: 16639036659 <577530412@qq.com>
Date: 星期二, 19 三月 2024 15:46:00 +0800
Subject: [PATCH] 新增检索条件
---
src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/PreventOverhaulLogServiceImpl.java | 56 ++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 36 insertions(+), 20 deletions(-)
diff --git a/src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/PreventOverhaulLogServiceImpl.java b/src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/PreventOverhaulLogServiceImpl.java
index ec1248f..5851b23 100644
--- a/src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/PreventOverhaulLogServiceImpl.java
+++ b/src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/PreventOverhaulLogServiceImpl.java
@@ -19,6 +19,8 @@
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;
@@ -36,6 +38,8 @@
private PreventOverhaulLogRepository overhaulLogRepository;
@Autowired
private PreventReportConfigService preventReportConfigService;
+ @Autowired
+ private IRiskListService iRiskListService;
@Override
@@ -56,7 +60,18 @@
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());
@@ -71,9 +86,7 @@
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("安全风险分析单元为空");
}
@@ -98,7 +111,6 @@
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());
@@ -149,25 +161,27 @@
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();
@@ -179,7 +193,8 @@
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没有进行设置
@@ -203,11 +218,12 @@
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;
}
--
Gitblit v1.9.2