浏览代码

Merge branch 'master' of http://git.tjyourong.com.cn/ctop/adsp-boot

# Conflicts:
#	jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
yumeng 4 年之前
父节点
当前提交
6605a833aa
共有 59 个文件被更改,包括 2183 次插入201 次删除
  1. 6 0
      jeecg-boot-base-common/pom.xml
  2. 6 0
      jeecg-boot-module-system/pom.xml
  3. 0 4
      jeecg-boot-module-system/src/main/java/org/jeecg/config/RedisConfig.java
  4. 2 3
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  5. 50 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  6. 6 6
      jeecg-boot-module-system/src/main/resources/application-test.yml
  7. 9 157
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  8. 43 0
      module-check/pom.xml
  9. 13 0
      module-check/src/main/java/cn/com/ctop/ModuleCheckApplication.java
  10. 20 0
      module-check/src/main/java/cn/com/ctop/check/TestGroovy.groovy
  11. 37 0
      module-check/src/main/java/cn/com/ctop/check/component/basic/AbstractScript.java
  12. 9 0
      module-check/src/main/java/cn/com/ctop/check/component/basic/BaseScript.java
  13. 114 0
      module-check/src/main/java/cn/com/ctop/check/component/execute/GroovyScriptExecutor.java
  14. 111 0
      module-check/src/main/java/cn/com/ctop/check/controller/CtopCheckTaskExecuteLogController.java
  15. 115 0
      module-check/src/main/java/cn/com/ctop/check/controller/CtopCheckTaskListController.java
  16. 47 0
      module-check/src/main/java/cn/com/ctop/check/entity/CtopCheckTaskExecuteLog.java
  17. 83 0
      module-check/src/main/java/cn/com/ctop/check/entity/CtopCheckTaskList.java
  18. 11 0
      module-check/src/main/java/cn/com/ctop/check/mapper/CtopCheckTaskExecuteLogMapper.java
  19. 19 0
      module-check/src/main/java/cn/com/ctop/check/mapper/CtopCheckTaskListMapper.java
  20. 5 0
      module-check/src/main/java/cn/com/ctop/check/mapper/xml/CtopCheckTaskExecuteLogMapper.xml
  21. 27 0
      module-check/src/main/java/cn/com/ctop/check/mapper/xml/CtopCheckTaskListMapper.xml
  22. 18 0
      module-check/src/main/java/cn/com/ctop/check/script/CheckTokenExecuteStateScript.groovy
  23. 26 0
      module-check/src/main/java/cn/com/ctop/check/script/TestGroovyScript.java
  24. 11 0
      module-check/src/main/java/cn/com/ctop/check/service/ICtopCheckTaskExecuteLogService.java
  25. 16 0
      module-check/src/main/java/cn/com/ctop/check/service/ICtopCheckTaskListService.java
  26. 15 0
      module-check/src/main/java/cn/com/ctop/check/service/impl/CtopCheckTaskExecuteLogServiceImpl.java
  27. 30 0
      module-check/src/main/java/cn/com/ctop/check/service/impl/CtopCheckTaskListServiceImpl.java
  28. 30 0
      module-check/src/main/java/cn/com/ctop/notice/handle/SendWeChatHandle.java
  29. 13 0
      module-check/src/test/java/cn/com/ctop/ModuleCheckApplicationTests.java
  30. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MailLogMapper.java
  31. 8 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MailLogMapper.xml
  32. 0 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MailLogServiceImpl.java
  33. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/StatusCode.java
  34. 6 0
      module-job-bytedance/pom.xml
  35. 1 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceRefreshTokenJob.java
  36. 54 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceMaterialsLoadJob.java
  37. 51 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceOperationRecordJob.java
  38. 18 0
      module-job-bytedance/src/main/resources/application-prod.yml
  39. 13 14
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl2.java
  40. 6 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceCreativeController.java
  41. 2 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/ByteDanceVideoInfoMapper.java
  42. 3 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/ByteDanceVideoInfoMapper.xml
  43. 2 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IByteDanceVideoInfoService.java
  44. 0 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IBytedanceImageInfoService.java
  45. 1 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceAdvertiserDataServiceImpl.java
  46. 1 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceCampaignServiceImpl.java
  47. 30 4
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceCreativeServiceImpl.java
  48. 5 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceVideoInfoServiceImpl.java
  49. 82 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceInterfaceController.java
  50. 22 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/entity/ByteDanceOperationRecord.java
  51. 527 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/entity/BytedanceReportPlayableDaily.java
  52. 16 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceOperationRecordMapper.java
  53. 116 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceOperationRecordMapper.xml
  54. 12 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceInterfaceService.java
  55. 1 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceReportService.java
  56. 287 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceInterfaceServiceImpl.java
  57. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceReportServiceImpl.java
  58. 2 2
      performance-appraisal/src/main/java/cn/com/ctop/uservideomap/controller/UserVideoMapController.java
  59. 20 0
      pom.xml

+ 6 - 0
jeecg-boot-base-common/pom.xml

@@ -4,6 +4,12 @@
     <modelVersion>4.0.0</modelVersion>
     <artifactId>jeecg-boot-base-common</artifactId>
     <version>2.0.2</version>
+    <dependencies>
+        <dependency>
+            <groupId>org.codehaus.groovy</groupId>
+            <artifactId>groovy</artifactId>
+        </dependency>
+    </dependencies>
     <parent>
         <groupId>org.jeecgframework.boot</groupId>
         <artifactId>jeecg-boot-parent</artifactId>

+ 6 - 0
jeecg-boot-module-system/pom.xml

@@ -230,6 +230,12 @@
             <artifactId>kie-spring</artifactId>
             <version>7.6.0.Final</version>
         </dependency>
+        <dependency>
+            <groupId>com.ctop</groupId>
+            <artifactId>module-check</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
     <dependencyManagement>

+ 0 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/config/RedisConfig.java

@@ -42,7 +42,6 @@ public class RedisConfig extends CachingConfigurerSupport {
 		return new KeyGenerator() {
 			@Override
 			public Object generate(Object target, Method method, Object... params) {
-
 				StringBuilder sb = new StringBuilder();
 				sb.append(target.getClass().getName());
 				sb.append(method.getDeclaringClass().getName());
@@ -97,11 +96,8 @@ public class RedisConfig extends CachingConfigurerSupport {
 		// RedisCacheConfiguration config =
 		// RedisCacheConfiguration.defaultCacheConfig().serializeValuesWith(pair);
 		// 创建默认缓存配置对象
-
-		// 创建默认缓存配置对象
         //设置缓存默认有效期3小时;
         RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofHours(3));
-
 		RedisCacheManager cacheManager = new RedisCacheManager(writer, config);
 		return cacheManager;
 	}

+ 2 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -32,9 +32,6 @@ import java.util.Map;
 
 @Configuration
 public class ShiroConfig {
-//    @Value("${jeecg.shiro.excludeUrls}")
-//    private String excludeUrls;
-
     @Value("${spring.redis.port}")
     private String port;
 
@@ -172,6 +169,8 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/job/test/*", "anon");
         filterChainDefinitionMap.put("//thirt/*", "anon");
         //filterChainDefinitionMap.put("/kuaishou/**", "anon");
+        filterChainDefinitionMap.put("/rest/script/*", "anon");
+        filterChainDefinitionMap.put("/ctop/checkTaskList/*", "anon");
 
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);

+ 50 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

@@ -9,12 +9,8 @@ import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.material.service.IBytedanceEffectVideoInfoService;
-import cn.com.ctop.toutiao.modules.report.service.IBytedancePlanDailyReportService;
-import cn.com.ctop.toutiao.modules.report.service.IBytedancePlanHourlyReportService;
-import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
-import cn.com.ctop.toutiao.modules.report.service.IReportService;
+import cn.com.ctop.toutiao.modules.report.service.*;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.api.R;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.annotations.Param;
@@ -791,7 +787,7 @@ public class TestController {
 
 
     @GetMapping(value = "/BytedanceDailyAsyncJob")
-    public void BytedanceDailyAsyncJob() throws ParseException {
+    public void BytedanceDailyAsyncJob() {
         String startDate = "2020-06-01";
         Date getDate = DateUtils.addDay(new Date(), -1);
         String endDate = DateUtils.formatDate(getDate);
@@ -922,5 +918,53 @@ public class TestController {
         return result;
     }
 
+    @Autowired
+    public IBytedanceInterfaceService bytedanceInterfaceService;
+
+    @GetMapping(value = "/searchLog")
+    public Result searchLog(@Param("accountId")Long accountId, @Param("startDate")String startDate, @Param("endDate")String endDate, @Param("operationTarget")Integer operationTarget) {
+        Result result = new Result();
+
+        if(accountId == null){
+            //1:查询当日数据
+            QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("media_id", 1);
+            queryWrapper.orderByDesc("create_time");
+            List<CtopOauthToken> tokens = tokenService.list(queryWrapper);
+            if (null == tokens || tokens.size() <= 0) {
+                log.error("定时获取快手操作记录数据异常:未获取到可用的token");
+                result.setSuccess(false);
+                result.setMessage("定时获取快手操作记录数据异常:未获取到可用的toke");
+                return result;
+            }
+
+            executorService = Executors.newFixedThreadPool(8);
+            tokens.forEach(token -> {
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        log.info("获取操作记录开始:accountId:{},startDate:{},endDate:{}", token.getAccountId(), startDate, endDate);
+                        bytedanceInterfaceService.searchLog(token.getAccountId(), token, operationTarget,startDate, endDate);
+                        log.info("获取快手操作记录结束:accountId:{},startDate:{},endDate:{}", token.getAccountId(), startDate, endDate);
+                    }
+                });
+            });
+        }else{
+            QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("account_id", accountId);
+            CtopOauthToken token = tokenService.getOauthTokenByAccountId(String.valueOf(accountId));
+            if (null == token) {
+                log.error("定时获取头条操作记录数据异常:未获取到可用的token");
+                result.setSuccess(false);
+                result.setMessage("定时获取头条操作记录数据异常:未获取到可用的toke");
+                return result;
+            }
+            log.info("获取快手操作记录开始:accountId:{},startDate:{},endDate:{}", token.getAccountId(), startDate, endDate);
+            bytedanceInterfaceService.searchLog(accountId, token, operationTarget,startDate, endDate);
+            log.info("获取快手操作记录结束:accountId:{},startDate:{},endDate:{}", token.getAccountId(), startDate, endDate);
+        }
+
+        return result;
+    }
 
 }

+ 6 - 6
jeecg-boot-module-system/src/main/resources/application-test.yml

@@ -91,16 +91,16 @@ spring:
         filters: stat,slf4j
         # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
-      datasource:
-        master:
-          url: jdbc:mysql://39.106.184.70:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-          username: hcst
-          password: test@20190531
 #      datasource:
 #        master:
-#          url: jdbc:mysql://39.97.120.42:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+#          url: jdbc:mysql://139.186.27.96:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
 #          username: hcst
 #          password: test@20190531
+      datasource:
+        master:
+          url: jdbc:mysql://39.106.184.70/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          username: hcst
+          password: test@20190531
           driver-class-name: com.mysql.jdbc.Driver
   #redis 配置
   redis:

+ 9 - 157
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -1,187 +1,39 @@
 package org.jeecg;
 
-import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.common.module.utils.HttpUtils;
-import cn.com.ctop.crawler.modules.pangolin.entity.PangolinApp;
-import cn.com.ctop.crawler.modules.pangolin.service.PangolinAppService;
-import cn.com.ctop.crawler.modules.pangolin.service.PangolinCrawlerService;
-import cn.com.ctop.crawler.modules.pangolin.service.PangolinLoginService;
-import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
-import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceCampaignService;
-import cn.com.ctop.toutiao.modules.report.service.IReportService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeService;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import lombok.extern.slf4j.Slf4j;
-import org.jeecg.common.util.DateUtils;
-import org.jeecg.modules.ctop.entity.KuaishouEffectVideoInfo;
-import org.jeecg.modules.ctop.service.IKuaishouEffectVideoInfoService;
-import org.jeecg.modules.demo.mock.MockController;
-import org.jeecg.modules.demo.test.entity.JeecgDemo;
-import org.jeecg.modules.demo.test.mapper.JeecgDemoMapper;
-import org.jeecg.modules.demo.test.service.IJeecgDemoService;
-import org.jeecg.modules.system.service.ISysDataLogService;
-import org.junit.Assert;
-import org.jeecg.modules.ctop.service.IRuleEngineService;
-import org.jeecg.modules.ctop.vo.QueryParam;
-import org.jeecg.modules.ctop.vo.RuleResult;
+import cn.com.ctop.toutiao.modules.report.service.IReportService;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.kie.api.runtime.KieSession;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
 import org.springframework.test.context.junit4.SpringRunner;
 
-import javax.annotation.Resource;
-import javax.annotation.Resource;
-import java.util.HashMap;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
 @RunWith(SpringRunner.class)
 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("wps")
 public class SampleTest {
     @Autowired
     private ICtopOauthTokenService oauthTokenService;
     @Autowired
-    private IByteDanceAdvertiserDataService advertiserDataService;
-    @Autowired
     private IReportService reportService;
-    @Autowired
-    private IKuaishouInterfaceService interfaceService;
-	@Resource
-	private JeecgDemoMapper jeecgDemoMapper;
-	@Resource
-	private IJeecgDemoService jeecgDemoService;
-	@Resource
-	private ISysDataLogService sysDataLogService;
-	@Resource
-	private MockController mock;
+	@Autowired
     private IByteDanceCreativeService creativeService;
+	@Autowired
+    private IByteDanceCampaignService campaignService;
 
     @Test
     public void loadBytedanceCreativeData() {
-        /**
-         *
-         */
         CtopOauthToken token = oauthTokenService.getTokenByAccountId(1649600126891015L);
         creativeService.getAdvertiserCreative(token,null,null);
-//        advertiserDataService.getMaterialList(token);
     }
 
-    @Autowired
-    private IBindAccountLoginService bindAccountLoginService;
-    @Autowired
-    private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
-
-	@Test
-	public void testSelect() {
-		System.out.println(("----- selectAll method test ------"));
-		List<JeecgDemo> userList = jeecgDemoMapper.selectList(null);
-		Assert.assertEquals(5, userList.size());
-		userList.forEach(System.out::println);
-	}
-
-	@Test
-	public void testXmlSql() {
-		System.out.println(("----- selectAll method test ------"));
-		List<JeecgDemo> userList = jeecgDemoMapper.getDemoByName("Sandy12");
-		userList.forEach(System.out::println);
-	}
-
-	/**
-	 * 测试事务
-	 */
-	@Test
-	public void testTran() {
-		jeecgDemoService.testTran();
-	}
-
-	//author:lvdandan-----date:20190315---for:添加数据日志测试----
-	/**
-	 * 测试数据日志添加
-	 */
-	@Test
-	public void testDataLogSave() {
-		System.out.println(("----- datalog test ------"));
-		String tableName = "jeecg_demo";
-		String dataId = "4028ef81550c1a7901550c1cd6e70001";
-		String dataContent = mock.sysDataLogJson();
-		sysDataLogService.addDataLog(tableName, dataId, dataContent);
-	}
-	//author:lvdandan-----date:20190315---for:添加数据日志测试----
-
-
-    @Autowired
-    private IByteDanceCampaignService campaignService;
-    @Test
-    public void testGetCampaign(){
-        CtopOauthToken token = oauthTokenService.getOauthTokenByAccountId("1649600126891015");
-        campaignService.getAdvertiserCampaign(token,"1672261893872756",null);
-    }
-
-    @Autowired
-    private IKuaishouEffectVideoInfoService effectVideoInfoService;
-    @Test
-    public void loadKuaishouEffectVideoInfo(){
-        List<KuaishouEffectVideoInfo>videoInfos = effectVideoInfoService.list();
-        for (KuaishouEffectVideoInfo video:videoInfos) {
-            if(null!=video.getSignature()&&!"".equals(video.getSignature())){
-                effectVideoInfoService.updateFinalCostDateBySignature(video.getSignature());
-                effectVideoInfoService.updateInitialCostDateBySignature(video.getSignature());
-                effectVideoInfoService.updateTotalCostBySignature(video.getSignature());
-//                effectVideoInfoService.updateTowWeekCostBySignature(video.getSignature());
-            }
-        }
-    }
-
-    @Test
-    public void getIndustryInfo(){
-        String access_token = "cbdf6502c04978ae401cb92a64530fb73a8c7dbe";
-        // 请求地址
-        String url = "https://ad.oceanengine.com/open_api/2/tools/industry/get/";
-        JSONObject jsonObject = HttpUtils.bytedanceGetRequest(access_token, url, new JSONObject());
-        System.out.println(jsonObject.toJSONString());
-    }
-
-    @Test
-    public void loadImageInfo()throws Exception{
-        List<CtopOauthToken>tokens = oauthTokenService.selectToutiaoToken();
-        for (CtopOauthToken token:tokens) {
-            advertiserDataService.getImageByPage(token,null,1);
-            Thread.sleep(1000L);
-        }
-    }
-
-    @Resource
-    private KieSession kieSession;
-    @Autowired
-    private IRuleEngineService ruleEngineService ;
-
     @Test
-    public void testEngine(){
-        QueryParam queryParam1 = new QueryParam() ;
-        queryParam1.setParamId("1");
-        queryParam1.setParamSign("+");
-        QueryParam queryParam2 = new QueryParam() ;
-        queryParam2.setParamId("2");
-        queryParam2.setParamSign("-");
-        // 入参
-        kieSession.insert(queryParam1);
-        kieSession.insert(queryParam2);
-        kieSession.insert(this.ruleEngineService);
-        // 返参
-        RuleResult resultParam = new RuleResult();
-        kieSession.insert(resultParam);
-        kieSession.fireAllRules();
-        System.out.println(resultParam.isPostCodeResult());
+    public void testLoadBytedanceData(){
+        CtopOauthToken token = oauthTokenService.getTokenByAccountId(1673731621920840L);
+       campaignService.getAdvertiserCampaign(token,null,null);
     }
 }

+ 43 - 0
module-check/pom.xml

@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>jeecg-boot-parent</artifactId>
+        <groupId>org.jeecgframework.boot</groupId>
+        <version>2.0.2</version>
+    </parent>
+    <groupId>com.ctop</groupId>
+    <artifactId>module-check</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>module-check</name>
+    <description>Data Check Jar</description>
+
+    <properties>
+        <java.version>1.8</java.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.jeecgframework.boot</groupId>
+            <artifactId>jeecg-boot-base-common</artifactId>
+            <version>2.0.2</version>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.com.ctop</groupId>
+            <artifactId>module-common</artifactId>
+            <version>2.0.2</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 13 - 0
module-check/src/main/java/cn/com/ctop/ModuleCheckApplication.java

@@ -0,0 +1,13 @@
+package cn.com.ctop;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class ModuleCheckApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(ModuleCheckApplication.class, args);
+    }
+
+}

