|
@@ -10,6 +10,7 @@ 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.ICtopOauthTokenService;
|
|
import cn.com.ctop.common.module.service.IUserAllocationService;
|
|
import cn.com.ctop.common.module.service.IUserAllocationService;
|
|
|
|
+import cn.com.ctop.common.module.utils.Check;
|
|
import cn.com.ctop.common.module.utils.CtopAdConstant;
|
|
import cn.com.ctop.common.module.utils.CtopAdConstant;
|
|
import cn.com.ctop.common.module.utils.ResultMapUtils;
|
|
import cn.com.ctop.common.module.utils.ResultMapUtils;
|
|
import cn.com.ctop.common.module.utils.StatusCode;
|
|
import cn.com.ctop.common.module.utils.StatusCode;
|
|
@@ -22,6 +23,7 @@ import lombok.SneakyThrows;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
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.ICleanMaterialService;
|
|
import org.jeecg.modules.ctop.service.ICreateInternalService;
|
|
import org.jeecg.modules.ctop.service.ICreateInternalService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -139,8 +141,6 @@ public class TestController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
@GetMapping(value = "/gerCreative")
|
|
@GetMapping(value = "/gerCreative")
|
|
public void gerCreative() {
|
|
public void gerCreative() {
|
|
QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
|
|
@@ -205,28 +205,27 @@ public class TestController {
|
|
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 = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
|
|
- executorService.submit(new Runnable() {
|
|
|
|
- @Override
|
|
|
|
- public void run() {
|
|
|
|
- try {
|
|
|
|
- System.err.println("获取创意,accountId:" + token.getAccountId());
|
|
|
|
- kuaishouInterfaceService.getCreativeList(token, null, null);
|
|
|
|
- // kuaishouInterfaceService.getVideoList2(token, null, null,1);
|
|
|
|
- //3: 获取图片信息数据
|
|
|
|
- // kuaishouInterfaceService.getImageList2(token, null, null,1);
|
|
|
|
- Thread.sleep(1 * 200);
|
|
|
|
- // kuaishouInterfaceService.getAppList(token.getAccountId(), token.getAccessToken());
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
|
|
+ executorService.submit(new Runnable() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ try {
|
|
|
|
+ System.err.println("获取创意,accountId:" + token.getAccountId());
|
|
|
|
+ kuaishouInterfaceService.getCreativeList(token, null, null);
|
|
|
|
+ // kuaishouInterfaceService.getVideoList2(token, null, null,1);
|
|
|
|
+ //3: 获取图片信息数据
|
|
|
|
+ // kuaishouInterfaceService.getImageList2(token, null, null,1);
|
|
|
|
+ Thread.sleep(1 * 200);
|
|
|
|
+ // kuaishouInterfaceService.getAppList(token.getAccountId(), token.getAccessToken());
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
}
|
|
}
|
|
- });
|
|
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
@GetMapping(value = "/gerCreativeReportByAccount")
|
|
@GetMapping(value = "/gerCreativeReportByAccount")
|
|
public void gerCreativeReportByAccount(Long accountId, String startDateStr, String endDateStr, QueryWrapper<CtopOauthToken> account_id) {
|
|
public void gerCreativeReportByAccount(Long accountId, String startDateStr, String endDateStr, QueryWrapper<CtopOauthToken> account_id) {
|
|
Thread thread = new Thread() {
|
|
Thread thread = new Thread() {
|
|
@@ -261,7 +260,7 @@ public class TestController {
|
|
|
|
|
|
@GetMapping("loadBytedanceData")
|
|
@GetMapping("loadBytedanceData")
|
|
public Map<String, Object> formatZybData(String date) {
|
|
public Map<String, Object> formatZybData(String date) {
|
|
- Map<String,Object>result = new HashMap<>();
|
|
|
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
Date getDate = null;
|
|
Date getDate = null;
|
|
try {
|
|
try {
|
|
@@ -283,20 +282,20 @@ public class TestController {
|
|
//清洗关于作业帮数据
|
|
//清洗关于作业帮数据
|
|
//1:查询作业帮相关的用户数据
|
|
//1:查询作业帮相关的用户数据
|
|
QueryWrapper<UserAllocation> wrapper = new QueryWrapper<>();
|
|
QueryWrapper<UserAllocation> wrapper = new QueryWrapper<>();
|
|
- wrapper.eq("project_id",215);
|
|
|
|
|
|
+ wrapper.eq("project_id", 215);
|
|
List<UserAllocation> allocations = userAllocationService.list(wrapper);
|
|
List<UserAllocation> allocations = userAllocationService.list(wrapper);
|
|
- if(null!=allocations&&allocations.size()>0){
|
|
|
|
- allocations.forEach(allocation->{
|
|
|
|
|
|
+ if (null != allocations && allocations.size() > 0) {
|
|
|
|
+ allocations.forEach(allocation -> {
|
|
//根据accountId和时间,查询相关的日报表信息
|
|
//根据accountId和时间,查询相关的日报表信息
|
|
QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
- String dateString = dateFormat.format(finalGetDate)+" 00:00:00";
|
|
|
|
- queryWrapper.eq("advertiser_id",allocation.getAccountId())
|
|
|
|
- .eq("stat_datetime",dateString)
|
|
|
|
|
|
+ String dateString = dateFormat.format(finalGetDate) + " 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->{
|
|
|
|
|
|
+ List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
|
|
|
|
+ if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
|
|
|
|
+ bytedancePlanDailyReports.forEach(report -> {
|
|
String adName = report.getAdName();
|
|
String adName = report.getAdName();
|
|
String[] tags = adName.split("-");
|
|
String[] tags = adName.split("-");
|
|
report.setAdsense(tags[1]);
|
|
report.setAdsense(tags[1]);
|
|
@@ -317,7 +316,7 @@ public class TestController {
|
|
report.setMaterialType("剧情");
|
|
report.setMaterialType("剧情");
|
|
} else if (materialName.contains("口播")) {
|
|
} else if (materialName.contains("口播")) {
|
|
report.setMaterialType("口播");
|
|
report.setMaterialType("口播");
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
report.setMaterialType("其他");
|
|
report.setMaterialType("其他");
|
|
}
|
|
}
|
|
planDailyReportService.updateById(report);
|
|
planDailyReportService.updateById(report);
|
|
@@ -325,15 +324,16 @@ public class TestController {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
|
|
|
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private IByteDanceAdvertiserDataService advertiserDataService;
|
|
private IByteDanceAdvertiserDataService advertiserDataService;
|
|
|
|
+
|
|
@GetMapping("getBytedanceData")
|
|
@GetMapping("getBytedanceData")
|
|
public Map<String, Object> getBytedanceData() {
|
|
public Map<String, Object> getBytedanceData() {
|
|
- Map<String,Object>result = new HashMap<>();
|
|
|
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
//1:查询当日数据
|
|
//1:查询当日数据
|
|
List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
|
|
List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
|
|
if (null == tokens || tokens.size() <= 0) {
|
|
if (null == tokens || tokens.size() <= 0) {
|
|
@@ -343,7 +343,7 @@ public class TestController {
|
|
//3:获取广告计划信息数据
|
|
//3:获取广告计划信息数据
|
|
advertiserDataService.getMaterialList(token);
|
|
advertiserDataService.getMaterialList(token);
|
|
});
|
|
});
|
|
- ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
|
|
|
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -403,7 +403,7 @@ public class TestController {
|
|
private IReportService reportService;
|
|
private IReportService reportService;
|
|
|
|
|
|
@GetMapping("bytedanceHourReport")
|
|
@GetMapping("bytedanceHourReport")
|
|
- public Map<String, Object> testReport() {
|
|
|
|
|
|
+ public Map<String, Object> bytedanceHourReport() {
|
|
Map<String, Object> result = new HashMap<>();
|
|
Map<String, Object> result = new HashMap<>();
|
|
log.info("头条时报数据获取开始");
|
|
log.info("头条时报数据获取开始");
|
|
Date getDate = new Date();
|
|
Date getDate = new Date();
|
|
@@ -623,4 +623,30 @@ public class TestController {
|
|
ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICleanMaterialService cleanMaterialService;
|
|
|
|
+
|
|
|
|
+ @GetMapping("testReport")
|
|
|
|
+ public void testReport() {
|
|
|
|
+ List<String> signatureList = cleanMaterialService.getSignature();
|
|
|
|
+ if (Check.isNull(signatureList)) {
|
|
|
|
+ log.error("素材数据获取为空");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ executorService = Executors.newFixedThreadPool(5);
|
|
|
|
+ for (int i = 0; i < signatureList.size(); i++) {
|
|
|
|
+ String signature = signatureList.get(i);
|
|
|
|
+ executorService.submit(new Runnable() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ System.err.println(signature);
|
|
|
|
+ cleanMaterialService.calculationReport(signature);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|