package com.tourguide.modules.user.dto; import com.tourguide.modules.user.entity.GuideUser; import java.math.BigDecimal; import java.time.LocalDateTime; /** 导游账号脱敏返回对象,不包含密码。 */ public class GuideUserResponse { private final Long id; private final String username; private final String realName; private final String mobile; private final String avatar; private final String certificateNo; private final Long teamId; private final String teamName; private final String teamType; private final Long acceptedOrderCount; private final Long currentMonthOrderCount; private final BigDecimal rating; private final Integer autoDisableWhitelisted; private final boolean premiumEnabled; private final Integer status; private final LocalDateTime createdAt; private GuideUserResponse(GuideUser user, String teamName) { this.id = user.getId(); this.username = user.getUsername(); this.realName = user.getRealName(); this.mobile = user.getMobile(); this.avatar = user.getAvatar(); this.certificateNo = user.getCertificateNo(); this.teamId = user.getTeamId(); this.teamName = teamName; this.teamType = user.getTeamId() == null ? "个人" : "讲解队"; this.acceptedOrderCount = user.getAcceptedOrderCount() == null ? 0L : user.getAcceptedOrderCount(); this.currentMonthOrderCount = user.getCurrentMonthOrderCount() == null ? 0L : user.getCurrentMonthOrderCount(); this.rating = user.getRating() == null ? BigDecimal.ZERO : user.getRating(); this.autoDisableWhitelisted = user.getAutoDisableWhitelisted() == null ? 0 : user.getAutoDisableWhitelisted(); this.premiumEnabled = Integer.valueOf(1).equals(user.getPremiumEnabled()); this.status = user.getStatus(); this.createdAt = user.getCreatedAt(); } public static GuideUserResponse from(GuideUser user) { return new GuideUserResponse(user, null); } public static GuideUserResponse from(GuideUser user, String teamName) { return new GuideUserResponse(user, teamName); } public Long getId() { return id; } public String getUsername() { return username; } public String getRealName() { return realName; } public String getMobile() { return mobile; } public String getAvatar() { return avatar; } public String getCertificateNo() { return certificateNo; } public Long getTeamId() { return teamId; } public String getTeamName() { return teamName; } public String getTeamType() { return teamType; } public Long getAcceptedOrderCount() { return acceptedOrderCount; } public Long getCurrentMonthOrderCount() { return currentMonthOrderCount; } public BigDecimal getRating() { return rating; } public Integer getAutoDisableWhitelisted() { return autoDisableWhitelisted; } public boolean isPremiumEnabled() { return premiumEnabled; } public Integer getStatus() { return status; } public LocalDateTime getCreatedAt() { return createdAt; } }