From f038e7d0338375025baa96986c5f1990abd990b9 Mon Sep 17 00:00:00 2001
From: heheng <475597332@qq.com>
Date: Fri, 10 Apr 2026 16:32:16 +0800
Subject: [PATCH] 新增暂存及图片功能

---
 gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml                 |    9 +++++++--
 gkhy-system/src/main/java/com/gkhy/system/service/impl/DailySafetyInspectionServiceImpl.java |    3 ++-
 gkhy-system/src/main/resources/mapper/system/SysDeptMapper.xml                               |    2 +-
 gkhy-admin/src/main/java/com/gkhy/web/controller/safety/DailySafetyInspectionController.java |   14 ++++++++++++++
 gkhy-system/src/main/java/com/gkhy/system/domain/DailySafetyInspection.java                  |    6 ++++++
 5 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/gkhy-admin/src/main/java/com/gkhy/web/controller/safety/DailySafetyInspectionController.java b/gkhy-admin/src/main/java/com/gkhy/web/controller/safety/DailySafetyInspectionController.java
index e1a88dd..1d7372e 100644
--- a/gkhy-admin/src/main/java/com/gkhy/web/controller/safety/DailySafetyInspectionController.java
+++ b/gkhy-admin/src/main/java/com/gkhy/web/controller/safety/DailySafetyInspectionController.java
@@ -53,11 +53,25 @@
     @ApiOperation(value = "新增编辑日常安全检查")
     public AjaxResult saveDailySafetyInspection(@Validated @RequestBody DailySafetyInspection dailySafetyInspection)
     {
+        dailySafetyInspection.setScratchpad(2);
         return toAjax(dailySafetyInspectionService.saveDailySafetyInspection(dailySafetyInspection));
     }
 
 
     /**
+     * 暂存日常安全检查
+     */
+    @PostMapping("/scratchpadDailySafetyInspection")
+    @ApiOperation(value = "暂存日常安全检查")
+    public AjaxResult scratchpadDailySafetyInspection( @RequestBody DailySafetyInspection dailySafetyInspection)
+    {
+        dailySafetyInspection.setScratchpad(1);
+        return toAjax(dailySafetyInspectionService.saveDailySafetyInspection(dailySafetyInspection));
+    }
+
+
+
+    /**
      * 删除通知公告
      */
     @GetMapping("/deleteDailySafetyInspection")
diff --git a/gkhy-system/src/main/java/com/gkhy/system/domain/DailySafetyInspection.java b/gkhy-system/src/main/java/com/gkhy/system/domain/DailySafetyInspection.java
index 54bfd18..c623fa2 100644
--- a/gkhy-system/src/main/java/com/gkhy/system/domain/DailySafetyInspection.java
+++ b/gkhy-system/src/main/java/com/gkhy/system/domain/DailySafetyInspection.java
@@ -164,4 +164,10 @@
     @ApiModelProperty(value = "部门信息")
     @TableField(exist = false)
     private List<DailySafetyInspectionDept> dailySafetyInspectionDepts;
+
+    @ApiModelProperty(value = "检查图片")
+    private String checkPics;
+
+    @ApiModelProperty(value = "1暂存2保存")
+    private Integer scratchpad;
 }
diff --git a/gkhy-system/src/main/java/com/gkhy/system/service/impl/DailySafetyInspectionServiceImpl.java b/gkhy-system/src/main/java/com/gkhy/system/service/impl/DailySafetyInspectionServiceImpl.java
index 9c43752..8a557fa 100644
--- a/gkhy-system/src/main/java/com/gkhy/system/service/impl/DailySafetyInspectionServiceImpl.java
+++ b/gkhy-system/src/main/java/com/gkhy/system/service/impl/DailySafetyInspectionServiceImpl.java
@@ -78,6 +78,7 @@
 //        }
 
         int i = 0;
