From 32f55fac90d67b276254b6d91e8b65e8f6e36b48 Mon Sep 17 00:00:00 2001
From: heheng <475597332@qq.com>
Date: Thu, 18 Sep 2025 10:09:28 +0800
Subject: [PATCH] 功能改造
---
gkhy-common/src/main/java/com/gkhy/common/core/domain/entity/SysDept.java | 11 +++++++++++
gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml | 9 +++++++--
gkhy-system/src/main/java/com/gkhy/system/domain/Hazards.java | 2 +-
gkhy-system/src/main/java/com/gkhy/system/service/impl/DailySafetyInspectionServiceImpl.java | 22 ++++++++++++++++++++++
gkhy-system/src/main/resources/mapper/system/SysDeptMapper.xml | 13 ++++++++++---
gkhy-system/src/main/java/com/gkhy/system/domain/DailySafetyInspection.java | 2 +-
6 files changed, 52 insertions(+), 7 deletions(-)
diff --git a/gkhy-common/src/main/java/com/gkhy/common/core/domain/entity/SysDept.java b/gkhy-common/src/main/java/com/gkhy/common/core/domain/entity/SysDept.java
index fe3ea6e..4bf8eed 100644
--- a/gkhy-common/src/main/java/com/gkhy/common/core/domain/entity/SysDept.java
+++ b/gkhy-common/src/main/java/com/gkhy/common/core/domain/entity/SysDept.java
@@ -51,6 +51,9 @@
/** 父部门名称 */
private String parentName;
+
+ /** 是否安全统计0否1是 */
+ private String safety;
/** 子部门 */
private List<SysDept> children = new ArrayList<SysDept>();
@@ -200,4 +203,12 @@
.append("updateTime", getUpdateTime())
.toString();
}
+
+ public String getSafety() {
+ return safety;
+ }
+
+ public void setSafety(String safety) {
+ this.safety = safety;
+ }
}
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 1eee189..70f6d2f 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
@@ -136,7 +136,7 @@
@TableField(exist = false)
@ApiModelProperty("参与检查人员id查询条件")
- private Long searchCheckUserId;
+ private List<Long> searchCheckUserIds;
@TableField(exist = false)
@ApiModelProperty("查询条件检查开始时间")
diff --git a/gkhy-system/src/main/java/com/gkhy/system/domain/Hazards.java b/gkhy-system/src/main/java/com/gkhy/system/domain/Hazards.java
index 7a55203..e8d2e1f 100644
--- a/gkhy-system/src/main/java/com/gkhy/system/domain/Hazards.java
+++ b/gkhy-system/src/main/java/com/gkhy/system/domain/Hazards.java
@@ -46,7 +46,7 @@
@NotBlank(message = "隐患描述不能为空")
private String hazardDescription;
- @ApiModelProperty(value ="隐患来源:1日常排查 2综合性排查 3专业性排查 4季节性排查 5重点时段及节假日前排查 6外聘专家诊断式排查7其他",required = true)
+ @ApiModelProperty(value ="隐患来源: 1综合检查、2部门检查、3实验室自查、4专项检查",required = true)
@TableField("hazard_source")
@NotNull(message = "隐患来源不能为空")
private Integer hazardSource;
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 b25180b..65476dd 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
@@ -5,12 +5,14 @@
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.common.constant.Constants;
+import com.gkhy.common.core.domain.entity.SysDept;
import com.gkhy.common.exception.ServiceException;
import com.gkhy.common.utils.SecurityUtils;
import com.gkhy.system.domain.DailySafetyInspection;
import com.gkhy.system.domain.DailySafetyInspectionUser;
import com.gkhy.system.mapper.DailySafetyInspectionMapper;
import com.gkhy.system.mapper.DailySafetyInspectionUserMapper;
+import com.gkhy.system.mapper.SysDeptMapper;
import com.gkhy.system.service.DailySafetyInspectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -37,6 +39,9 @@
@Autowired
private DailySafetyInspectionUserMapper dailySafetyInspectionUserMapper;
+ @Autowired
+ private SysDeptMapper sysDeptMapper;
+
@Override
public List<DailySafetyInspection> selectDailySafetyInspectionList(DailySafetyInspection inspection) {
return dailySafetyInspectionMapper.getDailySafetyInspectionList(inspection);
@@ -49,6 +54,15 @@
if (ObjectUtil.isEmpty(dailySafetyInspectionUsers)) {
throw new ServiceException("参检人员不能为空");
}
+ Long researchGroup = inspection.getResearchGroup();
+ SysDept sysDept = sysDeptMapper.selectDeptById(researchGroup);
+ if (sysDept == null) {
+ throw new ServiceException("部门不存在");
+ }
+ if (!"1".equals(sysDept.getSafety())){
+ throw new ServiceException("所选部门未开启安全检查");
+ }
+
int i = 0;
if (inspection.getId() == null) {
inspection.setCreateTime(LocalDateTime.now());
@@ -89,6 +103,14 @@
@Override
public int getCheckCount() {
Long deptId = SecurityUtils.getDeptId();
+ SysDept sysDept = sysDeptMapper.selectDeptById(deptId);
+ if (sysDept == null){
+ return 1;
+ }else {
+ if (!"1".equals(sysDept.getSafety())){
+ return 1;
+ }
+ }
return dailySafetyInspectionMapper.getCheckCount(deptId);
}
}
diff --git a/gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml b/gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml
index f1f3115..e573dcc 100644
--- a/gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml
+++ b/gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml
@@ -64,8 +64,13 @@
<if test="haveMainHazard != null and haveMainHazard == 1 ">
and (main_hazard != '无' and main_hazard != ' ')
</if>
- <if test="searchCheckUserId != null ">
- and a.id in (select daily_safety_inspection_id from daily_safety_inspection_user where check_user_id = #{searchCheckUserId})
+ <if test="searchCheckUserIds != null and !searchCheckUserIds.isEmpty()">
+ and a.id in (
+ select distinct daily_safety_inspection_id from daily_safety_inspection_user
+ where check_user_id in <foreach collection="searchCheckUserIds" item="group" open="(" separator="," close=")">
+ #{group}
+ </foreach>
+ )
</if>
order by a.create_time desc
</select>
diff --git a/gkhy-system/src/main/resources/mapper/system/SysDeptMapper.xml b/gkhy-system/src/main/resources/mapper/system/SysDeptMapper.xml
index 8c80410..b5d6515 100644
--- a/gkhy-system/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/gkhy-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -20,6 +20,7 @@
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
+ <result property="safety" column="safety" />
</resultMap>
<resultMap id="SysDeptDataResult" type="com.gkhy.system.domain.vo.DeptVo" extends="SysDeptResult">
@@ -27,7 +28,7 @@
</resultMap>
<sql id="selectDeptVo">
- select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
+ select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time,d.safety
from sys_dept d
</sql>
@@ -46,6 +47,9 @@
<if test="status != null and status != ''">
AND status = #{status}
</if>
+ <if test="safety != null and safety != ''">
+ AND safety = #{safety}
+ </if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by d.parent_id, d.order_num
@@ -55,7 +59,7 @@
<select id="selectDeptData" parameterType="Date" resultMap="SysDeptDataResult">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone,
- d.email, d.status, d.del_flag, d.create_by, d.create_time ,
+ 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
from sys_dept d
where d.del_flag = '0'
@@ -78,7 +82,7 @@
</select>
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
- select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,
+ select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,d.safety,
(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
from sys_dept d
where d.dept_id = #{deptId}
@@ -117,6 +121,7 @@
<if test="phone != null and phone != ''">phone,</if>
<if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if>
+ <if test="safety != null">safety,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
@@ -129,6 +134,7 @@
<if test="phone != null and phone != ''">#{phone},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if>
+ <if test="safety != null">#{safety},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
@@ -145,6 +151,7 @@
<if test="phone != null">phone = #{phone},</if>
<if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if>
+ <if test="safety != null">safety = #{safety},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
--
Gitblit v1.9.2