From ea62020863f7be0a0791ed6d3bd87b80364d8026 Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: 星期三, 15 十月 2025 08:35:04 +0800
Subject: [PATCH] 新增
---
multi-system/src/main/java/com/gkhy/exam/system/service/impl/AnnualMaintenanceRecordServiceImpl.java | 29 +++++++++++++++++------------
1 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/AnnualMaintenanceRecordServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/AnnualMaintenanceRecordServiceImpl.java
index 5152f50..a711980 100644
--- a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/AnnualMaintenanceRecordServiceImpl.java
+++ b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/AnnualMaintenanceRecordServiceImpl.java
@@ -6,6 +6,7 @@
import com.gkhy.exam.common.api.CommonPage;
import com.gkhy.exam.common.api.CommonResult;
import com.gkhy.exam.common.constant.UserConstant;
+import com.gkhy.exam.common.exception.ApiException;
import com.gkhy.exam.common.utils.PageUtils;
import com.gkhy.exam.common.utils.SecurityUtils;
import com.gkhy.exam.system.domain.AnnualMaintenanceRecord;
@@ -78,19 +79,23 @@
.map(AnnualMaintenanceRecordUser::getUserId)
.collect(Collectors.toSet());
if (userIdSet.size() != filteredUsers.size()){
- throw new RuntimeException("年度基础设施维护记录操作管理人员重复");
+ throw new ApiException("年度基础设施维护记录操作管理人员重复");
}
+ //维修员
List<AnnualMaintenanceRecordUser> fixUsers = annualMaintenanceRecordUsers.stream()
.filter(user -> 2 == user.getUserType())
.collect(Collectors.toList());
- Set<Long> fixUserIdSet = fixUsers.stream()
- .map(AnnualMaintenanceRecordUser::getUserId)
- .collect(Collectors.toSet());
- if (fixUserIdSet.size() != fixUsers.size()){
- throw new RuntimeException("年度基础设施维护记录人员重复");
+ if (!ObjectUtils.isEmpty(fixUsers)){
+ Set<Long> fixUserIdSet = fixUsers.stream()
+ .map(AnnualMaintenanceRecordUser::getUserId)
+ .collect(Collectors.toSet());
+ if (fixUserIdSet.size() != fixUsers.size()){
+ throw new ApiException("年度基础设施维护记录人员重复");
+ }
}
- if (ObjectUtils.isEmpty(filteredUsers) || ObjectUtils.isEmpty(fixUsers)){
- throw new RuntimeException("年度基础设施维护记录人员或操作管理人员不能为空");
+
+ if (ObjectUtils.isEmpty(filteredUsers) ){
+ throw new ApiException("年度基础设施维护记录操作管理人员不能为空");
}
if (ObjectUtils.isNotEmpty(delRecordUserIds)){
@@ -101,7 +106,7 @@
.in(AnnualMaintenanceRecordUser::getId, delRecordUserIds)
);
if (update <= 0){
- throw new RuntimeException("删除年度基础设施维护记录人员失败");
+ throw new ApiException("删除年度基础设施维护记录人员失败");
}
}
@@ -114,7 +119,7 @@
});
int insert = annualMaintenanceRecordUserMapper.batchInsert(annualMaintenanceRecordUsers);
if (insert <= 0){
- throw new RuntimeException("保存年度基础设施维护记录人员失败");
+ throw new ApiException("保存年度基础设施维护记录人员失败");
}
}else {
List<AnnualMaintenanceRecordUser> addUser = annualMaintenanceRecordUsers.stream()
@@ -128,7 +133,7 @@
});
int insert = annualMaintenanceRecordUserMapper.batchInsert(addUser);
if (insert <= 0){
- throw new RuntimeException("保存年度基础设施维护记录人员失败");
+ throw new ApiException("保存年度基础设施维护记录人员失败");
}
}
@@ -142,7 +147,7 @@
});
int update = annualMaintenanceRecordUserMapper.batchUpdate(updateUser);
if (update <= 0){
- throw new RuntimeException("保存年度基础设施维护记录人员失败");
+ throw new ApiException("保存年度基础设施维护记录人员失败");
}
}
--
Gitblit v1.9.2