From d2313541c965b7710d72bb29a7e2eefe016c4ea9 Mon Sep 17 00:00:00 2001
From: kongzy <kongzy>
Date: 星期五, 22 九月 2023 16:57:59 +0800
Subject: [PATCH] change redis password

---
 src/main/java/com/ruoyi/project/tr/hiddenDangerCheck/controller/DangerAcceptController.java |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/ruoyi/project/tr/hiddenDangerCheck/controller/DangerAcceptController.java b/src/main/java/com/ruoyi/project/tr/hiddenDangerCheck/controller/DangerAcceptController.java
index aba8b97..fbc52ca 100644
--- a/src/main/java/com/ruoyi/project/tr/hiddenDangerCheck/controller/DangerAcceptController.java
+++ b/src/main/java/com/ruoyi/project/tr/hiddenDangerCheck/controller/DangerAcceptController.java
@@ -4,6 +4,7 @@
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.security.ShiroUtils;
+import com.ruoyi.doublePrevention.service.RiskService;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
 import com.ruoyi.framework.web.controller.BaseController;
@@ -12,8 +13,10 @@
 import com.ruoyi.project.system.user.domain.User;
 import com.ruoyi.project.tr.hiddenDangerCheckPoint.domain.HiddenDangerCheckPoint;
 import com.ruoyi.project.tr.hiddenDangerCheckPoint.service.IHiddenDangerCheckPointService;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.*;
 
@@ -32,6 +35,9 @@
 
     @Autowired
     private IHiddenDangerCheckPointService hiddenDangerCheckPointService;
+
+    @Autowired
+    private RiskService riskService;
 
     @GetMapping()
     public String hiddenDangerCheckPoint() {
@@ -70,24 +76,35 @@
     @Log(title = "隐患验收--保存", businessType = BusinessType.UPDATE)
     @PostMapping("/editDangerAcceptSave")
     @ResponseBody
+    @Transactional
     public AjaxResult editDangerAcceptSave(HiddenDangerCheckPoint hiddenDangerCheckPoint) {
         //获取当前更新用户信息
         User sysUser = getSysUser();
         hiddenDangerCheckPoint.setUpdateBy(ShiroUtils.getLoginName());
         hiddenDangerCheckPoint.setUpdateTime(DateUtils.getNowDate());
+        if (ObjectUtils.isEmpty(hiddenDangerCheckPoint.getAcceptCreateTime())){
+            throw new RuntimeException("请填写验收时间");
+        }
         if (!StringUtils.isEmpty(hiddenDangerCheckPoint.getAcceptResult())) {
             //验收结果 (0不通过 打回上一级整改阶段  1通过)
             if ("0".equals(hiddenDangerCheckPoint.getAcceptResult())) {
-                hiddenDangerCheckPoint.setAcceptCreateTime(DateUtils.getNowDate());//设置验收时间
+                hiddenDangerCheckPoint.setAcceptCreateTime(hiddenDangerCheckPoint.getAcceptCreateTime());//设置验收时间 todo 改为使用前端传输的时间
                 hiddenDangerCheckPoint.setStage(TrHiddenDangerCheckConstants.DANGER_STAGE_PLAN_RECTIFY);//隐患整改阶段(数据进入到隐患整改阶段)
                 hiddenDangerCheckPoint.setRectifyStatus(TrHiddenDangerCheckConstants.RECTIFY_STATUS_NOT_RECTIFY);//整改状态(未整改)
                 hiddenDangerCheckPoint.setAcceptStatus(TrHiddenDangerCheckConstants.ACCEPT_STATUS_ALREADY_ACCEPT_NOT_PASS);//验收状态(验收未通过)
             } else if ("1".equals(hiddenDangerCheckPoint.getAcceptResult())) {
-                hiddenDangerCheckPoint.setAcceptCreateTime(DateUtils.getNowDate());//设置验收时间
+                hiddenDangerCheckPoint.setAcceptCreateTime(hiddenDangerCheckPoint.getAcceptCreateTime());
                 hiddenDangerCheckPoint.setAcceptStatus(TrHiddenDangerCheckConstants.ACCEPT_STATUS_ALREADY_ACCEPT_PASS);//验收状态(验收通过)
             }
         }
         int i = hiddenDangerCheckPointService.updateHiddenDangerCheckPoint(hiddenDangerCheckPoint);
+
+        // todo-2022 验收通过,修改为已验收状态
+        int result = riskService.updateDangerInfoAccept(hiddenDangerCheckPoint);
+        if (result < 1){
+            throw new RuntimeException("隐患验收信息保存失败");
+        }
+
         hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送
         return toAjax(i);
     }

--
Gitblit v1.9.2