ソースを参照

fix: risk调整

hidewnd 1 ヶ月 前
コミット
77595db895

+ 14 - 4
yt-risk/risk-manage/src/main/java/com/ytpm/service/impl/RiskServiceImpl.java

@@ -678,7 +678,8 @@ public class RiskServiceImpl implements RiskService {
             //获取最先的两条
             BigDecimal reduce = revenues.stream().map(YtDyzAdRecord::getRevenue).reduce(BigDecimal.ZERO, BigDecimal::add);
             if(reduce.compareTo(income)<0){
-                log.warn(StrUtil.format("[risk 746] reduce{}  income {}", reduce, income));
+                log.warn(StrUtil.format("[risk 746] userId:{} reduce:{}  income:{}",
+                        dyzUser.getUserId(), reduce, income));
                 riskLockUser(dyzUser, "746","系统判定小于最低收益限制",getTipsMsg());
             }
         }
@@ -1016,7 +1017,8 @@ public class RiskServiceImpl implements RiskService {
                 param.setOperatorName("系统风控");
                 param.setAgentId(configMapper.getApplicationOwner(dyzUser.getAppId()));
                 addBannedRecord(Collections.singletonList(dyzUser.getUserId()),param);
-                YtPlatformUserApp appInfo = appMapper.selectParentApp(dyzUser.getAppId());
+                YtApp ytApp = appMapper.selectRiskApp(dyzUser.getAppId());
+                YtPlatformUserApp userApp =  appMapper.selectParentApp(ytApp.getSuperiorId());
                 ScheduledExecutorService scheduled  = Executors.newSingleThreadScheduledExecutor();
                 scheduled.schedule(()->{
                     YtDyzUser next = new YtDyzUser();
@@ -1024,7 +1026,7 @@ public class RiskServiceImpl implements RiskService {
                     next.setUserStatus(UserStatusEnum.VISITOR_LOCK.getCode());
                     next.setRiskCode("344");
                     next.setRiskReason("预估收益不到上限游客用户风控");
-                    feignInvoker.invoke(appInfo.getServiceName(), "updateUserInfo",next);
+                    feignInvoker.invoke(userApp.getServiceName(), "updateUserInfo",next);
                 },300, TimeUnit.MILLISECONDS);
                 //修改为解锁用户存入redis 24小时后进行解锁
                 scheduled.shutdown();
@@ -1081,11 +1083,19 @@ public class RiskServiceImpl implements RiskService {
             if (view != null && view.getEnabled() == 1) {
                 BigDecimal limitValue = getLimitValue(view, "revenueLimit");
                 checkResult = totalRevenue.compareTo(limitValue) >= 0;
+                if (!checkResult) {
+                    log.warn(StrUtil.format("[risk 344] userId:{},totalRevenue:{} revenueLimit:{}",
+                            dyzUser.getUserId(), totalRevenue, limitValue));
+                }
             }
             // 校验总ecpm
             if (view2 != null && view2.getEnabled() == 1) {
-                BigDecimal limitValue = getLimitValue(view, "ecpmLimit");
+                BigDecimal limitValue = getLimitValue(view2, "ecpmLimit");
                 checkResult = checkResult && totalEcpm.compareTo(limitValue) >= 0;
+                if (!checkResult) {
+                    log.warn(StrUtil.format("[risk 345] userId:{}, totalEcpm:{}  > ecpmLimit:{}",
+                            dyzUser.getUserId(), totalEcpm, limitValue));
+                }
             }
         }
         return checkResult;