فهرست منبع

添加深度转化出价字段

syh 4 سال پیش
والد
کامیت
11b3220ecd

+ 37 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

@@ -15,6 +15,7 @@ import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouAccessToken;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
+import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.material.service.IBytedanceEffectVideoInfoService;
 import cn.com.ctop.toutiao.modules.report.mapper.BytedanceReportMaterialDailyMapper;
@@ -22,6 +23,7 @@ import cn.com.ctop.toutiao.modules.report.service.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.xxl.job.core.context.XxlJobHelper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.annotations.Param;
@@ -54,7 +56,7 @@ import static org.jeecg.common.util.DateUtils.getAnotherDay;
 @RequestMapping("/test")
 @Slf4j
 public class TestController {
-    @Autowired
+    @Resource
     private CtopOauthTokenMapper tokenMapper;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
@@ -107,7 +109,7 @@ public class TestController {
 
     @Autowired
     private IBindAccountAuthService bindAccountAuthService;
-    @Autowired
+    @Resource
     private UserAllocationMapper allocationMapper;
     @Autowired
     private IBytedanceReportService bytedanceReportService;
@@ -1364,4 +1366,37 @@ public class TestController {
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
+
+    private ExecutorService executor = Executors.newFixedThreadPool(10);
+    private CountDownLatch countDownLatch;
+    @Autowired
+    IBytedanceVideoReportService bytedanceVideoReportService;
+    @Autowired
+    IETLReportBytedanceVideoService etlReportBytedanceVideoService;
+    @GetMapping("execute")
+    public Map<String,Object> execute(String date) throws Exception {
+        Map<String,Object>result = new HashMap<>();
+        List<CtopOauthToken> tokens = oauthTokenService.selectToutiaoToken();
+        countDownLatch = new CountDownLatch(tokens.size());
+        tokens.forEach(token -> executor.submit(() -> {
+            try {
+                bytedanceVideoReportService.pullVideoReport(token,date,date,1);
+            } catch (Exception e) {
+                XxlJobHelper.log("头条视频报表基础数据拉取异常:{}",e.getMessage());
+            } finally {
+                countDownLatch.countDown();
+            }
+        }));
+        try {
+            countDownLatch.await();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        if(!executorService.isShutdown()){
+            executorService.shutdown();
+        }
+        etlReportBytedanceVideoService.cleanETL(date);
+        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        return result;
+    }
 }

+ 6 - 58
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -25,6 +25,7 @@ import cn.com.ctop.toutiao.modules.report.entity.BytedanceAccountReportTaskRecor
 import cn.com.ctop.toutiao.modules.report.mapper.BytedanceReportMaterialDailyMapper;
 import cn.com.ctop.toutiao.modules.report.service.*;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.xxl.job.core.context.XxlJobHelper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.junit.Test;
@@ -554,64 +555,11 @@ public class SampleTest {
 
     @Test
     public void testLoadBytedanceDataV2() {
-        String accountIds =
-                "1675440464386062," +
-                        "1688606248211533," +
-                        "1669181787105294," +
-                        "1687571097467912," +
-                        "1650079154438157," +
-                        "1680697900744711," +
-                        "1678156679964680," +
-                        "1670727177043982," +
-                        "1676160388944910," +
-                        "1687559760306190," +
-                        "1687382871519240," +
-                        "1680312075164686," +
-                        "1675440465991688," +
-                        "1664657972166663," +
-                        "1688193173408782," +
-                        "1675616147056647," +
-                        "1687308848716814," +
-                        "1686394621234247," +
-                        "1683594409340935," +
-                        "1683676478859341," +
-                        "1686384860112904," +
-                        "1668290872519693," +
-                        "1674063202781191," +
-                        "1685024266033160," +
-                        "1669714891201544," +
-                        "1687758256277512," +
-                        "1675434231118856," +
-                        "1686394621807687," +
-                        "1678411706704903," +
-                        "1686223489547271," +
-                        "1660120711467022," +
-                        "1686833795211278," +
-                        "1680697899143175," +
-                        "1661313994984462," +
-                        "1661313995480077," +
-                        "1636295780727820," +
-                        "1676540490482759," +
-                        "1675342904713223," +
-                        "1686771461984327," +
-                        "1685841129360391," +
-                        "1683676477736973," +
-                        "1661313994470413," +
-                        "1663465141771272," +
-                        "1687758256732174," +
-                        "1686223482927117," +
-                        "1686835166313479," +
-                        "1642648003678215," +
-                        "1639753233213454," +
-                        "1675239584963662," +
-                        "1674634579279885," +
-                        "1650263841162253," +
-                        "1672178052130888";
-        String[] accountArray = accountIds.split(",");
-        for (int i = 0; i < accountArray.length; i++) {
-            CtopOauthToken token = tokenService.getTokenByAccountId(Long.parseLong(accountArray[i]));
-
-            reportService.getAdvertiserReport(token, DateUtils.parseDate("2021-01-14", "yyyy-MM-dd"), DateUtils.parseDate("2021-01-14", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        List<CtopOauthToken> tokens = oauthTokenService.selectToutiaoToken();
+        countDownLatch = new CountDownLatch(tokens.size());
+        for(int i=2;i<20;i++){
+            String statDate= DateUtils.formatDate(DateUtils.addDay(new Date(), -i));
+            tokens.forEach(token -> bytedanceVideoReportService.pullVideoReport(token, statDate, statDate, 1));
         }
     }
 

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAdvertiserStrategy.java

@@ -46,6 +46,7 @@ public class AiKuaishouAdvertiserStrategy {
 	private Integer bid;
 	/**深度出价*/
 	private Long cpaBid;
+	private Long deepConversionBid;
 	/**优先低成本出价*/
 	private Integer smartBid;
 	/**优化目标*/

+ 1 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/link/service/impl/ETLReportBytedanceVideoServiceImpl.java

@@ -98,8 +98,7 @@ public class ETLReportBytedanceVideoServiceImpl extends ServiceImpl<ETLReportByt
         boolean result = this.saveBatch(etlReportBytedanceVideos);
         if(result){
             log.info("{},头条etl报表清洗完成,数量:{}",statDate,etlReportBytedanceVideos.size());
-        }
-        else{
+        } else{
             log.error("{},头条etl报表清洗失败,请重试",statDate);
         }
     }

+ 1 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

@@ -90,6 +90,7 @@ public class ReportServiceImpl implements IReportService {
             XxlJobHelper.log("头条广告主数据获取异常");
             return;
         }
+        System.out.println(getObject);
         Integer code = getObject.getInteger("code");
         String message = getObject.getString("message");
         if (null == code || code != 0) {