Ver Fonte

Merge remote-tracking branch 'origin/master'

yumeng há 5 anos atrás
pai
commit
181d460ea7
15 ficheiros alterados com 309 adições e 180 exclusões
  1. 0 1
      jeecg-boot-module-system/src/main/java/org/jeecg/JeecgApplication.java
  2. 38 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  3. 37 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UReportFileBindUserController.java
  4. 14 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceDailyReportLoadJob.java
  5. 87 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanDailyReportLoadJob.java
  6. 61 173
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  7. 4 1
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java
  8. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  9. 7 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  10. 10 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/StringUtils.java
  11. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  12. 4 0
      module-report/pom.xml
  13. 20 0
      module-report/src/main/java/cn/com/ctop/bytedance/entity/BytedancePlanDailyReport.java
  14. 1 0
      module-report/src/main/java/cn/com/ctop/bytedance/service/IBytedancePlanDailyReportService.java
  15. 24 0
      module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedancePlanDailyReportServiceImpl.java

+ 0 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/JeecgApplication.java

@@ -19,7 +19,6 @@ import java.net.UnknownHostException;
 @EnableSwagger2
 @EnableSwagger2
 @SpringBootApplication
 @SpringBootApplication
 @ComponentScan(basePackages = {"cn.com.ctop", "org.jeecg"})
 @ComponentScan(basePackages = {"cn.com.ctop", "org.jeecg"})
-@EnableAutoConfiguration
 @Configuration
 @Configuration
 
 
 
 

+ 38 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java

@@ -94,6 +94,16 @@ public class MaterialInfoController {
         return result;
         return result;
     }
     }
 
 