+
         if (inspection.getId() == null) {
             inspection.setCreateTime(LocalDateTime.now());
             inspection.setCreateBy(SecurityUtils.getUsername());
@@ -89,7 +90,7 @@
             inspection.setUpdateById(SecurityUtils.getUserId());
             i = dailySafetyInspectionMapper.updateById(inspection);
         }
-        if (i > 0){
+        if (i > 0 && ObjectUtil.isNotEmpty(inspection.getDailySafetyInspectionDepts())){
             saveDailySafetyInspectionDept(inspection.getDailySafetyInspectionDepts(),inspection.getId());
         }
 //        if (i > 0) {
diff --git a/gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml b/gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml
index 44c25ca..1453362 100644
--- a/gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml
+++ b/gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml
@@ -23,6 +23,8 @@
         <result column="update_by" property="updateBy"/>
         <result column="update_time" property="updateTime"/>
         <result column="check_type" property="checkType"/>
+        <result column="scratchpad" property="scratchpad"/>
+        <result column="check_pics" property="checkPics"/>
 
         <!--        <collection  property="dailySafetyInspectionUsers"   ofType="com.gkhy.system.domain.DailySafetyInspectionUser"  column="id = id" select="selectDailySafetyInspectionUsers" />-->
         <collection property="dailySafetyInspectionDepts" ofType="com.gkhy.system.domain.DailySafetyInspectionDept"
@@ -72,6 +74,9 @@
         <if test="checkType != null ">
             and a.check_type = #{checkType}
         </if>
+        <if test="scratchpad != null ">
+            and a.scratchpad = #{scratchpad}
+        </if>
         <if test="checkBeginDate != null ">
             <!-- 开始时间检索 -->
             AND date_format(a.check_date,'%Y%m%d') &gt;= date_format(#{checkBeginDate},'%Y%m%d')
@@ -114,14 +119,14 @@
         from daily_safety_inspection_dept a
             inner join daily_safety_inspection b on a.daily_safety_inspection_id = b.id
         where b.del_flag = 0
-          and a.dept_id = #{deptId}
+          and a.dept_id = #{deptId} and b.scratchpad = 2
           and date_format(b.check_date, '%Y%m') = date_format(now(), '%Y%m')
     </select>
 
     <select id="getCheckCountList" parameterType="java.util.List" resultType="int">
         select count(*)
         from daily_safety_inspection_dept a
-                 inner join daily_safety_inspection b on a.daily_safety_inspection_id = b.id
+                 inner join daily_safety_inspection b on a.daily_safety_inspection_id = b.id and b.scratchpad = 2
         where b.del_flag = 0
         and a.dept_id in
         <foreach collection="list" item="deptId" open="(" separator="," close=")">
diff --git a/gkhy-system/src/main/resources/mapper/system/SysDeptMapper.xml b/gkhy-system/src/main/resources/mapper/system/SysDeptMapper.xml
index 6914f6b..9bb890a 100644
--- a/gkhy-system/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/gkhy-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -62,7 +62,7 @@
 			   d.email, d.status, d.del_flag, d.create_by, d.create_time ,d.safety,
 <!--			   ( select count(*) from daily_safety_inspection where del_flag = 0 and research_group = dept_id and date_format(check_date,'%Y%m') = date_format(#{beginDate},'%Y%m')) check_count-->
 	(		select COUNT(*) from daily_safety_inspection_dept aa
-		INNER JOIN daily_safety_inspection bb on aa.daily_safety_inspection_id = bb.id and bb.del_flag = 0 and date_format(bb.check_date,'%Y%m') = date_format(#{beginDate},'%Y%m')
+		INNER JOIN daily_safety_inspection bb on aa.daily_safety_inspection_id = bb.id and bb.del_flag = 0  and bb.scratchpad = 2 and date_format(bb.check_date,'%Y%m') = date_format(#{beginDate},'%Y%m')
 		where aa.dept_id = d.dept_id) check_count
 
 		from sys_dept d

--
Gitblit v1.9.2