Просмотр исходного кода

1.增加是否程序化账户区分
2.增加素材报表获取

yumeng 3 дней назад
Родитель
Сommit
ece69b06ce

+ 1 - 1
job-adq/src/main/java/cn/com/ctop/job/adq/data/entity/AdqAdvertiserList.java

@@ -36,7 +36,7 @@ public class AdqAdvertiserList {
     private Integer isAdx;
 
     /**
-     * 1 是 2 否
+     * 是否小程序广告 1 是 0 否
      */
     private Integer isMp;
 

+ 3 - 0
job-adq/src/main/java/cn/com/ctop/job/adq/data/mapper/xml/AdqAdminAdvertiserListMapper.xml

@@ -9,6 +9,7 @@
         admin_advertiser_id,
         advertiser_id,
         advertiser_name,
+        is_mp,
         is_valid,
         raw_response
         )
@@ -19,12 +20,14 @@
             #{add.adminAdvertiserId},
             #{add.advertiserId},
             #{add.advertiserName},
+            #{add.isMp},
             1,
             #{add.rawResponse}
             )
         </foreach>
         on duplicate key update
         advertiser_name= VALUES(advertiser_name),
+        is_mp= VALUES(is_mp),
         is_valid= VALUES(is_valid),
         raw_response= VALUES(raw_response)
     </insert>

+ 1 - 1
job-adq/src/main/java/cn/com/ctop/job/adq/data/mapper/xml/AdqMaterialReportMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="cn.com.ctop.job.adq.data.mapper.AdqMaterialReportMapper">
 
     <insert id="insertAdqMaterialReportDaily">
-        replace into adq_material_report_daily (
+        replace into media_adq_material_report_daily (
         stat_time_day,
         advertiser_id,
         material_id,

+ 2 - 2
job-adq/src/main/java/cn/com/ctop/job/adq/data/service/impl/AdqAdminAdvertiserListServiceImpl.java

@@ -62,10 +62,10 @@ public class AdqAdminAdvertiserListServiceImpl implements IAdqAdminAdvertiserLis
                                 adqAdvertiserList.setIsAdx(2);
                             }
                             Boolean isMp = accountJson.getBoolean("is_mp");
-                            if (isMp) {
+                            if (Boolean.TRUE.equals(isMp)) {
                                 adqAdvertiserList.setIsMp(1);
                             } else {
-                                adqAdvertiserList.setIsMp(2);
+                                adqAdvertiserList.setIsMp(0);
                             }
                             addList.add(adqAdvertiserList);
                         }

+ 17 - 3
job-adq/src/main/java/cn/com/ctop/job/adq/data/service/impl/AdqMaterialReportServiceImpl.java

@@ -74,7 +74,7 @@ public class AdqMaterialReportServiceImpl implements IAdqMaterialReportService {
             List<JSONObject> reports = new ArrayList<>();
             if (Check.isNull(jsonObject)) {
                 log.error("请求素材日报失败,account_id:{},返回为空。", advertiserId);
-                if (isLog == 1) {
+                if (isLog != null && isLog == 1) {
                     AdqErrorLog errorInfo = new AdqErrorLog();
                     errorInfo.setAdvertiserId(advertiserId);
                     errorInfo.setStartDate(startDate);
@@ -109,7 +109,7 @@ public class AdqMaterialReportServiceImpl implements IAdqMaterialReportService {
                     }
                 } else {
                     log.error("请求素材日报失败,account_id:{},返回信息:{}", advertiserId, jsonObject);
-                    if (isLog == 1) {
+                    if (isLog != null && isLog == 1) {
                         AdqErrorLog errorInfo = new AdqErrorLog();
                         errorInfo.setAdvertiserId(advertiserId);
                         errorInfo.setStartDate(startDate);
@@ -127,7 +127,7 @@ public class AdqMaterialReportServiceImpl implements IAdqMaterialReportService {
             if (page < totalPage) {
                 getAdqMaterialDailyReport(advertiserId, accessToken, level, startDate, endDate, page + 1, isLog, errId, isSend);
             } else {
-                log.info("请求创意日报完成,account_id:{},开始日期:{},结束日期:{} totalPage:{}", advertiserId, startDate, endDate, totalPage);
+                log.info("请求素材日报完成,account_id:{},开始日期:{},结束日期:{} totalPage:{}", advertiserId, startDate, endDate, totalPage);
                 if (errId != null) {
                     adqErrorLogMapper.deleteInfoByErrorId(errId);
                 }
@@ -137,6 +137,20 @@ public class AdqMaterialReportServiceImpl implements IAdqMaterialReportService {
             }
         } catch (Exception e) {
             e.printStackTrace();
+            if (isLog != null && isLog == 1) {
+                try {
+                    AdqErrorLog errorInfo = new AdqErrorLog();
+                    errorInfo.setAdvertiserId(advertiserId);
+                    errorInfo.setStartDate(startDate);
+                    errorInfo.setEndDate(endDate);
+                    errorInfo.setDataDimension("material");
+                    errorInfo.setDataType("daily");
+                    errorInfo.setMsg(e.getMessage());
+                    adqErrorLogMapper.replaceErrorInfo(errorInfo);
+                } catch (Exception ex) {
+                    log.error("记录素材日报失败日志异常,account_id:{}", advertiserId, ex);
+                }
+            }
         }
     }
 }