From a55587c773d8877430b49477cd4b4961c6a2ba92 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期五, 19 六月 2020 15:06:52 +0800 Subject: [PATCH] 云发单群匹配 --- fanli/src/main/java/com/yeshi/fanli/util/aitaoker/AitaokerApiUtil.java | 74 ++++++++++++++++++++++++++++++++++++ 1 files changed, 73 insertions(+), 1 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/util/aitaoker/AitaokerApiUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/aitaoker/AitaokerApiUtil.java index b1692c6..9a13a0d 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/aitaoker/AitaokerApiUtil.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/aitaoker/AitaokerApiUtil.java @@ -305,7 +305,7 @@ * @param robotId * @return */ - public static List<WeiXinGroupDTO> getContract(int robotId) { + public static List<String> getContract(int robotId) { // 璇锋眰鍙傛暟 Map<String, String> map = new HashMap<>(); map.put("robot_id", robotId +""); @@ -315,6 +315,78 @@ if ("0000".equals(resultJson.optString("status"))) { JSONArray groupArray = resultJson.optJSONArray("data"); if (groupArray != null && groupArray.size() > 0) { + Type type = new TypeToken<ArrayList<String>>() { + }.getType(); + List<String> list = new Gson().fromJson(groupArray.toString(), type); + return list; + } + } + return null; + } + + /** + * 鑾峰彇缇ゅ垪琛� + * @param robotId + * @param roomId + * @return + */ + public static WeiXinGroupDTO getGroupDetail(int robotId, String roomId) { + if (StringUtil.isNullOrEmpty(roomId)) { + return null; + } + + // 璇锋眰鍙傛暟 + Map<String, String> map = new HashMap<>(); + map.put("robot_id", robotId +""); + map.put("room_id", roomId +""); // 缇ょ殑id ,澶氫釜鐢ㄩ�楀彿闅斿紑 + // 璇锋眰缁撴灉 + String result = baseRequest("itaoke.robot.room.detail", map); + JSONObject resultJson = JSONObject.fromObject(result); + if ("0000".equals(resultJson.optString("status"))) { + JSONArray groupArray = resultJson.optJSONArray("data"); + if (groupArray != null && groupArray.size() > 0) { + Type type = new TypeToken<ArrayList<WeiXinGroupDTO>>() { + }.getType(); + List<WeiXinGroupDTO> goodsList = new Gson().fromJson(groupArray.toString(), type); + if (goodsList == null || goodsList.size() == 0) { + return null; + } else { + return goodsList.get(0); + } + } + } + return null; + } + + + /** + * 鑾峰彇缇ゅ垪琛� + * @param robotId + * @param roomId + * @return + */ + public static List<WeiXinGroupDTO> getGroupDetail(int robotId, List<String> listRoomId) { + if (listRoomId == null || listRoomId.size() ==0) { + return null; + } + + String roomIds = ""; + for (String roomID: listRoomId) { + roomIds += roomID + ","; + } + if(roomIds.endsWith(",")) + roomIds = roomIds.substring(0, roomIds.length()-1); + + // 璇锋眰鍙傛暟 + Map<String, String> map = new HashMap<>(); + map.put("robot_id", robotId +""); + map.put("room_id", roomIds); // 缇ょ殑id ,澶氫釜鐢ㄩ�楀彿闅斿紑 + // 璇锋眰缁撴灉 + String result = baseRequest("itaoke.robot.room.detail", map); + JSONObject resultJson = JSONObject.fromObject(result); + if ("0000".equals(resultJson.optString("status"))) { + JSONArray groupArray = resultJson.optJSONArray("data"); + if (groupArray != null && groupArray.size() > 0) { Type type = new TypeToken<ArrayList<WeiXinGroupDTO>>() { }.getType(); List<WeiXinGroupDTO> goodsList = new Gson().fromJson(groupArray.toString(), type); -- Gitblit v1.8.0