Преглед на файлове

Merge remote-tracking branch 'origin/test-report' into test-report

syh преди 5 години
родител
ревизия
35713ee5ba

+ 8 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java

@@ -36,6 +36,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.text.ParseException;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -217,13 +218,17 @@ public class CallbackController {
 
                     //账号绑定
                     bindAccountAuthService.addBindAccount(accountId, KuaishouInterfaceConstant.LOGIN_TYPE_KUAISHOU, advertiserId);
-                   /* Thread t = new Thread() {
+                    Thread t = new Thread() {
                         @Override
                         public void run() {
-                            kuaishouInterfaceService.loadKuaishouDataSingle(topOauthToken);
+                            try {
+                                kuaishouInterfaceService.loadKuaishouDataSingle(topOauthToken);
+                            } catch (ParseException e) {
+                                e.printStackTrace();
+                            }
                         }
                     };
-                    t.start();*/
+                    t.start();
                 }
                 return "授权绑定成功";
             }

+ 2 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java

@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONObject;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
+import java.text.ParseException;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -37,7 +38,7 @@ public interface IKuaishouInterfaceService {
 
     void loadAllKuaishouData(List<CtopOauthToken> tokens);
 
-    void loadKuaishouDataSingle(CtopOauthToken token);
+    void loadKuaishouDataSingle(CtopOauthToken token) throws ParseException;
 
     /**
      * 创建广告计划

+ 0 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouDailyReportTaskServiceImpl.java

@@ -117,23 +117,19 @@ public class KuaiShouDailyReportTaskServiceImpl extends ServiceImpl<KuaiShouDail
             if (!Check.isNull(localPath)) {
                 if (task.getViewType() == 2) {
                     reportDailyCampaignMapper.loadCampaignDailyReport(task.getAccountId(), localPath);
-
                 } else if (task.getViewType() == 3) {
                     reportDailyGroupMapper.loadGroupDailyReport(task.getAccountId(), localPath);
 
                 } else if (task.getViewType() == 4) {
                     reportDailyCreativeMapper.loadCreativeDailyReport(task.getAccountId(), localPath);
-
                 }
             }
             task.setTaskStatus(4);
-
         } catch (Exception e) {
             e.printStackTrace();
             task.setTaskStatus(5);
         }
         this.updateById(task);
-
     }
 
 

+ 0 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java

@@ -223,8 +223,6 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
                     reportDailyCreativeMapper.loadCreativeDailyReport(task.getAccountId(), localPath);
 
                 }
-
-
             }
             task.setTaskStatus(4);
 
@@ -247,7 +245,6 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
 
     private void getDailyTypeList() {
         dailyTypeList = new ArrayList<>();
-        dailyTypeList.add(1);
         dailyTypeList.add(2);
         dailyTypeList.add(3);
         dailyTypeList.add(4);

+ 36 - 42
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -77,15 +77,11 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     private KuaiShouConversionInfosMapper conversionInfosMapper;
     @Autowired
     private KuaiShouConversionTypesMapper conversionTypesMapper;
-    @Autowired
-    private KuaiShouCreativeCreateMapper creativeCreateMapper;
+
     @Autowired
     private KuaiShouVideoUploadMapper videoUploadMapper;
     @Autowired
     private KuaiShouVideoMapper kuaiShouVideoMapper;
-
-    @Autowired
-    private KuaiShouImageGetMapper imageGetMapper;
     @Autowired
     private KuaiShouRegionListChildrenMapper regionListChildrenMapper;
     @Autowired
@@ -106,6 +102,12 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     private KuaiShouAdvertiserBaseInfoMapper advertiserBaseInfoMapper;
     @Autowired
     private IKuaiShouImageGetService iKuaiShouImageGetService;
+    @Autowired
+    private MaterialInfoMapper materialInfoMapper;
+    @Autowired
+    private KuaiShouGroupTargetMapper groupTargetMapper;
+    @Autowired
+    private KuaiShouTargetingTagsMapper targetingTagsMapper;
 
     @Override
     public void getAdvertiserReportHourly(CtopOauthToken token, Date startDate, Date endDate) {
@@ -1025,13 +1027,27 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     public void loadAllKuaishouData(List<CtopOauthToken> tokens) {
         if (null != tokens && tokens.size() > 0) {
             for (CtopOauthToken token : tokens) {
-                loadKuaishouDataSingle(token);
+                try {
+                    loadKuaishouDataSingle(token);
+                } catch (java.text.ParseException e) {
+                    e.printStackTrace();
+                }
             }
         }
     }
 
+    @Autowired
+    private IKuaiShouHistoryReportTaskService historyReportTaskService;
+
     @Override
-    public void loadKuaishouDataSingle(CtopOauthToken token) {
+    public void loadKuaishouDataSingle(CtopOauthToken token) throws java.text.ParseException {
+        log.info("----------------开始历史数据获取,accountId:{}", token.getAccountId());
+
+        String endDateStr = DateUtils.getDate("yyyy-MM-dd");
+        String startDate = DateUtils.addMonth(endDateStr, -6);
+
+        historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
+
         Date endDate = new Date();
         for (int i = 0; i < 7; i++) {
             Date getStartDate = DateUtils.addDay(endDate, -i);
@@ -1044,39 +1060,22 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             //4: 获取广告创意信息数据
             getAdvertiserCreativeReportHourly(token, getStartDate, getStartDate);
         }
-        for (int i = 0; i < 6; i++) {
-            Date getStartDate = new Date();
-            Date getEndDate = new Date();
-            if (i == 0) {
-                getStartDate = DateUtils.addDay(endDate, -175 + i * 30);
-                getEndDate = DateUtils.addDay(endDate, -150 + i * 30);
-            } else {
-                getStartDate = DateUtils.addDay(endDate, -180 + i * 30);
-                getEndDate = DateUtils.addDay(endDate, -150 + i * 30);
-            }
-            //1: 获取广告主信息数据
-            getAdvertiserReportDaily(token, getStartDate, getEndDate);
-            //2:获取广告计划信息数据
-            getAdvertiserCampaignReportDaily(token, getStartDate, getEndDate);
-            //3:获取广告组信息数据
-            getAdvertiserGroupReportDaily(token, getStartDate, getEndDate);
-            //4: 获取广告创意信息数据
-         //   getAdvertiserCreativeReportDaily(token, getStartDate, getEndDate);
 
-            //获取全量广告计划数据
-            getCampaignList(token, null, null);
-            //获取全量广组主数据
-            getGroupList(token, null, null);
-            //获取全量创意数据
-            getCreativeList(token, null, null);
-            //获取全量视频素材数据
-            getVideoList(token, null, null);
-            //获取图片信息数据
-            getImageList(token, null, null);
-        }
+        //获取全量广告计划数据
+        getCampaignList(token, null, null);
+        //获取全量广组主数据
+        getGroupList(token, null, null);
+        //获取全量创意数据
+        getCreativeList(token, null, null);
+        //获取全量视频素材数据
+        getVideoList(token, null, null);
+        //获取图片信息数据
+        getImageList(token, null, null);
 
 
         getAppList(token.getAccountId(), token.getAccessToken());
+
+
     }
 
 
@@ -1562,8 +1561,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
     }
 
-    @Autowired
-    private KuaiShouGroupTargetMapper groupTargetMapper;
 
     private void addGroup(Long advertiserId, JSONArray details) {
         if (!Check.isNull(details)) {
@@ -2445,8 +2442,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
     }
 
-    @Autowired
-    private MaterialInfoMapper materialInfoMapper;
 
     @Override
     public Map<String, Object> videoUpload(Long advertiserId, String accessToken, String videoUrl) {
@@ -3630,8 +3625,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
      * @param accountId
      * @param accessToken
      */
-    @Autowired
-    private KuaiShouTargetingTagsMapper targetingTagsMapper;
+
 
     @Override
     public void getTargetingTags(Long accountId, String accessToken) {