marxjaw 4 månader sedan
förälder
incheckning
4edc56bc5c

+ 1 - 1
yt-app/app-service/src/main/java/com/ytpm/service/AppUserService.java

@@ -6,5 +6,5 @@ public interface AppUserService {
     /**
      * openid查询用户信息
      */
-    YtDyzUser selectByOpenid(String openid, long ditchId);
+    YtDyzUser selectByOpenid(String openid, Long ditchId);
 }

+ 1 - 1
yt-app/app-service/src/main/java/com/ytpm/service/impl/AppUserServiceImpl.java

@@ -16,7 +16,7 @@ public class AppUserServiceImpl implements AppUserService {
      * openid查询用户信息
      */
     @Override
-    public YtDyzUser selectByOpenid(String openid,long ditchId) {
+    public YtDyzUser selectByOpenid(String openid,Long ditchId) {
         return appUserMapper.getYtAppUser(openid,ditchId);
     }
 }

+ 0 - 6
yt-app/app-service/src/main/resources/mapper/AppUserMapper.xml

@@ -79,9 +79,6 @@
             <if test="power != null">
                 power = #{power},
             </if>
-            <if test="registryTime != null">
-                registry_time = #{registryTime},
-            </if>
             <if test="lastLoginTime != null">
                 last_login_time = #{lastLoginTime},
             </if>
@@ -124,9 +121,6 @@
             <if test="wxOpenId != null">
                 wx_open_id = #{wxOpenId},
             </if>
-            <if test="ditchId != null">
-                ditch_id = #{ditchId},
-            </if>
             <if test="platformId != null">
                 platform_id = #{platformId}
             </if>

+ 24 - 0
yt-common/src/main/java/com/ytpm/agent/model/YtPlatformUserApp.java

@@ -0,0 +1,24 @@
+package com.ytpm.agent.model;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class YtPlatformUserApp {
+    private String appId;
+    private String appName;
+    private String userId;
+    private Integer appType;
+    private String appKey;
+    private String storeOnSale;
+    private String storeUrl;
+    private String packageName;
+    private String domain;
+    private String category;
+    private String subCategory;
+    private String coppa;
+    private String ccpa;
+    private String screenOrientation;
+    private Date issuedTime;
+}

+ 1 - 1
yt-common/src/main/java/com/ytpm/app/model/YtDyzUser.java

@@ -109,5 +109,5 @@ public class YtDyzUser {
     @ApiModelProperty("今日视频播放数")
     private int todayVideo;
     @ApiModelProperty(value = "渠道ID")
-    private long ditchId;
+    private Long ditchId;
 }

+ 1 - 1
yt-common/src/main/java/com/ytpm/app/param/WxLoginParam.java

@@ -22,5 +22,5 @@ public class WxLoginParam {
     @ApiModelProperty(value = "微信登录认证授权码",required = true)
     private String wxCode;
     @ApiModelProperty(value = "渠道ID")
-    private long ditchId;
+    private Long ditchId;
 }

+ 1 - 1
yt-common/src/main/java/com/ytpm/app/param/YtAppUserListParam.java

@@ -33,5 +33,5 @@ public class YtAppUserListParam extends PageMeta {
     @ApiModelProperty("用户id")
     private String userId;
     @ApiModelProperty("渠道类型id")
-    private long ditchId;
+    private Long ditchId;
 }

+ 1 - 1
yt-common/src/main/java/com/ytpm/util/RedisService.java

@@ -219,7 +219,7 @@ public class RedisService {
         return this.getStr(todayKey);
     }
 
-    public long getDitchId(){
+    public Long getDitchId(){
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
         LocalDate currentDate = LocalDate.now();
         LocalDate yesterday = currentDate.minusDays(1);

+ 9 - 2
yt-risk/risk-manage/src/main/java/com/ytpm/service/impl/RiskServiceImpl.java

@@ -464,8 +464,14 @@ public class RiskServiceImpl extends ReflectUtil implements RiskService {
     public Result<?> checkAdRisk(String userId,BigDecimal userRevenue) {
         ResultTable<YtDyzAdRecord> table = appFeign.adRecords(userId);
         List<YtDyzAdRecord> records = table.getData();
+        if(records.isEmpty()){
+            return Result.resultOk(RepMessage.QUERY_SUCCESS);
+        }
         //校验风控742规则
         RiskTemplateView ecpmLimit= configMapper.getByCode("742");
+        records = records.stream().filter(s->
+            DateUtil.isSameDay(DateUtil.parse(s.getFinishTime()), new Date())
+        ).collect(Collectors.toList());
         checkRisk742(ecpmLimit,userId,records);
         //校验风控746规则
         checkRisk746(userId,records,userRevenue);
@@ -480,7 +486,7 @@ public class RiskServiceImpl extends ReflectUtil implements RiskService {
         Map<String, String> revenueMap = revenue.getConfigList().stream().collect(
                 Collectors.toMap(RiskConfigView::getFieldName, RiskConfigView::getConfigVal));
         List<YtDyzAdRecord> revenues = records.stream().filter(
-                s -> s.getRevenue().compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList());
+                s -> Objects.nonNull(s.getRevenue())&&(s.getRevenue().compareTo(BigDecimal.ZERO)) > 0).collect(Collectors.toList());
         int incomeCount = 0;
 
         incomeCount = revenues.isEmpty()?incomeCount:records.size();
@@ -494,6 +500,7 @@ public class RiskServiceImpl extends ReflectUtil implements RiskService {
             BigDecimal income = new BigDecimal(revenueMap.get("income"));
             //获取最先的两条
             BigDecimal reduce = revenues.stream().map(YtDyzAdRecord::getRevenue).reduce(BigDecimal.ZERO, BigDecimal::add);
+            reduce = reduce.add(userRevenue);
             if(reduce.compareTo(income)<0){
                 riskLockUser(userId, "746","系统判定小于最低收益限制","用户已被风控,风控编码:746");
             }
@@ -515,7 +522,7 @@ public class RiskServiceImpl extends ReflectUtil implements RiskService {
             //过滤出ecpm值小于预设值的视频数
             int ecpm = Integer.parseInt(limitMap.get("ecpm"));
             long count = records.stream().filter(
-                    s -> (s.getEcpm().compareTo(BigDecimal.valueOf(ecpm))) < 0).count();
+                    s -> Objects.nonNull(s.getEcpm())&&(s.getEcpm().compareTo(BigDecimal.valueOf(ecpm))) < 0).count();
             int exact = Math.toIntExact(count);
             //判断小于预设值的视频数超出预设次数
             int haveCount = Integer.parseInt(limitMap.get("haveCount"));