|
@@ -9,17 +9,26 @@ import cn.com.ctop.common.module.vo.ResFileDTO;
|
|
|
import cn.com.ctop.crawler.modules.core.entity.CrawlerDouyinMusicTask;
|
|
|
import cn.com.ctop.crawler.modules.core.service.CrawlerDouyinMusicTaskService;
|
|
|
import cn.com.ctop.crawler.modules.douyin.service.DouyinMusicService;
|
|
|
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
|
|
|
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAdvertiserStrategyService;
|
|
|
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouCreateCreativeService;
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
|
|
|
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.material.entity.KuaishouAccessToken;
|
|
|
import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
|
|
|
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouProjectData;
|
|
|
import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
|
|
|
+import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouProjectDataService;
|
|
|
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouAudienceReportDailyService;
|
|
|
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyGroupService;
|
|
|
import cn.com.ctop.manage.modules.material.service.IMaterialUploadService;
|
|
|
+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;
|
|
@@ -31,10 +40,8 @@ import org.jeecg.common.api.vo.Result;
|
|
|
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.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.IOException;
|
|
@@ -56,7 +63,7 @@ import static org.jeecg.common.util.DateUtils.getAnotherDay;
|
|
|
@RequestMapping("/test")
|
|
|
@Slf4j
|
|
|
public class TestController {
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private CtopOauthTokenMapper tokenMapper;
|
|
|
@Autowired
|
|
|
private IKuaishouInterfaceService kuaishouInterfaceService;
|
|
@@ -69,8 +76,6 @@ public class TestController {
|
|
|
@Autowired
|
|
|
private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
|
|
|
@Autowired
|
|
|
- private CtopOauthTokenMapper oauthTokenMapper;
|
|
|
- @Autowired
|
|
|
private IKuaiShouHistoryReportTaskService historyReportTaskService;
|
|
|
@Autowired
|
|
|
private IMaterialInfoService materialInfoService;
|
|
@@ -83,8 +88,6 @@ public class TestController {
|
|
|
@Autowired
|
|
|
private IMaterialImageInfoService iMaterialImageInfoService;
|
|
|
@Autowired
|
|
|
- private IBytedanceReportService bytedanceReportService;
|
|
|
- @Autowired
|
|
|
private IKuaishouInterfaceService2 kuaishouInterfaceService2;
|
|
|
@Autowired
|
|
|
private IUserAllocationService userAllocationService;
|
|
@@ -96,40 +99,321 @@ public class TestController {
|
|
|
private MusicInfoService musicInfoService;
|
|
|
@Autowired
|
|
|
private IKuaiShouHistoryReportTaskService kuaiShouHistoryReportTaskService;
|
|
|
- @Autowired
|
|
|
- private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
|
|
|
-
|
|
|
|
|
|
- static ExecutorService executorService = Executors.newFixedThreadPool(10);
|
|
|
- static ExecutorService videoService = Executors.newFixedThreadPool(5);
|
|
|
+ static ExecutorService executorService = Executors.newFixedThreadPool(5);
|
|
|
static ExecutorService suzhaoService = Executors.newFixedThreadPool(5);
|
|
|
@Autowired
|
|
|
private IKuaiShouDailyAgentService dailyAgentService;
|
|
|
@Autowired
|
|
|
private IKuaishouTemplateService templateService;
|
|
|
@Autowired
|
|
|
- private IBytedanceAccountReportTaskRecordService reportTaskRecordService;
|
|
|
+ private ICtopOauthTokenService ctopOauthTokenService;
|
|
|
+ @Autowired
|
|
|
+ private IBindAccountAuthService bindAccountAuthService;
|
|
|
@Resource
|
|
|
- private BytedanceReportMaterialDailyMapper bytedanceReportMaterialDailyMapper;
|
|
|
+ private UserAllocationMapper allocationMapper;
|
|
|
@Autowired
|
|
|
- private ICtopOauthTokenService ctopOauthTokenService;
|
|
|
+ private IBytedanceReportService bytedanceReportService;
|
|
|
+ @Autowired
|
|
|
+ private IUserAllocationService allocationService;
|
|
|
+ @Autowired
|
|
|
+ private ICtopOauthTokenService tokenService;
|
|
|
|
|
|
@Autowired
|
|
|
- private IBindAccountAuthService bindAccountAuthService;
|
|
|
+ private IKuaiShouProjectDataService kuaiShouProjectDataService;
|
|
|
@Autowired
|
|
|
- private UserAllocationMapper allocationMapper;
|
|
|
+ private IKuaishouReportHourlyGroupService hourlyGroupService;
|
|
|
+ @Autowired
|
|
|
+ private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IKuaiShouCreativeService creativeService;
|
|
|
+ @Autowired
|
|
|
+ private IKuaiShouGroupService groupService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBatchService batchService;
|
|
|
+ static ExecutorService videoService = Executors.newFixedThreadPool(3);
|
|
|
@Autowired
|
|
|
private IMaterialUploadService materialUploadService;
|
|
|
|
|
|
+ @Value("${xxl-job.requestUrl}")
|
|
|
+ private String jobUrl;
|
|
|
+
|
|
|
@GetMapping("/uploadVideo")
|
|
|
public String uploadVideo(Long projectId) {
|
|
|
+
|
|
|
+ System.err.println(jobUrl + "/jeecg-boot/ai/create/customCreativeLimit");
|
|
|
+
|
|
|
// 832
|
|
|
- JSONArray idList = materialInfoService.getIdListByProject(projectId);
|
|
|
+ JSONArray idList = materialInfoService.getIdListByProject(832L);
|
|
|
JSONArray accountArray = new JSONArray();
|
|
|
- accountArray.add(9882357L);
|
|
|
- accountArray.add(9884574L);
|
|
|
|
|
|
- materialUploadService.uploadAccount("2", idList, accountArray, "2e3b982046a44b5faadaa77a7c0da114");
|
|
|
+ accountArray.add(9549277L);
|
|
|
+ accountArray.add(9635234L);
|
|
|
+ accountArray.add(9767697L);
|
|
|
+ accountArray.add(9825207L);
|
|
|
+
|
|
|
+
|
|
|
+ materialUploadService.uploadAccount("2", idList, accountArray, "2e3b982046a44b5faadaa77a7c0da114", true);
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping(value = "/getProgramCreative")
|
|
|
+ public void getProgramCreative() {
|
|
|
+ List<Long> list = new ArrayList();
|
|
|
+ list.add(10045052L);
|
|
|
+ list.add(10045823L);
|
|
|
+ list.add(10045830L);
|
|
|
+ list.add(10045831L);
|
|
|
+
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ Long accountId = list.get(i);
|
|
|
+ CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
|
|
|
+ creativeService.getProgramCreative(oauthToken, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping(value = "/campaignList")
|
|
|
+ public void campaignList() {
|
|
|
+ List<Long> list = new ArrayList();
|
|
|
+ list.add(10045052L);
|
|
|
+ list.add(10045823L);
|
|
|
+ list.add(10045830L);
|
|
|
+ list.add(10045831L);
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ Long accountId = list.get(i);
|
|
|
+ CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
|
|
|
+ // kuaishouInterfaceService.getCampaignList(oauthToken, null, null);
|
|
|
+ videoService.submit(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ try {
|
|
|
+ kuaishouInterfaceService.getCampaignList(oauthToken, null, null);
|
|
|
+ // kuaishouInterfaceService.getGroupList(oauthToken, null, null);
|
|
|
+ // kuaishouInterfaceService.getCreativeList(oauthToken, null, null);
|
|
|
+ Thread.sleep(1500);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping(value = "/creativeList")
|
|
|
+ public void creativeList() {
|
|
|
+ List<Long> list = new ArrayList();
|
|
|
+ list.add(10045052L);
|
|
|
+ list.add(10045823L);
|
|
|
+ list.add(10045830L);
|
|
|
+ list.add(10045831L);
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ Long accountId = list.get(i);
|
|
|
+ CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
|
|
|
+ QueryWrapper<KuaiShouCampaign> campaignQueryWrapper = new QueryWrapper<>();
|
|
|
+ campaignQueryWrapper.eq("account_id", accountId);
|
|
|
+
|
|
|
+ List<KuaiShouCampaign> list1 = campaignService.list(campaignQueryWrapper);
|
|
|
+ for (KuaiShouCampaign campaign : list1) {
|
|
|
+ executorService.submit(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ kuaishouInterfaceService.getCreativeList(oauthToken, null, null);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ try {
|
|
|
+ Thread.sleep(400L);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping(value = "/updateUnit")
|
|
|
+ public void updateUnit() throws Exception {
|
|
|
+ List<Long> list = new ArrayList();
|
|
|
+ list.add(9556344L);
|
|
|
+ list.add(9743738L);
|
|
|
+ list.add(9743727L);
|
|
|
+ list.add(9812671L);
|
|
|
+ list.add(9838554L);
|
|
|
+ list.add(9743746L);
|
|
|
+ list.add(9767055L);
|
|
|
+ list.add(9556274L);
|
|
|
+ list.add(9767096L);
|
|
|
+ list.add(9792538L);
|
|
|
+ list.add(9766952L);
|
|
|
+ list.add(9677440L);
|
|
|
+ list.add(9677334L);
|
|
|
+ list.add(9556465L);
|
|
|
+ list.add(9677236L);
|
|
|
+ list.add(9556227L);
|
|
|
+ list.add(9556188L);
|
|
|
+ list.add(9556431L);
|
|
|
+ list.add(9677408L);
|
|
|
+ list.add(9677284L);
|
|
|
+
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ Long accountId = list.get(i);
|
|
|
+ CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
|
|
|
+ QueryWrapper<KuaiShouGroup> groupQueryWrapper = new QueryWrapper<>();
|
|
|
+ groupQueryWrapper.eq("account_id", accountId);
|
|
|
+ // groupQueryWrapper.ne("schedule_time","000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111");
|
|
|
+ // groupQueryWrapper.eq("use_app_market", 1);
|
|
|
+ // groupQueryWrapper.gt("cpa_bid", 19000);
|
|
|
+
|
|
|
+
|
|
|
+ List<KuaiShouGroup> list1 = groupService.list(groupQueryWrapper);
|
|
|
+ /* for (KuaiShouGroup group : list1) {
|
|
|
+
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ json.put("unitId", group.getUnitId());
|
|
|
+ json.put("useAppMarket", 0);
|
|
|
+ json.put("appStore", new JSONArray());
|
|
|
+ batchService.updateUnit(json, oauthToken);
|
|
|
+ }*/
|
|
|
+
|
|
|
+ for (KuaiShouGroup group : list1) {
|
|
|
+ executorService.submit(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ try {
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ json.put("unitId", group.getUnitId());
|
|
|
+ json.put("cpaBid", 18 * 1000);
|
|
|
+ // json.put("gender", "2");
|
|
|
+ batchService.updateUnit(json, oauthToken);
|
|
|
+ Thread.sleep(1500);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping(value = "/updateCreative")
|
|
|
+ public void updateCreative() {
|
|
|
+ List<Long> list = new ArrayList();
|
|
|
+ list.add(10045052L);
|
|
|
+ list.add(10045823L);
|
|
|
+ list.add(10045830L);
|
|
|
+ list.add(10045831L);
|
|
|
+
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ Long accountId = list.get(i);
|
|
|
+ CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
|
|
|
+
|
|
|
+
|
|
|
+ QueryWrapper<KuaiShouCreative> creativeQueryWrapper = new QueryWrapper<>();
|
|
|
+ creativeQueryWrapper.eq("account_id", accountId);
|
|
|
+
|
|
|
+
|
|
|
+ List<KuaiShouCreative> creativeList = creativeService.list(creativeQueryWrapper);
|
|
|
+ for (KuaiShouCreative creative : creativeList) {
|
|
|
+ executorService.submit(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ try {
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ json.put("creativeId", creative.getCreativeId());
|
|
|
+ String url = "https://click-wailaxin.1sapp.com/vendor/feedback/reportClick?platform=kuaishou&feedback_type=android&account_id=19&plan_id=__DID__&adgroup_id=__AID__&creative_id=__CID__&imei=__IMEI2__&mac=__MAC__&androidid=__ANDROIDID2__&ts=__TS__&ip=__IP__&ua=__UA__&callback=__CALLBACK__&oaid=__OAID__&app=dxqlb";
|
|
|
+
|
|
|
+ if (creative.getCreativeMaterialType() == 1) {
|
|
|
+ json.put("clickTrackUrl", url);
|
|
|
+ } else if (creative.getCreativeMaterialType() == 4) {
|
|
|
+ json.put("impressionUrl", url);
|
|
|
+ json.put("clickTrackUrl", url);
|
|
|
+
|
|
|
+ }
|
|
|
+ JSONObject jsonObject = batchService.updateCreative(json, oauthToken);
|
|
|
+ log.info("修改创意返回信息:creative:{},结果:{}", creative.getCreativeId(), jsonObject);
|
|
|
+ Thread.sleep(1000L);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/cleanNewlyData")
|
|
|
+ public void cleanNewlyData(String startDate, String endDate) throws ParseException {
|
|
|
+
|
|
|
+
|
|
|
+ String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
+ String yesterday = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
|
|
|
+ //1:查询当日数据
|
|
|
+ QueryWrapper<KuaiShouProjectData> queryWrapper = new QueryWrapper();
|
|
|
+ queryWrapper.eq("project_status", 0);
|
|
|
+ List<KuaiShouProjectData> list = kuaiShouProjectDataService.list(queryWrapper);
|
|
|
+ if (Check.isNull(list)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (KuaiShouProjectData projectData : list) {
|
|
|
+ Long projectId = projectData.getProjectId();
|
|
|
+ if (Check.isNull(projectId)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ QueryWrapper<UserAllocation> allocationQueryWrapper = new QueryWrapper<>();
|
|
|
+ allocationQueryWrapper.eq("project_id", projectId);
|
|
|
+ allocationQueryWrapper.eq("account_status", 0);
|
|
|
+ List<UserAllocation> accountIds = allocationService.list(allocationQueryWrapper);
|
|
|
+ if (Check.isNull(accountIds)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ for (UserAllocation allocation : accountIds) {
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
|
|
|
+ if (Check.isNull(token)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ executorService.submit(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), yesterday, yesterday, "HOURLY", 1);
|
|
|
+
|
|
|
+ // hourlyGroupService.getAdvertiserGroupReportHourly(token.getAccountId(), token.getAccessToken(), yesterday, yesterday);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @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";
|
|
|
}
|
|
|
|
|
@@ -246,15 +530,13 @@ public class TestController {
|
|
|
|
|
|
@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(() -> {
|
|
|
+ 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 {
|
|
@@ -266,10 +548,6 @@ public class TestController {
|
|
|
} catch (InterruptedException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- System.out.println("数据获取完成");
|
|
|
-
|
|
|
- bytedanceReportMaterialDailyMapper.updateImageReportPlaneId();
|
|
|
- bytedanceReportMaterialDailyMapper.updateImageReportPlaneName();
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
ResultMapUtils.setResultMap(new HashMap<>(), StatusCode.COMMON_SUCCESS);
|
|
|
return result;
|
|
@@ -331,7 +609,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
|
|
@@ -513,7 +791,6 @@ public class TestController {
|
|
|
|
|
|
QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
|
|
|
userAllocationQueryWrapper.eq("project_id", projectId);
|
|
|
- // userAllocationQueryWrapper.eq("account_status", 0);
|
|
|
List<UserAllocation> list = userAllocationService.list(userAllocationQueryWrapper);
|
|
|
if (!Check.isNull(list)) {
|
|
|
for (UserAllocation allocation : list) {
|
|
@@ -521,7 +798,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);
|
|
|
|
|
@@ -554,7 +831,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);
|
|
|
|
|
@@ -581,7 +858,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);
|
|
|
|
|
@@ -651,9 +928,6 @@ public class TestController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
@GetMapping(value = "/createCutTask")
|
|
|
public String createCutTask(String startDate, String endDate) throws IOException {
|
|
|
List<MaterialInfo> materialInfos = materialInfoService.getListByDate(startDate, endDate);
|
|
@@ -676,11 +950,19 @@ public class TestController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- /* @GetMapping(value = "/getToken")
|
|
|
- public String getToken(Long accountId, String token, String refreshToken, Integer agentType) {
|
|
|
- oauthTokenService.getKuaiShouRefreshToken(accountId, token, refreshToken, agentType);
|
|
|
+ @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 = 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);
|
|
|
return "Success";
|
|
|
- }*/
|
|
|
+ }
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/updateCode")
|
|
@@ -747,7 +1029,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);
|
|
@@ -768,7 +1050,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);
|
|
@@ -784,17 +1066,16 @@ public class TestController {
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/getHistoryDataByAccountId")
|
|
|
- public String getHistoryDataByAccountId(Long accountId) {
|
|
|
+ public String getHistoryDataByAccountId(Long accountId, String startDte, String endDate) {
|
|
|
Result<String> result = new Result<>();
|
|
|
try {
|
|
|
- String endDateStr = DateUtils.getDate("yyyy-MM-dd");
|
|
|
- String startDate = DateUtils.addMonth(endDateStr, -6);
|
|
|
+
|
|
|
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);
|
|
|
+ historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), startDte, endDate, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
|
|
|
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@@ -824,7 +1105,7 @@ public class TestController {
|
|
|
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
|
|
@@ -897,7 +1178,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:获取全量广告组数据
|
|
@@ -909,13 +1190,6 @@ public class TestController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IBytedancePlanDailyReportService planDailyReportService;
|
|
|
- @Autowired
|
|
|
- private ICtopOauthTokenService tokenService;
|
|
|
-
|
|
|
-
|
|
|
@Autowired
|
|
|
private IByteDanceAdvertiserDataService advertiserDataService;
|
|
|
|
|
@@ -952,7 +1226,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) {
|
|
@@ -982,7 +1256,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() {
|
|
@@ -1170,4 +1444,124 @@ 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");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IAiKuaishouAdvertiserStrategyService strategyService;
|
|
|
+ @Autowired
|
|
|
+ private IAiKuaishouCreateCreativeService createCreativeService;
|
|
|
+
|
|
|
+ @GetMapping("testCreateCreative")
|
|
|
+ public Map<String, Object> testCreateCreative(Long accountId, Integer createType) {
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ AiKuaishouAdvertiserStrategy strategy = strategyService.getByAccountId(accountId);
|
|
|
+ if (strategy == null) {
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ createCreativeService.autoCreateCreative(strategy, createType, 150L);
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("testProgramCreative")
|
|
|
+ public Map<String, Object> testProgramCreative(Long accountId, Integer createType) {
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ AiKuaishouAdvertiserStrategy strategy = strategyService.getByAccountId(accountId);
|
|
|
+ if (strategy == null) {
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ createCreativeService.autoCreateProgramCreative(strategy, createType, 150L);
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("testCreateCreativeLimit")
|
|
|
+ public Map<String, Object> testCreateCreativeLimit(Long accountId, Integer hour) throws ParseException {
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ AiKuaishouAdvertiserStrategy strategy = strategyService.getByAccountId(accountId);
|
|
|
+ if (strategy == null) {
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ createCreativeService.customCreativeSupplement(strategy, hour);
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|