|
| 1 | +package me.chanjar.weixin.mp.bean.customerservice.request; |
| 2 | + |
| 3 | +import java.io.Serializable; |
| 4 | + |
| 5 | +import org.apache.commons.codec.digest.Md5Crypt; |
| 6 | +import org.apache.commons.lang3.builder.ToStringBuilder; |
| 7 | + |
| 8 | +import com.google.gson.annotations.SerializedName; |
| 9 | + |
| 10 | +import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; |
| 11 | + |
| 12 | +public class WxMpKfAccountRequest implements Serializable { |
| 13 | + private static final long serialVersionUID = -5451863610674856927L; |
| 14 | + |
| 15 | + /** |
| 16 | + * kf_account 完整客服账号,格式为:账号前缀@公众号微信号 |
| 17 | + */ |
| 18 | + @SerializedName("kf_account") |
| 19 | + private String kfAccount; |
| 20 | + |
| 21 | + /** |
| 22 | + * nickname 客服昵称,最长6个汉字或12个英文字符 |
| 23 | + */ |
| 24 | + @SerializedName("nickname") |
| 25 | + private String nickName; |
| 26 | + |
| 27 | + /** |
| 28 | + * password 客服账号登录密码,格式为密码明文的32位加密MD5值 |
| 29 | + */ |
| 30 | + @SerializedName("password") |
| 31 | + private String password; |
| 32 | + |
| 33 | + /** |
| 34 | + * rawPassword 客服账号登录密码,明文密码,仅用于辅助操作 |
| 35 | + */ |
| 36 | + @SerializedName("rawPassword") |
| 37 | + private String rawPassword; |
| 38 | + |
| 39 | + @Override |
| 40 | + public String toString() { |
| 41 | + return ToStringBuilder.reflectionToString(this); |
| 42 | + } |
| 43 | + |
| 44 | + public String toJson() { |
| 45 | + return WxMpGsonBuilder.INSTANCE.create().toJson(this); |
| 46 | + } |
| 47 | + |
| 48 | + public String getKfAccount() { |
| 49 | + return this.kfAccount; |
| 50 | + } |
| 51 | + |
| 52 | + public void setKfAccount(String kfAccount) { |
| 53 | + this.kfAccount = kfAccount; |
| 54 | + } |
| 55 | + |
| 56 | + public String getNickName() { |
| 57 | + return this.nickName; |
| 58 | + } |
| 59 | + |
| 60 | + public void setNickName(String nickName) { |
| 61 | + this.nickName = nickName; |
| 62 | + } |
| 63 | + |
| 64 | + public String getPassword() { |
| 65 | + return this.password; |
| 66 | + } |
| 67 | + |
| 68 | + public void setPassword(String password) { |
| 69 | + this.password = password; |
| 70 | + } |
| 71 | + |
| 72 | + public String getRawPassword() { |
| 73 | + return this.rawPassword; |
| 74 | + } |
| 75 | + |
| 76 | + public void setRawPassword(String rawPassword) { |
| 77 | + this.rawPassword = rawPassword; |
| 78 | + } |
| 79 | + |
| 80 | + public static Builder builder() { |
| 81 | + return new Builder(); |
| 82 | + } |
| 83 | + |
| 84 | + public static class Builder { |
| 85 | + private String kfAccount; |
| 86 | + private String nickName; |
| 87 | + private String password; |
| 88 | + private String rawPassword; |
| 89 | + |
| 90 | + @SuppressWarnings("hiding") |
| 91 | + public Builder kfAccount(String kfAccount) { |
| 92 | + this.kfAccount = kfAccount; |
| 93 | + return this; |
| 94 | + } |
| 95 | + |
| 96 | + @SuppressWarnings("hiding") |
| 97 | + public Builder nickName(String nickName) { |
| 98 | + this.nickName = nickName; |
| 99 | + return this; |
| 100 | + } |
| 101 | + |
| 102 | + @SuppressWarnings("hiding") |
| 103 | + public Builder password(String password) { |
| 104 | + this.password = password; |
| 105 | + return this; |
| 106 | + } |
| 107 | + |
| 108 | + @SuppressWarnings("hiding") |
| 109 | + public Builder rawPassword(String rawPassword) { |
| 110 | + this.rawPassword = rawPassword; |
| 111 | + this.password(Md5Crypt.md5Crypt(rawPassword.getBytes())); |
| 112 | + return this; |
| 113 | + } |
| 114 | + |
| 115 | + public Builder from(WxMpKfAccountRequest origin) { |
| 116 | + this.kfAccount(origin.kfAccount); |
| 117 | + this.nickName(origin.nickName); |
| 118 | + this.password(origin.password); |
| 119 | + this.rawPassword(origin.rawPassword); |
| 120 | + return this; |
| 121 | + } |
| 122 | + |
| 123 | + public WxMpKfAccountRequest build() { |
| 124 | + WxMpKfAccountRequest m = new WxMpKfAccountRequest(); |
| 125 | + m.kfAccount = this.kfAccount; |
| 126 | + m.nickName = this.nickName; |
| 127 | + m.password = this.password; |
| 128 | + m.rawPassword = this.rawPassword; |
| 129 | + return m; |
| 130 | + } |
| 131 | + } |
| 132 | + |
| 133 | +} |
0 commit comments