From 70366a218269f3501b9a1f44338ef00beef518c1 Mon Sep 17 00:00:00 2001
From: 16639036659 <577530412@qq.com>
Date: 星期三, 19 六月 2024 14:01:25 +0800
Subject: [PATCH] 专项检查任务调整

---
 src/main/java/com/ruoyi/project/tr/specialCheck/service/impl/SpecialCheckTaskServiceImpl.java |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/ruoyi/project/tr/specialCheck/service/impl/SpecialCheckTaskServiceImpl.java b/src/main/java/com/ruoyi/project/tr/specialCheck/service/impl/SpecialCheckTaskServiceImpl.java
index 40bf246..132f684 100644
--- a/src/main/java/com/ruoyi/project/tr/specialCheck/service/impl/SpecialCheckTaskServiceImpl.java
+++ b/src/main/java/com/ruoyi/project/tr/specialCheck/service/impl/SpecialCheckTaskServiceImpl.java
@@ -2,6 +2,7 @@
 
 import com.github.pagehelper.Page;
 import com.github.pagehelper.PageHelper;
+import com.ruoyi.common.utils.BeanCopyUtils;
 import com.ruoyi.doublePrevention.entity.PreventRiskControlMeasure;
 import com.ruoyi.doublePrevention.enums.ErrorCodes;
 import com.ruoyi.doublePrevention.enums.ResultCodes;
@@ -18,6 +19,7 @@
 import org.springframework.util.ObjectUtils;
 
 import java.time.LocalDateTime;
+import java.time.ZoneId;
 import java.util.Date;
 import java.util.List;
 import java.util.UUID;
@@ -66,10 +68,12 @@
     }
 
     @Override
-    public ResultVO<TbSpecialCheckTaskLog> addSpecialTask(TbSpecialCheckTaskLog tbSpecialCheckTaskLog) {
+    public ResultVO<TbSpecialCheckTaskLog> addSpecialTask(TbSpecialCheckTaskLogEditBO taskLogEditBO) {
         User sysUser = getSysUser();
         ResultVO resultVO = new ResultVO<>();
         resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
+
+        TbSpecialCheckTaskLog tbSpecialCheckTaskLog = BeanCopyUtils.copyBean(taskLogEditBO, TbSpecialCheckTaskLog.class);
         if (tbSpecialCheckTaskLog.getHazardCode() == null){
             resultVO.setMsg("重大风险源不能为空");
             return resultVO;
@@ -91,7 +95,7 @@
             resultVO.setMsg("结果不能为空");
             return resultVO;
         }
-        if (tbSpecialCheckTaskLog.getCheckDate() == null){
+        if (taskLogEditBO.getCheckDate() == null){
             resultVO.setMsg("检查日期不能为空");
             return resultVO;
         }
@@ -108,6 +112,7 @@
         tbSpecialCheckTaskLog.setReportStatus((byte) 1);
         tbSpecialCheckTaskLog.setReportTime(null);
         tbSpecialCheckTaskLog.setDeleted((byte) 0);
+        tbSpecialCheckTaskLog.setCheckDate(LocalDateTime.ofInstant(taskLogEditBO.getCheckDate().toInstant(), ZoneId.systemDefault()));
 
         int saveResult = taskSpecialLogMapper.save(tbSpecialCheckTaskLog);
         if (saveResult == 0){
@@ -126,10 +131,13 @@
     }
 
     @Override
-    public ResultVO<TbSpecialCheckTaskLog> updateSpecialCheckTaskLog(TbSpecialCheckTaskLogUpdateBO updateBO) {
+    public ResultVO<TbSpecialCheckTaskLog> updateSpecialCheckTaskLog(TbSpecialCheckTaskLogEditBO taskLogEditBO) {
         User sysUser = getSysUser();
         ResultVO resultVO = new ResultVO<>();
         resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
+
+        TbSpecialCheckTaskLogUpdateBO updateBO = BeanCopyUtils.copyBean(taskLogEditBO, TbSpecialCheckTaskLogUpdateBO.class);
+
         if (updateBO.getIndexId() == null){
             resultVO.setMsg("任务不能为空");
             return resultVO;
@@ -160,7 +168,7 @@
             resultVO.setMsg("结果不能为空");
             return resultVO;
         }
-        if (updateBO.getCheckDate() == null){
+        if (taskLogEditBO.getCheckDate() == null){
             resultVO.setMsg("检查日期不能为空");
             return resultVO;
         }
@@ -170,6 +178,7 @@
         updateBO.setUpdateDate(dateTime);
         updateBO.setUpdateBy(sysUser.getUserName());
         updateBO.setReportStatus((byte) 1);
+        updateBO.setCheckDate(LocalDateTime.ofInstant(taskLogEditBO.getCheckDate().toInstant(), ZoneId.systemDefault()));
 
         int updateResult = taskSpecialLogMapper.updateSpecialCheckTaskLogById(updateBO);
         if (updateResult == 0){

--
Gitblit v1.9.2