+    @PostMapping("excellent/set")
+    public Result<Object> setExcellent(@RequestParam(name = "id") String id, @RequestParam(name = "excellent") Integer excellent) {
+        Result<Object> result = new Result<>();
+        materialInfoService.setExcellent(id, excellent);
+        result.setCode(200);
+        result.setSuccess(true);
+        result.setMessage("设置成功");
+        return result;
+    }
+
 
 
     /**
     /**
      * 分页列表查询
      * 分页列表查询
@@ -107,6 +117,34 @@ public class MaterialInfoController {
     @Autowired
     @Autowired
     private IProjectMemberService memberService;
     private IProjectMemberService memberService;
 
 
+    @PostMapping("/excellent/list")
+    public Result<IPage<MaterialInfo>> excellentList(MaterialInfo materialInfo,
+                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                     HttpServletRequest req) {
+        Result<IPage<MaterialInfo>> result = new Result<>();
+        QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
+        Object createTime = materialInfo.getCreateTime();
+        materialInfo.setCreateTime(null);
+        materialInfo.setExcellent(1);
+        queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
+        if (!Check.isNull(createTime)) {
+            try {
+                Map<String, Object> map = DateUtils.getStartEndTime(createTime.toString());
+                queryWrapper.ge("create_time", map.get("start"));
+                queryWrapper.lt("create_time", map.get("end"));
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+        }
+
+        Page<MaterialInfo> page = new Page<>(pageNo, pageSize);
+        IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
     @AutoLog(value = "素材信息-分页列表查询")
     @AutoLog(value = "素材信息-分页列表查询")
     @ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")
     @ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")
     @GetMapping(value = "/list")
     @GetMapping(value = "/list")

+ 37 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UReportFileBindUserController.java

@@ -1,5 +1,9 @@
 package org.jeecg.modules.ctop.controller;
 package org.jeecg.modules.ctop.controller;
 
 
+import cn.com.ctop.bytedance.service.IBytedancePlanDailyReportService;
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
+import cn.com.ctop.common.module.utils.StringUtils;
 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 com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -19,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import java.util.Arrays;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Map;
 
 
 /**
 /**
@@ -35,7 +40,39 @@ import java.util.Map;
 public class UReportFileBindUserController {
 public class UReportFileBindUserController {
     @Autowired
     @Autowired
     private IUReportFileBindUserService uReportFileBindUserService;
     private IUReportFileBindUserService uReportFileBindUserService;
+    @Autowired
+    private IBytedancePlanDailyReportService planDailyReportService;
+    @PostMapping("loadRegistOrderDate")
+    public Map<String,Object>loadData(String data,String date){
+        Map<String,Object>result = new HashMap<>();
+        try {
+            planDailyReportService.loadData(data,date);
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+            return result;
+        }catch (Exception e){
+            e.printStackTrace();
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_SERVER_ERROR);
+            return result;
+        }
+    }
+    public static void main(String[] args) {
+        String data = "yk_xxl_jrtt_sxdx03hctddxc06_17\t,\t4\t,\t1\t|\n" +
+                "yk_xxl_jrtt_sxdx03hctddxc06_19\t,\t17\t,\t14\t|\n" +
+                "yk_xxl_jrtt_sxdx03hctddxc06_23\t,\t1\t,\t1\t|\n" +
+                "yk_xxl_jrtt_sxdx03hctddxc06_25\t,\t2\t,\t2\t|\n" +
+                "yk_xxl_jrtt_sxdx03hctddxc06_26\t,\t2\t,\t1\t|\n" +
+                "yk_xxl_jrtt_sxdx03hctddxc07_02\t,\t4\t,\t2\t|\n" +
+                "yk_xxl_jrtt_sxdx03hctddxc07_10\t,\t1\t,\t1\t|\n" +
+                "yk_xxl_jrtt_sxdx03hctddxc07_11\t,\t1\t,\t1\t|\n" +
+                "yk_xxl_jrtt_sxdx03hctddxc07_12\t,\t2\t,\t1\t|\n" +
+                "yk_xxl_jrtt_sxdx03hctddxc07_15\t,\t1\t,\t1\t|\n" +
+                "yk_xxl_jrtt_sxdx03hctddxc07_28\t,\t1\t,\t0\t|\n" +
+                "yk_xxl_jrtt_sxdx03hctddxc07_45\t,\t7\t,\t3\t|\n" +
+                "yk_xxl_jrtt_sxdx03hctddxc07_46\t,\t16\t,\t11\t|\n" +
+                "yk_xxl_jrtt_sxdx03hctddxc07_48\t,\t1\t,\t0\t";
+        System.out.println(StringUtils.replaceBlank(data));
 
 
+    }
     /**
     /**
      * 分页列表查询
      * 分页列表查询
      *
      *

+ 14 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceDailyReportLoadJob.java

@@ -1,9 +1,14 @@
 package org.jeecg.modules.ctop.job;
 package org.jeecg.modules.ctop.job;
 
 
+import cn.com.ctop.bytedance.entity.BytedancePlanDailyReport;
+import cn.com.ctop.bytedance.service.IBytedancePlanDailyReportService;
 import cn.com.ctop.bytedance.service.IReportService;
 import cn.com.ctop.bytedance.service.IReportService;
 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.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.DateUtils;
 import org.quartz.Job;
 import org.quartz.Job;
@@ -24,6 +29,8 @@ public class BytedanceDailyReportLoadJob implements Job {
     private ICtopOauthTokenService tokenService;
     private ICtopOauthTokenService tokenService;
     @Autowired
     @Autowired
     private IReportService reportService;
     private IReportService reportService;
+    @Autowired
+    private IUserAllocationService userAllocationService;
 
 
     @Override
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
@@ -37,12 +44,15 @@ public class BytedanceDailyReportLoadJob implements Job {
         tokens.forEach(token -> {
         tokens.forEach(token -> {
             //1: 获取广告主信息数据
             //1: 获取广告主信息数据
             reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
             reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-            //2:获取广告组信息数据
-            //reportService.getAdvertiserCampaignReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+//            2:获取广告组信息数据
+//            reportService.getAdvertiserCampaignReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
             //3:获取广告计划信息数据
             //3:获取广告计划信息数据
-            //reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+//            reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
             //4: 获取广告创意信息数据
             //4: 获取广告创意信息数据
-            //reportService.getAdvertiserCreativeReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+//            reportService.getAdvertiserCreativeReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
         });
         });
     }
     }
+
+    @Autowired
+    private IBytedancePlanDailyReportService planDailyReportService;
 }
 }

+ 87 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanDailyReportLoadJob.java

@@ -0,0 +1,87 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.bytedance.entity.BytedancePlanDailyReport;
+import cn.com.ctop.bytedance.service.IBytedancePlanDailyReportService;
+import cn.com.ctop.bytedance.service.IReportService;
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+@Slf4j
+public class BytedancePlanDailyReportLoadJob implements Job {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IReportService reportService;
+    @Autowired
+    private IUserAllocationService userAllocationService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        Date getDate = DateUtils.addDay(new Date(), -1);
+        //1:查询当日数据
+        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
+        if (null == tokens || tokens.size() <= 0) {
+            log.info("定时获取头条数据异常:为获取到可用的token");
+            return;
+        }
+        tokens.forEach(token -> {
+            //3:获取广告计划信息数据
+            reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        });
+        //清洗关于作业帮数据
+        //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 tag = tags[3];
+                        if(tag.contains("其他")){
+                            report.setMaterialType("其他");
+                        }else if (tag.contains("图片轮播")){
+                            report.setMaterialType("图片轮播");
+                        }else if(tag.contains("大字报")){
+                            report.setMaterialType("大字报");
+                        }else if(tag.contains("文字动画")){
+                            report.setMaterialType("文字动画");
+                        }else{
+                            report.setMaterialType("其他");
+                        }
+                        planDailyReportService.updateById(report);
+                    });
+                }
+            });
+        }
+    }
+
+    @Autowired
+    private IBytedancePlanDailyReportService planDailyReportService;
+}

+ 61 - 173
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -1,31 +1,20 @@
 package org.jeecg;
 package org.jeecg;
 
 
-import cn.com.ctop.bytedance.service.IByteDanceHourlyAccountWarningService;
+import cn.com.ctop.bytedance.entity.BytedancePlanDailyReport;
+import cn.com.ctop.bytedance.service.IBytedancePlanDailyReportService;
 import cn.com.ctop.bytedance.service.IReportService;
 import cn.com.ctop.bytedance.service.IReportService;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
+import cn.com.ctop.common.module.entity.UserAllocation;
 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.utils.CtopAdConstant;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.common.module.utils.HttpUtils2;
 import cn.com.ctop.crawler.modules.appium.service.IAppiumJobService;
 import cn.com.ctop.crawler.modules.appium.service.IAppiumJobService;
-import cn.com.ctop.crawler.modules.appium.service.IAppiumTaskService;
-import cn.com.ctop.kuaishou.modules.batch.service.IAccountWarningService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.http.impl.client.BasicCookieStore;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.DateUtils;
-import org.jeecg.modules.ctop.service.IBidWarningService;
-import org.jeecg.modules.ctop.service.ICreateInternalService;
 import org.jeecg.modules.mq.Sender;
 import org.jeecg.modules.mq.Sender;
 import org.junit.Test;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runner.RunWith;
-import org.openqa.selenium.By;
-import org.openqa.selenium.JavascriptExecutor;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebElement;
-import org.openqa.selenium.chrome.ChromeDriver;
-import org.openqa.selenium.chrome.ChromeOptions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -34,8 +23,6 @@ import org.springframework.test.context.junit4.SpringRunner;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Date;
 import java.util.List;
 import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 
 
 @RunWith(SpringRunner.class)
 @RunWith(SpringRunner.class)
 @SpringBootTest
 @SpringBootTest
@@ -45,183 +32,84 @@ public class SampleTest {
     private String chromeDriver;
     private String chromeDriver;
     @Autowired
     @Autowired
     private IAppiumJobService jobService;
     private IAppiumJobService jobService;
-    @Autowired
-    private ICreateInternalService createInternalService;
-    @Autowired
-    private IAppiumTaskService appiumTaskService;
-
-    @Test
-    public void testKs() throws InterruptedException {
-        String url = "https://ad.e.kuaishou.com/#/welcome?redirectUrl=https%3A%2F%2Fad.e.kuaishou.com%2F%23%2Findex";
-        System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
-        ChromeOptions chromeOptions = new ChromeOptions();
-//        chromeOptions.addArguments("--headless");
-        chromeOptions.addArguments("--incognito");
-        chromeOptions.addArguments("--disable-gpu");
-//        chromeOptions.addArguments("--no-sandbox");
-        chromeOptions.addArguments("--window-size=1920,1080");
-        chromeOptions.addArguments("--user-agent=" + HttpUtils2.USER_AGENT);
-        chromeOptions.setAcceptInsecureCerts(true);
-        WebDriver webDriver = new ChromeDriver(chromeOptions);
-        try {
-            Thread.sleep(3000L);
-            HttpUtils2.cookieStore = new BasicCookieStore();
-            webDriver.manage().deleteAllCookies();
-            //获取登录页面
-            webDriver.get(url);
-            Thread.sleep(3000L);
-            WebElement accountElement = webDriver.findElement(By.xpath("//div[@class='phone ']/input[@type='text']"));
-            accountElement.sendKeys("19845004383");
-            Thread.sleep(3000L);
-            WebElement passwordElement = webDriver.findElement(By.xpath("//div[@class='password ']/input[@type='password']"));
-            passwordElement.sendKeys("a123456");
-            WebElement loginElement = webDriver.findElement(By.xpath("//div[@class='foot']"));
-            Thread.sleep(3000L);
-            //点击登录
-            loginElement.click();
-            Thread.sleep(3000L);
-            //获取推广按钮
-            WebElement spreadElement = webDriver.findElement(By.linkText("推广"));
-            spreadElement.click();
-            Thread.sleep(3000L);
-            //选择广告创意
-            WebElement creativeElement = webDriver.findElement(By.xpath("//div[text()='广告创意']"));
-            creativeElement.click();
-            Thread.sleep(3000L);
-            //输入创意名称,点击搜索
-            WebElement searchElement = webDriver.findElement(By.xpath("//input[@type='text']"));
-            searchElement.sendKeys("2-这个是你画的吗-设计-11.19");
-            Thread.sleep(3000L);
-            WebElement searchButton = webDriver.findElement(By.xpath("//button[@class='ant-btn ant-input-search-button ant-btn-primary']"));
-            searchButton.click();
-            Thread.sleep(3000L);
-            WebElement tiyanElement = webDriver.findElement(By.linkText("体验"));
-            tiyanElement.click();
-            Thread.sleep(2000L);
-            WebElement inputKsIdElement = webDriver.findElement(By.xpath("//textarea[@placeholder='请输入快手账号…']"));
-            inputKsIdElement.sendKeys("123456765");
-            Thread.sleep(2000L);
-            WebElement chufaElement = webDriver.findElement(By.xpath("//button[@class='creative-experience-btn-enable']"));
-            chufaElement.click();
-
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            webDriver.manage().deleteAllCookies();
-            webDriver.close();
-        }
-    }
-
-    @Test
-    public void test() {
-        jobService.refreshWebPhone();
-    }
 
 
     @Test
     @Test
     public void testMq() {
     public void testMq() {
         Sender sender = new Sender();
         Sender sender = new Sender();
         sender.send();
         sender.send();
     }
     }
-
-    @Test
-    public void loadKuaishouDataSingle() throws Exception {
-        String url = "https://a201903112120030590198943.szwego.com/static/index.html#/shop_detail/A201903112120030590198943";
-        System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
-        ChromeOptions chromeOptions = new ChromeOptions();
-//        chromeOptions.addArguments("--headless");
-        chromeOptions.addArguments("--incognito");
-        chromeOptions.addArguments("--disable-gpu");
-//        chromeOptions.addArguments("--no-sandbox");
-        chromeOptions.addArguments("--window-size=1920,1080");
-        chromeOptions.addArguments("--user-agent=" + HttpUtils2.USER_AGENT);
-        chromeOptions.setAcceptInsecureCerts(true);
-        WebDriver webDriver = new ChromeDriver(chromeOptions);
-        webDriver.get(url);
-        Thread.sleep(3000L);
-        ((JavascriptExecutor) webDriver).executeScript("window.scrollTo(0,document.body.scrollHeight)");
-        Thread.sleep(3000L);
-        List<WebElement> elementList = webDriver.findElements(By.xpath("//div[@class='word-break ellipsis-two f14 g3']"));
-        for (WebElement element : elementList) {
-            System.out.println(element.getText());
-        }
-
-    }
-
-    @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
-
-    @Test
-    public void testMail() throws Exception {
-        // String accessToken, Long advertiserId, Date startDate, Date endDate, Integer page
-        kuaishouInterfaceService.getTargetingTags(23212L, "101a5c994d0a87322f305a306a30e38e");
-    }
-
-
-    @Autowired
-    private IBidWarningService bidWarningService;
-
-    @Autowired
-    private IAccountWarningService accountWarningService;
-    @Autowired
-    private CtopOauthTokenMapper oauthTokenMapper;
-    static ExecutorService executorService = Executors.newFixedThreadPool(5);
-
-    @Test
-    public void testMa() throws Exception {
-        // accountWarningService.accountWarning(23212L);
-        QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
-        oauthTokenQueryWrapper.eq("media_id", 2);
-        List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(oauthTokenQueryWrapper);
-        for (CtopOauthToken token : ctopOauthTokens) {
-            kuaishouInterfaceService.getCreativeList(token, null, null);
-        }
-
-
-    }
-
     @Autowired
     @Autowired
     private ICtopOauthTokenService tokenService;
     private ICtopOauthTokenService tokenService;
     @Autowired
     @Autowired
     private IReportService reportService;
     private IReportService reportService;
-@Autowired
-private IByteDanceHourlyAccountWarningService byteDanceHourlyAccountWarningService;
-    @Test
-    public void testMa2() throws Exception {
 
 
+    @Test
+    public void getBytedancePlanReport(){
 
 
-        byteDanceHourlyAccountWarningService.byteDanceAccountWarning(1655337394471943L,"2020-02-06","2020-02-05");
-        /*Date getDate = new Date();
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
-        String hour = simpleDateFormat.format(getDate);
-        if (null != hour && "00".equals(hour)) {
-            getDate = DateUtils.addDay(getDate, -1);
-        }
+        Date getDate = DateUtils.addDay(new Date(), -4);
         //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) {
-            log.info("定时获取头条小时数据异常:未获取到可用的token");
+            log.info("定时获取头条数据异常:为获取到可用的token");
             return;
             return;
         }
         }
-        Date finalGetDate = getDate;
-
-
-        QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
-        oauthTokenQueryWrapper.eq("account_id", 1655337394471943L);
-        CtopOauthToken ctopOauthToken = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);*/
-
+        tokens.forEach(token -> {
+           //3:获取广告计划信息数据
+            reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        });
+
+        //清洗关于作业帮数据
+        //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";
+                System.out.println(dateString);
+                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();
+                        System.out.println(adName);
+                        String[] tags = adName.split("-");
+                        report.setAdsense(tags[1]);
+                        report.setPlanCode(tags[2]);
+                        String tag = tags[3];
+                        if(tag.contains("其他")){
+                            report.setMaterialType("其他");
+                        }else if (tag.contains("图片轮播")){
+                            report.setMaterialType("图片轮播");
+                        }else if(tag.contains("大字报")){
+                            report.setMaterialType("大字报");
+                        }else if(tag.contains("文字动画")){
+                            report.setMaterialType("文字动画");
+                        }else{
+                            report.setMaterialType("其他");
+                        }
+                        planDailyReportService.updateById(report);
+                    });
+                }
+            });
+        }
+    }
 
 
-        //1: 获取广告主信息数据
-          //  reportService.getAdvertiserReport(ctopOauthToken, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-            //2:获取广告组信息数据
-            //reportService.getAdvertiserCampaignReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-            //3:获取广告计划信息数据
-            //reportService.getAdvertiserPlanReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-            //4: 获取广告创意信息数据
-            //reportService.getAdvertiserCreativeReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+    @Test
+    public void loadRegistOrderData(){
 
 
+    }
 
 
+    @Autowired
+    private IUserAllocationService userAllocationService;
 
 
-    }
+    @Autowired
+    private IBytedancePlanDailyReportService planDailyReportService;
 
 
 }
 }
 
 

