|
@@ -34,6 +34,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
+import java.time.LocalDate;
|
|
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -83,45 +85,22 @@ public class KuaishouController {
|
|
|
|
|
|
|
|
@ApiOperation(value = "根据账户获取视频素材-账户下全部视频素材", notes = "根据账户获取视频素材-账户下全部视频素材")
|
|
@ApiOperation(value = "根据账户获取视频素材-账户下全部视频素材", notes = "根据账户获取视频素材-账户下全部视频素材")
|
|
|
@GetMapping(value = "/KuaishouUnitAudienceReport")
|
|
@GetMapping(value = "/KuaishouUnitAudienceReport")
|
|
|
- public void KuaishouUnitAudienceReportJob(String date) throws Exception {
|
|
|
|
|
-
|
|
|
|
|
- List<JSONObject> tokens = tokenService.getByProjectId(458L); //淘特项目
|
|
|
|
|
-// String date = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.getNowDate("yyyy-MM-dd"), -1);
|
|
|
|
|
- Date enDate = DateUtils.addDay(DateUtils.getNowDate(), -1);
|
|
|
|
|
- for (JSONObject t : tokens) {
|
|
|
|
|
- Long accountId = t.getLong("accountId");
|
|
|
|
|
- String token = t.getString("accessToken");
|
|
|
|
|
- if (Check.isNull(token)) {
|
|
|
|
|
- log.error("此账户未获取到相关token,accountId:{}", accountId);
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
- //过期跳过
|
|
|
|
|
- if (enDate.after(t.getDate("accessTokenExpiresIn"))) {
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
- //广告计划 ID 集
|
|
|
|
|
- List<JSONObject> campaignArray = unitReportDailyService.selectPlanIdsByAccountIdAndTime(accountId, date);
|
|
|
|
|
- if (Check.isNull(campaignArray)) {
|
|
|
|
|
- log.error("未查询到计划ID");
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
- //广告组 ID 集
|
|
|
|
|
- for (JSONObject obj : campaignArray) {
|
|
|
|
|
- Long campaignId = obj.getLong("campaignId");
|
|
|
|
|
- List<Long> unitIds = unitReportDailyService.selectUnitIdsByAccountIdAndTime(accountId, campaignId, date);
|
|
|
|
|
- if (Check.isNull(unitIds)) {
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
- if (unitIds.size() > 59) {
|
|
|
|
|
- List<List<Long>> unitIdArray = Lists.partition(unitIds, 59);
|
|
|
|
|
- for (List<Long> list : unitIdArray) {
|
|
|
|
|
- unitReportDailyService.standardCrowdAnalysisReport(accountId, token, date, campaignId, list);
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- unitReportDailyService.standardCrowdAnalysisReport(accountId, token, date, campaignId, unitIds);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ public void KuaishouUnitAudienceReportJob() throws Exception {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ LocalDate start = LocalDate.of(2024, 5, 1);
|
|
|
|
|
+ LocalDate end = LocalDate.of(2024, 12, 31);
|
|
|
|
|
+
|
|
|
|
|
+ List<LocalDate> dateList = DateUtils.getDatesBetween(start, end);
|
|
|
|
|
+ for (int i = 0; i < dateList.size(); i++) {
|
|
|
|
|
+ LocalDate localDate = dateList.get(i);
|
|
|
|
|
+ String s = localDate + "";
|
|
|
|
|
+ Long date = Long.valueOf(s.replace("-", ""));
|
|
|
|
|
+ adUnitReportService.deleteData(date);
|
|
|
|
|
+ System.err.println(date + ":数据删除成功");
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -197,24 +176,10 @@ public class KuaishouController {
|
|
|
@GetMapping(value = "/testOne")
|
|
@GetMapping(value = "/testOne")
|
|
|
public void testOne(@RequestParam(name = "accountId") long accountId) throws Exception {
|
|
public void testOne(@RequestParam(name = "accountId") long accountId) throws Exception {
|
|
|
String token = tokenService.getByAccountId(accountId);
|
|
String token = tokenService.getByAccountId(accountId);
|
|
|
-// List<String> list = new ArrayList<>();
|
|
|
|
|
-// list.add("2023-11-10");
|
|
|
|
|
-// list.add("2023-08-26");
|
|
|
|
|
-// list.add("2023-08-27");
|
|
|
|
|
-// String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
|
|
-// String date = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -4);
|
|
|
|
|
-// for (String s : list) {
|
|
|
|
|
-// unitReportDailyService2.getUnitReportDaily(accountId, token, s, s, 1);
|
|
|
|
|
-// adUnitReportService.getAgentReport();
|
|
|
|
|
- kuaishouAccountReportHourlyService
|
|
|
|
|
- .getAdvertiserReportHour(accountId, token, "2024-07-11", "2024-07-11", 1);
|
|
|
|
|
-// videoListService.getVideoList(accountId, token, null, null, 1);
|
|
|
|
|
-// campaignReportDailyService.getCampaignReportDaily(accountId, token, s, s, 1);
|
|
|
|
|
-// }
|
|
|
|
|
|
|
|
|
|
-// videoReportDailyService.getImageReportDaily(accountId, token, date, nowDate, 1);
|
|
|
|
|
|
|
+ kuaishouAccountReportHourlyService
|
|
|
|
|
+ .getAdvertiserReportHour(accountId, token, "2025-11-05", "2025-11-05", 1);
|
|
|
|
|
|
|
|
-// videoListService.getVideosByAccountId(accountId, "2023-11-01", "2023-11-09");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|