liujie
2026-09-09 39f6fca28e3f78abe48f08e474ec011abb990b36
backend/src/main/java/com/tourguide/modules/user/service/GuideApplicationService.java
@@ -7,8 +7,11 @@
import com.tourguide.common.exception.BusinessException;
import com.tourguide.modules.user.dto.GuideApplicationResponse;
import com.tourguide.modules.user.entity.GuideApplication;
import com.tourguide.modules.user.entity.GuideTeam;
import com.tourguide.modules.user.mapper.GuideApplicationMapper;
import com.tourguide.modules.user.mapper.GuideTeamMapper;
import com.tourguide.modules.system.service.GuideNotificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
@@ -23,6 +26,7 @@
    private static final int APPROVED = 1;
    private static final int REJECTED = 2;
    private final GuideApplicationMapper applicationMapper;
    private final GuideTeamMapper teamMapper;
    private final GuideUserService guideUserService;
    private final GuideNotificationService notificationService;
    private final GuideAuditSmsService auditSmsService;
@@ -30,7 +34,16 @@
    public GuideApplicationService(GuideApplicationMapper applicationMapper, GuideUserService guideUserService,
                                   GuideNotificationService notificationService,
                                   GuideAuditSmsService auditSmsService) {
        this(applicationMapper, null, guideUserService, notificationService, auditSmsService);
    }
    @Autowired
    public GuideApplicationService(GuideApplicationMapper applicationMapper, GuideTeamMapper teamMapper,
                                   GuideUserService guideUserService,
                                   GuideNotificationService notificationService,
                                   GuideAuditSmsService auditSmsService) {
        this.applicationMapper = applicationMapper;
        this.teamMapper = teamMapper;
        this.guideUserService = guideUserService;
        this.notificationService = notificationService;
        this.auditSmsService = auditSmsService;
@@ -58,7 +71,9 @@
    public GuideApplicationResponse detail(Long id) {
        GuideApplication application = applicationMapper.selectById(id);
        if (application == null) { throw new BusinessException(404, "导游申请不存在"); }
        return GuideApplicationResponse.from(application);
        GuideTeam team = application.getTeamId() == null || teamMapper == null
                ? null : teamMapper.selectById(application.getTeamId());
        return GuideApplicationResponse.from(application, team == null ? null : team.getTeamName());
    }
    @Transactional