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/domin/BO/TbSpecialCheckTaskLogEditBO.java       |   51 +++++++++++++++++++++++++
 src/main/java/com/ruoyi/project/tr/specialCheck/service/SpecialCheckTaskService.java            |    6 ++-
 src/main/java/com/ruoyi/project/tr/specialCheck/service/impl/SpecialCheckTaskServiceImpl.java   |   17 ++++++--
 src/main/java/com/ruoyi/project/tr/specialCheck/controller/TBSpecialCheckTaskLogController.java |   14 +++---
 4 files changed, 75 insertions(+), 13 deletions(-)

diff --git a/src/main/java/com/ruoyi/project/tr/specialCheck/controller/TBSpecialCheckTaskLogController.java b/src/main/java/com/ruoyi/project/tr/specialCheck/controller/TBSpecialCheckTaskLogController.java
index 11f7f26..58c4742 100644
--- a/src/main/java/com/ruoyi/project/tr/specialCheck/controller/TBSpecialCheckTaskLogController.java
+++ b/src/main/java/com/ruoyi/project/tr/specialCheck/controller/TBSpecialCheckTaskLogController.java
@@ -16,9 +16,7 @@
 import com.ruoyi.project.tr.report.domain.Danger;
 import com.ruoyi.project.tr.riskList.domain.RiskList;
 import com.ruoyi.project.tr.riskList.service.IRiskListService;
-import com.ruoyi.project.tr.specialCheck.domin.BO.TbBaseCheckTaskBO;
-import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckTaskLogBO;
-import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckTaskLogUpdateBO;
+import com.ruoyi.project.tr.specialCheck.domin.BO.*;
 import com.ruoyi.project.tr.specialCheck.domin.DTO.TbSpecialCheckTaskLogDTO;
 import com.ruoyi.project.tr.specialCheck.domin.DTO.TbSpecialCheckTaskLogDateDTO;
 import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckTask;
@@ -91,6 +89,8 @@
     {
         List<RiskList> riskList = riskListService.listHazardSource();
         mmap.put("hazardList", riskList);
+        List<TbBaseCheckTask> listResult = tbBaseCheckService.listTbBaseCheckTask();
+        mmap.put("tbBaseCheckTask", listResult);
         return prefix + "/add";
     }
 
@@ -100,9 +100,9 @@
      */
     @PostMapping("/add")
     @ResponseBody
-    public AjaxResult addSpecialTask(TbSpecialCheckTaskLog tbSpecialCheckTaskLog){
+    public AjaxResult addSpecialTask(TbSpecialCheckTaskLogEditBO taskLogEditBO){
 
-        ResultVO<TbSpecialCheckTaskLog> resultVO = specialCheckTaskService.addSpecialTask(tbSpecialCheckTaskLog);
+        ResultVO<TbSpecialCheckTaskLog> resultVO = specialCheckTaskService.addSpecialTask(taskLogEditBO);
         String code = resultVO.getCode();
         if ("200".equals(code)){
             return toAjax(1);
@@ -151,9 +151,9 @@
      */
     @PostMapping("/edit")
     @ResponseBody
-    public AjaxResult editSave(TbSpecialCheckTaskLogUpdateBO updateBO)
+    public AjaxResult editSave(TbSpecialCheckTaskLogEditBO taskLogEditBO)
     {
-        ResultVO<TbSpecialCheckTaskLog> resultVO = specialCheckTaskService.updateSpecialCheckTaskLog(updateBO);
+        ResultVO<TbSpecialCheckTaskLog> resultVO = specialCheckTaskService.updateSpecialCheckTaskLog(taskLogEditBO);
         String code = resultVO.getCode();
         if ("200".equals(code)){
             return toAjax(1);
diff --git a/src/main/java/com/ruoyi/project/tr/specialCheck/domin/BO/TbSpecialCheckTaskLogEditBO.java b/src/main/java/com/ruoyi/project/tr/specialCheck/domin/BO/TbSpecialCheckTaskLogEditBO.java
new file mode 100644
index 0000000..83ef1d9
--- /dev/null
+++ b/src/main/java/com/ruoyi/project/tr/specialCheck/domin/BO/TbSpecialCheckTaskLogEditBO.java
@@ -0,0 +1,51 @@
+package com.ruoyi.project.tr.specialCheck.domin.BO;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.Date;
+
+@Data
+public class TbSpecialCheckTaskLogEditBO {
+
+
+    private Long indexId;
+
+    private String id;
+
+    private String companyCode;
+
+    private String hazardCode;
+
+    private String hazardSource;
+
+    private String taskId;
+
+    private String checkType;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date checkDate;
+
+    private String resultStatus;
+
+    private Byte deleted;
+
+    private String createBy;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createDate;
+
+    private String updateBy;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date updateDate;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date reportTime;
+
+    private Byte reportStatus;
+}
diff --git a/src/main/java/com/ruoyi/project/tr/specialCheck/service/SpecialCheckTaskService.java b/src/main/java/com/ruoyi/project/tr/specialCheck/service/SpecialCheckTaskService.java
index cbf8b2f..ed4aa41 100644
--- a/src/main/java/com/ruoyi/project/tr/specialCheck/service/SpecialCheckTaskService.java
+++ b/src/main/java/com/ruoyi/project/tr/specialCheck/service/SpecialCheckTaskService.java
@@ -2,7 +2,9 @@
 
 
 import com.ruoyi.doublePrevention.vo.ResultVO;
+import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckItemLogEditBO;
 import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckTaskLogBO;
+import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckTaskLogEditBO;
 import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckTaskLogUpdateBO;
 import com.ruoyi.project.tr.specialCheck.domin.TbSpecialCheckTaskLog;
 
@@ -12,11 +14,11 @@
 
     ResultVO<List<TbSpecialCheckTaskLog>> selectSpecialCheckTaskLogPage(TbSpecialCheckTaskLogBO specialCheckTaskLogBO);
 
-    ResultVO<TbSpecialCheckTaskLog> addSpecialTask(TbSpecialCheckTaskLog tbSpecialCheckTaskLog);
+    ResultVO<TbSpecialCheckTaskLog> addSpecialTask(TbSpecialCheckTaskLogEditBO taskLogEditBO);
 
     TbSpecialCheckTaskLog getSpecialCheckTaskLogByIndexId(Long id);
 
-    ResultVO<TbSpecialCheckTaskLog> updateSpecialCheckTaskLog(TbSpecialCheckTaskLogUpdateBO updateBO);
+    ResultVO<TbSpecialCheckTaskLog> updateSpecialCheckTaskLog(TbSpecialCheckTaskLogEditBO taskLogEditBO);
 
     ResultVO<TbSpecialCheckTaskLog> deleteTbSpecialCheckTaskLog(TbSpecialCheckTaskLogUpdateBO updateBO);
 }
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