Explorar o código

修改数据库连接端口++同步代码加synchronized

songyh %!s(int64=3) %!d(string=hai) anos
pai
achega
a7e68a3440

+ 15 - 17
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/impl/AiBytedanceAdvertiserStrategyServiceImpl.java

@@ -79,7 +79,20 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
     IAiBytedanceAutocreateLogService iBytedanceAutocreateLogService;
 
     private synchronized AiBytedanceAdDplinkInfo getlatestDpLinkInfo(AiBytedanceAdvertiserStrategy strategy,int status){
-        return adDplinkInfoService.getlatestDpLinkInfo(strategy.getId(),strategy.getAccountId(),strategy.getCreativeImageMode(),status);
+        AiBytedanceAdDplinkInfo adDplinkInfo = adDplinkInfoService.getlatestDpLinkInfo(strategy.getId(),strategy.getAccountId(),strategy.getCreativeImageMode(),status);
+        if(null == adDplinkInfo){
+            adDplinkInfo = new AiBytedanceAdDplinkInfo();
+            if("FIX".equalsIgnoreCase(strategy.getAdBidCreateType())){
+                adDplinkInfo.setAdBid(strategy.getAdCpaBid());
+            }else{
+                adDplinkInfo.setAdBid(strategy.getAdMinBid());
+            }
+            adDplinkInfo.setDpLinkIndex(strategy.getDpLinkStartIndex());
+        }else{
+            adDplinkInfo.setId(null);
+            adDplinkInfo.setDpLinkIndex(adDplinkInfo.getDpLinkIndex()+1);
+        }
+        return adDplinkInfo;
     }
 
     private synchronized void saveDpLink(AiBytedanceAdDplinkInfo dplinkInfo){
@@ -90,9 +103,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         UserAllocation userAllocation = userAllocationService.getByAccountId(strategy.getAccountId());
         if(null == userAllocation||userAllocation.getAccountStatus()!=0){
             log.info("此账户不存在或者已经被关闭=>accountId:{}", token.getAccountId());
-            AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
-                    token.getAccountId(),
-                    "获取账户",
+            AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(token.getAccountId(), "获取账户",
                     500,
                     "此账户不存在或者已经被关闭=>accountId:" + token.getAccountId(),
                     "userAllocationService.getByAccountId => "+ token.getAccountId());
@@ -141,19 +152,6 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
             if(null==useDplinkIndex||useDplinkIndex.equals(0)){
                 //查看已使用的dp链接
                 AiBytedanceAdDplinkInfo adDplinkInfo = getlatestDpLinkInfo(strategy,1);
-                if(null == adDplinkInfo){
-                    adDplinkInfo = new AiBytedanceAdDplinkInfo();
-                    if("FIX".equalsIgnoreCase(strategy.getAdBidCreateType())){
-                        adDplinkInfo.setAdBid(strategy.getAdCpaBid());
-                    }else{
-                        adDplinkInfo.setAdBid(strategy.getAdMinBid());
-                    }
-                    adDplinkInfo.setDpLinkIndex(strategy.getDpLinkStartIndex());
-                }else{
-                    adDplinkInfo.setId(null);
-                    adDplinkInfo.setDpLinkIndex(adDplinkInfo.getDpLinkIndex()+1);
-                }
-
                 //不使用dp链接
                 String date = DateUtils.formatDate();
                 //组名称

+ 0 - 1
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/common/service/impl/FileInfoServiceImpl.java

@@ -81,7 +81,6 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
         String result = null;
         for(int i=0;i<3;i++){
             JSONObject resultObject = marketingService.getSuggestImageId(token, vid);
-            log.info("获取推荐封面返回结果:{}",resultObject);
             if(null==resultObject||null==resultObject.getInteger("code")||0!=resultObject.getInteger("code")){
                 continue;
             }