| | |
| | | * @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 +"");
|
| | |
| | | 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);
|