|
@@ -6,10 +6,7 @@ import com.tzld.piaoquan.risk.control.dao.mapper.WorkWechatRoomInfoMapper;
|
|
|
import com.tzld.piaoquan.risk.control.model.po.UserBase;
|
|
|
import com.tzld.piaoquan.risk.control.model.po.WorkWechatRoomInfo;
|
|
|
import com.tzld.piaoquan.risk.control.model.po.WorkWechatRoomInfoExample;
|
|
|
-import com.tzld.piaoquan.risk.control.model.qywx.QwCommonResModel;
|
|
|
-import com.tzld.piaoquan.risk.control.model.qywx.RiskUserInfo;
|
|
|
-import com.tzld.piaoquan.risk.control.model.qywx.RoomListResponse;
|
|
|
-import com.tzld.piaoquan.risk.control.model.qywx.RoomMemberListInfo;
|
|
|
+import com.tzld.piaoquan.risk.control.model.qywx.*;
|
|
|
import com.tzld.piaoquan.risk.control.util.HttpClientUtil;
|
|
|
import com.tzld.piaoquan.risk.control.util.HttpPoolClient;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -33,6 +30,42 @@ public class RiskUserOperateService {
|
|
|
private long corpid;
|
|
|
private static final HttpPoolClient httpPoolClientDefault = HttpClientUtil.create(10000, 10000, 2000, 5000, 5, 10000);
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(RiskUserHandleService.class);
|
|
|
+ private static final List<Long> BLACKLIST_VID = Collections.unmodifiableList(Arrays.asList(7881302926289574L,7881299753025521L));
|
|
|
+
|
|
|
+
|
|
|
+ public boolean quickKick(RoomAddMemberMessage message,String uuid) {
|
|
|
+ if(message.getIsRoom() == 1) {
|
|
|
+ Map<String, Object> requestBody = new HashMap<>();
|
|
|
+ requestBody.put("uuid", uuid);
|
|
|
+ requestBody.put("oprType", 1);
|
|
|
+ if(message.getMemberList().isEmpty()) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ long vid = message.getMemberList().get(0);
|
|
|
+ if(!BLACKLIST_VID.contains(vid)) {
|
|
|
+ LOGGER.info("quickKick, vid: {} is in blacklist, skip kick", vid);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 如果是群聊,直接踢出
|
|
|
+ LOGGER.info("quickKick, message: {}, uuid: {}", message, uuid);
|
|
|
+ requestBody.put("blacklist_vid",Arrays.asList(message.getMemberList().get(0)));
|
|
|
+ String params = JSON.toJSONString(requestBody);
|
|
|
+ Optional<String> response = httpPoolClientDefault.postJson(qywxConfig.getDomain() + qywxConfig.getPath("kick-external"), params);
|
|
|
+ if (response.isPresent()) {
|
|
|
+ QwCommonResModel<RoomListResponse> roomInfo = QwCommonResModel.parseResponse(response.get(), RoomListResponse.class);
|
|
|
+ if (roomInfo.getErrcode() == 0) {
|
|
|
+ LOGGER.info("quick Kick external user {} from room {} successfully", vid);
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ LOGGER.error("Failed to kick external user {} f: {}", vid, roomInfo.getErrmsg());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ LOGGER.error("Failed to kick external user {} from : No response", vid);
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
public boolean checkAndKickExternalUser(UserBase staff,RiskUserInfo riskUserInfo,long vid,long roomId) {
|
|
|
LOGGER.info("checkAndKickExternalUser, staff: {}, riskUserInfo: {}, vid: {}, roomId: {}", staff, riskUserInfo, vid, roomId);
|
|
@@ -48,6 +81,10 @@ public class RiskUserOperateService {
|
|
|
}
|
|
|
|
|
|
public boolean kick(UserBase staff, long roomId, long vid) {
|
|
|
+ if(BLACKLIST_VID.contains(vid)) {
|
|
|
+ LOGGER.info("kick, vid: {} is in blacklist, skip normal kick", vid);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
Map<String, Object> requestBody = new HashMap<>();
|
|
|
requestBody.put("uuid", staff.getUuid());
|
|
|
requestBody.put("oprType", 1);
|