+ 4 - 1
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java

@@ -102,7 +102,10 @@ public class MaterialInfo {
      */
      */
     private String creativeCopywriter;
     private String creativeCopywriter;
 
 
-
+    /**
+     * 是否优秀素材
+     */
+    private Integer excellent;
     /**
     /**
      * createTime
      * createTime
      */
      */

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java

@@ -32,5 +32,5 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
 
 
     void getFile(MaterialInfo materialInfo);
     void getFile(MaterialInfo materialInfo);
 
 
-
+    void setExcellent(String id, Integer excellent);
 }
 }

+ 7 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -406,5 +406,12 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         });
         });
     }
     }
 
 
+    @Override
+    public void setExcellent(String id, Integer excellent) {
+        MaterialInfo info = this.getById(id);
+        info.setExcellent(excellent);
+        this.updateById(info);
+    }
+
 
 
 }
 }

+ 10 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/StringUtils.java

@@ -20,4 +20,14 @@ public class StringUtils {
         }
         }
         return list;
         return list;
     }
     }
+
+    public static String replaceBlank(String str) {
+        String dest = "";
+        if (str!=null) {
+            Pattern p = Pattern.compile("\\s*|\t|\r|\n");
+            Matcher m = p.matcher(str);
+            dest = m.replaceAll("");
+        }
+        return dest;
+    }
 }
 }

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -3393,6 +3393,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
      * @param endDate
      * @param endDate
      * @param page
      * @param page
      */
      */
