🎨 #2229 【企业微信】查询企业成员信息接口结果实体类增加视频号名称信息

This commit is contained in:
huangxm129
2021-08-01 11:47:34 +08:00
committed by GitHub
parent 10fd006f32
commit 140fb022a1
2 changed files with 29 additions and 1 deletions

View File

@@ -68,6 +68,10 @@ public class WxCpUser implements Serializable {
private List<ExternalAttribute> externalAttrs = new ArrayList<>();
private String externalPosition;
private String externalCorpName;
private WechatChannels wechatChannels;
public void addExternalAttr(ExternalAttribute externalAttr) {
this.externalAttrs.add(externalAttr);
@@ -113,7 +117,7 @@ public class WxCpUser implements Serializable {
@AllArgsConstructor
public static class ExternalAttribute implements Serializable {
private static final long serialVersionUID = -5696099236344075582L;
/**
* 属性类型: 0-本文 1-网页 2-小程序.
*/
@@ -144,4 +148,18 @@ public class WxCpUser implements Serializable {
*/
private String pagePath;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class WechatChannels implements Serializable {
private static final long serialVersionUID = -5696099236344075582L;
private String nickname;
private Integer status;
}
}

View File

@@ -30,6 +30,7 @@ public class WxCpUserGsonAdapter implements JsonDeserializer<WxCpUser>, JsonSeri
private static final String EXTERNAL_POSITION = "external_position";
private static final String DEPARTMENT = "department";
private static final String EXTERNAL_CORP_NAME = "external_corp_name";
private static final String WECHAT_CHANNELS = "wechat_channels";
@Override
public WxCpUser deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
@@ -95,6 +96,11 @@ public class WxCpUserGsonAdapter implements JsonDeserializer<WxCpUser>, JsonSeri
if (GsonHelper.isNotNull(o.get(EXTERNAL_PROFILE))) {
user.setExternalCorpName(GsonHelper.getString(o.getAsJsonObject().get(EXTERNAL_PROFILE).getAsJsonObject(), EXTERNAL_CORP_NAME));
JsonElement jsonElement = o.get(EXTERNAL_PROFILE).getAsJsonObject().get(WECHAT_CHANNELS);
if(jsonElement !=null){
JsonObject asJsonObject = jsonElement.getAsJsonObject();
user.setWechatChannels(WechatChannels.builder().nickname(GsonHelper.getString(asJsonObject,"nickname")).status(GsonHelper.getInteger(asJsonObject,"status")).build());
}
this.buildExternalAttrs(o, user);
}
@@ -321,6 +327,10 @@ public class WxCpUserGsonAdapter implements JsonDeserializer<WxCpUser>, JsonSeri
attrsJson.addProperty(EXTERNAL_CORP_NAME, user.getExternalCorpName());
}
if(user.getWechatChannels() != null){
attrsJson.add(WECHAT_CHANNELS,GsonHelper.buildJsonObject("nickname", user.getWechatChannels().getNickname(), "status", user.getWechatChannels().getStatus()));
}
if (!user.getExternalAttrs().isEmpty()) {
JsonArray attrsJsonArray = new JsonArray();
for (ExternalAttribute attr : user.getExternalAttrs()) {