Forráskód Böngészése

渠道号。。。修改bug

zhaoxian 3 éve
szülő
commit
eb59e8034a

+ 19 - 8
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/impl/KuaishouChannelServiceImpl.java

@@ -604,8 +604,13 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
         if (strategy.getClickTrackUrl().contains(CHANNEL_STR)) {
             channelStrategy.setClickTrackUrl(strategy.getClickTrackUrl().replace(CHANNEL_STR, channelCode).trim());
         }
-        if (strategy.getAppVersion().contains(CHANNEL_STR)) {
-            channelStrategy.setAppVersion(strategy.getAppVersion().replace(CHANNEL_STR, channelCode).trim());
+        String appVersion = strategy.getAppVersion();
+        if (appVersion.contains(CHANNEL_STR)) {
+            appVersion = appVersion.replace(CHANNEL_STR, channelCode).trim();
+            if (appVersion.endsWith("-")) {
+                appVersion = appVersion.substring(0, appVersion.length() - 1);
+            }
+            channelStrategy.setAppVersion(appVersion);
         }
         return channelStrategy;
     }
@@ -913,10 +918,10 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
                 return doAccountRangeAccountLevel(accountId, strategys, appName);
             } else if ("plan".equals(usageLevel) && usageLevel.equals(level)) {
                 //---------------------计划层级---------------------
-                return doPlanLevel(accountId, strategys, appName);
+                return doPlanLevel(accountId, strategys, appName, 0);
             } else if ("group".equals(usageLevel)) {
                 //---------------------组层级---------------------
-                return doGroupLevel(accountId, strategys, appName);
+                return doGroupLevel(accountId, strategys, appName, 0);
             }
         } else {
             /**============================项目范围============================*/
@@ -925,10 +930,10 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
                 return doAccountRangeAccountLevel(accountId, strategys, appName);
             } else if ("plan".equals(usageLevel) && usageLevel.equals(level)) {
                 //---------------------计划层级---------------------
-                return doPlanLevel(accountId, strategys, appName);
+                return doPlanLevel(accountId, strategys, appName, 0);
             } else if ("group".equals(usageLevel)) {
                 //---------------------组层级---------------------
-                return doGroupLevel(accountId, strategys, appName);
+                return doGroupLevel(accountId, strategys, appName, 0);
             }
         }
         return Result.error("未查到渠道号");
@@ -1015,7 +1020,7 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
     }
 
     //通过账户范围计划层级查询
-    private Result<Object> doPlanLevel(Long accountId, List<KuaishouChannelCreateStrategy> strategys, String appName) throws
+    private Result<Object> doPlanLevel(Long accountId, List<KuaishouChannelCreateStrategy> strategys, String appName, int count) throws
             Exception {
         List<Integer> haveCycleTimesList = channelMapper.queryUsedLevel(strategys);
         if (Check.isNull(haveCycleTimesList)) {
@@ -1062,11 +1067,14 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
                 }
             }
         }
+        if (count == 0) {
+            return doPlanLevel(accountId, strategys, appName, 1);
+        }
         return Result.ok("未查询到渠道号");
     }
 
     //通过项目范围广告组层级查询
-    private Result<Object> doGroupLevel(Long accountId, List<KuaishouChannelCreateStrategy> strategys, String appName) throws Exception {
+    private Result<Object> doGroupLevel(Long accountId, List<KuaishouChannelCreateStrategy> strategys, String appName, int count) throws Exception {
         List<Integer> haveCycleTimesList = channelMapper.queryUsedLevel(strategys);
         if (Check.isNull(haveCycleTimesList)) {
             return Result.error("渠道号已无效");
@@ -1112,6 +1120,9 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
                 }
             }
         }
+        if (count == 0) {
+            return doGroupLevel(accountId, strategys, appName, 1);
+        }
         return Result.ok("未查询到渠道号");
     }