|
@@ -4,20 +4,15 @@ import cn.com.ctop.bytedance.service.IReportService;
|
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
|
import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
|
import cn.com.ctop.common.module.service.IFileInfoService;
|
|
|
+import cn.com.ctop.common.module.utils.CtopAdConstant;
|
|
|
import cn.com.ctop.common.module.utils.OSSUtils;
|
|
|
import cn.com.ctop.common.module.utils.StringUtils;
|
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
|
|
|
-import cn.com.ctop.toutiao.entity.ByteDanceUserOrientationTemplate;
|
|
|
-import cn.com.ctop.toutiao.entity.BytedanceInterestCategory;
|
|
|
-import cn.com.ctop.toutiao.mapper.ByteDanceUserOrientationTemplateMapper;
|
|
|
-import cn.com.ctop.toutiao.mapper.BytedanceAreaInfoMapper;
|
|
|
-import cn.com.ctop.toutiao.mapper.BytedanceInterestCategoryMapper;
|
|
|
import cn.com.ctop.toutiao.service.IByteDanceAdvertiserDataService;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
-import org.jeecg.common.util.jsonschema.JsonschemaUtil;
|
|
|
import org.jeecg.modules.ctop.service.ICreateInternalService;
|
|
|
import org.jeecg.modules.demo.mock.MockController;
|
|
|
import org.jeecg.modules.demo.test.mapper.JeecgDemoMapper;
|
|
@@ -86,15 +81,79 @@ public class SampleTest {
|
|
|
// //1: 获取广告主信息数据
|
|
|
// kuaishouInterfaceService.getAdvertiserReportHourly(token, getDate);
|
|
|
// //2:获取广告计划信息数据
|
|
|
- kuaishouInterfaceService.getAdvertiserCampaignReportHourly(token, getDate);
|
|
|
+ kuaishouInterfaceService.getAdvertiserCampaignReportHourly(token, getDate, getDate);
|
|
|
// //3:获取广告组信息数据
|
|
|
- kuaishouInterfaceService.getAdvertiserGroupReportHourly(token, getDate);
|
|
|
+ kuaishouInterfaceService.getAdvertiserGroupReportHourly(token, getDate, getDate);
|
|
|
// //4: 获取广告创意信息数据
|
|
|
- kuaishouInterfaceService.getAdvertiserCreativeReportHourly(token, getDate);
|
|
|
+ kuaishouInterfaceService.getAdvertiserCreativeReportHourly(token, getDate, getDate);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
+ public void testLoadDate180() {
|
|
|
+ Date endDate = new Date();
|
|
|
+ Date hourlyStartDate = DateUtils.addDay(endDate, -7);
|
|
|
+ Date startDate = DateUtils.addDay(endDate, -170);
|
|
|
+ List<CtopOauthToken> bytedanceTokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
|
|
|
+ if (null != bytedanceTokens && bytedanceTokens.size() > 0) {
|
|
|
+ bytedanceTokens.forEach(token -> {
|
|
|
+ //1: 获取广告主信息数据
|
|
|
+ reportService.getAdvertiserReport(token, startDate, endDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ //2:获取广告组信息数据
|
|
|
+ reportService.getAdvertiserCampaignReport(token, startDate, endDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ //3:获取广告计划信息数据
|
|
|
+ reportService.getAdvertiserPlanReport(token, startDate, endDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ //4: 获取广告创意信息数据
|
|
|
+ reportService.getAdvertiserCreativeReport(token, startDate, endDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+
|
|
|
+ //1: 获取广告主信息数据
|
|
|
+ reportService.getAdvertiserReport(token, hourlyStartDate, endDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
|
|
|
+ //2:获取广告组信息数据
|
|
|
+ reportService.getAdvertiserCampaignReport(token, hourlyStartDate, endDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
|
|
|
+ //3:获取广告计划信息数据
|
|
|
+ reportService.getAdvertiserPlanReport(token, hourlyStartDate, endDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
|
|
|
+ //4: 获取广告创意信息数据
|
|
|
+ reportService.getAdvertiserCreativeReport(token, hourlyStartDate, endDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ List<CtopOauthToken> kuaishouTokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
|
|
|
+ if (null != kuaishouTokens && kuaishouTokens.size() > 0) {
|
|
|
+ for (CtopOauthToken token : kuaishouTokens) {
|
|
|
+ for (int i = 0; i < 7; i++) {
|
|
|
+ Date getStartDate = DateUtils.addDay(endDate, -i);
|
|
|
+ //1: 获取广告主信息数据
|
|
|
+ kuaishouInterfaceService.getAdvertiserReportHourly(token, getStartDate, getStartDate);
|
|
|
+ //2:获取广告计划信息数据
|
|
|
+ kuaishouInterfaceService.getAdvertiserCampaignReportHourly(token, getStartDate, getStartDate);
|
|
|
+ //3:获取广告组信息数据
|
|
|
+ kuaishouInterfaceService.getAdvertiserGroupReportHourly(token, getStartDate, getStartDate);
|
|
|
+ //4: 获取广告创意信息数据
|
|
|
+ kuaishouInterfaceService.getAdvertiserCreativeReportHourly(token, getStartDate, getStartDate);
|
|
|
+ }
|
|
|
+ for (int i = 0; i < 6; i++) {
|
|
|
+ Date getStartDate = new Date();
|
|
|
+ Date getEndDate = new Date();
|
|
|
+ if (i == 0) {
|
|
|
+ getStartDate = DateUtils.addDay(endDate, -175 + i * 30);
|
|
|
+ getEndDate = DateUtils.addDay(endDate, -150 + i * 30);
|
|
|
+ } else {
|
|
|
+ getStartDate = DateUtils.addDay(endDate, -180 + i * 30);
|
|
|
+ getEndDate = DateUtils.addDay(endDate, -150 + i * 30);
|
|
|
+ }
|
|
|
+ //1: 获取广告主信息数据
|
|
|
+ kuaishouInterfaceService.getAdvertiserReportDaily(token, getStartDate, getEndDate);
|
|
|
+ //2:获取广告计划信息数据
|
|
|
+ kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, getStartDate, getEndDate);
|
|
|
+ //3:获取广告组信息数据
|
|
|
+ kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, getStartDate, getEndDate);
|
|
|
+ //4: 获取广告创意信息数据
|
|
|
+ kuaishouInterfaceService.getAdvertiserCreativeReportDaily(token, getStartDate, getEndDate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
public void testFileType() {
|
|
|
File file = new File("D:\\工作文件\\360借条\\快手后台数据-户1.csv");
|
|
|
System.out.println(file);
|
|
@@ -112,70 +171,11 @@ public class SampleTest {
|
|
|
createInternalService.createInternal(json);
|
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
- private BytedanceAreaInfoMapper areaInfoMapper;
|
|
|
- @Autowired
|
|
|
- private BytedanceInterestCategoryMapper interestCategoryMapper;
|
|
|
-
|
|
|
- @Test
|
|
|
- public void setCategoryData() {
|
|
|
- String path = "D:\\工作文件\\头条批量\\data_20190222\\ad_tag.json";
|
|
|
- String jsonString = JsonschemaUtil.readJsonFile(path);
|
|
|
- JSONObject data = JSONObject.parseObject(jsonString);
|
|
|
- JSONArray tagArray = data.getJSONArray("adtags");
|
|
|
- tagArray.forEach(tag -> {
|
|
|
- JSONObject getTag = (JSONObject) tag;
|
|
|
- String pcode = getTag.getString("value");
|
|
|
- String plabel = getTag.getString("label");
|
|
|
- BytedanceInterestCategory category = new BytedanceInterestCategory();
|
|
|
- category.setCode(pcode);
|
|
|
- category.setName(plabel);
|
|
|
- category.setParentCode("0");
|
|
|
- category.setLevel(1);
|
|
|
- category.setCreateTime(new Date());
|
|
|
- category.setUpdateTime(new Date());
|
|
|
- interestCategoryMapper.insert(category);
|
|
|
- JSONArray children = getTag.getJSONArray("subTags");
|
|
|
- children.forEach(child -> {
|
|
|
- JSONObject getchild = (JSONObject) child;
|
|
|
- String code = getchild.getString("value");
|
|
|
- String label = getchild.getString("label");
|
|
|
- BytedanceInterestCategory childCategory = new BytedanceInterestCategory();
|
|
|
- childCategory.setCode(code);
|
|
|
- childCategory.setName(label);
|
|
|
- childCategory.setParentCode(pcode);
|
|
|
- childCategory.setLevel(2);
|
|
|
- childCategory.setCreateTime(new Date());
|
|
|
- childCategory.setUpdateTime(new Date());
|
|
|
- interestCategoryMapper.insert(childCategory);
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
|
|
|
@Autowired
|
|
|
private ICtopOauthTokenService tokenService;
|
|
|
@Autowired
|
|
|
- private ByteDanceUserOrientationTemplateMapper userOrientationTemplateMapper;
|
|
|
- @Autowired
|
|
|
private IByteDanceAdvertiserDataService advertiserDataService;
|
|
|
-
|
|
|
- @Test
|
|
|
- public void testEditPlan() throws Exception {
|
|
|
- String accountId = "74099510334";
|
|
|
- Long userOrientationId = 5L;
|
|
|
- Long adId = 1643004580559934L;
|
|
|
- //修改用户定向
|
|
|
- ByteDanceUserOrientationTemplate template = userOrientationTemplateMapper.selectById(userOrientationId);
|
|
|
- if (null != template) {
|
|
|
- CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
|
|
|
- if (null != token) {
|
|
|
- //获取modify_time
|
|
|
- Thread.sleep(5000L);
|
|
|
- advertiserDataService.getAdvertiserPlan(accountId, adId + "");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
@Autowired
|
|
|
private IFileInfoService fileInfoService;
|
|
|
|