|
@@ -2,6 +2,7 @@ package org.jeecg.modules.ctop.controller;
|
|
|
|
|
|
import cn.com.ctop.common.module.entity.*;
|
|
|
import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
|
|
|
+import cn.com.ctop.common.module.mapper.UserAllocationMapper;
|
|
|
import cn.com.ctop.common.module.service.*;
|
|
|
import cn.com.ctop.common.module.utils.*;
|
|
|
import cn.com.ctop.common.module.vo.ResFileDTO;
|
|
@@ -11,15 +12,18 @@ import cn.com.ctop.crawler.modules.douyin.service.DouyinMusicService;
|
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouTemplate;
|
|
|
import cn.com.ctop.kuaishou.modules.batch.service.*;
|
|
|
import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
|
|
|
-import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
|
|
|
+import cn.com.ctop.kuaishou.modules.material.entity.KuaishouAccessToken;
|
|
|
+import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
|
|
|
+import cn.com.ctop.kuaishou.modules.report.service.*;
|
|
|
+import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
|
|
|
import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
|
|
|
import cn.com.ctop.toutiao.modules.material.service.IBytedanceEffectVideoInfoService;
|
|
|
-import cn.com.ctop.toutiao.modules.report.entity.BytedanceAccountReportTaskRecord;
|
|
|
import cn.com.ctop.toutiao.modules.report.mapper.BytedanceReportMaterialDailyMapper;
|
|
|
import cn.com.ctop.toutiao.modules.report.service.*;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.xxl.job.core.context.XxlJobHelper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.ibatis.annotations.Param;
|
|
@@ -28,12 +32,16 @@ import org.jeecg.common.util.DateUtils;
|
|
|
import org.quartz.JobExecutionException;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
@@ -50,7 +58,7 @@ import static org.jeecg.common.util.DateUtils.getAnotherDay;
|
|
|
@RequestMapping("/test")
|
|
|
@Slf4j
|
|
|
public class TestController {
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private CtopOauthTokenMapper tokenMapper;
|
|
|
@Autowired
|
|
|
private IKuaishouInterfaceService kuaishouInterfaceService;
|
|
@@ -63,8 +71,6 @@ public class TestController {
|
|
|
@Autowired
|
|
|
private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
|
|
|
@Autowired
|
|
|
- private CtopOauthTokenMapper oauthTokenMapper;
|
|
|
- @Autowired
|
|
|
private IKuaiShouHistoryReportTaskService historyReportTaskService;
|
|
|
@Autowired
|
|
|
private IMaterialInfoService materialInfoService;
|
|
@@ -77,8 +83,6 @@ public class TestController {
|
|
|
@Autowired
|
|
|
private IMaterialImageInfoService iMaterialImageInfoService;
|
|
|
@Autowired
|
|
|
- private IBytedanceReportService bytedanceReportService;
|
|
|
- @Autowired
|
|
|
private IKuaishouInterfaceService2 kuaishouInterfaceService2;
|
|
|
@Autowired
|
|
|
private IUserAllocationService userAllocationService;
|
|
@@ -102,18 +106,187 @@ public class TestController {
|
|
|
private IBytedanceAccountReportTaskRecordService reportTaskRecordService;
|
|
|
@Resource
|
|
|
private BytedanceReportMaterialDailyMapper bytedanceReportMaterialDailyMapper;
|
|
|
+ @Autowired
|
|
|
+ private ICtopOauthTokenService ctopOauthTokenService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBindAccountAuthService bindAccountAuthService;
|
|
|
+ @Resource
|
|
|
+ private UserAllocationMapper allocationMapper;
|
|
|
+ @Autowired
|
|
|
+ private IBytedanceReportService bytedanceReportService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IUserAllocationService allocationService;
|
|
|
+ @Autowired
|
|
|
+ private IEtlKuaiShouNewlyService kuaiShouNewlyService;
|
|
|
+ static ExecutorService materialExecutorService = Executors.newFixedThreadPool(8);
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICtopOauthTokenService tokenService;
|
|
|
+ @Autowired
|
|
|
+ private IEtlKuaiShouGroupDailyReportService etlKuaiShouGroupDailyReportService;
|
|
|
+ @Autowired
|
|
|
+ private IEtlKuaiShouAccountMaterialOverviewService accountMaterialOverviewService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IEtlKuaiShouNewlyService newlyService;
|
|
|
+ @Autowired
|
|
|
+ private IKuaishouReportDailyGroupService reportDailyGroupService;
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/cleanNewlyData")
|
|
|
+ public void cleanNewlyData(String startDate, String endDate) throws ParseException {
|
|
|
+
|
|
|
+
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date parse1 = simpleDateFormat.parse(startDate);
|
|
|
+ Date parse2 = simpleDateFormat.parse(endDate);
|
|
|
+ /* CtopOauthToken token = new CtopOauthToken();
|
|
|
+ token.setAccountId(9791267L);
|
|
|
+ token.setAccessToken("b8ab3b361cd30339ef7e18dcc1305123");*/
|
|
|
+
|
|
|
+ List<CtopOauthToken> ctopOauthTokens = tokenService.selectKuaiShouToken();
|
|
|
+ // kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate, "adScene");
|
|
|
+ ctopOauthTokens.forEach(token -> executorService.submit(() -> {
|
|
|
+ kuaishouInterfaceService.getAdvertiserReportDaily(token, parse1, parse2, "adScene");
|
|
|
+ }));
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/getVideoByProjectId")
|
|
|
+ public String getVideoByProjectId(Long projectId) {
|
|
|
+ QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("project_id", projectId);
|
|
|
+ List<UserAllocation> list = allocationService.list(queryWrapper);
|
|
|
+ for (UserAllocation allocation : list) {
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
|
|
|
+ kuaishouInterfaceService.getVideoList(token, null, null);
|
|
|
+ }
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/testKuaishou")
|
|
|
+ public String kuaishouCallback(@RequestParam("auth_code") String authCode, @RequestParam("state") String state) {
|
|
|
+ try {
|
|
|
+ JSONObject json = JSONObject.parseObject(state);
|
|
|
+ if (Check.isNull(json)) {
|
|
|
+ throw new Exception("回调信息为空");
|
|
|
+ }
|
|
|
+ log.info("快手授权返回信息:{}", json);
|
|
|
+ log.info("快手授权返回oauthCode:{}", authCode);
|
|
|
+ Integer agentType = json.getInteger("agentType");
|
|
|
+ Long appId = json.getLong("appId");
|
|
|
+ if (org.apache.commons.lang.StringUtils.isNotBlank(authCode)) {
|
|
|
+ KuaishouResultToken accessToken = kuaishouInterfaceService.getAccessToken(authCode, appId);
|
|
|
+ if (accessToken.getCode() != 0) {
|
|
|
+ throw new Exception("快手回调token返回错误");
|
|
|
+ }
|
|
|
+ KuaishouAccessToken token = accessToken.getData();
|
|
|
+ if (token != null) {
|
|
|
+ Long accountId = token.getAccountId();
|
|
|
+ if (Check.isNull(accountId)) {
|
|
|
+ return "授权绑定失败!";
|
|
|
+ }
|
|
|
+ Map<String, Object> advertiseBaseInfoMap = kuaishouInterfaceService.advertiserInfo(accountId, token.getAccessToken());
|
|
|
+ if ((Integer) advertiseBaseInfoMap.get("code") != 0) {
|
|
|
+ return "授权绑定失败,失败原因:" + advertiseBaseInfoMap.get("message");
|
|
|
+ }
|
|
|
+ String advertiserId = json.getString("advertiserId");
|
|
|
+ //指定分配人姓名
|
|
|
+ String userName = json.getString("userName");
|
|
|
+ // 媒体类型: 1 头条 2 快手
|
|
|
+ String mediaId = json.getString("mediaId");
|
|
|
+ //创建人
|
|
|
+ String userId = json.getString("userId");
|
|
|
+ Long projectId = json.getLong("projectId");
|
|
|
+ BigDecimal warningProportion = json.getBigDecimal("WarningProportion");
|
|
|
+ BigDecimal warningAmount = json.getBigDecimal("WarningAmount");
|
|
|
+ String systemType = json.getString("systemType");
|
|
|
+ CtopOauthToken topOauthToken = new CtopOauthToken();
|
|
|
+ topOauthToken.setId(String.valueOf(accountId));
|
|
|
+ topOauthToken.setAppId(json.getLong("appId"));
|
|
|
+ topOauthToken.setAccountId(accountId);
|
|
|
+ topOauthToken.setMediaId("2");
|
|
|
+ topOauthToken.setAdvertiserId(advertiserId);
|
|
|
+ topOauthToken.setAgentType(agentType);
|
|
|
+ topOauthToken.setAccessToken(token.getAccessToken());
|
|
|
+ long accessTokenExpireIn = token.getAccessTokenExpiresIn() * 1000L;
|
|
|
+ long now = System.currentTimeMillis();
|
|
|
+ Date accessTokenExpireInDate = new Date(now + accessTokenExpireIn);
|
|
|
+ topOauthToken.setAccessTokenExpiresIn(accessTokenExpireInDate);
|
|
|
+ topOauthToken.setRefreshToken(token.getRefreshToken());
|
|
|
+ long refreshTokenExpireIn = token.getRefreshTokenExpiresIn() * 1000L;
|
|
|
+ Date refreshTokenExpireInDate = new Date(now + refreshTokenExpireIn);
|
|
|
+ topOauthToken.setRefreshTokenExpiresIn(refreshTokenExpireInDate);
|
|
|
+ topOauthToken.setUpdateTime(new Date());
|
|
|
+ ctopOauthTokenService.saveOrUpdate(topOauthToken);
|
|
|
+ QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
|
|
|
+ userAllocationQueryWrapper.eq("account_id", accountId);
|
|
|
+ userAllocationQueryWrapper.eq("media_id", 2);
|
|
|
+ userAllocationQueryWrapper.orderByDesc("create_time");
|
|
|
+ userAllocationQueryWrapper.last("limit 1");
|
|
|
+ UserAllocation checkUserAllocation = allocationMapper.selectOne(userAllocationQueryWrapper);
|
|
|
+ if (!Check.isNull(checkUserAllocation)) {
|
|
|
+ return "授权失败,该账号已被:" + checkUserAllocation.getUserName() + " 绑定!";
|
|
|
+ }
|
|
|
+ UserAllocation userAllocation = new UserAllocation();
|
|
|
+ userAllocation.setUserName(userName);
|
|
|
+ userAllocation.setUserId(userId);
|
|
|
+ userAllocation.setAdvertiserId(advertiserId);
|
|
|
+ userAllocation.setSystemType(systemType);
|
|
|
+ // 获取快手昵称
|
|
|
+ userAllocation.setAuthName((String) advertiseBaseInfoMap.get("userName"));
|
|
|
+ userAllocation.setMediaId(mediaId);
|
|
|
+ userAllocation.setAccountId(accountId);
|
|
|
+ userAllocation.setProjectId(projectId);
|
|
|
+ userAllocation.setWarningProportion(warningProportion);
|
|
|
+ userAllocation.setWarningAmount(warningAmount);
|
|
|
+ userAllocation.setCreateTime(new Date());
|
|
|
+ userAllocation.setUpdateTime(new Date());
|
|
|
+ allocationMapper.deleteById(userAllocation.getId());
|
|
|
+ Map<String, Object> deleteUserMap = new HashMap<>();
|
|
|
+ deleteUserMap.put("advertiser_id", advertiserId);
|
|
|
+ deleteUserMap.put("account_id", accountId);
|
|
|
+ allocationMapper.deleteByMap(deleteUserMap);
|
|
|
+ int i = allocationMapper.insert(userAllocation);
|
|
|
+ if (i > 0) {
|
|
|
+ log.info("同步分配用户表完成,task_id:{},accountId:{}", state, accountId);
|
|
|
+ }
|
|
|
+ //账号绑定
|
|
|
+ bindAccountAuthService.addBindAccount(accountId, KuaishouInterfaceConstant.LOGIN_TYPE_KUAISHOU, advertiserId);
|
|
|
+ Thread t = new Thread() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ try {
|
|
|
+ kuaishouInterfaceService.loadKuaishouDataSingle(topOauthToken);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ t.start();
|
|
|
+ }
|
|
|
+ return "授权绑定成功";
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return "授权绑定失败!";
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@GetMapping("/getBytedanceMatReport")
|
|
|
- public Map<String,Object>getData(){
|
|
|
- List<BytedanceAccountReportTaskRecord> records = reportTaskRecordService.listByParams(100,"ACCOUNT_DAILY");
|
|
|
- executorService = Executors.newFixedThreadPool(1);
|
|
|
- CountDownLatch countDownLatch = new CountDownLatch(records.size());
|
|
|
- records.forEach(record -> executorService.submit(() -> {
|
|
|
+ public Map<String, Object> getData() {
|
|
|
+ List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
|
|
|
+ executorService = Executors.newFixedThreadPool(10);
|
|
|
+ CountDownLatch countDownLatch = new CountDownLatch(tokens.size());
|
|
|
+ tokens.forEach(record -> executorService.submit(() -> {
|
|
|
try {
|
|
|
-// reportService.getAdvertiserReport(record, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
-// log.info("账户数据获取完成:account:{},时间:{}-{}",record.getAccountId(),record.getStartDate(),record.getEndDate());
|
|
|
- bytedanceReportService.bytedanceMaterialReportV2(record);
|
|
|
- log.info("素材数据获取完成:account:{},时间:{}-{}",record.getAccountId(),record.getStartDate(),record.getEndDate());
|
|
|
+ reportService.getAdvertiserReport(record, DateUtils.parseDate("2021-01-01", "yyyy-MM-dd"), DateUtils.parseDate("2021-01-31", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ log.info("账户数据获取完成:account:{},时间:{}-{}", record.getAccountId(), "2021-01-01", "2020-01-31");
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
} finally {
|
|
@@ -125,14 +298,13 @@ public class TestController {
|
|
|
} catch (InterruptedException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- System.out.println("数据获取完成");
|
|
|
- bytedanceReportMaterialDailyMapper.updateImageReportCode();
|
|
|
- bytedanceReportMaterialDailyMapper.updateImageReportProjectId();
|
|
|
- bytedanceReportMaterialDailyMapper.updateImageReportProjectName();
|
|
|
- bytedanceReportMaterialDailyMapper.updateImageReportPlaneId();
|
|
|
- bytedanceReportMaterialDailyMapper.updateImageReportPlaneName();
|
|
|
- Map<String,Object> result = new HashMap<>();
|
|
|
- ResultMapUtils.setResultMap(new HashMap<>(),StatusCode.COMMON_SUCCESS);
|
|
|
+// bytedanceReportMaterialDailyMapper.updateImageReportCode();
|
|
|
+// bytedanceReportMaterialDailyMapper.updateImageReportProjectId();
|
|
|
+// bytedanceReportMaterialDailyMapper.updateImageReportProjectName();
|
|
|
+// bytedanceReportMaterialDailyMapper.updateImageReportPlaneId();
|
|
|
+// bytedanceReportMaterialDailyMapper.updateImageReportPlaneName();
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ ResultMapUtils.setResultMap(new HashMap<>(), StatusCode.COMMON_SUCCESS);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -192,7 +364,7 @@ public class TestController {
|
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
|
tokenQueryWrapper.eq("account_id", accountId);
|
|
|
- CtopOauthToken token = oauthTokenMapper.selectOne(tokenQueryWrapper);
|
|
|
+ CtopOauthToken token = tokenMapper.selectOne(tokenQueryWrapper);
|
|
|
if (!Check.isNull(token)) {
|
|
|
suzhaoService.submit(new Runnable() {
|
|
|
@Override
|
|
@@ -282,26 +454,6 @@ public class TestController {
|
|
|
|
|
|
}
|
|
|
|
|
|
- @GetMapping(value = "/getGroupReport")
|
|
|
- public void getGroupReport() throws ParseException {
|
|
|
- List<CtopOauthToken> tokens = oauthTokenService.selectKuaiShouToken();
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date parse1 = simpleDateFormat.parse("2020-09-12");
|
|
|
- Date parse2 = simpleDateFormat.parse("2020-09-17");
|
|
|
- for (CtopOauthToken token : tokens) {
|
|
|
-
|
|
|
- suzhaoService.submit(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- //1: 获取广告主信息数据
|
|
|
- kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, parse1, parse2);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
@GetMapping(value = "/syncDouyinMusicAsc")
|
|
|
public String syncDouyinMusicAsc() {
|
|
@@ -402,7 +554,7 @@ public class TestController {
|
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
|
tokenQueryWrapper.eq("account_id", accountId);
|
|
|
- CtopOauthToken ctopOauthTokens = oauthTokenMapper.selectOne(tokenQueryWrapper);
|
|
|
+ CtopOauthToken ctopOauthTokens = tokenMapper.selectOne(tokenQueryWrapper);
|
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
|
historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), startDate, endDate, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY);
|
|
|
|
|
@@ -435,7 +587,7 @@ public class TestController {
|
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
|
tokenQueryWrapper.eq("account_id", accountId);
|
|
|
- CtopOauthToken ctopOauthTokens = oauthTokenMapper.selectOne(tokenQueryWrapper);
|
|
|
+ CtopOauthToken ctopOauthTokens = tokenMapper.selectOne(tokenQueryWrapper);
|
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
|
historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), startDate, endDate, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
|
|
|
|
|
@@ -462,7 +614,7 @@ public class TestController {
|
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
|
tokenQueryWrapper.eq("account_id", accountId);
|
|
|
- CtopOauthToken ctopOauthTokens = oauthTokenMapper.selectOne(tokenQueryWrapper);
|
|
|
+ CtopOauthToken ctopOauthTokens = tokenMapper.selectOne(tokenQueryWrapper);
|
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
|
historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), statDate, statDate, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY);
|
|
|
|
|
@@ -532,162 +684,6 @@ public class TestController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @GetMapping(value = "/getSuZhao")
|
|
|
- public void getSuZhao() throws JobExecutionException {
|
|
|
- try {
|
|
|
- //1:查询当日数据
|
|
|
- QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("media_id", 2);
|
|
|
- queryWrapper.orderByDesc("create_time");
|
|
|
- List<CtopOauthToken> tokens = tokenService.list(queryWrapper);
|
|
|
- if (null == tokens || tokens.size() <= 0) {
|
|
|
- log.info("定时获取快手数据异常:未获取到可用的token");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- tokens.forEach(token -> {
|
|
|
- suzhaoService.submit(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- //1: 获取广告主信息数据
|
|
|
- log.info("获取素造素材:accountId:{}", token.getAccountId());
|
|
|
- kuaishouInterfaceService.getSuZaoList(token.getAccessToken(), token.getAccountId(), 1, null, null);
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @GetMapping(value = "/getAccountList")
|
|
|
- public void getAccountList(String startDate, String endDate) throws JobExecutionException {
|
|
|
- Thread thread = new Thread() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- try {
|
|
|
- Date start = sim.parse(startDate);
|
|
|
- Date end = sim.parse(endDate);
|
|
|
- //1:查询当日数据
|
|
|
- List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
|
|
|
- if (null == tokens || tokens.size() <= 0) {
|
|
|
- log.info("定时获取快手数据异常:未获取到可用的token");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- executorService = Executors.newFixedThreadPool(3);
|
|
|
- tokens.forEach(token -> {
|
|
|
- executorService.submit(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- //1: 获取广告主信息数据
|
|
|
- kuaishouInterfaceService.getAdvertiserReportDaily(token, start, end);
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- } catch (ParseException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- };
|
|
|
- thread.start();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @GetMapping(value = "/getVideo")
|
|
|
- public String getVideo(String startDate, String endDate) throws IOException {
|
|
|
- try {
|
|
|
- Thread thread = new Thread() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
|
- tokenQueryWrapper.eq("media_id", 2);
|
|
|
- List<CtopOauthToken> list = tokenService.list(tokenQueryWrapper);
|
|
|
- list.forEach(token -> {
|
|
|
- videoService.submit(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- try {
|
|
|
- kuaishouInterfaceService.getSuZaoList(token.getAccessToken(), token.getAccountId(), 1, null, null);
|
|
|
- kuaishouInterfaceService.getVideoList(token, null, null);
|
|
|
- Thread.sleep(5000);
|
|
|
- /*String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
- String videoEndDate = DateUtils.addDay(nowDate, -180);
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date end = simpleDateFormat.parse(nowDate);
|
|
|
- Date start = simpleDateFormat.parse(videoEndDate);
|
|
|
- List<Date> dates = DateUtils.findDates(start, end);
|
|
|
- for (int i = 0; i < dates.size(); i++) {
|
|
|
- String formatDate = simpleDateFormat.format(dates.get(i));
|
|
|
- kuaishouInterfaceService.getImageList(token, formatDate);
|
|
|
- Thread.sleep(500);
|
|
|
- }*/
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- } finally {
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- log.info("快手物料数据同步完成");
|
|
|
- }
|
|
|
- };
|
|
|
- thread.start();
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- return "Success";
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @GetMapping(value = "/getVideoByAccountId")
|
|
|
- public String getVideoByAccountId(Long accountId) throws IOException {
|
|
|
- try {
|
|
|
- Thread thread = new Thread() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
|
- tokenQueryWrapper.eq("media_id", 2);
|
|
|
- tokenQueryWrapper.eq("account_id", accountId);
|
|
|
- CtopOauthToken one = tokenService.getOne(tokenQueryWrapper);
|
|
|
- try {
|
|
|
- kuaishouInterfaceService.getSuZaoList(one.getAccessToken(), one.getAccountId(), 1, null, null);
|
|
|
- kuaishouInterfaceService.getVideoList(one, null, null);
|
|
|
- String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
- String videoEndDate = DateUtils.addDay(nowDate, -180);
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date end = simpleDateFormat.parse(nowDate);
|
|
|
- Date start = simpleDateFormat.parse(videoEndDate);
|
|
|
- List<Date> dates = DateUtils.findDates(start, end);
|
|
|
- for (int i = 0; i < dates.size(); i++) {
|
|
|
- String formatDate = simpleDateFormat.format(dates.get(i));
|
|
|
-
|
|
|
- kuaishouInterfaceService.getImageList(one, formatDate);
|
|
|
- Thread.sleep(100);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- } finally {
|
|
|
- }
|
|
|
- log.info("快手物料数据同步完成");
|
|
|
- }
|
|
|
- };
|
|
|
- thread.start();
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- return "Success";
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
@GetMapping(value = "/createCutTask")
|
|
|
public String createCutTask(String startDate, String endDate) throws IOException {
|
|
|
List<MaterialInfo> materialInfos = materialInfoService.getListByDate(startDate, endDate);
|
|
@@ -710,51 +706,21 @@ public class TestController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @GetMapping(value = "/getToken")
|
|
|
- public String getToken(Long accountId, String token, String refreshToken, Integer agentType) {
|
|
|
- oauthTokenService.getKuaiShouRefreshToken(accountId, token, refreshToken, agentType);
|
|
|
- return "Success";
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
@GetMapping(value = "/getAccountReport")
|
|
|
public String getAccountReport(Long accountId, String startDate, String endDate) throws ParseException {
|
|
|
QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
|
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
|
oauthTokenQueryWrapper.eq("account_id", accountId);
|
|
|
oauthTokenQueryWrapper.last("limit 1");
|
|
|
- CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
|
|
|
+ CtopOauthToken token = tokenMapper.selectOne(oauthTokenQueryWrapper);
|
|
|
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
Date date1 = sim.parse(startDate);
|
|
|
Date date2 = sim.parse(endDate);
|
|
|
- kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2);
|
|
|
+ // kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2);
|
|
|
return "Success";
|
|
|
}
|
|
|
|
|
|
|
|
|
- @GetMapping(value = "/getAccountReportList")
|
|
|
- public String getAccountReportList(String startDate, String endDate) {
|
|
|
- Result<String> result = new Result<>();
|
|
|
- try {
|
|
|
- SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date date1 = sim.parse(startDate);
|
|
|
- Date date2 = sim.parse(endDate);
|
|
|
- QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
|
- tokenQueryWrapper.eq("media_id", 2);
|
|
|
- List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(tokenQueryWrapper);
|
|
|
- if (!Check.isNull(ctopOauthTokens)) {
|
|
|
- for (CtopOauthToken token : ctopOauthTokens) {
|
|
|
- kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2);
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- result.setSuccess(false);
|
|
|
- }
|
|
|
- return "success";
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
@GetMapping(value = "/updateCode")
|
|
|
public String updateCode() {
|
|
|
List<MaterialInfo> list = materialInfoService.list();
|
|
@@ -819,7 +785,7 @@ public class TestController {
|
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
|
oauthTokenQueryWrapper.eq("account_id", accountId);
|
|
|
oauthTokenQueryWrapper.last("limit 1");
|
|
|
- CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
|
|
|
+ CtopOauthToken token = tokenMapper.selectOne(oauthTokenQueryWrapper);
|
|
|
String endDateStr = DateUtils.getDate("yyyy-MM-dd");
|
|
|
String startDate = DateUtils.addMonth(endDateStr, -6);
|
|
|
historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
|
|
@@ -840,7 +806,7 @@ public class TestController {
|
|
|
String startDate = DateUtils.addMonth(endDateStr, -6);
|
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
|
- List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(tokenQueryWrapper);
|
|
|
+ List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(tokenQueryWrapper);
|
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
|
for (CtopOauthToken token : ctopOauthTokens) {
|
|
|
historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-01", "2020-10-01", CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
|
|
@@ -864,7 +830,7 @@ public class TestController {
|
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
|
tokenQueryWrapper.eq("account_id", accountId);
|
|
|
- CtopOauthToken ctopOauthTokens = oauthTokenMapper.selectOne(tokenQueryWrapper);
|
|
|
+ CtopOauthToken ctopOauthTokens = tokenMapper.selectOne(tokenQueryWrapper);
|
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
|
historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
|
|
|
|
|
@@ -891,44 +857,12 @@ public class TestController {
|
|
|
return "success";
|
|
|
}
|
|
|
|
|
|
- @GetMapping(value = "/getGroupData")
|
|
|
- public String getGroupData() {
|
|
|
-
|
|
|
-
|
|
|
- Date endDate = new Date();
|
|
|
- QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
|
- tokenQueryWrapper.eq("media_id", 2);
|
|
|
- List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(tokenQueryWrapper);
|
|
|
- for (CtopOauthToken token : ctopOauthTokens) {
|
|
|
-
|
|
|
- for (int i = 0; i < 7; i++) {
|
|
|
- Date getStartDate = DateUtils.addDay(endDate, -i);
|
|
|
- //3:获取广告组信息数据
|
|
|
- kuaishouInterfaceService.getAdvertiserGroupReportHourly(token, getStartDate, getStartDate);
|
|
|
- }
|
|
|
- for (int i = 0; i < 6; i++) {
|
|
|
- Date getStartDate = new Date();
|
|
|
- Date getEndDate = new Date();
|
|
|
- if (i == 0) {
|
|
|
- getStartDate = DateUtils.addDay(endDate, -175 + i * 30);
|
|
|
- getEndDate = DateUtils.addDay(endDate, -150 + i * 30);
|
|
|
- } else {
|
|
|
- getStartDate = DateUtils.addDay(endDate, -180 + i * 30);
|
|
|
- getEndDate = DateUtils.addDay(endDate, -150 + i * 30);
|
|
|
- }
|
|
|
- //3:获取广告组信息数据
|
|
|
- kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, getStartDate, getEndDate);
|
|
|
- }
|
|
|
- }
|
|
|
- return "Success";
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
@GetMapping(value = "/gerCreative")
|
|
|
public void gerCreative() {
|
|
|
QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
|
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
|
- List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(oauthTokenQueryWrapper);
|
|
|
+ List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(oauthTokenQueryWrapper);
|
|
|
for (CtopOauthToken token : ctopOauthTokens) {
|
|
|
executorService.submit(new Runnable() {
|
|
|
@Override
|
|
@@ -1001,7 +935,7 @@ public class TestController {
|
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
|
oauthTokenQueryWrapper.eq("account_id", accountId);
|
|
|
oauthTokenQueryWrapper.last("limit 1");
|
|
|
- CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
|
|
|
+ CtopOauthToken token = tokenMapper.selectOne(oauthTokenQueryWrapper);
|
|
|
try {
|
|
|
// kuaishouInterfaceService.getCampaignList(token, null, null);
|
|
|
//1:获取全量广告组数据
|
|
@@ -1013,13 +947,6 @@ public class TestController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IBytedancePlanDailyReportService planDailyReportService;
|
|
|
- @Autowired
|
|
|
- private ICtopOauthTokenService tokenService;
|
|
|
-
|
|
|
-
|
|
|
@Autowired
|
|
|
private IByteDanceAdvertiserDataService advertiserDataService;
|
|
|
|
|
@@ -1048,38 +975,6 @@ public class TestController {
|
|
|
private IBytedancePlanHourlyReportService planHourlyReportService;
|
|
|
|
|
|
|
|
|
- @GetMapping(value = "/AccountReportByAccount")
|
|
|
- public void AccountReportByAccount(Long accountId, String startDateStr, String endDateStr) {
|
|
|
- QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
|
|
|
- oauthTokenQueryWrapper.eq("media_id", 2);
|
|
|
- oauthTokenQueryWrapper.eq("account_id", accountId);
|
|
|
- oauthTokenQueryWrapper.last("limit 1");
|
|
|
- CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
|
|
|
- executorService.submit(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- try {
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date startDate = null;
|
|
|
- Date endDate = null;
|
|
|
- try {
|
|
|
- startDate = simpleDateFormat.parse(startDateStr);
|
|
|
- endDate = simpleDateFormat.parse(endDateStr);
|
|
|
- } catch (ParseException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- kuaishouInterfaceService.getAdvertiserReportDaily(token, startDate, endDate);
|
|
|
-
|
|
|
- Thread.sleep(1 * 200);
|
|
|
- // kuaishouInterfaceService.getAppList(token.getAccountId(), token.getAccessToken());
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
@GetMapping(value = "/getAllCreativeList")
|
|
|
public void getAllCreativeList() {
|
|
|
|
|
@@ -1088,7 +983,7 @@ public class TestController {
|
|
|
|
|
|
QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
|
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
|
- List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(oauthTokenQueryWrapper);
|
|
|
+ List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(oauthTokenQueryWrapper);
|
|
|
|
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
|
for (CtopOauthToken token : ctopOauthTokens) {
|
|
@@ -1118,7 +1013,7 @@ public class TestController {
|
|
|
|
|
|
QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
|
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
|
- List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(oauthTokenQueryWrapper);
|
|
|
+ List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(oauthTokenQueryWrapper);
|
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
|
for (CtopOauthToken token : ctopOauthTokens) {
|
|
|
executorService.submit(new Runnable() {
|
|
@@ -1138,27 +1033,6 @@ public class TestController {
|
|
|
|
|
|
}
|
|
|
|
|
|
- @GetMapping(value = "/KuaishouDailyAccountReportLoadJob")
|
|
|
- public void KuaishouDailyAccountReportLoadJob() {
|
|
|
- Date getDate = DateUtils.addDay(new Date(), -2);
|
|
|
- //1:查询当日数据
|
|
|
- List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
|
|
|
- if (null == tokens || tokens.size() <= 0) {
|
|
|
- log.info("定时获取快手数据异常:未获取到可用的token");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- executorService = Executors.newFixedThreadPool(3);
|
|
|
- tokens.forEach(token -> {
|
|
|
- executorService.submit(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- //1: 获取广告主信息数据
|
|
|
- kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate);
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
|
|
|
@Autowired
|
|
|
private IBytedanceEffectVideoInfoService effectVideoInfoService;
|
|
@@ -1327,4 +1201,80 @@ public class TestController {
|
|
|
ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping("loadMatData")
|
|
|
+ public Map<String, Object> getData(String startDate, String endDate, Long accountId) {
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
|
|
|
+ Date start = DateUtils.parseDate(startDate, "yyyy-MM-dd");
|
|
|
+ int days = DateUtils.getdaysOfTwoDate(startDate, endDate) + 1;
|
|
|
+ for (int i = 0; i < days; i++) {
|
|
|
+ String getDate = DateUtils.formatDate(DateUtils.addDay(start, i));
|
|
|
+ bytedanceReportService.bytedanceMaterialReport(token, getDate, getDate);
|
|
|
+ }
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("loadAccountData")
|
|
|
+ public Map<String, Object> getData(Long accountId) {
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
|
|
|
+ reportService.getAdvertiserReport(token, DateUtils.parseDate("2021-01-01", "yyyy-MM-dd"), DateUtils.parseDate("2021-01-31", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ IBytedanceVideoReportService bytedanceVideoReportService;
|
|
|
+ @Autowired
|
|
|
+ IETLReportBytedanceVideoService etlReportBytedanceVideoService;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IKuaishouAudienceReportDailyService kuaishouAudienceReportDailyService;
|
|
|
+ @Autowired
|
|
|
+ private IKuaiShouGroupService kuaiShouGroupService;
|
|
|
+ @Autowired
|
|
|
+ private IKuaishouStrategyService kuaishouStrategyService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 勿动勿删,煜一人群报表数据拉取接口。
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return void
|
|
|
+ * @throws
|
|
|
+ * @author ZHAOXA
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/getAudienceData")
|
|
|
+ public Result getAudienceData(@RequestBody JSONObject request) throws Exception {
|
|
|
+ Long accountId = request.getLong("accountId");
|
|
|
+ Long planId = request.getLong("planId");
|
|
|
+ Long unitId = request.getLong("unitId");
|
|
|
+ String type = request.getString("type");
|
|
|
+ String startTime = request.getString("startTime");
|
|
|
+ String endTime = request.getString("endTime");
|
|
|
+ if (Check.isNull(accountId) || Check.isNull(planId) || Check.isNull(unitId) || Check.isNull(type) || Check.isNull(endTime) || Check.isNull(startTime)) {
|
|
|
+ return Result.error("缺少参数");
|
|
|
+ }
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
|
|
|
+ List<String> dayList = new ArrayList<>();
|
|
|
+ if (startTime.equals(endTime)) {
|
|
|
+ dayList.add(startTime);
|
|
|
+ } else {
|
|
|
+ dayList = DateUtils.getDays(startTime, endTime);
|
|
|
+ }
|
|
|
+ ExecutorService executorServic1e = Executors.newFixedThreadPool(8);
|
|
|
+ int page = 1;
|
|
|
+ int pageSize = 2000;
|
|
|
+ dayList.forEach(date -> executorServic1e.submit(() -> {
|
|
|
+ try {
|
|
|
+ kuaishouAudienceReportDailyService.crowdAnalysisReport(token, date, type, planId, unitId, page, pageSize);
|
|
|
+ Thread.sleep(500);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ log.error("获取人群消息异常", e);
|
|
|
+ }
|
|
|
+ }));
|
|
|
+ return Result.ok("success");
|
|
|
+ }
|
|
|
}
|