From 7be0d5b901b999d2347774df3cc1a64927838bb3 Mon Sep 17 00:00:00 2001
From: heheng <475597332@qq.com>
Date: 星期二, 15 四月 2025 10:10:35 +0800
Subject: [PATCH] 优化每年专项数据获取

---
 src/main/java/com/ruoyi/project/mobile/service/ApiDangerScheduleService.java |   44 ++++++++++++++++++++++++++++++--------------
 1 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/src/main/java/com/ruoyi/project/mobile/service/ApiDangerScheduleService.java b/src/main/java/com/ruoyi/project/mobile/service/ApiDangerScheduleService.java
index 2f9b2f3..aab7529 100644
--- a/src/main/java/com/ruoyi/project/mobile/service/ApiDangerScheduleService.java
+++ b/src/main/java/com/ruoyi/project/mobile/service/ApiDangerScheduleService.java
@@ -20,12 +20,12 @@
 import com.ruoyi.project.tr.hiddenDangerCheck.service.IHiddenDangerCheckService;
 import com.ruoyi.project.tr.hiddenDangerCheckPoint.domain.HiddenDangerCheckPoint;
 import com.ruoyi.project.tr.hiddenDangerCheckPoint.service.IHiddenDangerCheckPointService;
+import org.apache.commons.lang3.ObjectUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.ObjectUtils;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -49,6 +49,9 @@
 
     @Autowired
     private RiskService riskService;
+
+    @Autowired
+    private PreventRiskDangerCheckAndMeasureService riskDangerCheckAndMeasureService;//隐患检查点Service
 
     @Autowired
     private PreventRiskDangerCheckAndMeasureService preventRiskDangerCheckAndMeasureService;
@@ -157,7 +160,7 @@
 
 
     /**
-     * 设置为记录正常
+     * 设置为记录正常 todo
      */
     public ApiResult editPointScheduleSetNormal(String str, ApiRequestHeader header) {
         //验证userId,loginName,token,deviceType,deviceId,appType 是否一致
@@ -179,6 +182,11 @@
                 return ApiResult.error("隐患排查记录附属表:写入手机识别码错误");
             }
 
+            //添加检查说明信息
+            int result1 = riskDangerCheckAndMeasureService.updateCheckDesc(hdcp);
+            if (result1 < 1){
+                throw new RuntimeException("登记检查上报结果失败");
+            }
             hdcpService.getTaskCountTotal(Long.valueOf(header.userId));//查询未执行任务总数量并推送
 
             return ApiResult.success("定时隐患排查--设置为正常--成功");
@@ -201,6 +209,12 @@
         }
         try {
             HiddenDangerCheckPoint hdcp = new ObjectMapper().readValue(str, HiddenDangerCheckPoint.class);
+            if (ObjectUtils.isEmpty(hdcp.getCheckPerson())){
+                throw new RuntimeException("检查人不能为空");
+            }
+            if (ObjectUtils.isEmpty(hdcp.getFindTime())){
+                throw new RuntimeException("发现时间不能为空");
+            }
             hdcp.setUpdateBy(header.loginName);
             hdcp.setUpdateTime(DateUtils.getNowDate());
             hdcp.setRegisterCreateTime(DateUtils.getNowDate());//设置隐患登记上报创建时间
@@ -217,6 +231,8 @@
             queryExist.setWhetherDanger(TrHiddenDangerCheckConstants.WHETHER_DANGER_YES);//是否为隐患(是隐患)
             queryExist.setCheckPointId(hdcp.getCheckPointId());
             queryExist.setCheckId(hdcp.getCheckId());
+
+            hdcp.setReportStatus("0");
 
             /**
              * 本次查询结果 :如果未上报过隐患,必定为空
@@ -235,18 +251,18 @@
                 hdcp.setCompanyId(user.getCompanyId());
                 i = hdcpService.insertHiddenDangerCheckPoint(hdcp);
                 if (i< 1){
-                    throw new RuntimeException("添加隐患附属信息失败");
+                    throw new RuntimeException("添加隐患信息失败");
                 }
 
                 //获取Id返回值
-                hdcp.getId();
-                int result = riskService.insertDangerInfo(hdcp.getId(), hdcp);
-                if (result< 1){
-                    throw new RuntimeException("添加隐患附属信息失败");
-                }
+//                hdcp.getId();
+//                int result = riskService.insertDangerInfo(hdcp.getId(), hdcp);
+//                if (result< 1){
+//                    throw new RuntimeException("添加隐患附属信息失败");
+//                }
 
-                PreventRiskDangerCheckAndMeasure dangerCheckPointInfo = preventRiskDangerCheckAndMeasureService.getByDangerCheckPointId(hdcp.getId());
-                riskService.updateCheckLog(dangerCheckPointInfo.getCheckId(), hdcp);
+//                PreventRiskDangerCheckAndMeasure dangerCheckPointInfo = preventRiskDangerCheckAndMeasureService.getByDangerCheckPointId(hdcp.getId());
+//                riskService.updateCheckLog(dangerCheckPointInfo.getCheckId(), hdcp);
 
             }else{
                 hdcp.setUpdateBy(user.getLoginName());
@@ -258,10 +274,10 @@
 //                if (result < 1){
 //                    throw new RuntimeException("修改失败");
 //                }
-                int result = riskService.insertDangerInfo(hdcp.getId(), hdcp);
-                if (result< 1){
-                    throw new RuntimeException("添加隐患附属信息失败");
-                }
+//                int result = riskService.insertDangerInfo(hdcp.getId(), hdcp);
+//                if (result< 1){
+//                    throw new RuntimeException("添加隐患附属信息失败");
+//                }
 
                 PreventRiskDangerCheckAndMeasure dangerCheckPointInfo = preventRiskDangerCheckAndMeasureService.getByDangerCheckPointId(hdcp.getId());
                 riskService.updateCheckLog(dangerCheckPointInfo.getCheckId(), hdcp);

--
Gitblit v1.9.2