+    @Override
     public void getVideoList(String token, Long accountId, Date startDate, Date endDate, int page) {
     public void getVideoList(String token, Long accountId, Date startDate, Date endDate, int page) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_LIST;
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_LIST;
         Map<String, String> headers = new HashMap<>();
         Map<String, String> headers = new HashMap<>();

+ 4 - 0
module-report/pom.xml

@@ -46,6 +46,10 @@
             <version>2.0.2</version>
             <version>2.0.2</version>
             <scope>compile</scope>
             <scope>compile</scope>
         </dependency>
         </dependency>
+        <dependency>
+            <groupId>org.jeecgframework.boot</groupId>
+            <artifactId>jeecg-boot-base-common</artifactId>
+        </dependency>
     </dependencies>
     </dependencies>
 
 
     <build>
     <build>

+ 20 - 0
module-report/src/main/java/cn/com/ctop/bytedance/entity/BytedancePlanDailyReport.java

@@ -390,6 +390,26 @@ public class BytedancePlanDailyReport {
      */
      */
     @ApiModelProperty(value = "updateTime")
     @ApiModelProperty(value = "updateTime")
     private Date updateTime;
     private Date updateTime;
+    /**
+     * 广告位
+     */
+    private String adsense;
+    /**
+     * 素材类型
+     */
+    private String materialType;
+    /**
+     * 注册数
+     */
+    private Integer registNum;
+    /**
+     * 成单数
+     */
+    private Integer orderNum;
+    /**
+     * 计划代码
+     */
+    private String planCode;
 
 
     public BytedancePlanDailyReport(JSONObject data, Long setAdvertiserId) {
     public BytedancePlanDailyReport(JSONObject data, Long setAdvertiserId) {
         Long playFeedBreak75 = data.getLong("play_75_feed_break");
         Long playFeedBreak75 = data.getLong("play_75_feed_break");

+ 1 - 0
module-report/src/main/java/cn/com/ctop/bytedance/service/IBytedancePlanDailyReportService.java

@@ -11,4 +11,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
  */
 public interface IBytedancePlanDailyReportService extends IService<BytedancePlanDailyReport> {
 public interface IBytedancePlanDailyReportService extends IService<BytedancePlanDailyReport> {
 
 
+    void loadData(String data, String date);
 }
 }

+ 24 - 0
module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedancePlanDailyReportServiceImpl.java

@@ -3,6 +3,8 @@ package cn.com.ctop.bytedance.service.impl;
 import cn.com.ctop.bytedance.entity.BytedancePlanDailyReport;
 import cn.com.ctop.bytedance.entity.BytedancePlanDailyReport;
 import cn.com.ctop.bytedance.mapper.BytedancePlanDailyReportMapper;
 import cn.com.ctop.bytedance.mapper.BytedancePlanDailyReportMapper;
 import cn.com.ctop.bytedance.service.IBytedancePlanDailyReportService;
 import cn.com.ctop.bytedance.service.IBytedancePlanDailyReportService;
+import cn.com.ctop.common.module.utils.StringUtils;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
@@ -15,4 +17,26 @@ import org.springframework.stereotype.Service;
 @Service
 @Service
 public class BytedancePlanDailyReportServiceImpl extends ServiceImpl<BytedancePlanDailyReportMapper, BytedancePlanDailyReport> implements IBytedancePlanDailyReportService {
 public class BytedancePlanDailyReportServiceImpl extends ServiceImpl<BytedancePlanDailyReportMapper, BytedancePlanDailyReport> implements IBytedancePlanDailyReportService {
 
 
+    @Override
+    public void loadData(String data, String date) {
+        String getData = StringUtils.replaceBlank(data);
+        String[]orderDatas = getData.split("|");
+        if(null!=orderDatas&&orderDatas.length>0){
+            for (int i=0;i<orderDatas.length;i++) {
+                String orderData = orderDatas[i];
+                String[] orderObjects = orderData.split(",");
+                String planCode = orderObjects[0].replace("yk_xxl_jrtt_","");
+                String registNum =orderObjects[1];
+                String orderNum =orderObjects[2];
+                QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("plan_code",planCode).eq("stat_datetime",date+" 00:00:00");
+                BytedancePlanDailyReport report = this.getOne(queryWrapper);
+                if(null!=report){
+                    report.setOrderNum(Integer.parseInt(orderNum));
+                    report.setRegistNum(Integer.parseInt(registNum));
+                    this.updateById(report);
+                }
+            }
+        }
+    }
 }
 }