“djh”
2026-02-06 88717f3e96fb853f3dbc3d6e6b3de0ba4ce1f3c5
multi-system/src/main/java/com/gkhy/exam/system/service/impl/AnnualMaintenanceRecordServiceImpl.java
@@ -3,9 +3,11 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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;
@@ -13,7 +15,6 @@
import com.gkhy.exam.system.mapper.AnnualMaintenanceRecordMapper;
import com.gkhy.exam.system.mapper.AnnualMaintenanceRecordUserMapper;
import com.gkhy.exam.system.service.AnnualMaintenanceRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -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("保存年度基础设施维护记录人员失败");
                }
            }