|
@@ -2,6 +2,7 @@ package org.jeecg.modules.ctop.controller;
|
|
|
|
|
|
import cn.com.ctop.common.module.entity.*;
|
|
import cn.com.ctop.common.module.entity.*;
|
|
import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
|
|
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.service.*;
|
|
import cn.com.ctop.common.module.utils.*;
|
|
import cn.com.ctop.common.module.utils.*;
|
|
import cn.com.ctop.common.module.vo.ResFileDTO;
|
|
import cn.com.ctop.common.module.vo.ResFileDTO;
|
|
@@ -11,6 +12,8 @@ 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.entity.KuaishouTemplate;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.*;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.*;
|
|
import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
|
|
import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
|
|
|
|
+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.IKuaiShouDailyAgentService;
|
|
import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
|
|
import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
|
|
import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
|
|
import cn.com.ctop.toutiao.modules.material.service.IBytedanceEffectVideoInfoService;
|
|
import cn.com.ctop.toutiao.modules.material.service.IBytedanceEffectVideoInfoService;
|
|
@@ -29,11 +32,15 @@ import org.quartz.JobExecutionException;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
|
|
+import java.math.BigDecimal;
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -63,8 +70,6 @@ public class TestController {
|
|
@Autowired
|
|
@Autowired
|
|
private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
|
|
private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
|
|
@Autowired
|
|
@Autowired
|
|
- private CtopOauthTokenMapper oauthTokenMapper;
|
|
|
|
- @Autowired
|
|
|
|
private IKuaiShouHistoryReportTaskService historyReportTaskService;
|
|
private IKuaiShouHistoryReportTaskService historyReportTaskService;
|
|
@Autowired
|
|
@Autowired
|
|
private IMaterialInfoService materialInfoService;
|
|
private IMaterialInfoService materialInfoService;
|
|
@@ -77,8 +82,6 @@ public class TestController {
|
|
@Autowired
|
|
@Autowired
|
|
private IMaterialImageInfoService iMaterialImageInfoService;
|
|
private IMaterialImageInfoService iMaterialImageInfoService;
|
|
@Autowired
|
|
@Autowired
|
|
- private IBytedanceReportService bytedanceReportService;
|
|
|
|
- @Autowired
|
|
|
|
private IKuaishouInterfaceService2 kuaishouInterfaceService2;
|
|
private IKuaishouInterfaceService2 kuaishouInterfaceService2;
|
|
@Autowired
|
|
@Autowired
|
|
private IUserAllocationService userAllocationService;
|
|
private IUserAllocationService userAllocationService;
|
|
@@ -102,18 +105,133 @@ public class TestController {
|
|
private IBytedanceAccountReportTaskRecordService reportTaskRecordService;
|
|
private IBytedanceAccountReportTaskRecordService reportTaskRecordService;
|
|
@Resource
|
|
@Resource
|
|
private BytedanceReportMaterialDailyMapper bytedanceReportMaterialDailyMapper;
|
|
private BytedanceReportMaterialDailyMapper bytedanceReportMaterialDailyMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICtopOauthTokenService ctopOauthTokenService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IBindAccountAuthService bindAccountAuthService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private UserAllocationMapper allocationMapper;
|
|
|
|
+
|
|
|
|
+ @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")
|
|
@GetMapping("/getBytedanceMatReport")
|
|
public Map<String,Object>getData(){
|
|
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(() -> {
|
|
|
|
|
|
+ List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
|
|
|
|
+ executorService = Executors.newFixedThreadPool(10);
|
|
|
|
+ CountDownLatch countDownLatch = new CountDownLatch(tokens.size());
|
|
|
|
+ tokens.forEach(record -> executorService.submit(() -> {
|
|
try {
|
|
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) {
|
|
} catch (Exception e) {
|
|
|
|
|
|
} finally {
|
|
} finally {
|
|
@@ -126,11 +244,11 @@ public class TestController {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
System.out.println("数据获取完成");
|
|
System.out.println("数据获取完成");
|
|
- bytedanceReportMaterialDailyMapper.updateImageReportCode();
|
|
|
|
- bytedanceReportMaterialDailyMapper.updateImageReportProjectId();
|
|
|
|
- bytedanceReportMaterialDailyMapper.updateImageReportProjectName();
|
|
|
|
- bytedanceReportMaterialDailyMapper.updateImageReportPlaneId();
|
|
|
|
- bytedanceReportMaterialDailyMapper.updateImageReportPlaneName();
|
|
|
|
|
|
+// bytedanceReportMaterialDailyMapper.updateImageReportCode();
|
|
|
|
+// bytedanceReportMaterialDailyMapper.updateImageReportProjectId();
|
|
|
|
+// bytedanceReportMaterialDailyMapper.updateImageReportProjectName();
|
|
|
|
+// bytedanceReportMaterialDailyMapper.updateImageReportPlaneId();
|
|
|
|
+// bytedanceReportMaterialDailyMapper.updateImageReportPlaneName();
|
|
Map<String,Object> result = new HashMap<>();
|
|
Map<String,Object> result = new HashMap<>();
|
|
ResultMapUtils.setResultMap(new HashMap<>(),StatusCode.COMMON_SUCCESS);
|
|
ResultMapUtils.setResultMap(new HashMap<>(),StatusCode.COMMON_SUCCESS);
|
|
return result;
|
|
return result;
|
|
@@ -192,7 +310,7 @@ public class TestController {
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
tokenQueryWrapper.eq("account_id", accountId);
|
|
tokenQueryWrapper.eq("account_id", accountId);
|
|
- CtopOauthToken token = oauthTokenMapper.selectOne(tokenQueryWrapper);
|
|
|
|
|
|
+ CtopOauthToken token = tokenMapper.selectOne(tokenQueryWrapper);
|
|
if (!Check.isNull(token)) {
|
|
if (!Check.isNull(token)) {
|
|
suzhaoService.submit(new Runnable() {
|
|
suzhaoService.submit(new Runnable() {
|
|
@Override
|
|
@Override
|
|
@@ -402,7 +520,7 @@ public class TestController {
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
tokenQueryWrapper.eq("account_id", accountId);
|
|
tokenQueryWrapper.eq("account_id", accountId);
|
|
- CtopOauthToken ctopOauthTokens = oauthTokenMapper.selectOne(tokenQueryWrapper);
|
|
|
|
|
|
+ CtopOauthToken ctopOauthTokens = tokenMapper.selectOne(tokenQueryWrapper);
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), startDate, endDate, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY);
|
|
historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), startDate, endDate, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY);
|
|
|
|
|
|
@@ -435,7 +553,7 @@ public class TestController {
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
tokenQueryWrapper.eq("account_id", accountId);
|
|
tokenQueryWrapper.eq("account_id", accountId);
|
|
- CtopOauthToken ctopOauthTokens = oauthTokenMapper.selectOne(tokenQueryWrapper);
|
|
|
|
|
|
+ CtopOauthToken ctopOauthTokens = tokenMapper.selectOne(tokenQueryWrapper);
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), startDate, endDate, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
|
|
historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), startDate, endDate, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
|
|
|
|
|
|
@@ -462,7 +580,7 @@ public class TestController {
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
tokenQueryWrapper.eq("account_id", accountId);
|
|
tokenQueryWrapper.eq("account_id", accountId);
|
|
- CtopOauthToken ctopOauthTokens = oauthTokenMapper.selectOne(tokenQueryWrapper);
|
|
|
|
|
|
+ CtopOauthToken ctopOauthTokens = tokenMapper.selectOne(tokenQueryWrapper);
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), statDate, statDate, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY);
|
|
historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), statDate, statDate, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY);
|
|
|
|
|
|
@@ -710,11 +828,11 @@ public class TestController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- @GetMapping(value = "/getToken")
|
|
|
|
|
|
+ /* @GetMapping(value = "/getToken")
|
|
public String getToken(Long accountId, String token, String refreshToken, Integer agentType) {
|
|
public String getToken(Long accountId, String token, String refreshToken, Integer agentType) {
|
|
oauthTokenService.getKuaiShouRefreshToken(accountId, token, refreshToken, agentType);
|
|
oauthTokenService.getKuaiShouRefreshToken(accountId, token, refreshToken, agentType);
|
|
return "Success";
|
|
return "Success";
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/getAccountReport")
|
|
@GetMapping(value = "/getAccountReport")
|
|
@@ -723,7 +841,7 @@ public class TestController {
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
oauthTokenQueryWrapper.eq("account_id", accountId);
|
|
oauthTokenQueryWrapper.eq("account_id", accountId);
|
|
oauthTokenQueryWrapper.last("limit 1");
|
|
oauthTokenQueryWrapper.last("limit 1");
|
|
- CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
|
|
|
|
|
|
+ CtopOauthToken token = tokenMapper.selectOne(oauthTokenQueryWrapper);
|
|
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
|
|
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
|
|
Date date1 = sim.parse(startDate);
|
|
Date date1 = sim.parse(startDate);
|
|
Date date2 = sim.parse(endDate);
|
|
Date date2 = sim.parse(endDate);
|
|
@@ -741,7 +859,7 @@ public class TestController {
|
|
Date date2 = sim.parse(endDate);
|
|
Date date2 = sim.parse(endDate);
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
- List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(tokenQueryWrapper);
|
|
|
|
|
|
+ List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(tokenQueryWrapper);
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
for (CtopOauthToken token : ctopOauthTokens) {
|
|
for (CtopOauthToken token : ctopOauthTokens) {
|
|
kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2);
|
|
kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2);
|
|
@@ -819,7 +937,7 @@ public class TestController {
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
oauthTokenQueryWrapper.eq("account_id", accountId);
|
|
oauthTokenQueryWrapper.eq("account_id", accountId);
|
|
oauthTokenQueryWrapper.last("limit 1");
|
|
oauthTokenQueryWrapper.last("limit 1");
|
|
- CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
|
|
|
|
|
|
+ CtopOauthToken token = tokenMapper.selectOne(oauthTokenQueryWrapper);
|
|
String endDateStr = DateUtils.getDate("yyyy-MM-dd");
|
|
String endDateStr = DateUtils.getDate("yyyy-MM-dd");
|
|
String startDate = DateUtils.addMonth(endDateStr, -6);
|
|
String startDate = DateUtils.addMonth(endDateStr, -6);
|
|
historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
|
|
historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
|
|
@@ -840,7 +958,7 @@ public class TestController {
|
|
String startDate = DateUtils.addMonth(endDateStr, -6);
|
|
String startDate = DateUtils.addMonth(endDateStr, -6);
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
- List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(tokenQueryWrapper);
|
|
|
|
|
|
+ List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(tokenQueryWrapper);
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
for (CtopOauthToken token : ctopOauthTokens) {
|
|
for (CtopOauthToken token : ctopOauthTokens) {
|
|
historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-01", "2020-10-01", CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
|
|
historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-01", "2020-10-01", CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
|
|
@@ -864,7 +982,7 @@ public class TestController {
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
tokenQueryWrapper.eq("account_id", accountId);
|
|
tokenQueryWrapper.eq("account_id", accountId);
|
|
- CtopOauthToken ctopOauthTokens = oauthTokenMapper.selectOne(tokenQueryWrapper);
|
|
|
|
|
|
+ CtopOauthToken ctopOauthTokens = tokenMapper.selectOne(tokenQueryWrapper);
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
|
|
historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
|
|
|
|
|
|
@@ -928,7 +1046,7 @@ public class TestController {
|
|
public void gerCreative() {
|
|
public void gerCreative() {
|
|
QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
- List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(oauthTokenQueryWrapper);
|
|
|
|
|
|
+ List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(oauthTokenQueryWrapper);
|
|
for (CtopOauthToken token : ctopOauthTokens) {
|
|
for (CtopOauthToken token : ctopOauthTokens) {
|
|
executorService.submit(new Runnable() {
|
|
executorService.submit(new Runnable() {
|
|
@Override
|
|
@Override
|
|
@@ -1001,7 +1119,7 @@ public class TestController {
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
oauthTokenQueryWrapper.eq("account_id", accountId);
|
|
oauthTokenQueryWrapper.eq("account_id", accountId);
|
|
oauthTokenQueryWrapper.last("limit 1");
|
|
oauthTokenQueryWrapper.last("limit 1");
|
|
- CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
|
|
|
|
|
|
+ CtopOauthToken token = tokenMapper.selectOne(oauthTokenQueryWrapper);
|
|
try {
|
|
try {
|
|
// kuaishouInterfaceService.getCampaignList(token, null, null);
|
|
// kuaishouInterfaceService.getCampaignList(token, null, null);
|
|
//1:获取全量广告组数据
|
|
//1:获取全量广告组数据
|
|
@@ -1054,7 +1172,7 @@ public class TestController {
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
oauthTokenQueryWrapper.eq("account_id", accountId);
|
|
oauthTokenQueryWrapper.eq("account_id", accountId);
|
|
oauthTokenQueryWrapper.last("limit 1");
|
|
oauthTokenQueryWrapper.last("limit 1");
|
|
- CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
|
|
|
|
|
|
+ CtopOauthToken token = tokenMapper.selectOne(oauthTokenQueryWrapper);
|
|
executorService.submit(new Runnable() {
|
|
executorService.submit(new Runnable() {
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
@@ -1088,7 +1206,7 @@ public class TestController {
|
|
|
|
|
|
QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
- List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(oauthTokenQueryWrapper);
|
|
|
|
|
|
+ List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(oauthTokenQueryWrapper);
|
|
|
|
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
for (CtopOauthToken token : ctopOauthTokens) {
|
|
for (CtopOauthToken token : ctopOauthTokens) {
|
|
@@ -1118,7 +1236,7 @@ public class TestController {
|
|
|
|
|
|
QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
oauthTokenQueryWrapper.eq("media_id", 2);
|
|
- List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(oauthTokenQueryWrapper);
|
|
|
|
|
|
+ List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(oauthTokenQueryWrapper);
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
if (!Check.isNull(ctopOauthTokens)) {
|
|
for (CtopOauthToken token : ctopOauthTokens) {
|
|
for (CtopOauthToken token : ctopOauthTokens) {
|
|
executorService.submit(new Runnable() {
|
|
executorService.submit(new Runnable() {
|