+ 20 - 0
module-check/src/main/java/cn/com/ctop/check/TestGroovy.groovy

@@ -0,0 +1,20 @@
+package cn.com.ctop.check
+
+import cn.com.ctop.check.component.basic.AbstractScript
+import cn.com.ctop.common.module.service.IRefreshTokenService
+import cn.com.ctop.common.module.service.impl.RefreshTokenServiceImpl
+import org.jeecg.common.api.vo.Result
+
+class TestGroovy extends AbstractScript {
+
+   private IRefreshTokenService refreshTokenService;
+
+    @Override
+    Result<Object> exec() {
+        refreshTokenService=applicationContext.getBean(RefreshTokenServiceImpl.class)
+        println("开始执行Groovy脚本")
+        refreshTokenService.byteDanceRefresh();
+        println("执行完成")
+        return Result.ok("666")
+    }
+}

+ 37 - 0
module-check/src/main/java/cn/com/ctop/check/component/basic/AbstractScript.java

@@ -0,0 +1,37 @@
+package cn.com.ctop.check.component.basic;
+
+import cn.com.ctop.check.entity.CtopCheckTaskList;
+import cn.com.ctop.notice.handle.SendWeChatHandle;
+import org.springframework.context.ApplicationContext;
+
+public abstract class AbstractScript implements BaseScript{
+
+    protected ApplicationContext applicationContext;
+
+    protected CtopCheckTaskList ctopCheckTaskList;
+
+    protected SendWeChatHandle sendWeChatHandle;
+
+
+    public ApplicationContext getApplicationContext() {
+        return applicationContext;
+    }
+
+    public void setApplicationContext(ApplicationContext applicationContext) {
+        this.applicationContext = applicationContext;
+    }
+
+    public CtopCheckTaskList getCtopCheckTaskList() { return ctopCheckTaskList; }
+
+    public void setCtopCheckTaskList(CtopCheckTaskList ctopCheckTaskList) {
+        this.ctopCheckTaskList = ctopCheckTaskList;
+    }
+
+    public SendWeChatHandle getSendWeChatHandle() {
+        return sendWeChatHandle;
+    }
+
+    public void setSendWeChatHandle(SendWeChatHandle sendWeChatHandle) {
+        this.sendWeChatHandle = sendWeChatHandle;
+    }
+}

+ 9 - 0
module-check/src/main/java/cn/com/ctop/check/component/basic/BaseScript.java

@@ -0,0 +1,9 @@
+package cn.com.ctop.check.component.basic;
+
+import org.jeecg.common.api.vo.Result;
+
+public interface BaseScript {
+
+    Result<Object> exec();
+
+}

+ 114 - 0
module-check/src/main/java/cn/com/ctop/check/component/execute/GroovyScriptExecutor.java

@@ -0,0 +1,114 @@
+package cn.com.ctop.check.component.execute;
+
+import cn.com.ctop.check.component.basic.AbstractScript;
+import cn.com.ctop.check.entity.CtopCheckTaskList;
+import cn.com.ctop.check.service.ICtopCheckTaskListService;
+import cn.com.ctop.notice.handle.SendWeChatHandle;
+import groovy.lang.GroovyClassLoader;
+import groovy.lang.GroovyCodeSource;
+import lombok.extern.slf4j.Slf4j;
+import org.codehaus.groovy.control.CompilationFailedException;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.UUIDGenerator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+
+/**
+ *  Created by JQ.bi on 2020.08.11
+ */
+@Slf4j
+@Component
+public class GroovyScriptExecutor {
+
+    private final static String ROOT_PATH = System.getProperty("user.dir");
+
+    private final static String SCRIPT_PATH = ROOT_PATH + File.separator + "script";
+
+    private final ApplicationContext applicationContext;
+
+    private final ICtopCheckTaskListService checkTaskListService;
+
+    private final SendWeChatHandle  sendWeChatHandle;
+
+    private final GroovyClassLoader classLoader;
+
+    @Autowired
+    public GroovyScriptExecutor(ApplicationContext applicationContext,ICtopCheckTaskListService checkTaskListService,SendWeChatHandle  sendWeChatHandle) {
+        this.applicationContext=applicationContext;
+        this.checkTaskListService = checkTaskListService;
+        this.sendWeChatHandle=sendWeChatHandle;
+        this.classLoader = new GroovyClassLoader();
+        initClassPath();
+    }
+
+    public Result<Object> execute(CtopCheckTaskList script) {
+        if(script.getIsDelete()||!script.getExeState()){
+            return Result.error(String.format("groovy script is invalid. api_name=%s", script.getApiName()));
+        }else {
+            return executescriptScript(script);
+        }
+    }
+
+    public Result<Object> execute(Integer id, String apiName) {
+        CtopCheckTaskList script = checkTaskListService.queryByIdAndApiName(id,apiName);
+        if (script == null) {
+            return Result.error(String.format("groovy script not found. api_name=%s", apiName));
+        }else {
+            return executescriptScript(script);
+        }
+    }
+
+    private Result<Object> executescriptScript(CtopCheckTaskList taskList){
+        ClearCache();
+        GroovyCodeSource groovyCodeSource = getGroovyCodeSource(taskList);
+        Result<Object> response = null;
+        try {
+            Class scriptClass = this.classLoader.parseClass(groovyCodeSource);
+            Object instance = scriptClass.newInstance();
+            if (instance instanceof AbstractScript) {
+                AbstractScript scriptInstance = (AbstractScript) instance;
+                scriptInstance.setApplicationContext(applicationContext);
+                scriptInstance.setSendWeChatHandle(sendWeChatHandle);
+                scriptInstance.setCtopCheckTaskList(taskList);
+                response = scriptInstance.exec();
+            } else {
+                log.error("script script should extends Abstractscript.");
+                response=Result.error("script script should extends Abstractscript.");
+            }
+        } catch (InstantiationException | IllegalAccessException | CompilationFailedException e) {
+            log.error("Error execute check task script. ", e);
+            response=Result.error("Error execute check task script. "+e.getMessage());
+        }
+        return response;
+    }
+
+    private GroovyCodeSource getGroovyCodeSource(CtopCheckTaskList taskList) {
+        String codeBase = "/script/" + UUIDGenerator.generate();
+        GroovyCodeSource groovyCodeSource = new GroovyCodeSource(taskList.getScript(), taskList.getApiName(), codeBase);
+        groovyCodeSource.setCachable(false);
+        return groovyCodeSource;
+    }
+
+    private void initClassPath() {
+        String libPath = SCRIPT_PATH + File.separator + "lib";
+        File lib = new File(libPath);
+        if (lib.exists()) {
+            File[] files = lib.listFiles(pathname -> pathname.isFile() && pathname.getName().endsWith(".jar"));
+            if (files != null) {
+                for (File file : files) {
+                    String path = file.getPath();
+                    this.classLoader.addClasspath(path);
+                }
+            }
+        }
+    }
+
+    //清除缓存
+    private void ClearCache(){
+        classLoader.clearCache();
+    }
+
+}

+ 111 - 0
module-check/src/main/java/cn/com/ctop/check/controller/CtopCheckTaskExecuteLogController.java

