|
@@ -1,12 +1,20 @@
|
|
package org.jeecg.modules.ctop.controller;
|
|
package org.jeecg.modules.ctop.controller;
|
|
|
|
|
|
|
|
+import cn.com.ctop.bytedance.entity.BytedancePlanDailyReport;
|
|
|
|
+import cn.com.ctop.bytedance.service.IBytedancePlanDailyReportService;
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
|
|
+import cn.com.ctop.common.module.entity.UserAllocation;
|
|
import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
|
|
import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
|
|
|
|
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
|
|
+import cn.com.ctop.common.module.service.IUserAllocationService;
|
|
|
|
+import cn.com.ctop.common.module.utils.ResultMapUtils;
|
|
|
|
+import cn.com.ctop.common.module.utils.StatusCode;
|
|
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 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;
|
|
import lombok.SneakyThrows;
|
|
import lombok.SneakyThrows;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.common.util.DateUtils;
|
|
import org.jeecg.common.util.DateUtils;
|
|
import org.jeecg.modules.ctop.service.ICreateInternalService;
|
|
import org.jeecg.modules.ctop.service.ICreateInternalService;
|
|
@@ -14,10 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-import java.util.UUID;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.Executors;
|
|
|
|
|
|
@@ -26,6 +31,7 @@ import java.util.concurrent.Executors;
|
|
*/
|
|
*/
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/test")
|
|
@RequestMapping("/test")
|
|
|
|
+@Slf4j
|
|
public class TestController {
|
|
public class TestController {
|
|
@Autowired
|
|
@Autowired
|
|
private ICreateInternalService createInternalService;
|
|
private ICreateInternalService createInternalService;
|
|
@@ -243,4 +249,141 @@ public class TestController {
|
|
thread.start();
|
|
thread.start();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IUserAllocationService userAllocationService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IBytedancePlanDailyReportService planDailyReportService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICtopOauthTokenService tokenService;
|
|
|
|
+
|
|
|
|
+ @GetMapping("formatZybData")
|
|
|
|
+ public Map<String, Object> formatZybData() {
|
|
|
|
+ //清洗关于作业帮数据
|
|
|
|
+ //1:查询作业帮相关的用户数据
|
|
|
|
+ QueryWrapper<UserAllocation> wrapper = new QueryWrapper<>();
|
|
|
|
+ wrapper.eq("project_id", 215);
|
|
|
|
+ List<UserAllocation> allocations = userAllocationService.list(wrapper);
|
|
|
|
+ if (null != allocations && allocations.size() > 0) {
|
|
|
|
+ allocations.forEach(allocation -> {
|
|
|
|
+ //根据accountId和时间,查询相关的日报表信息
|
|
|
|
+ QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+// String dateString = dateFormat.format(getDate)+" 00:00:00";
|
|
|
|
+ queryWrapper.eq("advertiser_id", allocation.getAccountId())
|
|
|
|
+// .eq("stat_datetime",dateString)
|
|
|
|
+ ;
|
|
|
|
+ List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
|
|
|
|
+ if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
|
|
|
|
+ bytedancePlanDailyReports.forEach(report -> {
|
|
|
|
+ String adName = report.getAdName();
|
|
|
|
+ String[] tags = adName.split("-");
|
|
|
|
+ report.setAdsense(tags[1]);
|
|
|
|
+ report.setPlanCode(tags[2]);
|
|
|
|
+ String materialName = tags[3];
|
|
|
|
+ report.setMaterialName(materialName);
|
|
|
|
+ if (materialName.contains("其他")) {
|
|
|
|
+ report.setMaterialType("其他");
|
|
|
|
+ } else if (materialName.contains("图片轮播")) {
|
|
|
|
+ report.setMaterialType("图片轮播");
|
|
|
|
+ } else if (materialName.contains("大字报")) {
|
|
|
|
+ report.setMaterialType("大字报");
|
|
|
|
+ } else if (materialName.contains("文字动画")) {
|
|
|
|
+ report.setMaterialType("文字动画");
|
|
|
|
+ } else if (materialName.contains("采访形式")) {
|
|
|
|
+ report.setMaterialType("采访形式");
|
|
|
|
+ } else if (materialName.contains("剧情")) {
|
|
|
|
+ report.setMaterialType("剧情");
|
|
|
|
+ } else if (materialName.contains("口播")) {
|
|
|
|
+ report.setMaterialType("口播");
|
|
|
|
+ } else {
|
|
|
|
+ report.setMaterialType("其他");
|
|
|
|
+ }
|
|
|
|
+ planDailyReportService.updateById(report);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @GetMapping("formatYddData")
|
|
|
|
+ public Map<String, Object> formatYddData() throws Exception {
|
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
|
+ //清洗关于缘多多数据
|
|
|
|
+ //1:查询缘多多相关的用户数据
|
|
|
|
+ QueryWrapper<UserAllocation> yddWrapper = new QueryWrapper<>();
|
|
|
|
+ yddWrapper.eq("project_id", 113);
|
|
|
|
+ List<UserAllocation> yddallocations = userAllocationService.list(yddWrapper);
|
|
|
|
+ if (null != yddallocations && yddallocations.size() > 0) {
|
|
|
|
+ yddallocations.forEach(allocation -> {
|
|
|
|
+ //根据accountId和时间,查询相关的日报表信息
|
|
|
|
+ QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.eq("advertiser_id", allocation.getAccountId())
|
|
|
|
+ //.eq("stat_datetime",dateString)
|
|
|
|
+ ;
|
|
|
|
+ List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
|
|
|
|
+ if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
|
|
|
|
+ bytedancePlanDailyReports.forEach(report -> {
|
|
|
|
+ String adName = report.getAdName();
|
|
|
|
+ String[] tags = adName.split("-");
|
|
|
|
+ report.setChannelCode(tags[0]);
|
|
|
|
+ planDailyReportService.updateById(report);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //清洗关于缘多多数据
|
|
|
|
+ //1:查询缘多多相关的用户数据
|
|
|
|
+ QueryWrapper<UserAllocation> dsjyWrapper = new QueryWrapper<>();
|
|
|
|
+ yddWrapper.eq("project_id", 112);
|
|
|
|
+ List<UserAllocation> dsjyAllocations = userAllocationService.list(dsjyWrapper);
|
|
|
|
+ if (null != dsjyAllocations && dsjyAllocations.size() > 0) {
|
|
|
|
+ dsjyAllocations.forEach(allocation -> {
|
|
|
|
+ //根据accountId和时间,查询相关的日报表信息
|
|
|
|
+ QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.eq("advertiser_id", allocation.getAccountId())
|
|
|
|
+ //.eq("stat_datetime",dateString)
|
|
|
|
+ ;
|
|
|
|
+ List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
|
|
|
|
+ if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
|
|
|
|
+ bytedancePlanDailyReports.forEach(report -> {
|
|
|
|
+ String adName = report.getAdName();
|
|
|
|
+ String[] tags = adName.split("-");
|
|
|
|
+ report.setChannelCode(tags[0]);
|
|
|
|
+ planDailyReportService.updateById(report);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //清洗关于缘多多数据
|
|
|
|
+ //1:查询缘多多相关的用户数据
|
|
|
|
+ QueryWrapper<UserAllocation> fjyhWrapper = new QueryWrapper<>();
|
|
|
|
+ yddWrapper.eq("project_id", 222);
|
|
|
|
+ List<UserAllocation> fjyhAllocations = userAllocationService.list(fjyhWrapper);
|
|
|
|
+ if (null != fjyhAllocations && fjyhAllocations.size() > 0) {
|
|
|
|
+ fjyhAllocations.forEach(allocation -> {
|
|
|
|
+ //根据accountId和时间,查询相关的日报表信息
|
|
|
|
+ QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.eq("advertiser_id", allocation.getAccountId())
|
|
|
|
+ //.eq("stat_datetime",dateString)
|
|
|
|
+ ;
|
|
|
|
+ List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
|
|
|
|
+ if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
|
|
|
|
+ bytedancePlanDailyReports.forEach(report -> {
|
|
|
|
+ String adName = report.getAdName();
|
|
|
|
+ String[] tags = adName.split("-");
|
|
|
|
+ report.setChannelCode(tags[0]);
|
|
|
|
+ planDailyReportService.updateById(report);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
}
|
|
}
|