@Test public void testListByDepartment() throws Exception { List<WxCpUser> users = this.wxCpService.getUserService().listByDepartment(1, true, 0); assertNotEquals(users.size(), 0); for (WxCpUser user : users) { System.out.println(ToStringBuilder.reflectionToString(user, ToStringStyle.MULTI_LINE_STYLE)); } }
@Override public List<WxCpUser> listByDepartment(Integer departId, Boolean fetchChild, Integer status) throws WxErrorException { String url = "https: String params = ""; if (fetchChild != null) { params += "&fetch_child=" + (fetchChild ? "1" : "0"); } if (status != null) { params += "&status=" + status; } else { params += "&status=0"; } String responseContent = this.mainService.get(url, params); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilder.INSTANCE.create() .fromJson(tmpJsonElement.getAsJsonObject().get("userlist"), new TypeToken<List<WxCpUser>>() { }.getType() ); }
WxCpUserServiceImpl implements WxCpUserService { @Override public List<WxCpUser> listByDepartment(Integer departId, Boolean fetchChild, Integer status) throws WxErrorException { String url = "https: String params = ""; if (fetchChild != null) { params += "&fetch_child=" + (fetchChild ? "1" : "0"); } if (status != null) { params += "&status=" + status; } else { params += "&status=0"; } String responseContent = this.mainService.get(url, params); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilder.INSTANCE.create() .fromJson(tmpJsonElement.getAsJsonObject().get("userlist"), new TypeToken<List<WxCpUser>>() { }.getType() ); } }
WxCpUserServiceImpl implements WxCpUserService { @Override public List<WxCpUser> listByDepartment(Integer departId, Boolean fetchChild, Integer status) throws WxErrorException { String url = "https: String params = ""; if (fetchChild != null) { params += "&fetch_child=" + (fetchChild ? "1" : "0"); } if (status != null) { params += "&status=" + status; } else { params += "&status=0"; } String responseContent = this.mainService.get(url, params); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilder.INSTANCE.create() .fromJson(tmpJsonElement.getAsJsonObject().get("userlist"), new TypeToken<List<WxCpUser>>() { }.getType() ); } WxCpUserServiceImpl(WxCpService mainService); }
WxCpUserServiceImpl implements WxCpUserService { @Override public List<WxCpUser> listByDepartment(Integer departId, Boolean fetchChild, Integer status) throws WxErrorException { String url = "https: String params = ""; if (fetchChild != null) { params += "&fetch_child=" + (fetchChild ? "1" : "0"); } if (status != null) { params += "&status=" + status; } else { params += "&status=0"; } String responseContent = this.mainService.get(url, params); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilder.INSTANCE.create() .fromJson(tmpJsonElement.getAsJsonObject().get("userlist"), new TypeToken<List<WxCpUser>>() { }.getType() ); } WxCpUserServiceImpl(WxCpService mainService); @Override void authenticate(String userId); @Override void create(WxCpUser user); @Override void update(WxCpUser user); @Override void delete(String... userIds); @Override WxCpUser getById(String userid); @Override List<WxCpUser> listByDepartment(Integer departId, Boolean fetchChild, Integer status); @Override List<WxCpUser> listSimpleByDepartment(Integer departId, Boolean fetchChild, Integer status); @Override WxCpInviteResult invite(List<String> userIds, List<String> partyIds, List<String> tagIds); @Override Map<String, String> userId2Openid(String userId, Integer agentId); @Override String openid2UserId(String openid); }
WxCpUserServiceImpl implements WxCpUserService { @Override public List<WxCpUser> listByDepartment(Integer departId, Boolean fetchChild, Integer status) throws WxErrorException { String url = "https: String params = ""; if (fetchChild != null) { params += "&fetch_child=" + (fetchChild ? "1" : "0"); } if (status != null) { params += "&status=" + status; } else { params += "&status=0"; } String responseContent = this.mainService.get(url, params); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilder.INSTANCE.create() .fromJson(tmpJsonElement.getAsJsonObject().get("userlist"), new TypeToken<List<WxCpUser>>() { }.getType() ); } WxCpUserServiceImpl(WxCpService mainService); @Override void authenticate(String userId); @Override void create(WxCpUser user); @Override void update(WxCpUser user); @Override void delete(String... userIds); @Override WxCpUser getById(String userid); @Override List<WxCpUser> listByDepartment(Integer departId, Boolean fetchChild, Integer status); @Override List<WxCpUser> listSimpleByDepartment(Integer departId, Boolean fetchChild, Integer status); @Override WxCpInviteResult invite(List<String> userIds, List<String> partyIds, List<String> tagIds); @Override Map<String, String> userId2Openid(String userId, Integer agentId); @Override String openid2UserId(String openid);  }