Browse Source

修改定时任务

zhouzeyu@c-top.com.cn 4 năm trước cách đây
mục cha
commit
8905e9433f

+ 7 - 3
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceCreativeReportDailyServiceImpl.java

@@ -9,7 +9,6 @@ import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
@@ -68,10 +67,15 @@ public class BytedanceCreativeReportDailyServiceImpl implements IBytedanceCreati
             BytedanceCreativeReportDaily report = JSONObject.parseObject(dataObject.toJSONString(), BytedanceCreativeReportDaily.class);
 
             report.setAdvertiserId(oauthToken.getAccountId());
-            report.setStatDatetime(yesterda.replace("-", ""));
+            report.setStatDatetime(report.getStatDatetime() == null ? null : report.getStatDatetime().substring(0, 10).replace("-", ""));
             list.add(report);
         }
-        bytedanceCreativeReportDailyMapper.insert(list);
+        try {
+            bytedanceCreativeReportDailyMapper.insert(list);
+        }catch (Exception e){
+            log.info(e.toString());
+        }
+
         pageNumber++;
         int totalPage = resultObject.getJSONObject("data").getJSONObject("page_info").getInteger("total_page");
         if (pageNumber <= totalPage) {

+ 1 - 1
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceCreativeReportHourlyServiceImpl.java

@@ -67,7 +67,7 @@ public class BytedanceCreativeReportHourlyServiceImpl implements IBytedanceCreat
             String hour = report.getStatDatetime().substring(11, 13);
             report.setHour(Integer.parseInt(hour));
             report.setAdvertiserId(oauthToken.getAccountId());
-            report.setStatDatetime(yesterda.replace("-", ""));
+            report.setStatDatetime(report.getStatDatetime() == null ? null : report.getStatDatetime().substring(0, 10).replace("-", ""));
             list.add(report);
         }
         bytedanceCreativeReportHourlyMapper.insert(list);