|
@@ -17,6 +17,8 @@ import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
|
|
import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
|
|
import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
|
|
|
|
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCreativeMapper;
|
|
|
|
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCreativeStatisticMapper;
|
|
import cn.com.ctop.toutiao.service.IByteDanceAdvertiserDataService;
|
|
import cn.com.ctop.toutiao.service.IByteDanceAdvertiserDataService;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -201,6 +203,75 @@ public class TestController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IUserAllocationService userAllocationService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private KuaishouReportDailyCreativeStatisticMapper reportDailyCreativeStatisticMapper;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private KuaishouReportDailyCreativeMapper reportDailyCreativeMapper;
|
|
|
|
+
|
|
|
|
+ @GetMapping(value = "/getCreativeReportByProjectId")
|
|
|
|
+ public void getCreativeReportByProjectId(Long projectId) {
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ Map<String, Object> deleteMap = new HashMap<>();
|
|
|
|
+ String date = DateUtils.getDate("yyyy-MM-dd");
|
|
|
|
+ String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", date, -1);
|
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ Date endDate = simpleDateFormat.parse(anotherDay);
|
|
|
|
+ QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ userAllocationQueryWrapper.eq("project_id", projectId);
|
|
|
|
+ List<UserAllocation> list = userAllocationService.list(userAllocationQueryWrapper);
|
|
|
|
+ if (!Check.isNull(list)) {
|
|
|
|
+ for (UserAllocation allocation : list) {
|
|
|
|
+ executorService.submit(new Runnable() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ if (!Check.isNull(allocation)) {
|
|
|
|
+
|
|
|
|
+ QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ oauthTokenQueryWrapper.eq("media_id", 2);
|
|
|
|
+ oauthTokenQueryWrapper.eq("account_id", allocation.getAccountId());
|
|
|
|
+ CtopOauthToken ctopOauthToken = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
|
|
|
|
+ if (!Check.isNull(ctopOauthToken)) {
|
|
|
|
+ deleteMap.put("account_id", allocation.getAccountId());
|
|
|
|
+ deleteMap.put("stat_date", anotherDay);
|
|
|
|
+ reportDailyCreativeStatisticMapper.deleteByMap(deleteMap);
|
|
|
|
+ reportDailyCreativeMapper.deleteByMap(deleteMap);
|
|
|
|
+
|
|
|
|
+ // 1.计划数据
|
|
|
|
+ kuaishouInterfaceService.getCampaignList(ctopOauthToken, null, null);
|
|
|
|
+ // 2:广告组数据
|
|
|
|
+ kuaishouInterfaceService.getGroupList(ctopOauthToken, null, null);
|
|
|
|
+ // 3:创意数据
|
|
|
|
+ kuaishouInterfaceService.getCreativeList(ctopOauthToken, null, null);
|
|
|
|
+
|
|
|
|
+ QueryWrapper<KuaiShouCampaign> campaignQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ campaignQueryWrapper.eq("account_id", ctopOauthToken.getAccountId());
|
|
|
|
+ List<KuaiShouCampaign> campaigns = campaignService.list(campaignQueryWrapper);
|
|
|
|
+ if (!Check.isNull(list)) {
|
|
|
|
+ for (KuaiShouCampaign campaign : campaigns) {
|
|
|
|
+ kuaishouInterfaceService.getAdvertiserCreativeReportDailyV2(campaign.getCampaignId(), ctopOauthToken, endDate, endDate);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } catch (ParseException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
@GetMapping(value = "/getPlanAndGroupByAccount")
|
|
@GetMapping(value = "/getPlanAndGroupByAccount")
|
|
public void getPlanAndGroupByAccount(Long accountId) {
|
|
public void getPlanAndGroupByAccount(Long accountId) {
|
|
QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
|
|
@@ -240,9 +311,11 @@ public class TestController {
|
|
public void run() {
|
|
public void run() {
|
|
try {
|
|
try {
|
|
System.err.println("获取创意,accountId:" + token.getAccountId());
|
|
System.err.println("获取创意,accountId:" + token.getAccountId());
|
|
|
|
+ // 1.计划数据
|
|
kuaishouInterfaceService.getCampaignList(token, null, null);
|
|
kuaishouInterfaceService.getCampaignList(token, null, null);
|
|
- //1:获取全量广告组数据
|
|
|
|
|
|
+ // 2:广告组数据
|
|
kuaishouInterfaceService.getGroupList(token, null, null);
|
|
kuaishouInterfaceService.getGroupList(token, null, null);
|
|
|
|
+ // 3:创意数据
|
|
kuaishouInterfaceService.getCreativeList(token, null, null);
|
|
kuaishouInterfaceService.getCreativeList(token, null, null);
|
|
|
|
|
|
Thread.sleep(1 * 200);
|
|
Thread.sleep(1 * 200);
|
|
@@ -280,8 +353,6 @@ public class TestController {
|
|
thread.start();
|
|
thread.start();
|
|
}
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private IUserAllocationService userAllocationService;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private IBytedancePlanDailyReportService planDailyReportService;
|
|
private IBytedancePlanDailyReportService planDailyReportService;
|