liujie
2026-09-14 15defa991fcd30b9fa60bab17d2230b5929bf2a2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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; }
}