From 856ae096fce09c50cf56cfadac1413a269b2560b Mon Sep 17 00:00:00 2001
From: 16639036659 <577530412@qq.com>
Date: 星期一, 11 九月 2023 14:00:18 +0800
Subject: [PATCH] 临时提交
---
src/main/java/com/ruoyi/project/mobile/service/ApiHiddenDangerCheckService.java | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 109 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/ruoyi/project/mobile/service/ApiHiddenDangerCheckService.java b/src/main/java/com/ruoyi/project/mobile/service/ApiHiddenDangerCheckService.java
index 8d108f0..24c379c 100644
--- a/src/main/java/com/ruoyi/project/mobile/service/ApiHiddenDangerCheckService.java
+++ b/src/main/java/com/ruoyi/project/mobile/service/ApiHiddenDangerCheckService.java
@@ -7,6 +7,8 @@
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.doublePrevention.service.baseService.PreventRiskDangerConfirmLogService;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.mobile.domain.ApiRequestHeader;
import com.ruoyi.project.mobile.domain.ApiResult;
@@ -16,10 +18,13 @@
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.data.redis.connection.ReactiveListCommands;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -45,6 +50,16 @@
@Autowired
IUserService userService;//用户Service
+
+ @Autowired
+ private RiskService riskService;
+
+ @Autowired
+ private PreventRiskDangerConfirmLogService confirmLogService;
+
+
+ @Autowired
+ private IHiddenDangerCheckPointService hiddenDangerCheckPointService;
/**
* 获取隐患列表
@@ -111,7 +126,48 @@
}
}
-
+ /**
+ * 隐患核查--再次核查
+ */
+ @Transactional
+ public ApiResult editNextConfirmSave(String str, ApiRequestHeader header) {
+ //验证userId,loginName,token,deviceType,deviceId,appType 是否一致
+ ApiRequestHeader requestHeader = getHeader(header);
+ if (!(header.equals(requestHeader))) {
+ return ApiResult.errorToken("验证userId,loginName,token,deviceType,deviceId,appType 不一致");
+ }
+ try {
+ Map<String, String> map = new ObjectMapper().readValue(str, HashMap.class);
+ HiddenDangerCheckPoint hdcp = new ObjectMapper().readValue(str, HiddenDangerCheckPoint.class);
+ // todo-2022 中间核查,插入多人核查附属表
+ if(ObjectUtils.isEmpty(hdcp.getId())){
+ throw new RuntimeException("id不能为空");
+ }
+ // report_status , 上报判定结果(0未判定 1不是隐患 2是隐患)
+// if(ObjectUtils.isEmpty(hdcp.getReportStatus())){
+// throw new RuntimeException("判定结果不能为空");
+// }
+ // examine_user_id , 核查人id
+ if(ObjectUtils.isEmpty(hdcp.getExamineUserId())){
+ throw new RuntimeException("核查人Id不能为空");
+ }
+ // examine_user_name
+ if(ObjectUtils.isEmpty(hdcp.getExamineUserName())){
+ throw new RuntimeException("核查人姓名不能为空");
+ }
+ // examine_opinion 意见
+// if(ObjectUtils.isEmpty(hdcp.getRectifyDeadlineTime())){
+// throw new RuntimeException("核查意见不能为空");
+// }
+ int confirmResult = confirmLogService.saveConfirmLog(hdcp);
+ if (confirmResult < 1){
+ throw new RuntimeException("操作失败");
+ }
+ return ApiResult.success("隐患核查保存成功");
+ } catch (Exception e) {
+ return ApiResult.error("异常");
+ }
+ }
/**
* 隐患核查--保存
*/
@@ -124,6 +180,7 @@
try {
Map<String, String> map = new ObjectMapper().readValue(str, HashMap.class);
HiddenDangerCheckPoint hdcp = new ObjectMapper().readValue(str, HiddenDangerCheckPoint.class);
+ // todo-2023 此处最终核查
hdcp.setUpdateBy(header.loginName);
hdcp.setUpdateTime(DateUtils.getNowDate());
hdcp.setExamineCreateTime(DateUtils.getNowDate());//设置核查时间
@@ -137,7 +194,20 @@
hdcp.setWhetherDanger(TrHiddenDangerCheckConstants.WHETHER_DANGER_NOT);//是否为隐患(正常)
}
}
+
hdcpService.updateHiddenDangerCheckPoint(hdcp);
+
+ //此处插入隐患附属表
+ int result = riskService.insertDangerInfo(hdcp.getId(), hdcp);
+ if (result< 1){
+ throw new RuntimeException("添加隐患附属信息失败");
+ }
+
+ HiddenDangerCheckPoint hiddenDangerCheckPoint = hiddenDangerCheckPointService.getHiddenDangerCheckPointById(hdcp.getId());
+ int confirmResult = confirmLogService.saveConfirmLog(hiddenDangerCheckPoint);
+ if (confirmResult < 1){
+ throw new RuntimeException("操作失败");
+ }
hdcpService.getTaskCountTotal(Long.valueOf(header.userId));//查询未执行任务总数量并推送
@@ -168,7 +238,37 @@
hdcpService.getTaskCountTotal(Long.valueOf(header.userId));//查询未执行任务总数量并推送
+ // todo-2022 隐患信息附属表
+ int result = riskService.updateDangerInfoRectify(hdcp);
+ if (result < 1){
+ throw new RuntimeException("整改信息保存失败");
+ }
return ApiResult.success("隐患整改保存成功");
+ } catch (Exception e) {
+ return ApiResult.error("异常");
+ }
+ }
+
+ /**
+ * 整改延期--保存
+ */
+ public ApiResult rectifyTimeOutSave(String str, ApiRequestHeader header) {
+ //验证userId,loginName,token,deviceType,deviceId,appType 是否一致
+ ApiRequestHeader requestHeader = getHeader(header);
+ if (!(header.equals(requestHeader))) {
+ return ApiResult.errorToken("验证userId,loginName,token,deviceType,deviceId,appType 不一致");
+ }
+ try {
+ HiddenDangerCheckPoint hdcp = new ObjectMapper().readValue(str, HiddenDangerCheckPoint.class);
+ hdcp.setUpdateBy(header.loginName);
+ hdcp.setUpdateTime(DateUtils.getNowDate());
+
+ int result = hdcpService.rectifyTimeOut(hdcp.getId(), hdcp.getRectifyDeadlineTime());
+ if (result < 1) {
+ return ApiResult.error("延期失败");
+ }
+
+ return ApiResult.success("延期成功");
} catch (Exception e) {
return ApiResult.error("异常");
}
@@ -203,6 +303,12 @@
hdcpService.updateHiddenDangerCheckPoint(hdcp);
hdcpService.getTaskCountTotal(Long.valueOf(header.userId));//查询未执行任务总数量并推送
+
+ // todo-2022 验收通过,修改为已验收状态
+ int result = riskService.updateDangerInfoAccept(hdcp);
+ if (result < 1){
+ throw new RuntimeException("隐患验收信息保存失败");
+ }
return ApiResult.success("隐患验收保存成功");
} catch (Exception e) {
@@ -264,7 +370,7 @@
/**
- * 隐患计划执行中---设置为记录正常
+ * 隐患计划执行中---设置为记录正常 // todo
*/
public ApiResult editPointSetNormal(String str, ApiRequestHeader header) {
//验证userId,loginName,token,deviceType,deviceId,appType 是否一致
@@ -692,4 +798,5 @@
return map;
}
+
}
--
Gitblit v1.9.2