|
|
@@ -21,6 +21,7 @@ import org.springframework.util.StringUtils;
|
|
|
import shop.alien.config.properties.RiskControlProperties;
|
|
|
import shop.alien.entity.SecondVideoTask;
|
|
|
import shop.alien.entity.second.*;
|
|
|
+import shop.alien.entity.second.enums.RiskControlRuleTypeEnum;
|
|
|
import shop.alien.entity.second.enums.SecondGoodsStatusEnum;
|
|
|
import shop.alien.entity.second.vo.*;
|
|
|
import shop.alien.entity.store.*;
|
|
|
@@ -550,14 +551,12 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
|
|
|
// 检查用户是否在24小时内发布商品超过阈值
|
|
|
if (!checkUserPublishLimit(goods)) {
|
|
|
log.warn("用户 {} 在24小时内发布商品次数超过限制", goodsDTO.getUserId());
|
|
|
- // TODO 插入风控记录
|
|
|
|
|
|
}
|
|
|
|
|
|
// 检查用户是否在24小时内发布同类商品超过阈值
|
|
|
if (!checkUserPublishSameCategoryLimit(goods)) {
|
|
|
log.warn("用户 {} 在24小时内发布同类商品次数超过限制", goodsDTO.getUserId());
|
|
|
- // TODO 插入风控记录
|
|
|
}
|
|
|
|
|
|
boolean saveResult;
|
|
|
@@ -620,11 +619,21 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
|
|
|
.in(SecondGoodsRecord::getGoodsStatus,
|
|
|
SecondGoodsStatusEnum.LISTED.getCode(),
|
|
|
SecondGoodsStatusEnum.SOLD.getCode());
|
|
|
-
|
|
|
- int publishCount = secondGoodsRecordMapper.selectCount(queryWrapper);
|
|
|
-
|
|
|
- // 如果发布数量超过限制,返回false
|
|
|
- return publishCount < publishLimit;
|
|
|
+ // 获取发布
|
|
|
+ List<SecondGoodsRecord> secondGoodsRecordList = secondGoodsRecordMapper.selectList(queryWrapper);
|
|
|
+ // 提取商品id集合
|
|
|
+ List<Integer> secondGoodsRecordIdList = secondGoodsRecordList.stream().map(SecondGoodsRecord::getId).collect(Collectors.toList());
|
|
|
+ // 转成json
|
|
|
+ String json = JSON.toJSONString(secondGoodsRecordIdList);
|
|
|
+ // 获取实际发布数量
|
|
|
+ int sameCategoryCount = secondGoodsRecordList.size();
|
|
|
+ // 如果发布数量超过限制,记录风控数据
|
|
|
+ if (sameCategoryCount >= publishLimit) {
|
|
|
+ // "异常发布-同类商品发布频率"
|
|
|
+ riskControlService.recordRiskControlData(goods.getUserId(), RiskControlRuleTypeEnum.TRANSACTION_FRAUD.getRuleType(), RiskControlRuleTypeEnum.TRANSACTION_FRAUD.getDescription(), goods.getId().toString(),json);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -660,7 +669,8 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
|
|
|
int sameCategoryCount = secondGoodsList.size();
|
|
|
// 如果发布数量超过限制,记录风控数据
|
|
|
if (sameCategoryCount >= sameCategoryLimit) {
|
|
|
- riskControlService.recordRiskControlData(goods.getUserId(), 4, "异常发布-同类商品发布频率", goods.getId(),json);
|
|
|
+ // "异常发布-同类商品发布频率"
|
|
|
+ riskControlService.recordRiskControlData(goods.getUserId(), RiskControlRuleTypeEnum.ABNORMAL_PUBLISH.getRuleType(), RiskControlRuleTypeEnum.ABNORMAL_PUBLISH.getDescription(), goods.getId().toString(),json);
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|