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/java/com/gkhy/system/service/impl/DailySafetyInspectionServiceImpl.java | 37 +++++++++++++++++++++++++++++--------
1 files changed, 29 insertions(+), 8 deletions(-)
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 0392d7c..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
@@ -21,6 +21,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -77,6 +78,7 @@
// }
int i = 0;
+
if (inspection.getId() == null) {
inspection.setCreateTime(LocalDateTime.now());
inspection.setCreateBy(SecurityUtils.getUsername());
@@ -88,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) {
@@ -130,16 +132,35 @@
@Override
public int getCheckCount() {
- Long deptId = SecurityUtils.getDeptId();
- SysDept sysDept = sysDeptMapper.selectDeptById(deptId);
- if (sysDept == null){
+ Long[] deptIds = SecurityUtils.getDeptIds();
+ if (ObjectUtil.isEmpty(deptIds)){
return 1;
- }else {
- if (!"1".equals(sysDept.getSafety())){
- return 1;
+ }
+ List<SysDept> sysDepts = sysDeptMapper.selectDeptByIds(deptIds);
+ if (ObjectUtil.isEmpty(sysDepts)){
+ return 1;
+ }
+ List<Long> data = new ArrayList<>();
+ for (SysDept sysDept : sysDepts) {
+ if ("1".equals(sysDept.getSafety())){
+ data.add(sysDept.getDeptId());
}
}
- return dailySafetyInspectionMapper.getCheckCount(deptId);
+ if (ObjectUtil.isEmpty(data)){
+ return 1;
+ }
+ return dailySafetyInspectionMapper.getCheckCountList(data);
+
+// 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);
}
--
Gitblit v1.9.2