| | |
| | | } |
| | | |
| | | private void anonymizeCancelledGuide(GuideUser user) { |
| | | user.setUsername("deleted_" + UUID.randomUUID().toString().replace("-", "").substring(0, 24)); |
| | | user.setMobile(null); |
| | | user.setCertificateNo(null); |
| | | user.setIdCardNo(null); |
| | | userMapper.updateById(user); |
| | | String deletedUsername = "deleted_" + UUID.randomUUID().toString().replace("-", "").substring(0, 24); |
| | | userMapper.anonymizeCancelledGuide(user.getId(), deletedUsername); |
| | | } |
| | | |
| | | private void ensureUniqueGuideIdentity(GuideApplication application, GuideUser existingUser) { |
| | | if (StringUtils.hasText(application.getIdCardNo())) { |
| | | // 兼容旧注销数据:释放已注销账号占用的身份证唯一索引。 |
| | | userMapper.clearCancelledIdentityByIdCard(application.getIdCardNo().trim().toUpperCase()); |
| | | } |
| | | if (StringUtils.hasText(application.getCertificateNo()) |
| | | && userMapper.selectCount(new LambdaQueryWrapper<GuideUser>() |
| | | .eq(GuideUser::getCertificateNo, application.getCertificateNo()) |
| | | .ne(GuideUser::getStatus, STATUS_CANCELLED) |
| | | .ne(existingUser != null && existingUser.getId() != null, |
| | | GuideUser::getId, existingUser == null ? null : existingUser.getId())) > 0) { |
| | | throw new BusinessException(409, "该导游证号已存在导游账号"); |
| | | } |
| | | if (StringUtils.hasText(application.getIdCardNo()) |
| | | && userMapper.selectCount(new LambdaQueryWrapper<GuideUser>() |
| | | .eq(GuideUser::getIdCardNo, application.getIdCardNo()) |
| | | .eq(GuideUser::getIdCardNo, application.getIdCardNo().trim().toUpperCase()) |
| | | .ne(GuideUser::getStatus, STATUS_CANCELLED) |
| | | .ne(existingUser != null && existingUser.getId() != null, |
| | | GuideUser::getId, existingUser == null ? null : existingUser.getId())) > 0) { |
| | | throw new BusinessException(409, "该身份证号已存在导游账号"); |