Procházet zdrojové kódy

fix:补充userRevenueRate 离线广告保存Null值校验

hidewnd před 2 týdny
rodič
revize
f25e62b191

+ 4 - 1
yt-novel/yt-novel-service/src/main/java/com/ytpm/novel/service/impl/AdServiceImpl.java

@@ -159,6 +159,9 @@ public class AdServiceImpl implements AdService {
                 insertEntity.setRecordId(IdUtil.fastSimpleUUID());
                 insertEntity.setUserId(user.getUserId());
                 insertEntity.setNetworkName(AdPlatformTypeEnum.getDesc(Integer.parseInt(adParam.getNetworkFormId())));
+                if (userRevenueRate != null) {
+                    insertEntity.setRevenueRate(userRevenueRate.toPlainString());
+                }
                 saveList.add(insertEntity);
                 if (AdRecordEnum.LOGIN_BEFORE.getCode().equals(param.getLoginStatus())
                         && AdSourceTypeEnum.rewarded_video.getAdSourceType() == adParam.getAdSourceType()) {
@@ -166,7 +169,7 @@ public class AdServiceImpl implements AdService {
                 }
                 if (insertEntity.getRevenue() != null) {
                     totalRevenue = totalRevenue.add(insertEntity.getRevenue());
-                    if (isLoginAfter ) {
+                    if (isLoginAfter && userRevenueRate != null) {
                         redPackRevenue = redPackRevenue.add(insertEntity.getRevenue().multiply(userRevenueRate));
                     }
                 }

+ 5 - 2
yt-question/yt-question-service/src/main/java/com/ytpm/question/service/impl/AdServiceImpl.java

@@ -133,7 +133,7 @@ public class AdServiceImpl implements AdService {
             YtDyzAdRecord insertEntity;
             List<String> filter = new ArrayList<>();
             List<YtDyzAdRecord> saveList = new ArrayList<>();
-            BigDecimal totalRevenue = BigDecimal.ZERO;
+            BigDecimal totalRevenue = BigDecimal.ZERO; // 用户总收益
             BigDecimal redPackRevenue = BigDecimal.ZERO; // 用户红包收益
             BigDecimal userRevenueRate = appUserService.getUserRevenueRate(user.getAppId()); // 用户红包收益比例
             boolean isLoginAfter = param.getLoginStatus() != null && AdRecordEnum.LOGIN_BEFORE.getCode().equals(param.getLoginStatus());
@@ -160,6 +160,9 @@ public class AdServiceImpl implements AdService {
                 insertEntity.setRecordId(IdUtil.fastSimpleUUID());
                 insertEntity.setUserId(user.getUserId());
                 insertEntity.setNetworkName(AdPlatformTypeEnum.getDesc(Integer.parseInt(adParam.getNetworkFormId())));
+                if (userRevenueRate != null) {
+                    insertEntity.setRevenueRate(userRevenueRate.toPlainString());
+                }
                 saveList.add(insertEntity);
                 if (AdRecordEnum.LOGIN_BEFORE.getCode().equals(param.getLoginStatus())
                         && AdSourceTypeEnum.rewarded_video.getAdSourceType() == adParam.getAdSourceType()) {
@@ -167,7 +170,7 @@ public class AdServiceImpl implements AdService {
                 }
                 if (insertEntity.getRevenue() != null) {
                     totalRevenue = totalRevenue.add(insertEntity.getRevenue());
-                    if (isLoginAfter ) {
+                    if (isLoginAfter && userRevenueRate != null) {
                         redPackRevenue = redPackRevenue.add(insertEntity.getRevenue().multiply(userRevenueRate));
                     }
                 }