|
@@ -284,4 +284,74 @@ public class RiskUserOperateService {
|
|
|
log.info("forceCloseRoomSwitch, roomId: {}, autoRemoveUserSwitch set to 0", roomId);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询群黑名单
|
|
|
+ *
|
|
|
+ * 调用企业微信API获取指定群的黑名单用户列表
|
|
|
+ *
|
|
|
+ * @param uuid 企业微信用户UUID
|
|
|
+ * @return 黑名单查询响应结果
|
|
|
+ */
|
|
|
+ public RoomBlacklistResponse getRoomBlacklist(String uuid) {
|
|
|
+ if (uuid == null || uuid.trim().isEmpty()) {
|
|
|
+ LOGGER.error("getRoomBlacklist called with null or empty uuid");
|
|
|
+ return createErrorResponse(-1, "UUID不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 构建请求参数
|
|
|
+ Map<String, Object> requestBody = new HashMap<>();
|
|
|
+ requestBody.put("uuid", uuid);
|
|
|
+ requestBody.put("limit", 1000);
|
|
|
+
|
|
|
+ // 构建API URL
|
|
|
+ String url = qywxConfig.getDomain() + qywxConfig.getPath("get-room-black-list");
|
|
|
+
|
|
|
+ LOGGER.info("Calling getRoomBlacklist API, uuid: {}, limit: {}", uuid, 1000);
|
|
|
+
|
|
|
+ // 调用API
|
|
|
+ Optional<String> response = httpPoolClientDefault.postJson(url, JSON.toJSONString(requestBody.toString()));
|
|
|
+
|
|
|
+ if (response.isPresent()) {
|
|
|
+ String responseBody = response.get();
|
|
|
+ LOGGER.info("getRoomBlacklist API response: {}", responseBody);
|
|
|
+
|
|
|
+ // 解析响应
|
|
|
+ RoomBlacklistResponse result = JSON.parseObject(responseBody, RoomBlacklistResponse.class);
|
|
|
+
|
|
|
+ if (result != null && result.getErrcode() == 0) {
|
|
|
+ LOGGER.info("Successfully retrieved room blacklist, uuid: {}, count: {}",
|
|
|
+ uuid, result.getData() != null ? result.getData().getSum() : 0);
|
|
|
+ } else {
|
|
|
+ LOGGER.warn("getRoomBlacklist API returned error, uuid: {}, errcode: {}, errmsg: {}",
|
|
|
+ uuid, result != null ? result.getErrcode() : -1,
|
|
|
+ result != null ? result.getErrmsg() : "解析失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ } else {
|
|
|
+ LOGGER.error("getRoomBlacklist API call failed, no response received, uuid: {}", uuid);
|
|
|
+ return createErrorResponse(-1, "API调用失败,未收到响应");
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ LOGGER.error("Exception occurred while calling getRoomBlacklist API, uuid: {}", uuid, e);
|
|
|
+ return createErrorResponse(-1, "API调用异常: " + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建错误响应
|
|
|
+ *
|
|
|
+ * @param errcode 错误码
|
|
|
+ * @param errmsg 错误信息
|
|
|
+ * @return 错误响应对象
|
|
|
+ */
|
|
|
+ private RoomBlacklistResponse createErrorResponse(int errcode, String errmsg) {
|
|
|
+ RoomBlacklistResponse response = new RoomBlacklistResponse();
|
|
|
+ response.setErrcode(errcode);
|
|
|
+ response.setErrmsg(errmsg);
|
|
|
+ return response;
|
|
|
+ }
|
|
|
}
|