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/project/tr/hiddenDangerCheck/controller/DangerReportController.java | 122 ++++++++++++++++++++++++++++++++--------
1 files changed, 96 insertions(+), 26 deletions(-)
diff --git a/src/main/java/com/ruoyi/project/tr/hiddenDangerCheck/controller/DangerReportController.java b/src/main/java/com/ruoyi/project/tr/hiddenDangerCheck/controller/DangerReportController.java
index 54faa6d..608337a 100644
--- a/src/main/java/com/ruoyi/project/tr/hiddenDangerCheck/controller/DangerReportController.java
+++ b/src/main/java/com/ruoyi/project/tr/hiddenDangerCheck/controller/DangerReportController.java
@@ -5,7 +5,10 @@
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.security.ShiroUtils;
+import com.ruoyi.doublePrevention.entity.PreventRiskDangerInfo;
+import com.ruoyi.doublePrevention.entity.dto.resp.PreventRiskUnitCodeAndNameListQueryRespDTO;
import com.ruoyi.doublePrevention.service.RiskService;
+import com.ruoyi.doublePrevention.service.baseService.PreventRiskDangerConfirmLogService;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
@@ -19,6 +22,7 @@
import com.ruoyi.project.tr.hiddenDangerCheckPoint.service.IHiddenDangerCheckPointService;
import com.ruoyi.project.tr.hiddenTroubleType.domain.HiddenTroubleType;
import com.ruoyi.project.tr.hiddenTroubleType.service.IHiddenTroubleTypeService;
+import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
@@ -54,6 +58,9 @@
@Autowired
private RiskService riskService;
+
+ @Autowired
+ private PreventRiskDangerConfirmLogService confirmLogService;
@GetMapping()
public String hiddenDangerCheck(ModelMap mmap) {
@@ -107,6 +114,19 @@
// 第二:1.隐患上报创建人(register_user_id) 或者 2.(判定人(judge_user_id),report_status 不为null )------为本登录帐号userId的
hiddenDangerCheckPoint.setJudgeQueryByUserId(getSysUser().getUserId());
List<HiddenDangerCheckPoint> list = hiddenDangerCheckPointService.selectHiddenDangerCheckPointList(hiddenDangerCheckPoint);
+ List<HiddenDangerCheckPoint> resultList = new ArrayList<>();
+
+ for (HiddenDangerCheckPoint dangerCheckPoint : list) {
+ PreventRiskDangerInfo dangerInfo = riskService.getDangerInfoById(dangerCheckPoint.getId());
+ if (ObjectUtils.isNotEmpty(dangerInfo)){
+ dangerCheckPoint.setHazardCode(dangerInfo.getHazardCode());
+ dangerCheckPoint.setDangerSrc(dangerInfo.getDangerSrc());
+ dangerCheckPoint.setDangerReason(dangerInfo.getDangerReason());
+ dangerCheckPoint.setHazardDangerType(dangerInfo.getHazardDangerType());
+ dangerCheckPoint.setDangerResult(dangerInfo.getDangerResult());
+ }
+ resultList.add(dangerCheckPoint);
+ }
return getDataTable(list);
}
@@ -129,19 +149,25 @@
hiddenTroubleType.setCompanyId(sysUser.getCompanyId());
List<HiddenTroubleType> hiddenTroubleTypeList = hiddenTroubleTypeService.selectHiddenTroubleTypeList(hiddenTroubleType);
mmap.put("hiddenTroubleTypeList", hiddenTroubleTypeList);
-
+ List<PreventRiskUnitCodeAndNameListQueryRespDTO> respDTOS = riskService.listRiskUnitCodeAndName();
+ mmap.put("riskUnits", respDTOS);
return prefix + "/addDangerReport";
}
/**
* 新增保存隐患上报
- * todo-2022 隐患上报 需要检查对分别对两张表做了什么,然后添加附属表(tr_hidden_danger_check_point)
*/
@Log(title = "隐患上报", businessType = BusinessType.INSERT)
@PostMapping("/addDangerReportSave")
@ResponseBody
@Transactional
public AjaxResult addDangerReportSave(HiddenDangerCheckPoint hdcp) {
+ if (ObjectUtils.isEmpty(hdcp.getCheckPerson())){
+ throw new RuntimeException("检查人不能为空");
+ }
+ if (ObjectUtils.isEmpty(hdcp.getFindTime())){
+ throw new RuntimeException("发现时间不能为空");
+ }
HiddenDangerCheck hiddenDangerCheck = new HiddenDangerCheck();
hiddenDangerCheck.setCreateBy(ShiroUtils.getLoginName());//创建者
hiddenDangerCheck.setCreateTime(DateUtils.getNowDate());//获取创建时间
@@ -165,14 +191,13 @@
throw new RuntimeException("添加隐患信息失败");
}
-
- // todo-2022 此处插入附属表
- //获取Id返回值
- hdcp.getId();
- int result = riskService.insertDangerInfo(hdcp.getId(), hdcp);
- if (result< 1){
- throw new RuntimeException("添加隐患附属信息失败");
- }
+// // 此处插入附属表 --- 此处已弃用,在核查整改后插入
+// //获取Id返回值
+// hdcp.getId();
+// int result = riskService.insertDangerInfo(hdcp.getId(), hdcp);
+// if (result< 1){
+// throw new RuntimeException("添加隐患附属信息失败");
+// }
hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送
@@ -209,12 +234,18 @@
@Log(title = "隐患上报全流程", businessType = BusinessType.INSERT)
@PostMapping("/addDangerReportWholeProcessSave")
@ResponseBody
+ @Transactional
public AjaxResult addDangerReportWholeProcessSave(HiddenDangerCheckPoint hdcp) {
//新增隐患上报
HiddenDangerCheck hiddenDangerCheck = new HiddenDangerCheck();
// hiddenDangerCheck.setCreateBy(ShiroUtils.getLoginName());//创建者
// hiddenDangerCheck.setCreateTime(DateUtils.getNowDate());//获取创建时间
-
+ if (ObjectUtils.isEmpty(hdcp.getCheckPerson())){
+ throw new RuntimeException("检查人不能为空");
+ }
+ if (ObjectUtils.isEmpty(hdcp.getFindTime())){
+ throw new RuntimeException("发现时间不能为空");
+ }
hiddenDangerCheck.setCreateBy(ShiroUtils.getLoginName());//创建者
hiddenDangerCheck.setCreateTime(hdcp.getRectifyCreateTime());//获取创建时间
@@ -223,6 +254,9 @@
hiddenDangerCheck.setDangerPlaceId(hdcp.getDangerPlaceId());
hiddenDangerCheck.setDangerPlaceName(hdcp.getDangerPlaceName());
hiddenDangerCheckService.insertHiddenDangerCheck(hiddenDangerCheck);//构造隐患排查对象保存,主要保存隐患责任部门,隐患地点
+
+ //1.全流程隐患上报信息封装
+
hdcp.setCheckId(hiddenDangerCheck.getCheckId());
hdcp.setCreateBy(ShiroUtils.getLoginName());//创建者
@@ -241,6 +275,7 @@
//隐患上报提交
hdcp.setRegisterSubmitTime(hdcp.getJudgeCreateTime());//设置隐患上报提交时间
// hdcp.setRegisterSubmitTime(DateUtils.getNowDate());//设置隐患上报提交时间
+
//隐患上报判定
@@ -271,11 +306,15 @@
}
}
+
//隐患整改
// hdcp.setRectifyCreateTime(DateUtils.getNowDate());//设置整改时间
hdcp.setRectifyStatus(TrHiddenDangerCheckConstants.RECTIFY_STATUS_ALREADY_RECTIFY);//整改状态(已整改)
hdcp.setAcceptStatus(TrHiddenDangerCheckConstants.ACCEPT_STATUS_NOT_ACCEPT);//验收状态(未验收)
hdcp.setStage(TrHiddenDangerCheckConstants.DANGER_STAGE_PLAN_ACCEPT);//隐患验收阶段(数据进入到隐患验收阶段)
+
+
+ //4.全流程隐患整改信息封装-未操作
//隐患验收
if (!StringUtils.isEmpty(hdcp.getAcceptResult())) {
@@ -286,8 +325,11 @@
hdcp.setRectifyStatus(TrHiddenDangerCheckConstants.RECTIFY_STATUS_NOT_RECTIFY);//整改状态(未整改)
hdcp.setAcceptStatus(TrHiddenDangerCheckConstants.ACCEPT_STATUS_ALREADY_ACCEPT_NOT_PASS);//验收状态(验收未通过)
} else if ("1".equals(hdcp.getAcceptResult())) {
-// hdcp.setAcceptCreateTime(DateUtils.getNowDate());//设置验收时间
+// hdcp.setAcceptCreateTime(DateUtils.getNowDate());//设置验收时间
hdcp.setAcceptStatus(TrHiddenDangerCheckConstants.ACCEPT_STATUS_ALREADY_ACCEPT_PASS);//验收状态(验收通过)
+
+ //5.全流程隐患验收信息封装-未操作
+
}
}
hdcp.setCompanyId(getSysUser().getCompanyId());
@@ -297,13 +339,16 @@
int i = hiddenDangerCheckPointService.insertHiddenDangerCheckPoint(hdcp);
+ // todo-2022 全流程隐患附属信息插入
+ //获取返回值id
+ hdcp.getId();
+ int result = riskService.insertDangerInfo(hdcp.getId(), hdcp);
+ if (result < 1){
+ throw new RuntimeException("全流程隐患信息保存失败");
+ }
+
return toAjax(i);
}
-
-
-
-
-
@@ -314,6 +359,17 @@
@GetMapping("/editDangerReport/{id}")
public String editDangerReport(@PathVariable("id") Long id, ModelMap mmap) {
HiddenDangerCheckPoint hdcp = hiddenDangerCheckPointService.selectHiddenDangerCheckPointById(id);
+ // todo-2022 修改前查询
+ PreventRiskDangerInfo dangerInfo = riskService.getDangerInfoById(hdcp.getId());
+
+ if (ObjectUtils.isNotEmpty(dangerInfo)){
+ hdcp.setHazardCode(dangerInfo.getHazardCode());
+ hdcp.setDangerSrc(dangerInfo.getDangerSrc());
+ hdcp.setDangerReason(dangerInfo.getDangerReason());
+ hdcp.setHazardDangerType(dangerInfo.getHazardDangerType());
+ hdcp.setDangerResult(dangerInfo.getDangerResult());
+ }
+
mmap.put("hiddenDangerCheckPoint", hdcp);
//获取所在公司人员信息
@@ -352,10 +408,10 @@
hiddenDangerCheckPointService.updateHiddenDangerCheckPoint(hiddenDangerCheckPoint);
// todo-2022 此处修改附属表
- int result = riskService.updateDangerInfo(hiddenDangerCheckPoint);
- if (result < 1){
- throw new RuntimeException("修改失败");
- }
+// int result = riskService.updateDangerInfo(hiddenDangerCheckPoint);
+// if (result < 1){
+// throw new RuntimeException("修改失败");
+// }
hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送
return AjaxResult.success();
@@ -400,6 +456,7 @@
@Log(title = "修改判定隐患上报保存", businessType = BusinessType.UPDATE)
@PostMapping("/editJudgeDangerReportSave")
@ResponseBody
+ @Transactional
public AjaxResult editJudgeDangerReportSave(HiddenDangerCheckPoint hiddenDangerCheckPoint) {
hiddenDangerCheckPoint.setJudgeCreateTime(DateUtils.getNowDate());//设置隐患上报判定时间
if (!StringUtils.isEmpty(hiddenDangerCheckPoint.getReportStatus())) {
@@ -412,10 +469,24 @@
hiddenDangerCheckPoint.setDangerLevel("0");//默认设置为一般隐患
hiddenDangerCheckPoint.setStage(TrHiddenDangerCheckConstants.DANGER_STAGE_PLAN_EXAMINE);//隐患核查阶段(数据进入到隐患核查阶段)
hiddenDangerCheckPoint.setExamineStatus(TrHiddenDangerCheckConstants.EXAMINE_STATUS_NOT_EXAMINE);//核查状态(待核查)
+
+// //
+// int result = riskService.updateDangerInfoJudge(hiddenDangerCheckPoint);
+// if (result < 1){
+// throw new RuntimeException("整改信息保存失败");
+// }
+
}
}
int i = hiddenDangerCheckPointService.updateHiddenDangerCheckPoint(hiddenDangerCheckPoint);
+
+ int result = confirmLogService.saveConfirmLog(hiddenDangerCheckPoint);
+ if (result < 1){
+ return AjaxResult.error("操作失败");
+ }
+
hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送
+
return toAjax(i);
}
@@ -437,11 +508,10 @@
hiddenDangerCheckService.deleteHiddenDangerCheckById(hdcp.getCheckId());
// todo-2022 此处删除附属表
- int result = riskService.deleteDangerInfo(hdcp.getId());
-
- if (result < 1){
- throw new RuntimeException("删除失败");
- }
+// int result = riskService.deleteDangerInfo(hdcp.getId());
+// if (result < 1){
+// throw new RuntimeException("删除失败");
+// }
hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送
return AjaxResult.success();
--
Gitblit v1.9.2