瀏覽代碼

素材报表修改

hcst_sunzhen 5 年之前
父節點
當前提交
2fb3c64713

+ 7 - 7
module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedanceReportServiceImpl.java

@@ -880,7 +880,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
     //素材报表
     public void bytedanceMaterialReportRetry(CtopOauthToken token, String startDate, String endDate){
         Long accountId = token.getAccountId();
-        log.info("头条素材报表当前accountId为:" + accountId);
+       // log.info("头条素材报表当前accountId为:" + accountId);
         Integer page = 1;
         Integer pageSize = 100;
         int code = bytedanceMaterialReportByPage(page, pageSize, token, accountId, startDate, endDate);
@@ -901,7 +901,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
 
     public void bytedanceMaterialReport(CtopOauthToken token, String startDate, String endDate){
         Long accountId = token.getAccountId();
-        log.info("头条素材报表当前accountId为:" + accountId);
+       // log.info("头条素材报表当前accountId为:" + accountId);
         Integer page = 1;
         Integer pageSize = 100;
         int code = bytedanceMaterialReportByPage(page, pageSize, token, accountId, startDate, endDate);
@@ -938,6 +938,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
 
         JSONObject json = HttpUtils.bytedanceGetRequest(access_token, open_api_domain + path, JSONObject.parseObject(JSONObject.toJSONString(data)));
         if(json == null){
+            //insertMaterialRetry(accountId, startDate, endDate, -2);
             log.error("请求有误:" + JSONObject.toJSONString(data));
             return -2;
         }
@@ -948,13 +949,12 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
                     Integer code = json.getInteger("code");
                     if(code != 0){
                         log.error("获取任务列表返回信息错误,错误码为:" + code + ",头条accountId:" + accountId + ";返回json为:" + JSONObject.toJSONString(data));
-                        //returnCode = -1;
                         return -1;
                     }
 
                     JSONObject jsonData = json.getJSONObject("data");
                     if (Check.isNull(jsonData)){
-                        log.error("获取任务列表返回信息data内容为空");
+                        log.error("获取任务列表返回信息data内容为空,头条accountId:" + accountId + ";返回json为:" + JSONObject.toJSONString(data));
                         return -1;
                     }
                     JSONObject pageInfo = jsonData.getJSONObject("page_info");
@@ -1074,7 +1074,6 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
                             daily.setConvertCost(metrics.getBigDecimal("convert_cost"));
 
                             bytedanceReportMaterialDailyList.add(daily);
-                            //bytedanceReportMaterialDailyMapper.insert(daily);
                         }
                     }
                     //Long insertStartTime = System.currentTimeMillis();
@@ -1083,10 +1082,10 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
                     //log.info("头条获取素材报表插入数据结束,执行耗时:{}秒", (insertEndTime - insertStartTime) / 1000);
                     if(currentPage >= totalPage){
                         //log.info("accountId:" + accountId + "数据同步完成,开始时间:" + startDate + ",结束时间:"+ endDate);
-                        //returnCode = 1;
                         return 1;
                     }else{
-                        bytedanceMaterialReportByPage(page + 1, pageSize, token, accountId, startDate, endDate);
+                        int pageCode = bytedanceMaterialReportByPage(page + 1, pageSize, token, accountId, startDate, endDate);
+                        return pageCode;
                     }
                 }else{
                     //returnCode = -1;
@@ -1095,6 +1094,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
                 }
         } catch (Exception e) {
             e.printStackTrace();
+            log.error("头条报表其他错误,accountId:" + accountId + ",json:"+JSONObject.toJSONString(data));
             returnCode = -3;
         }
         return returnCode;