| | |
| | | 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.*; |
| | |
| | | }); |
| | | int insert = annualMaintenanceServiceContentMapper.batchInsert(annualMaintenanceServiceContentList); |
| | | if (insert <= 0) { |
| | | throw new RuntimeException("保存保养内容失败"); |
| | | throw new ApiException("保存保养内容失败"); |
| | | } |
| | | } else { |
| | | annualMaintenanceServiceContentList.forEach(content -> { |
| | |
| | | }); |
| | | int update = annualMaintenanceServiceContentMapper.batchUpdate(annualMaintenanceServiceContentList); |
| | | if (update <= 0) { |
| | | throw new RuntimeException("保存保养内容失败"); |
| | | throw new ApiException("保存保养内容失败"); |
| | | } |
| | | } |
| | | } |
| | |
| | | .in(AnnualMaintenanceServiceUser::getId, delServiceUserIds) |
| | | ); |
| | | if (update1 <= 0) { |
| | | throw new RuntimeException("保存失败"); |
| | | throw new ApiException("保存失败"); |
| | | } |
| | | } |
| | | |
| | |
| | | }); |
| | | int i = annualMaintenanceServiceUserMapper.batchInsert(addUser); |
| | | if (i <= 0) { |
| | | throw new RuntimeException("保存失败"); |
| | | throw new ApiException("保存失败"); |
| | | } |
| | | } |
| | | |
| | |
| | | }); |
| | | int update = annualMaintenanceServiceUserMapper.batchUpdate(updateUser); |
| | | if (update <= 0) { |
| | | throw new RuntimeException("保存失败"); |
| | | throw new ApiException("保存失败"); |
| | | } |
| | | } |
| | | |
| | |
| | | .filter(user -> 1 == user.getUserType()) |
| | | .collect(Collectors.toList()); |
| | | if (ObjectUtil.isEmpty(filteredUsers)) { |
| | | throw new RuntimeException("请填写一级保养操作人员"); |
| | | throw new ApiException("请填写一级保养操作人员"); |
| | | } |
| | | Set<Long> userIdSet = filteredUsers.stream() |
| | | .map(AnnualMaintenanceServiceUser::getUserId) |
| | | .collect(Collectors.toSet()); |
| | | if (userIdSet.size() != filteredUsers.size()) { |
| | | throw new RuntimeException("一级保养操作人员重复"); |
| | | throw new ApiException("一级保养操作人员重复"); |
| | | } |
| | | |
| | | List<AnnualMaintenanceServiceUser> filteredUsers2 = annualMaintenanceServiceUserList.stream() |
| | | .filter(user -> 2 == user.getUserType()) |
| | | .collect(Collectors.toList()); |
| | | if (ObjectUtil.isEmpty(filteredUsers2)) { |
| | | throw new RuntimeException("请填写一级保养检查人员"); |
| | | throw new ApiException("请填写一级保养检查人员"); |
| | | } |
| | | Set<Long> userIdSet2 = filteredUsers2.stream() |
| | | .map(AnnualMaintenanceServiceUser::getUserId) |
| | | .collect(Collectors.toSet()); |
| | | if (userIdSet2.size() != filteredUsers2.size()) { |
| | | throw new RuntimeException("一级保养检查人员重复"); |
| | | throw new ApiException("一级保养检查人员重复"); |
| | | } |
| | | |
| | | List<AnnualMaintenanceServiceUser> filteredUsers3 = annualMaintenanceServiceUserList.stream() |
| | | .filter(user -> 3 == user.getUserType()) |
| | | .collect(Collectors.toList()); |
| | | if (ObjectUtil.isEmpty(filteredUsers3)) { |
| | | throw new RuntimeException("请填写二级保养操作人员"); |
| | | throw new ApiException("请填写二级保养操作人员"); |
| | | } |
| | | Set<Long> userIdSet3 = filteredUsers3.stream() |
| | | .map(AnnualMaintenanceServiceUser::getUserId) |
| | | .collect(Collectors.toSet()); |
| | | if (userIdSet3.size() != filteredUsers3.size()) { |
| | | throw new RuntimeException("二级保养操作人员重复"); |
| | | throw new ApiException("二级保养操作人员重复"); |
| | | } |
| | | |
| | | List<AnnualMaintenanceServiceUser> filteredUsers4 = annualMaintenanceServiceUserList.stream() |
| | | .filter(user -> 4 == user.getUserType()) |
| | | .collect(Collectors.toList()); |
| | | if (ObjectUtil.isEmpty(filteredUsers4)) { |
| | | throw new RuntimeException("请填写二级保养检查人员"); |
| | | throw new ApiException("请填写二级保养检查人员"); |
| | | } |
| | | Set<Long> userIdSet4 = filteredUsers4.stream() |
| | | .map(AnnualMaintenanceServiceUser::getUserId) |
| | | .collect(Collectors.toSet()); |
| | | if (userIdSet4.size() != filteredUsers4.size()) { |
| | | throw new RuntimeException("二级保养检查人员重复"); |
| | | throw new ApiException("二级保养检查人员重复"); |
| | | } |
| | | } |
| | | |
| | |
| | | .set(AnnualMaintenanceServiceUser::getDelFlag, UserConstant.DEPT_DISABLE) |
| | | .set(AnnualMaintenanceServiceUser::getUpdateTime, LocalDateTime.now()) |
| | | .set(AnnualMaintenanceServiceUser::getUpdateBy, SecurityUtils.getUsername())); |
| | | if (update1 <= 0) { |
| | | throw new RuntimeException("删除失败"); |
| | | } |
| | | // if (update1 <= 0) { |
| | | // throw new ApiException("删除失败"); |
| | | // } |
| | | int update2 = annualMaintenanceServiceContentMapper.update(new AnnualMaintenanceServiceContent(), |
| | | new LambdaUpdateWrapper<AnnualMaintenanceServiceContent>().eq(AnnualMaintenanceServiceContent::getAnnualMaintenanceServiceId, id) |
| | | .set(AnnualMaintenanceServiceContent::getDelFlag, UserConstant.DEPT_DISABLE) |
| | | .set(AnnualMaintenanceServiceContent::getUpdateTime, LocalDateTime.now()) |
| | | .set(AnnualMaintenanceServiceContent::getUpdateBy, SecurityUtils.getUsername()) |
| | | ); |
| | | if (update2 <= 0) { |
| | | throw new RuntimeException("删除失败"); |
| | | } |
| | | |
| | | return CommonResult.success(); |
| | | } |
| | | return CommonResult.failed(); |