Skip to content

Commit

Permalink
#927 企业微信WxCpUser的departIds类型改为Long[]
Browse files Browse the repository at this point in the history
  • Loading branch information
binarywang committed Jan 24, 2019
1 parent 58faf5a commit bdd7299
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class WxCpUser implements Serializable {
private static final long serialVersionUID = -5696099236344075582L;
private String userId;
private String name;
private Integer[] departIds;
private Long[] departIds;
private Integer[] orders;
private String position;
private String mobile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public WxCpUser deserialize(JsonElement json, Type typeOfT, JsonDeserializationC

if (o.get("department") != null) {
JsonArray departJsonArray = o.get("department").getAsJsonArray();
Integer[] departIds = new Integer[departJsonArray.size()];
Long[] departIds = new Long[departJsonArray.size()];
int i = 0;
for (JsonElement jsonElement : departJsonArray) {
departIds[i++] = jsonElement.getAsInt();
departIds[i++] = jsonElement.getAsLong();
}
user.setDepartIds(departIds);
}
Expand Down Expand Up @@ -156,7 +156,7 @@ public JsonElement serialize(WxCpUser user, Type typeOfSrc, JsonSerializationCon
}
if (user.getDepartIds() != null) {
JsonArray jsonArray = new JsonArray();
for (Integer departId : user.getDepartIds()) {
for (Long departId : user.getDepartIds()) {
jsonArray.add(new JsonPrimitive(departId));
}
o.add("department", jsonArray);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void testCreate() throws Exception {
WxCpUser user = new WxCpUser();
user.setUserId(userId);
user.setName("Some Woman");
user.setDepartIds(new Integer[]{2});
user.setDepartIds(new Long[]{2L});
user.setEmail("[email protected]");
user.setGender(Gender.FEMALE);
user.setMobile("13560084979");
Expand Down

0 comments on commit bdd7299

Please sign in to comment.