| | |
| | | import com.tourguide.modules.order.mapper.TourOrderMapper; |
| | | import com.tourguide.modules.user.domain.ClientType; |
| | | import com.tourguide.modules.user.entity.GuideUser; |
| | | import com.tourguide.modules.user.mapper.GuideApplicationMapper; |
| | | import com.tourguide.modules.user.mapper.GuideUserMapper; |
| | | import com.tourguide.security.JwtTokenService; |
| | | import com.tourguide.security.TokenPayload; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.UUID; |
| | | |
| | | @Service |
| | | public class GuideAccountService { |
| | | private final GuideUserMapper guideUserMapper; |
| | | private final GuideApplicationMapper guideApplicationMapper; |
| | | private final TourOrderMapper tourOrderMapper; |
| | | private final JwtTokenService jwtTokenService; |
| | | private final TokenSessionService tokenSessionService; |
| | | |
| | | public GuideAccountService(GuideUserMapper guideUserMapper, TourOrderMapper tourOrderMapper, |
| | | public GuideAccountService(GuideUserMapper guideUserMapper, GuideApplicationMapper guideApplicationMapper, |
| | | TourOrderMapper tourOrderMapper, |
| | | JwtTokenService jwtTokenService, TokenSessionService tokenSessionService) { |
| | | this.guideUserMapper = guideUserMapper; |
| | | this.guideApplicationMapper = guideApplicationMapper; |
| | | this.tourOrderMapper = tourOrderMapper; |
| | | this.jwtTokenService = jwtTokenService; |
| | | this.tokenSessionService = tokenSessionService; |
| | |
| | | if (user == null) { |
| | | throw new BusinessException(404, "导游用户不存在"); |
| | | } |
| | | user.setStatus(GuideUserService.STATUS_CANCELLED); |
| | | user.setAutoDisableWhitelisted(0); |
| | | user.setAutoDisabled(0); |
| | | guideUserMapper.updateById(user); |
| | | String idCardNo = user.getIdCardNo(); |
| | | if (idCardNo != null && !idCardNo.trim().isEmpty()) { |
| | | guideApplicationMapper.clearIdentityByIdCard(idCardNo); |
| | | } |
| | | String deletedUsername = "deleted_" + UUID.randomUUID().toString().replace("-", "").substring(0, 24); |
| | | guideUserMapper.cancelAccount(guideId, deletedUsername); |
| | | tokenSessionService.remove(payload); |
| | | } |
| | | } |