@@ -0,0 +1,111 @@
+package cn.com.ctop.check.controller;
+
+import cn.com.ctop.check.entity.CtopCheckTaskExecuteLog;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import cn.com.ctop.check.service.ICtopCheckTaskExecuteLogService;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+* 数据检查任务执行日志.
+*/
+@Slf4j
+@RestController
+@RequestMapping("/ctop/checkTaskExecuteLog")
+public class CtopCheckTaskExecuteLogController {
+
+   @Autowired
+   private ICtopCheckTaskExecuteLogService ctopCheckTaskExecuteLogService;
+
+   /**
+    * 分页列表查询
+    */
+   @GetMapping(value = "/list")
+   public Result<IPage<CtopCheckTaskExecuteLog>> queryPageList(CtopCheckTaskExecuteLog ctopCheckTaskExecuteLog,
+                                                               @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+                                                               @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+                                                               HttpServletRequest req) {
+       Result<IPage<CtopCheckTaskExecuteLog>> result = new Result<>();
+       QueryWrapper<CtopCheckTaskExecuteLog> queryWrapper = QueryGenerator.initQueryWrapper(ctopCheckTaskExecuteLog, req.getParameterMap());
+       queryWrapper.orderByDesc("create_time");
+       Page<CtopCheckTaskExecuteLog> page = new Page<>(pageNo, pageSize);
+       IPage<CtopCheckTaskExecuteLog> pageList = ctopCheckTaskExecuteLogService.page(page, queryWrapper);
+       pageList.getRecords().forEach(it->it.setExeTime((int)(it.getEndDate()-it.getStartDate())/1000));
+       result.setSuccess(true);
+       result.setResult(pageList);
+       return result;
+   }
+
+   /**
+    *  添加
+    */
+   @PostMapping(value = "/add")
+   public Result<CtopCheckTaskExecuteLog> add(@RequestBody CtopCheckTaskExecuteLog ctopCheckTaskExecuteLog) {
+       Result<CtopCheckTaskExecuteLog> result = new Result<>();
+       try {
+           ctopCheckTaskExecuteLogService.save(ctopCheckTaskExecuteLog);
+           result.success("添加成功!");
+       } catch (Exception e) {
+           log.error(e.getMessage(),e);
+           result.error500("操作失败");
+       }
+       return result;
+   }
+
+   /**
+    *  编辑
+    */
+   @PostMapping(value = "/edit")
+   public Result<CtopCheckTaskExecuteLog> edit(@RequestBody CtopCheckTaskExecuteLog ctopCheckTaskExecuteLog) {
+       Result<CtopCheckTaskExecuteLog> result = new Result<CtopCheckTaskExecuteLog>();
+       CtopCheckTaskExecuteLog ctopCheckTaskExecuteLogEntity = ctopCheckTaskExecuteLogService.getById(ctopCheckTaskExecuteLog.getId());
+       if(ctopCheckTaskExecuteLogEntity==null) {
+           result.error500("未找到对应实体");
+       }else {
+           boolean ok = ctopCheckTaskExecuteLogService.updateById(ctopCheckTaskExecuteLog);
+           if(ok) {
+               result.success("修改成功!");
+           }
+       }
+       return result;
+   }
+
+   /**
+    *  通过id删除
+    */
+   @PostMapping(value = "/delete")
+   public Result<?> delete(@RequestParam(name="id",required=true) Long id) {
+       try {
+           ctopCheckTaskExecuteLogService.removeById(id);
+       } catch (Exception e) {
+           log.error(e.getMessage());
+           return Result.error("删除失败!");
+       }
+       return Result.ok("删除成功!");
+   }
+
+
+   /**
+    * 通过id查询
+    */
+   @GetMapping(value = "/queryById")
+   public Result<CtopCheckTaskExecuteLog> queryById(@RequestParam(name="id",required=true) String id) {
+       Result<CtopCheckTaskExecuteLog> result = new Result<>();
+       CtopCheckTaskExecuteLog ctopCheckTaskExecuteLog = ctopCheckTaskExecuteLogService.getById(id);
+       if(ctopCheckTaskExecuteLog==null) {
+           result.error500("未找到对应实体");
+       }else {
+           result.setResult(ctopCheckTaskExecuteLog);
+           result.setSuccess(true);
+       }
+       return result;
+   }
+
+}

+ 115 - 0
module-check/src/main/java/cn/com/ctop/check/controller/CtopCheckTaskListController.java

