| | |
| | | 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; |
| | |
| | | .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)){ |
| | |
| | | .in(AnnualMaintenanceRecordUser::getId, delRecordUserIds) |
| | | ); |
| | | if (update <= 0){ |
| | | throw new RuntimeException("删除年度基础设施维护记录人员失败"); |
| | | throw new ApiException("删除年度基础设施维护记录人员失败"); |
| | | } |
| | | } |
| | | |
| | |
| | | }); |
| | | int insert = annualMaintenanceRecordUserMapper.batchInsert(annualMaintenanceRecordUsers); |
| | | if (insert <= 0){ |
| | | throw new RuntimeException("保存年度基础设施维护记录人员失败"); |
| | | throw new ApiException("保存年度基础设施维护记录人员失败"); |
| | | } |
| | | }else { |
| | | List<AnnualMaintenanceRecordUser> addUser = annualMaintenanceRecordUsers.stream() |
| | |
| | | }); |
| | | int insert = annualMaintenanceRecordUserMapper.batchInsert(addUser); |
| | | if (insert <= 0){ |
| | | throw new RuntimeException("保存年度基础设施维护记录人员失败"); |
| | | throw new ApiException("保存年度基础设施维护记录人员失败"); |
| | | } |
| | | } |
| | | |
| | |
| | | }); |
| | | int update = annualMaintenanceRecordUserMapper.batchUpdate(updateUser); |
| | | if (update <= 0){ |
| | | throw new RuntimeException("保存年度基础设施维护记录人员失败"); |
| | | throw new ApiException("保存年度基础设施维护记录人员失败"); |
| | | } |
| | | } |
| | | |