huangpingkang 1 год назад
Родитель
Сommit
56bef95e1a

+ 6 - 4
job-adq/src/main/java/cn/com/ctop/job/adq/data/service/impl/AdqRetryReportServiceImpl.java

@@ -32,6 +32,8 @@ public class AdqRetryReportServiceImpl implements IAdqRetryReportService {
     private static ExecutorService sendExecutorService = Executors.newFixedThreadPool(5);
     @Autowired
     private AdqAccountReportMapper accountReportMapper;
+    @Autowired
+    private AdqErrorLogMapper adqErrorLogMapper;
 
     @Override
     public void getCreativeHourRetry(Long errorId, Long advertiserId, String accessToken, String startDate, String endDate, Integer page, Integer isSend) {
@@ -87,7 +89,7 @@ public class AdqRetryReportServiceImpl implements IAdqRetryReportService {
             getCreativeHourRetry(errorId, advertiserId, accessToken, startDate, endDate, page + 1, isSend);
         } else {
             log.error("请求创意时报完成,account_id:{},日期:{}", advertiserId, startDate);
-            adqReportMapper.deleteInfoByErrorId(errorId);
+            adqErrorLogMapper.deleteInfoByErrorId(errorId);
             if (isSend == 1) {
                 sendMessage(advertiserId, startDate, endDate, 3, "hour", 1, "creative");
             }
@@ -149,7 +151,7 @@ public class AdqRetryReportServiceImpl implements IAdqRetryReportService {
                 getCreativeDailyRetry(errorId, advertiserId, accessToken, startDate, endDate, page + 1, isSend);
             } else {
                 log.error("请求创意日报完成,account_id:{},日期:{}", advertiserId, startDate);
-                adqReportMapper.deleteInfoByErrorId(errorId);
+                adqErrorLogMapper.deleteInfoByErrorId(errorId);
                 if (isSend == 1) {
                     sendMessage(advertiserId, startDate, endDate, 3, "daily", 1, "creative");
                 }
@@ -212,7 +214,7 @@ public class AdqRetryReportServiceImpl implements IAdqRetryReportService {
                 getAccountHourRetry(errorId, advertiserId, accessToken, startDate, endDate, page + 1, isSend);
             } else {
                 log.info("请求账户时报完成,account_id:{},日期:{}", advertiserId, startDate);
-                adqReportMapper.deleteInfoByErrorId(errorId);
+                adqErrorLogMapper.deleteInfoByErrorId(errorId);
                 if (isSend == 1) {
                     sendMessage(advertiserId, startDate, endDate, 3, "daily", 1, "account");
                 }
@@ -274,7 +276,7 @@ public class AdqRetryReportServiceImpl implements IAdqRetryReportService {
                 getAccountDailyRetry(errorId, advertiserId, accessToken, startDate, endDate, page + 1, isSend);
             } else {
                 log.error("请求账户日报完成,account_id:{},日期:{}", advertiserId, startDate);
-                adqReportMapper.deleteInfoByErrorId(errorId);
+                adqErrorLogMapper.deleteInfoByErrorId(errorId);
                 if (isSend == 1) {
                     sendMessage(advertiserId, startDate, endDate, 3, "daily", 1, "account");
                 }

+ 25 - 0
job-adq/src/main/java/cn/com/ctop/job/adq/handler/AdqAccountReportJob.java

@@ -2,6 +2,7 @@ package cn.com.ctop.job.adq.handler;
 
 
 import cn.com.ctop.job.adq.data.service.IAdqAccountReportService;
+import cn.com.ctop.job.adq.data.service.IAdqAssetReportService;
 import cn.com.ctop.job.adq.data.service.IAdqCreativeReportService;
 import cn.com.ctop.job.adq.data.utils.Check;
 import cn.com.ctop.job.adq.data.utils.DateUtils;
@@ -24,6 +25,8 @@ import java.util.concurrent.Executors;
 @Component
 public class AdqAccountReportJob {
     @Autowired
+    private IAdqAssetReportService adqAssetReportService;
+    @Autowired
     private IAdqAccountReportService accountReportService;
     private static ExecutorService nowDateHourExecutorService = Executors.newFixedThreadPool(3);
     private static ExecutorService yesDateHourExecutorService = Executors.newFixedThreadPool(3);
@@ -95,5 +98,27 @@ public class AdqAccountReportJob {
         });
     }
 
+    @XxlJob("assetReport")
+    public void assetReport() throws Exception {
+        String param = XxlJobHelper.getJobParam(); // 执行参数
+        if (Check.isNull(param)) {
+            log.error("入参为空");
+            return;
+        }
+
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String data = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        String[] s = param.split("_");
+        Long advertiserId = Long.valueOf(s[0]);
+        String accessToken = s[1];
+        dailyExecutorService.submit(new Runnable() {
+            @Override
+            public void run() {
+                adqAssetReportService.getAdqAssetDailyReport(advertiserId, accessToken, data, data, 1, 1, null, null);
+            }
+        });
+    }
+
+
 
 }

+ 31 - 0
job-adq/src/main/java/cn/com/ctop/job/adq/handler/AdqRetryReportJob.java

@@ -1,15 +1,18 @@
 package cn.com.ctop.job.adq.handler;
 
 
+import cn.com.ctop.job.adq.data.service.IAdqAssetReportService;
 import cn.com.ctop.job.adq.data.service.IAdqCreativeReportService;
 import cn.com.ctop.job.adq.data.service.IAdqRetryReportService;
 import cn.com.ctop.job.adq.data.utils.Check;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -28,12 +31,15 @@ public class AdqRetryReportJob {
     private static ExecutorService hourCreativeExecutorService = Executors.newFixedThreadPool(2);
     private static ExecutorService hourrAccountExecutorService = Executors.newFixedThreadPool(2);
     private static ExecutorService dailyAccountExecutorService = Executors.newFixedThreadPool(2);
+    private static ExecutorService assetExecutorService = Executors.newFixedThreadPool(2);
 
 
     @Autowired
     private IAdqCreativeReportService adqReportService;
     @Autowired
     private IAdqRetryReportService retryReportService;
+    @Autowired
+    private IAdqAssetReportService assetReportService;
 
     @XxlJob("adqRetryReport")
     public void promoterReport() throws Exception {
@@ -95,6 +101,31 @@ public class AdqRetryReportJob {
                         });
                     }
 
+                } else if ("asset".equals(dataDimension)) {
+                    assetExecutorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            if (!Check.isNull(accessToken)) {
+                                assetReportService.getAdqAssetDailyReport(advertiserId, accessToken, startDate, endDate, 1, null, id, isSend);
+                            }
+                        }
+                    });
+                } else if ("asset_info".equals(dataDimension)) {
+                    assetExecutorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            if (!Check.isNull(accessToken)) {
+                                JSONObject msg = jsonObject.getJSONObject("msg");
+                                String marketingTargetType = msg.getString("marketing_target_type");
+                                JSONArray marketingAssetIds = msg.getJSONArray("marketing_asset_ids");
+                                List<String> assetIds = new ArrayList<>();
+                                if (!Check.isNull(marketingAssetIds)) {
+                                    assetIds = marketingAssetIds.toJavaList(String.class);
+                                }
+                                assetReportService.getAdqAssetInfo(marketingTargetType, assetIds, advertiserId, accessToken, null, id, isSend);
+                            }
+                        }
+                    });
                 }
 
 

+ 1 - 1
job-adq/src/main/resources/application.yml

@@ -1,5 +1,5 @@
 server:
-  port: 58087
+  port: 8087
   ip: 127.0.0.1
   servlet:
     context-path: /