|
@@ -15,6 +15,8 @@ import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService
|
|
|
import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
|
|
|
import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
|
|
|
import cn.com.ctop.toutiao.modules.report.service.IReportService;
|
|
|
+import com.xxl.job.core.biz.model.ReturnT;
|
|
|
+import com.xxl.job.core.log.XxlJobLogger;
|
|
|
import lombok.Data;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
@@ -153,10 +155,22 @@ public class SampleTest {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICtopOauthTokenService tokenService;
|
|
|
@Test
|
|
|
public void loadAccountData() {
|
|
|
- CtopOauthToken token = oauthTokenService.getTokenByAccountId(1665922219192387L);
|
|
|
- reportService.getAdvertiserReport(token, DateUtils.parseDate("2020-09-01","yy-MM-dd"), DateUtils.parseDate("2020-09-01","yy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
|
|
|
+ //查询需要拉取数据的账户token
|
|
|
+ List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
|
|
|
+
|
|
|
+ Date yesterday = DateUtils.parseDate(DateUtils.getAnotherDay("yy-MM-dd", DateUtils.getNowDate("yy-MM-dd"), -1), "yy-MM-dd");
|
|
|
+ tokens.forEach(it -> {
|
|
|
+ try {
|
|
|
+ reportService.getAdvertiserReport(it, yesterday, yesterday, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
|
|
|
+ } catch (Exception e) {
|
|
|
+ XxlJobLogger.log("获取昨日头条小时数据异常:拉取数据异常");
|
|
|
+ XxlJobLogger.log(e.getMessage());
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
@@ -177,7 +191,7 @@ public class SampleTest {
|
|
|
uReportExportService.exportExcel(uReport.getString("name"));
|
|
|
uReportSubscriber.forEach(sender->{
|
|
|
emailSendMsgHandle.SendAttachment("bijiequan@c-top.com.cn",title,content,
|
|
|
- new File(System.getProperty("user.dir")+ File.separator + "uReport"+File.separator+uReport.getString("name").replace("ureport.xml","")+"xlsx"));
|
|
|
+ new File("/data/file/report"+ File.separator + "uReport"+File.separator+uReport.getString("name").replace("ureport.xml","")+"xlsx"));
|
|
|
}); }
|
|
|
});
|
|
|
//发完全部订阅,删除文件
|