From 506c54af9412e0aeeab3e73d52c7cafe1cca0d00 Mon Sep 17 00:00:00 2001
From: heheng <475597332@qq.com>
Date: 星期五, 17 十月 2025 17:30:08 +0800
Subject: [PATCH] 功能改造
---
gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml | 3 +++
gkhy-system/src/main/java/com/gkhy/system/service/impl/DailySafetyInspectionServiceImpl.java | 29 ++++++++++++++++++++++++++++-
gkhy-system/src/main/java/com/gkhy/system/domain/DailySafetyInspection.java | 8 ++++++++
3 files changed, 39 insertions(+), 1 deletions(-)
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 c69d484..54bfd18 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
@@ -118,6 +118,10 @@
@TableField("create_by")
private String createBy;
+ @ApiModelProperty("创建者id")
+ @TableField("create_by_id")
+ private Long createById;
+
@ApiModelProperty("创建时间")
@TableField("create_time")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@@ -127,6 +131,10 @@
@TableField("update_by")
private String updateBy;
+ @ApiModelProperty("更新者id")
+ @TableField("update_by_id")
+ private Long updateById;
+
@ApiModelProperty("更新时间")
@TableField("update_time")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
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 42cf000..799ac95 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
@@ -49,6 +49,14 @@
@Override
public List<DailySafetyInspection> selectDailySafetyInspectionList(DailySafetyInspection inspection) {
+ boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId());
+ if (!admin){
+ boolean sysAdmin = SecurityUtils.hasRole(Constants.SYS_ADMIN);
+ boolean placeSafetyOfficer = SecurityUtils.hasRole(Constants.PLACE_SAFETY_OFFICER);
+ if (!(sysAdmin || placeSafetyOfficer)) {
+ inspection.setCreateById(SecurityUtils.getUserId());
+ }
+ }
return dailySafetyInspectionMapper.getDailySafetyInspectionList(inspection);
}
@@ -72,10 +80,12 @@
if (inspection.getId() == null) {
inspection.setCreateTime(LocalDateTime.now());
inspection.setCreateBy(SecurityUtils.getUsername());
+ inspection.setCreateById(SecurityUtils.getUserId());
i = dailySafetyInspectionMapper.insert(inspection);
} else {
inspection.setUpdateTime(LocalDateTime.now());
inspection.setUpdateBy(SecurityUtils.getUsername());
+ inspection.setUpdateById(SecurityUtils.getUserId());
i = dailySafetyInspectionMapper.updateById(inspection);
}
if (i > 0){
@@ -115,7 +125,7 @@
return dailySafetyInspectionMapper.update(new DailySafetyInspection(),
new LambdaUpdateWrapper<DailySafetyInspection>().eq(DailySafetyInspection::getId, id)
.set(DailySafetyInspection::getDelFlag, Constants.FAIL).set(DailySafetyInspection::getUpdateTime, LocalDateTime.now())
- .set(DailySafetyInspection::getUpdateBy, SecurityUtils.getUsername()));
+ .set(DailySafetyInspection::getUpdateBy, SecurityUtils.getUsername()).set(DailySafetyInspection::getUpdateById, SecurityUtils.getUserId()));
}
@Override
@@ -131,4 +141,21 @@
}
return dailySafetyInspectionMapper.getCheckCount(deptId);
}
+
+
+ private void checkPer(){
+ boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId());
+ if (!admin){
+ boolean sysAdmin = SecurityUtils.hasRole(Constants.SYS_ADMIN);
+ if (!sysAdmin){
+ throw new RuntimeException("没有权限");
+ }
+ boolean placeSafetyOfficer = SecurityUtils.hasRole(Constants.PLACE_SAFETY_OFFICER);
+ if (!placeSafetyOfficer){
+ throw new RuntimeException("没有权限");
+ }
+
+ }
+
+ }
}
diff --git a/gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml b/gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml
index 818dce4..403dd09 100644
--- a/gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml
+++ b/gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml
@@ -66,6 +66,9 @@
<!-- <if test="researchGroup != null ">-->
<!-- and a.research_group = #{researchGroup}-->
<!-- </if>-->
+ <if test="createById != null ">
+ and a.create_by_id = #{createById}
+ </if>
<if test="checkType != null ">
and a.check_type = #{checkType}
</if>
--
Gitblit v1.9.2