@@ -0,0 +1,115 @@
+package cn.com.ctop.check.controller;
+
+import cn.com.ctop.check.entity.CtopCheckTaskList;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import cn.com.ctop.check.service.ICtopCheckTaskListService;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+* 检查数据任务列表
+*/
+@Slf4j
+@RestController
+@RequestMapping("/ctop/checkTaskList")
+public class CtopCheckTaskListController {
+
+    @Autowired
+    private ICtopCheckTaskListService ctopCheckTaskListService;
+
+    /**
+     * 分页列表查询
+     */
+    @GetMapping(value = "/list")
+    public Result<IPage<CtopCheckTaskList>> queryPageList(CtopCheckTaskList ctopCheckTaskList,
+                                                          @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                          HttpServletRequest req) {
+        Result<IPage<CtopCheckTaskList>> result = new Result<>();
+        //过滤已删除
+        ctopCheckTaskList.setIsDelete(false);
+        QueryWrapper<CtopCheckTaskList> queryWrapper = QueryGenerator.initQueryWrapper(ctopCheckTaskList, req.getParameterMap());
+        queryWrapper.orderByDesc("create_time");
+        Page<CtopCheckTaskList> page = new Page<>(pageNo, pageSize);
+        IPage<CtopCheckTaskList> pageList = ctopCheckTaskListService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     */
+    @PostMapping(value = "/add")
+    public Result<CtopCheckTaskList> add(@RequestBody CtopCheckTaskList ctopCheckTaskList) {
+        Result<CtopCheckTaskList> result = new Result<>();
+        try {
+            ctopCheckTaskListService.save(ctopCheckTaskList);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     */
+    @PostMapping(value = "/edit")
+    public Result<CtopCheckTaskList> edit(@RequestBody CtopCheckTaskList ctopCheckTaskList) {
+        Result<CtopCheckTaskList> result = new Result<>();
+        CtopCheckTaskList ctopCheckTaskListEntity = ctopCheckTaskListService.getById(ctopCheckTaskList.getId());
+        if (ctopCheckTaskListEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = ctopCheckTaskListService.updateById(ctopCheckTaskList);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     */
+    @PostMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) Integer id) {
+        try {
+            CtopCheckTaskList ctopCheckTaskList=new CtopCheckTaskList();
+            ctopCheckTaskList.setId(id);
+            ctopCheckTaskList.setIsDelete(true);
+            ctopCheckTaskListService.updateById(ctopCheckTaskList);
+        } catch (Exception e) {
+            log.error(e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 通过id查询
+     */
+    @GetMapping(value = "/queryById")
+    public Result<CtopCheckTaskList> queryById(@RequestParam(name = "id", required = true) Integer id) {
+        Result<CtopCheckTaskList> result = new Result<>();
+        CtopCheckTaskList ctopCheckTaskList = ctopCheckTaskListService.getById(id);
+        if (ctopCheckTaskList == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(ctopCheckTaskList);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+}

+ 47 - 0
module-check/src/main/java/cn/com/ctop/check/entity/CtopCheckTaskExecuteLog.java

@@ -0,0 +1,47 @@
+package cn.com.ctop.check.entity;
+
+import cn.com.ctop.common.module.annotation.Dict;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 数据检查任务执行日志
+ */
+@Data
+@TableName("ctop_check_task_execute_log")
+public class CtopCheckTaskExecuteLog {
+    
+	/**
+	 * id
+	 */
+	@TableId(type = IdType.AUTO)
+	private Long id;
+
+	/**checkTaskId*/
+	@Dict(dicCode = "id",dictTable="ctop_check_task_list",dicText="name")
+	private Integer checkTaskId;
+
+	/**startDate*/
+	private Long startDate;
+
+	/**endDate*/
+	private Long endDate;
+
+	//执行时间毫秒
+	@TableField(exist=false)
+	private Integer exeTime;
+
+	/**执行结果*/
+	private Boolean exeResult;
+
+	/**通知状态*/
+	private Boolean notifyState;
+
+	/**createTime*/
+	private Date createTime;
+}

+ 83 - 0
module-check/src/main/java/cn/com/ctop/check/entity/CtopCheckTaskList.java

@@ -0,0 +1,83 @@
+package cn.com.ctop.check.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 检查数据任务列表
+ */
+@Data
+@TableName("ctop_check_task_list")
+public class CtopCheckTaskList {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 任务名称
+     */
+    private String name;
+
+    /**
+     * 描述
+     */
+    private String comment;
+
+    /**
+     * job 名称
+     */
+    private String jobName;
+
+    /**
+     * 包名
+     */
+    private String packageName;
+
+    /**
+     * 类名
+     */
+    private String apiName;
+
+    /**
+     * 脚本
+     *
+     */
+    private String script;
+
+    /**
+     * mail
+     */
+    private String mail;
+
+    /**
+     * 执行状态
+     */
+    private Boolean exeState;
+
+    /**
+     * 媒体类型
+     */
+    private Integer mediaType;
+
+    /**
+     * createTime
+     */
+    private Date createTime;
+
+    /**
+     * updateTime
+     */
+    private Date updateTime;
+
+    /**
+     * 是否删除
+     */
+    private Boolean isDelete;
+}

+ 11 - 0
module-check/src/main/java/cn/com/ctop/check/mapper/CtopCheckTaskExecuteLogMapper.java

@@ -0,0 +1,11 @@
+package cn.com.ctop.check.mapper;
+
+import cn.com.ctop.check.entity.CtopCheckTaskExecuteLog;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 数据检查任务执行日志
+ */
+public interface CtopCheckTaskExecuteLogMapper extends BaseMapper<CtopCheckTaskExecuteLog> {
+
+}

+ 19 - 0
module-check/src/main/java/cn/com/ctop/check/mapper/CtopCheckTaskListMapper.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.check.mapper;
+
+import cn.com.ctop.check.entity.CtopCheckTaskList;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 检查数据任务列表
+ *
+ */
+public interface CtopCheckTaskListMapper extends BaseMapper<CtopCheckTaskList> {
+
+    CtopCheckTaskList queryByIdAndApiName(@Param("id") int id, @Param("apiName") String apiName);
+
+    List<CtopCheckTaskList> queryExecuteList(@Param("jobName") String jobName);
+
+}

+ 5 - 0
module-check/src/main/java/cn/com/ctop/check/mapper/xml/CtopCheckTaskExecuteLogMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.check.mapper.CtopCheckTaskExecuteLogMapper">
+
+</mapper>

+ 27 - 0
module-check/src/main/java/cn/com/ctop/check/mapper/xml/CtopCheckTaskListMapper.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.check.mapper.CtopCheckTaskListMapper">
+
+    <select id="queryByIdAndApiName" resultType="cn.com.ctop.check.entity.CtopCheckTaskList">
+        SELECT
+            *
+        FROM
+            ctop_check_task_list
+        WHERE
+            id = #{id}
+          AND api_name = #{apiName}
+          AND is_delete = FALSE
+    </select>
+
+    <select id="queryExecuteList" resultType="cn.com.ctop.check.entity.CtopCheckTaskList">
+        SELECT
+            *
+        FROM
+            ctop_check_task_list
+        WHERE
+            job_name = #{jobName}
+          AND is_delete = FALSE
+          AND exe_state = TRUE
+        ORDER BY media_type
+    </select>
+</mapper>

+ 18 - 0
module-check/src/main/java/cn/com/ctop/check/script/CheckTokenExecuteStateScript.groovy

@@ -0,0 +1,18 @@
+package cn.com.ctop.check.script
+
+import cn.com.ctop.check.component.basic.AbstractScript
+import cn.com.ctop.common.module.service.ICtopOauthTokenService
+import cn.com.ctop.common.module.service.impl.CtopOauthTokenServiceImpl
+import org.jeecg.common.api.vo.Result
+
+class CheckTokenExecuteStateScript extends AbstractScript{
+
+    private ICtopOauthTokenService ctopOauthTokenService
+
+    @Override
+    Result<Object> exec() {
+        ctopOauthTokenService=applicationContext.getBean(CtopOauthTokenServiceImpl.class)
+
+        return null
+    }
+}

+ 26 - 0
module-check/src/main/java/cn/com/ctop/check/script/TestGroovyScript.java

@@ -0,0 +1,26 @@
+package cn.com.ctop.check.script;
+
+import cn.com.ctop.check.component.execute.GroovyScriptExecutor;
+import cn.com.ctop.check.service.ICtopCheckTaskListService;
+import org.jeecg.common.api.vo.Result;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/rest/script")
+public class TestGroovyScript {
+
+    @Autowired
+    ICtopCheckTaskListService checkTaskListService;
+
+    @Autowired
+    GroovyScriptExecutor groovyScriptExecutor;
+
+    @GetMapping("/test")
+    public Result testGroovy(){
+        groovyScriptExecutor.execute(1,"TestGroovy");
+        return Result.ok();
+    }
+}

+ 11 - 0
module-check/src/main/java/cn/com/ctop/check/service/ICtopCheckTaskExecuteLogService.java

@@ -0,0 +1,11 @@
+package cn.com.ctop.check.service;
+
+import cn.com.ctop.check.entity.CtopCheckTaskExecuteLog;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 数据检查任务执行日志
+ */
+public interface ICtopCheckTaskExecuteLogService extends IService<CtopCheckTaskExecuteLog> {
+
+}

+ 16 - 0
module-check/src/main/java/cn/com/ctop/check/service/ICtopCheckTaskListService.java

@@ -0,0 +1,16 @@
+package cn.com.ctop.check.service;
+
+import cn.com.ctop.check.entity.CtopCheckTaskList;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 检查数据任务列表
+ */
+public interface ICtopCheckTaskListService extends IService<CtopCheckTaskList> {
+
+    CtopCheckTaskList queryByIdAndApiName(int id, String apiName);
+
+    List<CtopCheckTaskList> queryExecuteList(String jobName);
+}

+ 15 - 0
module-check/src/main/java/cn/com/ctop/check/service/impl/CtopCheckTaskExecuteLogServiceImpl.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.check.service.impl;
+
+import cn.com.ctop.check.entity.CtopCheckTaskExecuteLog;
+import cn.com.ctop.check.mapper.CtopCheckTaskExecuteLogMapper;
+import cn.com.ctop.check.service.ICtopCheckTaskExecuteLogService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 数据检查任务执行日志
+ */
+@Service
+public class CtopCheckTaskExecuteLogServiceImpl extends ServiceImpl<CtopCheckTaskExecuteLogMapper, CtopCheckTaskExecuteLog> implements ICtopCheckTaskExecuteLogService {
+
+}

+ 30 - 0
module-check/src/main/java/cn/com/ctop/check/service/impl/CtopCheckTaskListServiceImpl.java

@@ -0,0 +1,30 @@
+package cn.com.ctop.check.service.impl;
+
+import cn.com.ctop.check.entity.CtopCheckTaskList;
+import cn.com.ctop.check.mapper.CtopCheckTaskListMapper;
+import cn.com.ctop.check.service.ICtopCheckTaskListService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 检查数据任务列表
+ */
+@Service
+public class CtopCheckTaskListServiceImpl extends ServiceImpl<CtopCheckTaskListMapper, CtopCheckTaskList> implements ICtopCheckTaskListService {
+
+    @Autowired
+    CtopCheckTaskListMapper ctopCheckTaskListMapper;
+
+    @Override
+    public CtopCheckTaskList queryByIdAndApiName(int id, String apiName) {
+        return ctopCheckTaskListMapper.queryByIdAndApiName(id,apiName);
+    }
+
+    @Override
+    public List<CtopCheckTaskList> queryExecuteList(String jobName) {
+        return ctopCheckTaskListMapper.queryExecuteList(jobName);
+    }
+}

+ 30 - 0
module-check/src/main/java/cn/com/ctop/notice/handle/SendWeChatHandle.java

@@ -0,0 +1,30 @@
+package cn.com.ctop.notice.handle;
+
+import cn.com.ctop.common.module.mapper.MailLogMapper;
+import cn.com.ctop.common.module.service.ISendMessageService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Slf4j
+@Service
+public class SendWeChatHandle {
+
+    @Autowired
+    MailLogMapper mailLogMapper;
+    @Autowired
+    ISendMessageService sendMessageService;
+
+    public boolean SendWeChatByMail(String mail,String message){
+        boolean result=true;
+        String weChatId=mailLogMapper.getWeChatByMail(mail);
+        if(weChatId.isEmpty()){
+            log.error("mail's wechat not found. mail =%s", mail);
+            //TODO 通知管理员添加邮箱
+            result=false;
+        }else{
+            sendMessageService.sendMessage(weChatId,message);
+        }
+        return result;
+    }
+}

+ 13 - 0
module-check/src/test/java/cn/com/ctop/ModuleCheckApplicationTests.java

@@ -0,0 +1,13 @@
+package cn.com.ctop;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class ModuleCheckApplicationTests {
+
+    @Test
+    void contextLoads() {
+    }
+
+}

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MailLogMapper.java

@@ -24,4 +24,6 @@ public interface MailLogMapper extends BaseMapper<MailLog> {
     String getWChatIdByUserId(@Param("userId") String responsibleId);
 
     String getUserNameByUserId(@Param("userId") String transferor);
+
+    String getWeChatByMail(@Param("mail") String mail);
 }

+ 8 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MailLogMapper.xml

@@ -58,5 +58,13 @@
     where id = #{userId}
     </select>
 
+    <select id="getWeChatByMail" resultType="java.lang.String">
+        SELECT
+            wexin_id
+        FROM
+            ctop_corp_wexin_user
+        WHERE
+            wexin_email = #{mail}
+    </select>
 
 </mapper>

+ 0 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MailLogServiceImpl.java

@@ -22,7 +22,6 @@ import org.springframework.stereotype.Service;
  * @date 2019-12-08
  */
 @Service
-@Primary
 public class MailLogServiceImpl extends ServiceImpl<MailLogMapper, MailLog> implements IMailLogService {
     @Autowired
     private MailLogMapper mailLogMapper;

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/StatusCode.java

@@ -22,6 +22,8 @@ public enum StatusCode {
     COMMON_PARAM_ERROR("参数异常", -1, false),
     COMMON_ACCOUNT_ERROR("参数异常", -2, false),
     COMMON_DATA_NOT_EXIST("数据不存在或者已经被删除", -101, false),
+    BYTEDANCE_PLAN_DATA_NOT_EXIST("此计划不存在或者已经被删除", -101, false),
+    BYTEDANCE_ACCOUNT_DATA_NOT_EXIST("此账户尚未绑定或已停投", -101, false),
     COMMON_VERSION_NOT_EXIST("版本号不存在", -102, false),
     BYTEDANCE_VIDEO_UPLOAD_FAIL("今日头条视频文件上传失败", -201, false),
     MATERIAL_UPLOAD_FAIL("素材文件上传失败", -201, false),

+ 6 - 0
module-job-bytedance/pom.xml

@@ -141,6 +141,12 @@
             <artifactId>xxl-job-core</artifactId>
             <version>2.0.2</version>
         </dependency>
+        <dependency>
+            <groupId>com.ctop</groupId>
+            <artifactId>module-check</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
     <dependencyManagement>

+ 1 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceRefreshTokenJob.java

@@ -8,6 +8,7 @@ import org.springframework.stereotype.Component;
 
 @Component
 public class ByteDanceRefreshTokenJob {
+
     @Autowired
     private IRefreshTokenService refreshTokenService;
 

+ 54 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceMaterialsLoadJob.java

@@ -0,0 +1,54 @@
+package cn.com.ctop.job.bytedance.handler;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import com.xxl.job.core.log.XxlJobLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Component
+public class BytedanceMaterialsLoadJob {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(4);
+    //线程计数器
+    static CountDownLatch countDownLatch = null;
+    @Autowired
+    private IByteDanceAdvertiserDataService advertiserDataService;
+
+    @XxlJob("bytedanceMaterialsLoadJob")
+    public ReturnT<String> execute(String param) throws Exception{
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+        countDownLatch = new CountDownLatch(tokens.size());
+        tokens.forEach(token -> {
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        //获取全量视频素材数据
+                        advertiserDataService.getMaterialList(token);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    } finally {
+                        countDownLatch.countDown();
+                    }
+                }
+            });
+        });
+        try {
+            countDownLatch.await();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        XxlJobLogger.log("物料数据同步完成");
+        return ReturnT.SUCCESS;
+    }
+}

+ 51 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceOperationRecordJob.java

@@ -0,0 +1,51 @@
+package cn.com.ctop.job.bytedance.handler;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.toutiao.modules.material.service.IBytedanceBidWarningService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceInterfaceService;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import com.xxl.job.core.log.XxlJobLogger;
+import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Component
+public class BytedanceOperationRecordJob {
+    @Autowired
+    private IBytedanceInterfaceService bytedanceInterfaceService;
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(8);
+
+    @XxlJob("bytedanceOperationRecordJob")
+    public ReturnT<String> execute(String startDate, String endDate) throws Exception {
+        if(StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)){
+            return ReturnT.FAIL;
+        }
+
+        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
+        if (null == tokens || tokens.size() <= 0) {
+            XxlJobLogger.log("定时获取头条操作记录数据异常:未获取到可用的token");
+            return ReturnT.FAIL;
+        }
+        tokens.forEach(token -> {
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    XxlJobLogger.log("定时获取头条操作记录数据开始,accountId:" + token.getAccountId() + "操作目标为:" + 2 + "时间:" + startDate + "~" + endDate);
+                    bytedanceInterfaceService.searchLog(token.getAccountId(), token, 2, startDate, endDate);
+                    XxlJobLogger.log("定时获取头条操作记录数据结束,accountId:" + token.getAccountId() + "操作目标为:" + 2 + "时间:" + startDate + "~" + endDate);
+                }
+            });
+        });
+        return ReturnT.SUCCESS;
+    }
+}

+ 18 - 0
module-job-bytedance/src/main/resources/application-prod.yml

@@ -116,6 +116,24 @@ mybatis-plus:
       table-underline: true
 #jeecg专用配置
 jeecg:
+  elasticsearch:
+    cluster-nodes:
+    check-enabled: false
+  uploadType:
+  oss:
+    endpoint:
+    accessKey:
+    secretKey:
+    bucketName:
+    staticDomain:
+  sms:
+    accessKeyId:
+    accessKeySecret:
+  minio:
+    minio_url:
+    minio_name:
+    minio_pass:
+    bucketName:
   ffmpeg:
     bin: ffmpeg
   path:

+ 13 - 14
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl2.java

@@ -10,7 +10,6 @@ import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService2;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.collections.ArrayStack;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -93,19 +92,19 @@ public class KuaishouInterfaceServiceImpl2 implements IKuaishouInterfaceService2
                             //for(int j=0; j<jsize;j++){
                             //    JSONObject log = contentLogArray.getJSONObject(j);
 
-                            KuaishouOperationRecord record = new KuaishouOperationRecord();
-                            record.setAccountId(advertiserId);
-                            record.setStatDate(DateUtils.formatDate(operationTime));
-                            record.setOperationTime(operationTime);
-                            record.setOperationType(operationType);
-                            record.setRoleType(roleType);
-                            record.setObjectName(objectName);
-                            record.setOperationTarget(operationTarget);
-                            record.setObjectId(objectId);
-                            record.setLog(contentLogArrayString);
-                            //record.setFieldName(log.getString("field_name"));
-                            //record.setOriginalData(log.getString("original_data"));
-                            //record.setUpdateData(log.getString("update_data"));
+                                KuaishouOperationRecord record = new KuaishouOperationRecord();
+                                record.setAccountId(advertiserId);
+                                record.setStatDate(DateUtils.formatDate(operationTime));
+                                record.setOperationTime(operationTime);
+                                record.setOperationType(operationType);
+                                record.setRoleType(roleType);
+                                record.setObjectName(objectName);
+                                record.setOperationTarget(operationTarget);
+                                record.setObjectId(objectId);
+                                record.setLog(contentLogArrayString);
+                                //record.setFieldName(log.getString("field_name"));
+                                //record.setOriginalData(log.getString("original_data"));
+                                //record.setUpdateData(log.getString("update_data"));
 
                             recordList.add(record);
                             //}

+ 6 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceCreativeController.java

@@ -151,6 +151,12 @@ public class ByteDanceCreativeController {
         return result;
     }
 
+    @PostMapping("/detail")
+    public Map<String,Object>creativeDetail(@RequestParam(name = "adId",required = true,defaultValue = "0") Long adId,
+                                            @RequestParam(name = "accountId",required = true,defaultValue = "0") Long accountId){
+        return byteDanceCreativeService.getCreativeDetail(accountId,adId);
+    }
+
     /**
      * 通过id删除
      *

+ 2 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/ByteDanceVideoInfoMapper.java

@@ -15,4 +15,6 @@ import java.util.List;
 public interface ByteDanceVideoInfoMapper extends BaseMapper<ByteDanceVideoInfo> {
 
     void replaceBatch(@Param(value = "videoList") List<ByteDanceVideoInfo> videoInfoList);
+
+    void updateVideoType();
 }

+ 3 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/ByteDanceVideoInfoMapper.xml

@@ -51,4 +51,7 @@
             )
         </foreach>
     </insert>
+    <update id="updateVideoType">
+        update ctop_bytedance_video_info set type = 2 where height&gt;width
+    </update>
 </mapper>

+ 2 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IByteDanceVideoInfoService.java

@@ -16,4 +16,6 @@ public interface IByteDanceVideoInfoService extends IService<ByteDanceVideoInfo>
     void replaceBatch(List<ByteDanceVideoInfo> videoInfoList);
 
     ByteDanceVideoInfo getOneByParams(Long materialId);
+
+    void updateVideoType();
 }

+ 0 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IBytedanceImageInfoService.java

@@ -12,6 +12,5 @@ import java.util.List;
  * @version V1.0
  */
 public interface IBytedanceImageInfoService extends IService<BytedanceImageInfo> {
-
     void replaceBatch(List<BytedanceImageInfo> videoInfoList);
 }

+ 1 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceAdvertiserDataServiceImpl.java

@@ -577,6 +577,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     public void getMaterialList(CtopOauthToken token) {
         getVideoByPage(token, "", 1);
         getImageByPage(token, "", 1);
+        videoInfoService.updateVideoType();
     }
 
     @Autowired

+ 1 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceCampaignServiceImpl.java

@@ -178,6 +178,7 @@ public class ByteDanceCampaignServiceImpl extends ServiceImpl<ByteDanceCampaignM
         params.put("page", pageNumber + "");
         params.put("page_size", 100);
         String result = HttpUtils.httpGetRequest(url, headers, params);
+        System.out.println(result);
         JSONObject jsonObject = JSONObject.parseObject(result);
         Integer code = jsonObject.getInteger("code");
         if (null == code || !code.equals(0)) {

+ 30 - 4
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceCreativeServiceImpl.java

@@ -1,10 +1,14 @@
 package cn.com.ctop.toutiao.modules.material.service.impl;
 
 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.*;
+import cn.com.ctop.toutiao.modules.material.entity.ByteDanceAdvertisePlan;
 import cn.com.ctop.toutiao.modules.material.entity.ByteDanceCreative;
 import cn.com.ctop.toutiao.modules.material.mapper.ByteDanceCreativeMapper;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertisePlanService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -12,7 +16,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
 import java.util.HashMap;
@@ -28,12 +31,15 @@ import java.util.TreeMap;
  */
 @Slf4j
 @Service
-@Primary
 public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeMapper, ByteDanceCreative> implements IByteDanceCreativeService {
     @Autowired
     private ICtopOauthTokenService tokenService;
     @Autowired
     private ByteDanceCreativeMapper creativeMapper;
+    @Autowired
+    private IUserAllocationService userAllocationService;
+    @Autowired
+    private IByteDanceAdvertisePlanService byteDanceAdvertisePlanService;
 
     /**
      * 更改创意状态
@@ -189,7 +195,6 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
         resultMap.put("message", "广告计划("+adId+"):"+"创意创建成功");
         return resultMap;
     }
-
     /**
      * 获取创意详细信息
      * @return
@@ -197,6 +202,20 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
     @Override
     public Map<String, Object> getCreativeDetail(Long accountId, Long adId){
         Map<String,Object>resultMap = new HashMap<>();
+        if(null == adId||adId == 0||null == accountId||accountId == 0){
+            ResultMapUtils.setResultMap(resultMap,StatusCode.COMMON_PARAM_ERROR);
+            return resultMap;
+        }
+        UserAllocation allocation = userAllocationService.getByAccountId(accountId);
+        if(null == allocation||allocation.getAccountStatus()!=0){
+            ResultMapUtils.setResultMap(resultMap,StatusCode.BYTEDANCE_PLAN_DATA_NOT_EXIST);
+            return resultMap;
+        }
+        ByteDanceAdvertisePlan plan = byteDanceAdvertisePlanService.getById(adId);
+        if(null == plan||plan.getOptStatus().equals("AD_STATUS_DELETE")){
+            ResultMapUtils.setResultMap(resultMap,StatusCode.BYTEDANCE_ACCOUNT_DATA_NOT_EXIST);
+            return resultMap;
+        }
         CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
         // 请求地址
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_read");
@@ -214,11 +233,17 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
             resultMap.put("message", message);
             return resultMap;
         }
-        resultMap.put("data",result.getJSONObject("data"));
+        JSONObject getData = result.getJSONObject("data");
+        resultMap.put("data",formatData(getData));
         ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS);
         return resultMap;
     }
 
+    private JSONObject formatData(JSONObject getData) {
+        JSONObject data = new JSONObject();
+        return data;
+    }
+
     /**
      * TODO 后续需要拼接参数
      * @param accountId
@@ -301,6 +326,7 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
         return result;
     }
 
+
     private JSONObject initParams(JSONObject data) {
         JSONObject params = new JSONObject();
         String creativeWay = data.getString("creativeWay");

+ 5 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceVideoInfoServiceImpl.java

@@ -35,4 +35,9 @@ public class ByteDanceVideoInfoServiceImpl extends ServiceImpl<ByteDanceVideoInf
         queryWrapper.last("limit 1");
         return this.getOne(queryWrapper);
     }
+
+    @Override
+    public void updateVideoType() {
+        videoInfoMapper.updateVideoType();
+    }
 }

+ 82 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceInterfaceController.java

@@ -0,0 +1,82 @@
+package cn.com.ctop.toutiao.modules.report.controller;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceAccountReportService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceInterfaceService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * Created by JQ.bi on 2020.6.5
+ */
+@Slf4j
+@RestController
+@RequestMapping("/ctop/bytedance/report")
+public class BytedanceInterfaceController {
+
+    @Autowired
+    private IBytedanceReportService bytedanceReportService;
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IByteDanceVideoReportDailyService byteDanceVideoReportDailyService;
+    @Autowired
+    private IBytedanceInterfaceService bytedanceInterfaceService;
+
+
+    /**
+     * 头条视频素材报表--此接口仅有视频素材,单个accountId拉取数据
+     * @param startDate
+     * @param endDate
+     * @return
+     */
+    @GetMapping("/bytedancePlayableReportByAccountId")
+    public Result bytedancePlayableReportByAccountId(@RequestParam(name = "startDate") String startDate,
+                                                          @RequestParam(name = "endDate") String endDate,
+                                                          @RequestParam(name = "accountId") Long accountId) {
+        Result result = new Result<>();
+        if (StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)||accountId==null){
+            result.error500("开始时间,结束时间和账户id不能为空");
+            return result;
+        }
+        try {
+            log.info("头条获取单个账户视频素材报表数据任务执行开始");
+            Long starttime = System.currentTimeMillis();
+            CtopOauthToken token = tokenService.getOauthTokenByAccountId(String.valueOf(accountId));
+            if (null == token ) {
+                log.info("头条获取单个账户视频素材报表数据任务执行失败:未获取到可用的token");
+                return result;
+            }
+
+            //间隔天数
+            Long days = DateUtils.getDiscrepantDays(startDate, endDate);
+            String start = null;
+            String end = null;
+            for (int i = 0; i <= days; i++) {
+                start = DateUtils.addDay(startDate, i);
+                end = start;
+                //获取头条素材报表数据
+                bytedanceInterfaceService.bytedancePlayableReport(token, start, end);
+            }
+
+            Long endtime = System.currentTimeMillis();
+            log.info("头条获取视频素材报表数据任务执行结束,执行耗时:{}秒", (endtime - starttime) / 1000);
+        } catch (Exception e) {
+            log.error("头条获取视频素材报表数据任务执行结失败");
+            e.printStackTrace();
+            result.setSuccess(false);
+        }
+        return result;
+    }
+
+}

+ 22 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/entity/ByteDanceOperationRecord.java

@@ -0,0 +1,22 @@
+package cn.com.ctop.toutiao.modules.report.entity;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class ByteDanceOperationRecord {
+
+    private Long accountId;
+    private Long objectId;
+    private String contentTitle;
+    private String objectType;
+    private String objectName;
+    private Date operationCreateTime;
+    private String contentLog;
+    private String operator;
+    private String optIp;
+    private Integer operationTarget;
+    private String statDate;
+
+}

+ 527 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/entity/BytedanceReportPlayableDaily.java

@@ -0,0 +1,527 @@
+package cn.com.ctop.toutiao.modules.report.entity;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecg.common.util.DateUtils;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 头条视频素材日报表--仅包含视频素材
+ * @author sunzhen
+ */
+@Data
+@TableName("ctop_bytedance_report_playable_daily")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_bytedance_report_playable_daily", description="头条视频素材日报表--仅包含视频素材")
+public class BytedanceReportPlayableDaily {
+
+	/**id*/
+	@TableId(type = IdType.AUTO)
+	@ApiModelProperty(value = "id")
+	private Long id;
+	/**广告主id*/
+	@Excel(name = "广告主id", width = 15)
+	@ApiModelProperty(value = "广告主id")
+	private Long accountId;
+	/**数据起始时间1*/
+	@Excel(name = "数据起始时间1", width = 15)
+	@ApiModelProperty(value = "数据起始时间1")
+	private String statDatetime;
+
+	/**点击量1*/
+	@Excel(name = "点击量1", width = 15)
+	@ApiModelProperty(value = "点击量1")
+	private Integer click;
+	/**总花费1*/
+	@Excel(name = "总花费1", width = 15)
+	@ApiModelProperty(value = "总花费1")
+	private BigDecimal cost;
+	/**应用下载-激活1*/
+	@Excel(name = "应用下载-激活1", width = 15)
+	@ApiModelProperty(value = "应用下载-激活1")
+	private Integer active;
+	/**应用下载-安卓下载完成1*/
+	@Excel(name = "应用下载-安卓下载完成1", width = 15)
+	@ApiModelProperty(value = "应用下载-安卓下载完成1")
+	private Integer downloadFinish;
+	/**应用下载-安卓下载开始1*/
+	@Excel(name = "应用下载-安卓下载开始1", width = 15)
+	@ApiModelProperty(value = "应用下载-安卓下载开始1")
+	private Integer downloadStart;
+	/**应用下载-安卓安装完成*/
+	@Excel(name = "应用下载-安卓安装完成", width = 15)
+	@ApiModelProperty(value = "应用下载-安卓安装完成")
+	private Integer installFinish;
+	/**应用下载-注册1*/
+	@Excel(name = "应用下载-注册1", width = 15)
+	@ApiModelProperty(value = "应用下载-注册1")
+	private Integer register;
+	/**应用下载-付费数1*/
+	@Excel(name = "应用下载-付费数1", width = 15)
+	@ApiModelProperty(value = "应用下载-付费数1")
+	private Integer payCount;
+	/**应用下载-到达uv1*/
+	@Excel(name = "应用下载-到达uv1", width = 15)
+	@ApiModelProperty(value = "应用下载-到达uv1")
+	private Integer inAppUv;
+	/**应用下载-详情页到站uv1*/
+	@Excel(name = "应用下载-详情页到站uv1", width = 15)
+	@ApiModelProperty(value = "应用下载-详情页到站uv1")
+	private Integer inAppDetailUv;
+	/**应用下载-加入购物车1*/
+	@Excel(name = "应用下载-加入购物车1", width = 15)
+	@ApiModelProperty(value = "应用下载-加入购物车1")
+	private Integer inAppCart;
+	/**应用下载-提交订单1*/
+	@Excel(name = "应用下载-提交订单1", width = 15)
+	@ApiModelProperty(value = "应用下载-提交订单1")
+	private Integer inAppOrder;
+	/**应用下载-付费1*/
+	@Excel(name = "应用下载-付费1", width = 15)
+	@ApiModelProperty(value = "应用下载-付费1")
+	private Integer inAppPay;
+	/**落地页-电话拨打数1*/
+	@Excel(name = "落地页-电话拨打数1", width = 15)
+	@ApiModelProperty(value = "落地页-电话拨打数1")
+	private Integer phone;
+	/**表单提交数1*/
+	@Excel(name = "表单提交数1", width = 15)
+	@ApiModelProperty(value = "表单提交数1")
+	private Integer form;
+	/**落地页-地图搜索1*/
+	@Excel(name = "落地页-地图搜索1", width = 15)
+	@ApiModelProperty(value = "落地页-地图搜索1")
+	private Integer mapSearch;
+	/**落地页-按钮button1*/
+	@Excel(name = "落地页-按钮button1", width = 15)
+	@ApiModelProperty(value = "落地页-按钮button1")
+	private Integer button;
+	/**落地页-关键页面浏览1*/
+	@Excel(name = "落地页-关键页面浏览1", width = 15)
+	@ApiModelProperty(value = "落地页-关键页面浏览1")
+	private Integer viewMaterial;
+	/**落地页-QQ咨询数1*/
+	@Excel(name = "落地页-QQ咨询数1", width = 15)
+	@ApiModelProperty(value = "落地页-QQ咨询数1")
+	private Integer qq;
+	/**落地页-抽奖数1*/
+	@Excel(name = "落地页-抽奖数1", width = 15)
+	@ApiModelProperty(value = "落地页-抽奖数1")
+	private Integer lottery;
+	/**落地页-投票1*/
+	@Excel(name = "落地页-投票1", width = 15)
+	@ApiModelProperty(value = "落地页-投票1")
+	private Integer vote;
+	/**落地页-页面跳转1*/
+	@Excel(name = "落地页-页面跳转1", width = 15)
+	@ApiModelProperty(value = "落地页-页面跳转1")
+	private Integer redirect;
+	/**落地页-商品购买1*/
+	@Excel(name = "落地页-商品购买1", width = 15)
+	@ApiModelProperty(value = "落地页-商品购买1")
+	private Integer shopping;
+	/**落地页-在线咨询1*/
+	@Excel(name = "落地页-在线咨询1", width = 15)
+	@ApiModelProperty(value = "落地页-在线咨询1")
+	private Integer consult;
+	/**落地页-微信1*/
+	@Excel(name = "落地页-微信1", width = 15)
+	@ApiModelProperty(value = "落地页-微信1")
+	private Integer wechat;
+	/**落地页-智能电话确认拨打1*/
+	@Excel(name = "落地页-智能电话确认拨打1", width = 15)
+	@ApiModelProperty(value = "落地页-智能电话确认拨打1")
+	private Integer phoneConfirm;
+	/**落地页-智能电话确认接通1*/
+	@Excel(name = "落地页-智能电话确认接通1", width = 15)
+	@ApiModelProperty(value = "落地页-智能电话确认接通1")
+	private Integer phoneConnect;
+	/**落地页-智能电话有效咨询1*/
+	@Excel(name = "落地页-智能电话有效咨询1", width = 15)
+	@ApiModelProperty(value = "落地页-智能电话有效咨询1")
+	private Integer consultEffective;
+	/**视频-总播放1*/
+	@Excel(name = "视频-总播放1", width = 15)
+	@ApiModelProperty(value = "视频-总播放1")
+	private Integer totalPlay;
+	/**视频-有效播放1*/
+	@Excel(name = "视频-有效播放1", width = 15)
+	@ApiModelProperty(value = "视频-有效播放1")
+	private Integer validPlay;
+	/**视频-wifi播放1*/
+	@Excel(name = "视频-wifi播放1", width = 15)
+	@ApiModelProperty(value = "视频-wifi播放1")
+	private Integer wifiPlay;
+	/**视频-播放时长,单位ms1*/
+	@Excel(name = "视频-播放时长,单位ms1", width = 15)
+	@ApiModelProperty(value = "视频-播放时长,单位ms1")
+	private Integer playDurationSum;
+	/**视频-播放25%进度总数1*/
+	@Excel(name = "视频-播放25%进度总数1", width = 15)
+	@ApiModelProperty(value = "视频-播放25%进度总数1")
+	private Integer play25FeedBreak;
+	/**视频-播放50%进度总数1*/
+	@Excel(name = "视频-播放50%进度总数1", width = 15)
+	@ApiModelProperty(value = "视频-播放50%进度总数1")
+	private Integer play50FeedBreak;
+	/**视频-播放75%进度总数*/
+	@Excel(name = "视频-播放75%进度总数", width = 15)
+	@ApiModelProperty(value = "视频-播放75%进度总数")
+	private Integer play75FeedBreak;
+	/**视频-播放100%进度总数1*/
+	@Excel(name = "视频-播放100%进度总数1", width = 15)
+	@ApiModelProperty(value = "视频-播放100%进度总数1")
+	private Integer play100FeedBreak;
+	/**附加创意-电话按钮1*/
+	@Excel(name = "附加创意-电话按钮1", width = 15)
+	@ApiModelProperty(value = "附加创意-电话按钮1")
+	private Integer advancedCreativePhoneClick;
+	/**附加创意-在线咨询1*/
+	@Excel(name = "附加创意-在线咨询1", width = 15)
+	@ApiModelProperty(value = "附加创意-在线咨询1")
+	private Integer advancedCreativeCounselClick;
+	/**附加创意-表单提交1*/
+	@Excel(name = "附加创意-表单提交1", width = 15)
+	@ApiModelProperty(value = "附加创意-表单提交1")
+	private Integer advancedCreativeFormClick;
+	/**互动数据-分享数1*/
+	@Excel(name = "互动数据-分享数1", width = 15)
+	@ApiModelProperty(value = "互动数据-分享数1")
+	private Integer shareMaterial;
+	/**互动数据-评论数1*/
+	@Excel(name = "互动数据-评论数1", width = 15)
+	@ApiModelProperty(value = "互动数据-评论数1")
+	private Integer commentMaterial;
+	/**互动数据-关注数1*/
+	@Excel(name = "互动数据-关注数1", width = 15)
+	@ApiModelProperty(value = "互动数据-关注数1")
+	private Integer follow;
+	/**互动数据-主页访问量1*/
+	@Excel(name = "互动数据-主页访问量1", width = 15)
+	@ApiModelProperty(value = "互动数据-主页访问量1")
+	private Integer homeVisited;
+	/**互动数据-挑战赛查看数1*/
+	@Excel(name = "互动数据-挑战赛查看数1", width = 15)
+	@ApiModelProperty(value = "互动数据-挑战赛查看数1")
+	private Integer iesChallengeClick;
+	/**互动数据-音乐查看数1*/
+	@Excel(name = "互动数据-音乐查看数1", width = 15)
+	@ApiModelProperty(value = "互动数据-音乐查看数1")
+	private Integer iesMusicClick;
+	/**次留数1*/
+	@Excel(name = "次留数1", width = 15)
+	@ApiModelProperty(value = "次留数1")
+	private Integer nextDayOpen;
+	/**次留率1*/
+	@Excel(name = "次留率1", width = 15)
+	@ApiModelProperty(value = "次留率1")
+	private BigDecimal nextDayOpenRate;
+	/**次留成本*/
+	@Excel(name = "次留成本", width = 15)
+	@ApiModelProperty(value = "次留成本")
+	private BigDecimal nextDayOpenCost;
+	/**素材类型*/
+	@Excel(name = "素材类型", width = 15)
+	@ApiModelProperty(value = "素材类型")
+	private String imageMode;
+	/**素材id*/
+	@Excel(name = "素材id", width = 15)
+	@ApiModelProperty(value = "素材id")
+	private Long materialId;
+	/**投放位置*/
+	@Excel(name = "投放位置", width = 15)
+	@ApiModelProperty(value = "投放位置")
+	private String inventory;
+	/**activePayAmount*/
+	@Excel(name = "activePayAmount", width = 15)
+	@ApiModelProperty(value = "activePayAmount")
+	private Integer activePayAmount;
+	/**validPlayCost*/
+	@Excel(name = "validPlayCost", width = 15)
+	@ApiModelProperty(value = "validPlayCost")
+	private BigDecimal validPlayCost;
+	/**advancedCreativeCouponAddition*/
+	@Excel(name = "advancedCreativeCouponAddition", width = 15)
+	@ApiModelProperty(value = "advancedCreativeCouponAddition")
+	private Integer advancedCreativeCouponAddition;
+	/**convert*/
+	@Excel(name = "convert", width = 15)
+	@ApiModelProperty(value = "convert")
+	private Integer convertMaterial;
+	/**activePayCost*/
+	@Excel(name = "activePayCost", width = 15)
+	@ApiModelProperty(value = "activePayCost")
+	private BigDecimal activePayCost;
+	/**download*/
+	@Excel(name = "download", width = 15)
+	@ApiModelProperty(value = "download")
+	private Integer download;
+	/**cpa*/
+	@Excel(name = "cpa", width = 15)
+	@ApiModelProperty(value = "cpa")
+	private BigDecimal cpa;
+	/**cpc*/
+	@Excel(name = "cpc", width = 15)
+	@ApiModelProperty(value = "cpc")
+	private BigDecimal cpc;
+	/**locationClick*/
+	@Excel(name = "locationClick", width = 15)
+	@ApiModelProperty(value = "locationClick")
+	private Integer locationClick;
+	/**playOverRate*/
+	@Excel(name = "playOverRate", width = 15)
+	@ApiModelProperty(value = "playOverRate")
+	private BigDecimal playOverRate;
+	/**ctr*/
+	@Excel(name = "ctr", width = 15)
+	@ApiModelProperty(value = "ctr")
+	private BigDecimal ctr;
+	/**cpm*/
+	@Excel(name = "cpm", width = 15)
+	@ApiModelProperty(value = "cpm")
+	private BigDecimal cpm;
+	/**wifiPlayRate*/
+	@Excel(name = "wifiPlayRate", width = 15)
+	@ApiModelProperty(value = "wifiPlayRate")
+	private BigDecimal wifiPlayRate;
+	/**like*/
+	@Excel(name = "like", width = 15)
+	@ApiModelProperty(value = "like")
+	private Integer likeMaterial;
+	/**activePayRate*/
+	@Excel(name = "activePayRate", width = 15)
+	@ApiModelProperty(value = "activePayRate")
+	private BigDecimal activePayRate;
+	/**activeCost*/
+	@Excel(name = "activeCost", width = 15)
+	@ApiModelProperty(value = "activeCost")
+	private BigDecimal activeCost;
+	/**gameAddictionCost*/
+	@Excel(name = "gameAddictionCost", width = 15)
+	@ApiModelProperty(value = "gameAddictionCost")
+	private BigDecimal gameAddictionCost;
+	/**gameAddiction*/
+	@Excel(name = "gameAddiction", width = 15)
+	@ApiModelProperty(value = "gameAddiction")
+	private Integer gameAddiction;
+	/**activeRate*/
+	@Excel(name = "activeRate", width = 15)
+	@ApiModelProperty(value = "activeRate")
+	private BigDecimal activeRate;
+	/**playDuration10s*/
+	@Excel(name = "playDuration10s", width = 15)
+	@ApiModelProperty(value = "playDuration10s")
+	private Integer playDuration_10s;
+	/**phoneEffective*/
+	@Excel(name = "phoneEffective", width = 15)
+	@ApiModelProperty(value = "phoneEffective")
+	private Integer phoneEffective;
+	/**gameAddictionRate*/
+	@Excel(name = "gameAddictionRate", width = 15)
+	@ApiModelProperty(value = "gameAddictionRate")
+	private BigDecimal gameAddictionRate;
+	/**activeRegisterRate*/
+	@Excel(name = "activeRegisterRate", width = 15)
+	@ApiModelProperty(value = "activeRegisterRate")
+	private BigDecimal activeRegisterRate;
+	/**averageVideoPlay*/
+	@Excel(name = "averageVideoPlay", width = 15)
+	@ApiModelProperty(value = "averageVideoPlay")
+	private BigDecimal averageVideoPlay;
+	/**downloadFinishCost*/
+	@Excel(name = "downloadFinishCost", width = 15)
+	@ApiModelProperty(value = "downloadFinishCost")
+	private BigDecimal downloadFinishCost;
+	/**playDuration3s*/
+	@Excel(name = "playDuration3s", width = 15)
+	@ApiModelProperty(value = "playDuration3s")
+	private Integer playDuration_3s;
+	/**activeRegisterCost*/
+	@Excel(name = "activeRegisterCost", width = 15)
+	@ApiModelProperty(value = "activeRegisterCost")
+	private BigDecimal activeRegisterCost;
+	/**show*/
+	@Excel(name = "show", width = 15)
+	@ApiModelProperty(value = "show")
+	private Integer showMaterial;
+	/**convertRate*/
+	@Excel(name = "convertRate", width = 15)
+	@ApiModelProperty(value = "convertRate")
+	private BigDecimal convertRate;
+	/**downloadFinishRate*/
+	@Excel(name = "downloadFinishRate", width = 15)
+	@ApiModelProperty(value = "downloadFinishRate")
+	private BigDecimal downloadFinishRate;
+	/**installFinishRate*/
+	@Excel(name = "installFinishRate", width = 15)
+	@ApiModelProperty(value = "installFinishRate")
+	private BigDecimal installFinishRate;
+	/**coupon*/
+	@Excel(name = "coupon", width = 15)
+	@ApiModelProperty(value = "coupon")
+	private Integer coupon;
+	/**couponSinglePage*/
+	@Excel(name = "couponSinglePage", width = 15)
+	@ApiModelProperty(value = "couponSinglePage")
+	private Integer couponSinglePage;
+	/**playOver*/
+	@Excel(name = "playOver", width = 15)
+	@ApiModelProperty(value = "playOver")
+	private Integer playOver;
+	/**downloadStartCost*/
+	@Excel(name = "downloadStartCost", width = 15)
+	@ApiModelProperty(value = "downloadStartCost")
+	private BigDecimal downloadStartCost;
+	/**message*/
+	@Excel(name = "message", width = 15)
+	@ApiModelProperty(value = "message")
+	private Integer message;
+	/**playDuration*/
+	@Excel(name = "playDuration", width = 15)
+	@ApiModelProperty(value = "playDuration")
+	private Integer playDuration;
+	/**validPlayRate*/
+	@Excel(name = "validPlayRate", width = 15)
+	@ApiModelProperty(value = "validPlayRate")
+	private BigDecimal validPlayRate;
+	/**averagePlayTimePerPlay*/
+	@Excel(name = "averagePlayTimePerPlay", width = 15)
+	@ApiModelProperty(value = "averagePlayTimePerPlay")
+	private BigDecimal averagePlayTimePerPlay;
+	/**convertCost*/
+	@Excel(name = "convertCost", width = 15)
+	@ApiModelProperty(value = "convertCost")
+	private BigDecimal convertCost;
+	/**convertShowRate*/
+	@Excel(name = "convertShowRate", width = 15)
+	@ApiModelProperty(value = "convertShowRate")
+	private BigDecimal convertShowRate;
+	/**installFinishCost*/
+	@Excel(name = "installFinishCost", width = 15)
+	@ApiModelProperty(value = "installFinishCost")
+	private BigDecimal installFinishCost;
+
+	private BigDecimal downloadStartRate;
+
+
+
+
+	public BytedanceReportPlayableDaily() {
+	}
+
+	public BytedanceReportPlayableDaily(JSONObject detailJson, Long accountId) {
+		JSONObject dimensions = detailJson.getJSONObject("dimensions");
+		this.accountId = accountId;
+		//this.setPlayableName(dimensions.getString("playable_name"));
+		//this.setPlayableUrl(dimensions.getString("playable_url"));
+		//this.setPlayableId(dimensions.getLong("playable_id"));
+		//this.setPlayablePreviewUrl(dimensions.getString("playable_preview_url"));
+		//this.setPlayableOrientation(dimensions.getString("playable_orientation"));
+		this.setStatDatetime(dimensions.getDate("stat_datetime") == null ? null : DateUtils.formatDate(dimensions.getDate("stat_datetime"), "yyyy-MM-dd"));
+
+		JSONObject metrics = detailJson.getJSONObject("metrics");
+		this.setActivePayAmount(metrics.getInteger("active_pay_amount"));
+		this.setValidPlayCost(metrics.getBigDecimal("valid_play_cost"));
+		this.setPlay75FeedBreak(metrics.getInteger("play_75_feed_break"));
+		this.setNextDayOpen(metrics.getInteger("next_day_open"));
+		this.setAdvancedCreativeCouponAddition(metrics.getInteger("advanced_creative_coupon_addition"));
+		this.setConvertMaterial(metrics.getInteger("convert"));
+		this.setActivePayCost(metrics.getBigDecimal("active_pay_cost"));
+		this.setInAppCart(metrics.getInteger("in_app_cart"));
+		this.setPlay25FeedBreak(metrics.getInteger("play_25_feed_break"));
+		this.setConsultEffective(metrics.getInteger("consult_effective"));
+		this.setViewMaterial(metrics.getInteger("view"));
+		this.setDownload(metrics.getInteger("download"));
+		this.setCpa(metrics.getBigDecimal("cpa"));
+		this.setCpc(metrics.getBigDecimal("cpc"));
+		this.setLocationClick(metrics.getInteger("location_click"));
+		this.setPhoneConfirm(metrics.getInteger("phone_confirm"));
+		this.setIesMusicClick(metrics.getInteger("ies_music_click"));
+		this.setPlayOverRate(metrics.getBigDecimal("play_over_rate"));
+		this.setWifiPlay(metrics.getInteger("wifi_play"));
+		this.setShopping(metrics.getInteger("shopping"));
+		this.setQq(metrics.getInteger("qq"));
+		this.setCtr(metrics.getBigDecimal("ctr"));
+		this.setCpm(metrics.getBigDecimal("cpm"));
+		this.setWifiPlayRate(metrics.getBigDecimal("wifi_play_rate"));
+		this.setLikeMaterial(metrics.getInteger("like"));
+		this.setPlay50FeedBreak(metrics.getInteger("play_50_feed_break"));
+		this.setActivePayRate(metrics.getBigDecimal("active_pay_rate"));
+		this.setActiveCost(metrics.getBigDecimal("active_cost"));
+		this.setActive(metrics.getInteger("active"));
+		this.setGameAddictionCost(metrics.getBigDecimal("game_addiction_cost"));
+		this.setGameAddiction(metrics.getInteger("game_addiction"));
+		this.setActiveRate(metrics.getBigDecimal("active_rate"));
+		this.setClick(metrics.getInteger("click"));
+		this.setPlayDuration_10s(metrics.getInteger("play_duration_10s"));
+		this.setAdvancedCreativePhoneClick(metrics.getInteger("advanced_creative_phone_click"));
+		this.setDownloadStart(metrics.getInteger("download_start"));
+		this.setHomeVisited(metrics.getInteger("home_visited"));
+		this.setPhone(metrics.getInteger("phone"));
+		this.setPhoneEffective(metrics.getInteger("phone_effective"));
+		this.setInAppPay(metrics.getInteger("in_app_pay"));
+		this.setGameAddictionRate(metrics.getBigDecimal("game_addiction_rate"));
+		this.setNextDayOpenCost(metrics.getBigDecimal("next_day_open_cost"));
+		this.setIesChallengeClick(metrics.getInteger("ies_challenge_click"));
+		this.setTotalPlay(metrics.getInteger("total_play"));
+		this.setActiveRegisterRate(metrics.getBigDecimal("active_register_rate"));
+		this.setAverageVideoPlay(metrics.getBigDecimal("average_video_play"));
+		this.setDownloadFinishCost(metrics.getBigDecimal("download_finish_cost"));
+		this.setPlayDuration_3s(metrics.getInteger("play_duration_3s"));
+		this.setActiveRegisterCost(metrics.getBigDecimal("active_register_cost"));
+		this.setShowMaterial(metrics.getInteger("show"));
+		this.setNextDayOpenRate(metrics.getBigDecimal("next_day_open_rate"));
+		this.setMapSearch(metrics.getInteger("map_search"));
+		this.setButton(metrics.getInteger("button"));
+		this.setPlayDurationSum(metrics.getInteger("play_duration_sum"));
+		this.setPlay100FeedBreak(metrics.getInteger("play_100_feed_break"));
+		this.setAdvancedCreativeCounselClick(metrics.getInteger("advanced_creative_counsel_click"));
+		this.setConvertRate(metrics.getBigDecimal("convert_rate"));
+		this.setDownloadFinishRate(metrics.getBigDecimal("download_finish_rate"));
+		this.setConsult(metrics.getInteger("consult"));
+		this.setShareMaterial(metrics.getInteger("share"));
+		this.setVote(metrics.getInteger("vote"));
+		this.setValidPlay(metrics.getInteger("valid_play"));
+		this.setInstallFinishRate(metrics.getBigDecimal("install_finish_rate"));
+		this.setRedirect(metrics.getInteger("redirect"));
+		this.setPayCount(metrics.getInteger("pay_count"));
+		this.setAdvancedCreativeFormClick(metrics.getInteger("advanced_creative_form_click"));
+		this.setCost(metrics.getBigDecimal("cost"));
+		this.setPhoneConnect(metrics.getInteger("phone_connect"));
+		this.setCoupon(metrics.getInteger("coupon"));
+		this.setDownloadStartRate(metrics.getBigDecimal("download_start_rate"));
+		this.setDownloadFinish(metrics.getInteger("download_finish"));
+		this.setWechat(metrics.getInteger("wechat"));
+		this.setCouponSinglePage(metrics.getInteger("coupon_single_page"));
+		this.setInstallFinish(metrics.getInteger("install_finish"));
+		this.setLottery(metrics.getInteger("lottery"));
+		this.setPlayOver(metrics.getInteger("play_over"));
+		this.setInAppOrder(metrics.getInteger("in_app_order"));
+		this.setDownloadStartCost(metrics.getBigDecimal("download_start_cost"));
+		this.setFollow(metrics.getInteger("follow"));
+		this.setMessage(metrics.getInteger("message"));
+		this.setInAppDetailUv(metrics.getInteger("in_app_detail_uv"));
+		this.setPlayDuration(metrics.getInteger("play_duration"));
+		this.setForm(metrics.getInteger("form"));
+		this.setValidPlayRate(metrics.getBigDecimal("valid_play_rate"));
+		this.setAveragePlayTimePerPlay(metrics.getBigDecimal("average_play_time_per_play"));
+		this.setConvertShowRate(metrics.getBigDecimal("convert_show_rate"));
+		this.setInstallFinishCost(metrics.getBigDecimal("install_finish_cost"));
+		this.setCommentMaterial(metrics.getInteger("comment"));
+		this.setInAppUv(metrics.getInteger("in_app_uv"));
+		this.setRegister(metrics.getInteger("register"));
+		this.setConvertCost(metrics.getBigDecimal("convert_cost"));
+	}
+
+}

+ 16 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceOperationRecordMapper.java

@@ -0,0 +1,16 @@
+package cn.com.ctop.toutiao.modules.report.mapper;
+
+import cn.com.ctop.toutiao.modules.report.entity.ByteDanceOperationRecord;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface BytedanceOperationRecordMapper {
+
+    void insertOperationRecordCampaign(@Param("records") List<ByteDanceOperationRecord> records);
+
+    void insertOperationRecordPlan(@Param("records") List<ByteDanceOperationRecord> records);
+
+    void insertOperationRecordCreative(@Param("records") List<ByteDanceOperationRecord> records);
+
+}

+ 116 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceOperationRecordMapper.xml

@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.toutiao.modules.report.mapper.BytedanceOperationRecordMapper">
+
+    <select id="insertOperationRecordCampaign">
+        replace into
+        ctop_bytedance_operation_record_campaign
+        (
+        account_id,
+        stat_date,
+        object_id,
+        object_type,
+        content_title,
+        object_name,
+        operation_create_time,
+        content_log,
+        operator,
+        opt_ip,
+        operation_target
+        )
+        values
+        <foreach collection="records" item="record" separator=",">
+            (
+            #{record.accountId},
+            #{record.statDate},
+            #{record.objectId},
+            #{record.objectType},
+            #{record.contentTitle},
+            #{record.objectName},
+            #{record.operationCreateTime},
+            #{record.contentLog},
+            #{record.operator},
+            #{record.optIp},
+            #{record.operationTarget}
+            )
+        </foreach>
+    </select>
+
+    <select id="insertOperationRecordPlan">
+        replace into
+        ctop_bytedance_operation_record_plan
+        (
+        account_id,
+        stat_date,
+        object_id,
+        object_type,
+        content_title,
+        object_name,
+        operation_create_time,
+        content_log,
+        operator,
+        opt_ip,
+        operation_target
+        )
+        values
+        <foreach collection="records" item="record" separator=",">
+            (
+            #{record.accountId},
+            #{record.statDate},
+            #{record.objectId},
+            #{record.objectType},
+            #{record.contentTitle},
+            #{record.objectName},
+            #{record.operationCreateTime},
+            #{record.contentLog},
+            #{record.operator},
+            #{record.optIp},
+            #{record.operationTarget}
+            )
+        </foreach>
+    </select>
+
+    <select id="insertOperationRecordCreative">
+        replace into
+        ctop_bytedance_operation_record_creative
+        (
+        account_id,
+        stat_date,
+        object_id,
+        object_type,
+        content_title,
+        object_name,
+        operation_create_time,
+        content_log,
+        operator,
+        opt_ip,
+        operation_target
+        )
+        values
+        <foreach collection="records" item="record" separator=",">
+            (
+            #{record.accountId},
+            #{record.statDate},
+            #{record.objectId},
+            #{record.objectType},
+            #{record.contentTitle},
+            #{record.objectName},
+            #{record.operationCreateTime},
+            #{record.contentLog},
+            #{record.operator},
+            #{record.optIp},
+            #{record.operationTarget}
+            )
+        </foreach>
+    </select>
+
+
+
+
+
+
+
+
+
+
+</mapper>

+ 12 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceInterfaceService.java

@@ -0,0 +1,12 @@
+package cn.com.ctop.toutiao.modules.report.service;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+
+public interface IBytedanceInterfaceService {
+
+    void searchLog(Long accountId, CtopOauthToken token, Integer operationType, String startDate, String endDate);
+
+    //头条试玩报表
+    int bytedancePlayableReport(CtopOauthToken token, String startDate, String endDate);
+
+}

+ 1 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceReportService.java

@@ -4,7 +4,6 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialRetry;
 import com.alibaba.fastjson.JSONObject;
 
-import java.text.ParseException;
 import java.util.List;
 
 public interface IBytedanceReportService {
@@ -34,7 +33,7 @@ public interface IBytedanceReportService {
      */
     List<JSONObject> getReportList(JSONObject requestJson);
 
-    void bytedanceAsyncTaskCreate(String startDate, String endDate, CtopOauthToken token, Integer type) throws ParseException;
+    void bytedanceAsyncTaskCreate(String startDate, String endDate, CtopOauthToken token, Integer type);
 
     void bytedanceAsyncTaskGet();
 

+ 287 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceInterfaceServiceImpl.java

@@ -0,0 +1,287 @@
+package cn.com.ctop.toutiao.modules.report.service.impl;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.toutiao.modules.material.entity.ByteDanceAdvertisePlan;
+import cn.com.ctop.toutiao.modules.material.entity.ByteDanceCampaign;
+import cn.com.ctop.toutiao.modules.material.entity.ByteDanceCreative;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertisePlanService;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceCampaignService;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeService;
+import cn.com.ctop.toutiao.modules.report.entity.ByteDanceOperationRecord;
+import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialRetry;
+import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportVideoMaterialDaily;
+import cn.com.ctop.toutiao.modules.report.mapper.BytedanceOperationRecordMapper;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceInterfaceService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Primary;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+@Slf4j
+@Primary
+public class BytedanceInterfaceServiceImpl implements IBytedanceInterfaceService {
+    @Autowired
+    private IByteDanceCampaignService byteDanceCampaignService;
+    @Autowired
+    private IByteDanceAdvertisePlanService byteDanceAdvertisePlanService;
+    @Autowired
+    private BytedanceOperationRecordMapper bytedanceOperationRecordMapper;
+    @Autowired
+    private IByteDanceCreativeService byteDanceCreativeService;
+
+    @Override
+    public void searchLog(Long accountId, CtopOauthToken token, Integer operationTarget, String startDate, String endDate){
+
+        //int campaignCount = byteDanceCampaignService.count(parameterQueryWrapper);
+        //int campaignPageSize = 20;
+        //int campaignPage = 1;
+        //
+        //Integer campaignTotalPage = (campaignCount - 1) / campaignPageSize + 1;
+        //if (campaignPage < campaignTotalPage) {
+        //    QueryWrapper<ByteDanceCampaign> parameterQueryWrapper2 = new QueryWrapper<>();
+        //    parameterQueryWrapper2.eq("account_id", accountId);
+        //    parameterQueryWrapper2.last("limit" +  (campaignPage-1) +  "," + campaignPageSize);
+        //    parameterQueryWrapper2.select("id");
+        //
+        //}
+        int pageNum = 1;
+        int pageSize = 20;
+        String startTime = startDate + " 00:00:00";
+        String endTime = endDate + " 23:59:59";
+
+        try {
+            if(operationTarget == 2){
+                QueryWrapper<ByteDanceCampaign> parameterQueryWrapper = new QueryWrapper<>();
+                parameterQueryWrapper.eq("account_id", accountId);
+                parameterQueryWrapper.select("id");
+                List<ByteDanceCampaign> list = byteDanceCampaignService.list(parameterQueryWrapper);
+                for (ByteDanceCampaign campaign:list){
+                    logSearchByPage(pageNum, pageSize, token, accountId, campaign.getId(), 2, startTime, endTime);  //组
+                }
+            }else if(operationTarget == 3){
+                QueryWrapper<ByteDanceAdvertisePlan> parameterQueryWrapper = new QueryWrapper<>();
+                parameterQueryWrapper.eq("account_id", accountId);
+                parameterQueryWrapper.select("id");
+                List<ByteDanceAdvertisePlan> list = byteDanceAdvertisePlanService.list(parameterQueryWrapper);
+                for (ByteDanceAdvertisePlan plan:list){
+                    logSearchByPage(pageNum, pageSize, token, accountId, plan.getId(), 3, startTime, endTime);  //计划
+                }
+            }else if(operationTarget == 4){
+                QueryWrapper<ByteDanceCreative> parameterQueryWrapper = new QueryWrapper<>();
+                parameterQueryWrapper.eq("account_id", accountId);
+                parameterQueryWrapper.select("id");
+                List<ByteDanceCreative> list = byteDanceCreativeService.list(parameterQueryWrapper);
+                for(ByteDanceCreative creative:list){
+                    logSearchByPage(pageNum, pageSize, token, accountId, creative.getId(), 4, startTime, endTime);  //创意
+                }
+            }
+        }catch (Exception e){
+            log.error("获取头条操作记录失败:accountId:{},startDate:{},endDate:{}", token.getAccountId(), startDate, endDate);
+            log.error(e.getMessage());
+        }
+    }
+
+    private void logSearchByPage(Integer pageNum, Integer pageSize, CtopOauthToken token, Long accountId, Long objectId, Integer operationType, String startTime, String endTime) {
+        log.info("当前页数:" + pageNum);
+        String access_token = token.getAccessToken();
+
+        // 请求地址
+        String open_api_domain = "https://ad.oceanengine.com";
+        String path = "/open_api/2/tools/log_search/";
+
+        // 请求参数
+        Map data = new HashMap();
+        data.put("advertiser_id", accountId);
+        data.put("start_time", startTime);
+        data.put("end_time", endTime);
+        data.put("page", pageNum);
+        data.put("page_size", pageSize);
+
+        List<Long> list = new ArrayList<>();
+        list.add(objectId);
+        data.put("object_id", list);
+
+        JSONObject json = HttpUtils.bytedanceGetRequest(access_token, open_api_domain + path, JSONObject.parseObject(JSONObject.toJSONString(data)));
+        if (json == null) {
+            log.error("头条日志查询返回为空,请求有误:" + JSONObject.toJSONString(data) + ";;;返回值为:"+ json);
+            return ;
+        }
+
+        int code =  json.getInteger("code");
+        if(code == 0){
+            List<ByteDanceOperationRecord>  records = new ArrayList<>();
+
+            JSONObject dataResultJson = json.getJSONObject("data");
+            JSONObject pageInfoJson = dataResultJson.getJSONObject("page_info");
+            int totalPage = pageInfoJson.getInteger("total_number");
+            int page = pageInfoJson.getInteger("page");
+
+            JSONArray logsArray = dataResultJson.getJSONArray("logs");
+            int logsSize = logsArray.size();
+            for (int i=0; i<logsSize ;i++){
+                JSONObject logJson =  logsArray.getJSONObject(i);
+                ByteDanceOperationRecord record = new ByteDanceOperationRecord();
+                record.setAccountId(accountId);
+                record.setContentTitle(logJson.getString("content_title"));
+                record.setContentLog(logJson.getString("content_log"));
+                record.setObjectId(logJson.getLong("object_id"));
+                record.setObjectName(logJson.getString("object_name"));
+                record.setObjectType(logJson.getString("object_type"));
+                record.setOperationCreateTime(logJson.getDate("create_time"));
+                record.setStatDate(DateUtils.formatDate(logJson.getDate("create_time")));
+                record.setOperator(logJson.getString("operator"));
+                record.setOptIp(logJson.getString("opt_ip"));
+                record.setOperationTarget(operationType);
+
+                records.add(record);
+            }
+
+            //按类型入库
+            if(records !=null && records.size()!=0){
+                insertLog(operationType, records);
+            }
+
+            if(page < totalPage){
+                logSearchByPage(page+1, pageSize, token, accountId, objectId, operationType, startTime, endTime);
+            }
+        }else{
+            log.error("头条日志查询返回为空,请求有误:" + JSONObject.toJSONString(data)+";;;返回值为:"+ json);
+            return ;
+        }
+        //return 200;
+    }
+
+    private void insertLog(Integer operationTarget, List<ByteDanceOperationRecord> records){
+        if(operationTarget == 2){
+            bytedanceOperationRecordMapper.insertOperationRecordCampaign(records);
+        }else if(operationTarget == 3){
+            bytedanceOperationRecordMapper.insertOperationRecordPlan(records);
+        }else if(operationTarget == 4){
+            bytedanceOperationRecordMapper.insertOperationRecordCreative(records);
+        }
+    }
+
+    //////////////////////////////////////////////////
+
+
+    /**
+     * 头条视频素材报表
+     * @param token
+     * @param startDate
+     * @param endDate
+     * @return
+     */
+    @Override
+    public int bytedancePlayableReport(CtopOauthToken token, String startDate, String endDate) {
+        Long accountId = token.getAccountId();
+        log.info("头条素材报表当前accountId为:{}  {}~{},开始" , accountId, startDate,endDate);
+        Integer page = 1;
+        Integer pageSize = 100;
+        int code = bytedancePlayableReportByPage(page, pageSize, token, accountId, startDate, endDate);
+        if (code != 200 && code != 1) {
+            BytedanceReportMaterialRetry retry = new BytedanceReportMaterialRetry();
+            retry.setAccountId(accountId);
+            retry.setStatus(0);
+            retry.setStartDate(startDate);
+            retry.setEndDate(endDate);
+            retry.setStatusCode(code);
+            retry.setType(2);  //1素材报表重试,2视频素材报表重试
+            //bytedanceReportMaterialDailyMapper.replaceMaterialRetry(retry);
+        }
+        log.info("头条素材报表当前accountId为:{}  {}~{},结束" , accountId, startDate,endDate);
+        return code;
+    }
+
+    private int bytedancePlayableReportByPage(Integer page, Integer pageSize, CtopOauthToken token, Long accountId, String startDate, String endDate) {
+        log.info("当前页数:"+ page);
+        String access_token = token.getAccessToken();
+
+        // 请求地址
+        String open_api_domain = "https://ad.oceanengine.com";
+        String path = "/open_api/2/report/integrated/get/";
+
+        // 请求参数
+        Map data = new HashMap();
+        data.put("advertiser_id", accountId);
+        data.put("start_date", startDate);
+        data.put("end_date", endDate);
+        data.put("page", page);
+        data.put("page_size", pageSize);
+        data.put("group_by", new String[]{"STAT_GROUP_BY_PLAYABLE_ID", "STAT_GROUP_BY_TIME_DAY"});  //, "STAT_GROUP_BY_TIME_DAY"
+
+        JSONObject json = HttpUtils.bytedanceGetRequest(access_token, open_api_domain + path, JSONObject.parseObject(JSONObject.toJSONString(data)));
+        if (json == null) {
+            log.error("返回为空,请求有误:" + JSONObject.toJSONString(data));
+            return -2;
+        }
+
+        int returnCode = 200;
+        try {
+            if (!Check.isNull(json)) {
+                Integer code = json.getInteger("code");
+                if (code != 0) {
+                    log.error("获取任务列表返回信息错误,错误码为:" + code + ",头条accountId:" + accountId + ";返回json为:" + json + "请求为:" + JSONObject.toJSONString(data));
+                    return -1;
+                }
+
+                JSONObject jsonData = json.getJSONObject("data");
+                if (Check.isNull(jsonData)) {
+                    log.error("获取任务列表返回信息data内容为空,头条accountId:" + accountId + ";返回json为:" + json + "请求为:" + JSONObject.toJSONString(data));
+                    return -1;
+                }
+                JSONObject pageInfo = jsonData.getJSONObject("page_info");
+                Integer totalPage = pageInfo.getInteger("total_page");
+                Integer currentPage = pageInfo.getInteger("page");
+
+                JSONArray jsonArrayay = jsonData.getJSONArray("list");
+                if (jsonArrayay.size() == 0) {
+                    log.info("accountId:" + accountId + ";没有数据。总页数为:" + totalPage + "当前页数为:" + currentPage);
+                    return 1;
+                }
+
+                List<BytedanceReportVideoMaterialDaily> bytedanceReportVideoMaterialDailyList = new ArrayList<>();
+                for (int i = 0; i < jsonArrayay.size(); i++) {
+                    JSONObject detailJson = jsonArrayay.getJSONObject(i);
+                    if (!Check.isNull(detailJson)) {
+                        BytedanceReportVideoMaterialDaily daily = new BytedanceReportVideoMaterialDaily(detailJson, accountId);
+                        bytedanceReportVideoMaterialDailyList.add(daily);
+                    }
+                }
+                //bytedanceReportMaterialDailyMapper.replaceIntoVideoMaterialBatch(bytedanceReportVideoMaterialDailyList);
+                if (currentPage >= totalPage) {
+                    log.info("头条视频素材报表当前accountId为:{}  {}~{},接口数据拉取成功" , accountId, startDate,endDate);
+                    return 1;
+                } else {
+                    return bytedancePlayableReportByPage(page + 1, pageSize, token, accountId, startDate, endDate);
+                }
+            } else {
+                log.error("头条视频素材报表服务器返回为空,accountId:" + accountId + ",json:" + json + "请求为:" + JSONObject.toJSONString(data));
+                return -1;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("头条视频素材报表其他错误,accountId:" + accountId + ",json:" + json + "请求为:" + JSONObject.toJSONString(data));
+            returnCode = -3;
+        }
+        return returnCode;
+    }
+
+
+
+
+
+
+
+}

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceReportServiceImpl.java

@@ -502,7 +502,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
     /////////////////////////////////////////////////////////////////////////////////////////////////
     //创建异步任务
     @Override
-    public void bytedanceAsyncTaskCreate(String startDate, String endDate, CtopOauthToken token, Integer type) throws ParseException {
+    public void bytedanceAsyncTaskCreate(String startDate, String endDate, CtopOauthToken token, Integer type) {
         int diffMonths = DateUtils.calDiffMonth(DateUtils.parseDate(startDate, "yyyy-MM-dd"), DateUtils.parseDate(endDate, "yyyy-MM-dd"));
         if (diffMonths == 0) {
             bytedanceAsyncTaskCreateByMonth(startDate, endDate, token, type);

+ 2 - 2
performance-appraisal/src/main/java/cn/com/ctop/uservideomap/controller/UserVideoMapController.java

@@ -64,9 +64,9 @@ public class UserVideoMapController {
                                                      @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                      HttpServletRequest req) {
-        Result<IPage<UserVideoMap>> result = new Result<IPage<UserVideoMap>>();
+        Result<IPage<UserVideoMap>> result = new Result<>();
         QueryWrapper<UserVideoMap> queryWrapper = QueryGenerator.initQueryWrapper(userVideoMap, req.getParameterMap());
-        Page<UserVideoMap> page = new Page<UserVideoMap>(pageNo, pageSize);
+        Page<UserVideoMap> page = new Page<>(pageNo, pageSize);
         IPage<UserVideoMap> pageList = userVideoMapService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);

+ 20 - 0
pom.xml

@@ -28,6 +28,7 @@
         <module>module-job-bytedance</module>
         <module>module-job-kuaishou</module>
         <module>module-callback</module>
+        <module>module-check</module>
     </modules>
 
     <distributionManagement>
@@ -456,6 +457,25 @@
                 <artifactId>spring-boot-maven-plugin</artifactId>
             </plugin>
              指定JDK编译版本 -->
+            <plugin> <!--groovy的编译--> <!--https://github.com/groovy/GMavenPlus/wiki/Examples-->
+                <groupId>org.codehaus.gmavenplus</groupId>
+                <artifactId>gmavenplus-plugin</artifactId>
+                <version>1.6.1</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>addSources</goal>
+                            <goal>addTestSources</goal>
+                            <goal>generateStubs</goal>
+                            <goal>generateTestStubs</goal>
+                            <goal>compile</goal>
+                            <goal>compileTests</goal>
+                            <goal>removeStubs</goal>
+                            <goal>removeTestStubs</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>