|
@@ -1,8 +1,11 @@
|
|
|
package com.tzld.piaoquan.risk.control.service.impl;
|
|
|
|
|
|
import com.tzld.piaoquan.risk.control.dao.mapper.QywxCorpBlacklistUserMapper;
|
|
|
+import com.tzld.piaoquan.risk.control.dao.mapper.UserBaseMapper;
|
|
|
import com.tzld.piaoquan.risk.control.model.po.QywxCorpBlacklistUser;
|
|
|
import com.tzld.piaoquan.risk.control.model.po.QywxCorpBlacklistUserExample;
|
|
|
+import com.tzld.piaoquan.risk.control.model.po.UserBase;
|
|
|
+import com.tzld.piaoquan.risk.control.model.po.UserBaseExample;
|
|
|
import com.tzld.piaoquan.risk.control.service.CorpBlacklistService;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -26,6 +29,9 @@ public class CorpBlacklistServiceImpl implements CorpBlacklistService {
|
|
|
|
|
|
@Autowired
|
|
|
private QywxCorpBlacklistUserMapper corpBlacklistUserMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserBaseMapper userBaseMapper;
|
|
|
|
|
|
/**
|
|
|
* 根据vid和corpId查询拉黑时间
|
|
@@ -53,15 +59,14 @@ public class CorpBlacklistServiceImpl implements CorpBlacklistService {
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void addToCorpBlacklist(Long vid, Long corpId) {
|
|
|
- if (vid == null || corpId == null) {
|
|
|
- throw new IllegalArgumentException("用户VID和企业ID不能为空");
|
|
|
- }
|
|
|
-
|
|
|
- if (vid <= 0 || corpId <= 0) {
|
|
|
- throw new IllegalArgumentException("用户VID和企业ID必须是有效的正数");
|
|
|
- }
|
|
|
-
|
|
|
try {
|
|
|
+ if (vid == null || corpId == null) {
|
|
|
+ throw new IllegalArgumentException("用户VID和企业ID不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (vid <= 0 || corpId <= 0) {
|
|
|
+ throw new IllegalArgumentException("用户VID和企业ID必须是有效的正数");
|
|
|
+ }
|
|
|
// 检查是否已存在
|
|
|
if (isInCorpBlacklist(vid, corpId)) {
|
|
|
throw new RuntimeException("用户已在该企业黑名单中,VID: " + vid + ", CorpId: " + corpId);
|
|
@@ -83,11 +88,8 @@ public class CorpBlacklistServiceImpl implements CorpBlacklistService {
|
|
|
throw new RuntimeException("添加用户到企业黑名单失败,数据库操作无效");
|
|
|
}
|
|
|
|
|
|
- } catch (RuntimeException e) {
|
|
|
- throw e;
|
|
|
} catch (Exception e) {
|
|
|
log.error("Unexpected error while adding user to corp blacklist, vid: {}, corpId: {}", vid, corpId, e);
|
|
|
- throw new RuntimeException("添加用户到企业黑名单时发生系统异常", e);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -179,4 +181,40 @@ public class CorpBlacklistServiceImpl implements CorpBlacklistService {
|
|
|
throw new RuntimeException("从企业黑名单移除用户失败", e);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据uuid查询corp_id
|
|
|
+ * @param uuid
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Long getCorpIdByUuid(String uuid) {
|
|
|
+ // 从qywx_user_base表根据uuid查询corp_id
|
|
|
+ if (uuid == null || uuid.trim().isEmpty()) {
|
|
|
+ log.warn("getCorpIdByUuid called with null or empty uuid");
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ UserBaseExample example = new UserBaseExample();
|
|
|
+ example.createCriteria().andUuidEqualTo(uuid);
|
|
|
+
|
|
|
+ List<UserBase> users = userBaseMapper.selectByExample(example);
|
|
|
+
|
|
|
+ if (users.isEmpty()) {
|
|
|
+ log.warn("No user found for uuid: {}", uuid);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ UserBase user = users.get(0);
|
|
|
+ Long corpId = user.getCorpId();
|
|
|
+
|
|
|
+ log.debug("Found corpId: {} for uuid: {}", corpId, uuid);
|
|
|
+ return corpId;
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("Failed to get corpId for uuid: {}", uuid, e);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|