@Test public void testChatCreate() throws Exception { final String result = cpService.getChatService().chatCreate("测试群聊", userId, Arrays.asList(userId, userId), chatId); assertThat(result).isNotEmpty(); assertThat(result).isEqualTo(chatId); }
@Override public String chatCreate(String name, String owner, List<String> users, String chatId) throws WxErrorException { Map<String, Object> data = new HashMap<>(4); if (StringUtils.isNotBlank(name)) { data.put("name", name); } if (StringUtils.isNotBlank(owner)) { data.put("owner", owner); } if (users != null) { data.put("userlist", users); } if (StringUtils.isNotBlank(chatId)) { data.put("chatid", chatId); } String result = this.cpService.post(APPCHAT_CREATE, WxGsonBuilder.create().toJson(data)); return new JsonParser().parse(result).getAsJsonObject().get("chatid").getAsString(); }
WxCpChatServiceImpl implements WxCpChatService { @Override public String chatCreate(String name, String owner, List<String> users, String chatId) throws WxErrorException { Map<String, Object> data = new HashMap<>(4); if (StringUtils.isNotBlank(name)) { data.put("name", name); } if (StringUtils.isNotBlank(owner)) { data.put("owner", owner); } if (users != null) { data.put("userlist", users); } if (StringUtils.isNotBlank(chatId)) { data.put("chatid", chatId); } String result = this.cpService.post(APPCHAT_CREATE, WxGsonBuilder.create().toJson(data)); return new JsonParser().parse(result).getAsJsonObject().get("chatid").getAsString(); } }
WxCpChatServiceImpl implements WxCpChatService { @Override public String chatCreate(String name, String owner, List<String> users, String chatId) throws WxErrorException { Map<String, Object> data = new HashMap<>(4); if (StringUtils.isNotBlank(name)) { data.put("name", name); } if (StringUtils.isNotBlank(owner)) { data.put("owner", owner); } if (users != null) { data.put("userlist", users); } if (StringUtils.isNotBlank(chatId)) { data.put("chatid", chatId); } String result = this.cpService.post(APPCHAT_CREATE, WxGsonBuilder.create().toJson(data)); return new JsonParser().parse(result).getAsJsonObject().get("chatid").getAsString(); } WxCpChatServiceImpl(WxCpService cpService); }
WxCpChatServiceImpl implements WxCpChatService { @Override public String chatCreate(String name, String owner, List<String> users, String chatId) throws WxErrorException { Map<String, Object> data = new HashMap<>(4); if (StringUtils.isNotBlank(name)) { data.put("name", name); } if (StringUtils.isNotBlank(owner)) { data.put("owner", owner); } if (users != null) { data.put("userlist", users); } if (StringUtils.isNotBlank(chatId)) { data.put("chatid", chatId); } String result = this.cpService.post(APPCHAT_CREATE, WxGsonBuilder.create().toJson(data)); return new JsonParser().parse(result).getAsJsonObject().get("chatid").getAsString(); } WxCpChatServiceImpl(WxCpService cpService); @Override String chatCreate(String name, String owner, List<String> users, String chatId); @Override String create(String name, String owner, List<String> users, String chatId); @Override void chatUpdate(String chatId, String name, String owner, List<String> usersToAdd, List<String> usersToDelete); @Override void update(String chatId, String name, String owner, List<String> usersToAdd, List<String> usersToDelete); @Override WxCpChat chatGet(String chatId); @Override WxCpChat get(String chatId); @Override void sendMsg(WxCpAppChatMessage message); }
WxCpChatServiceImpl implements WxCpChatService { @Override public String chatCreate(String name, String owner, List<String> users, String chatId) throws WxErrorException { Map<String, Object> data = new HashMap<>(4); if (StringUtils.isNotBlank(name)) { data.put("name", name); } if (StringUtils.isNotBlank(owner)) { data.put("owner", owner); } if (users != null) { data.put("userlist", users); } if (StringUtils.isNotBlank(chatId)) { data.put("chatid", chatId); } String result = this.cpService.post(APPCHAT_CREATE, WxGsonBuilder.create().toJson(data)); return new JsonParser().parse(result).getAsJsonObject().get("chatid").getAsString(); } WxCpChatServiceImpl(WxCpService cpService); @Override String chatCreate(String name, String owner, List<String> users, String chatId); @Override String create(String name, String owner, List<String> users, String chatId); @Override void chatUpdate(String chatId, String name, String owner, List<String> usersToAdd, List<String> usersToDelete); @Override void update(String chatId, String name, String owner, List<String> usersToAdd, List<String> usersToDelete); @Override WxCpChat chatGet(String chatId); @Override WxCpChat get(String chatId); @Override void sendMsg(WxCpAppChatMessage message);  }