Skip to content

添加查询企业成员信息返回视频号名称 #2229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -113,7 +117,7 @@ public static class Attr implements Serializable {
@AllArgsConstructor
public static class ExternalAttribute implements Serializable {
private static final long serialVersionUID = -5696099236344075582L;

/**
* 属性类型: 0-本文 1-网页 2-小程序.
*/
Expand Down Expand Up @@ -144,4 +148,18 @@ public static class ExternalAttribute 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;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -95,6 +96,11 @@ public WxCpUser deserialize(JsonElement json, Type typeOfT, JsonDeserializationC

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);
}

Expand Down Expand Up @@ -321,6 +327,10 @@ public JsonElement serialize(WxCpUser user, Type typeOfSrc, JsonSerializationCon
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()) {
Expand Down