Просмотр исходного кода

Merge branch 'master' of http://39.106.184.70:3000/ctop/adsp-boot into test-upload

# Conflicts:
#	module-common/src/main/java/cn/com/ctop/common/module/utils/ExportExcelUtils.java
yumeng 5 лет назад
Родитель
Сommit
eac9bfc0f9
63 измененных файлов с 2274 добавлено и 327 удалено
  1. 14 2
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  2. BIN
      jeecg-boot-module-system/docs/opencv-420.jar
  3. 23 0
      jeecg-boot-module-system/pom.xml
  4. 15 11
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  5. 10 33
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  6. 1 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanRealTimeLoadJob.java
  7. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouAppListJob.java
  8. 0 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyLoadFileJob.java
  9. 0 12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouNowDateGroupJob.java
  10. 3 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/OceanengineJob.java
  11. 1 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/WatermarkVideoJob.java
  12. 231 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/opencv/CornerCheck.java
  13. 215 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/opencv/Perspective.java
  14. 17 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/opencv/Test.java
  15. 87 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/opencv/VideoProcessing.java
  16. 3 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/test/service/impl/JeecgDemoServiceImpl.java
  17. 20 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/PerformanceController2.java
  18. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IPerformanceService2.java
  19. 423 36
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/PerformanceServiceImpl2.java
  20. 13 0
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  21. 49 0
      jeecg-boot-module-system/src/main/resources/generatorConfig.xml
  22. 15 32
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  23. 12 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java
  24. 0 2
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CorpWeixinServiceImpl.java
  25. 0 2
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  26. 0 2
      module-common/src/main/java/cn/com/ctop/common/module/utils/ExportExcelUtils.java
  27. 0 2
      module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils.java
  28. 0 1
      module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils2.java
  29. 0 3
      module-common/src/main/java/cn/com/ctop/common/module/utils/JavacvUtil.java
  30. 2 19
      module-common/src/main/java/cn/com/ctop/common/module/utils/MpsUtils.java
  31. 0 3
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/service/impl/AppiumJobServiceImpl.java
  32. 2 16
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/AppiumUtil.java
  33. 0 11
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/KuaimiUtil.java
  34. 0 3
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/dataeye/service/impl/DataeyeCompanyServiceImpl.java
  35. 0 10
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/jiema/service/impl/KuaimiServiceImpl.java
  36. 0 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/jiema/service/impl/WumaServiceImpl.java
  37. 0 9
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/test/AppiumTest.java
  38. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/service/impl/KuaishouAppServiceImpl.java
  39. 0 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouController.java
  40. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouConversionTypesController.java
  41. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouGroupCreateLogController.java
  42. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouUpdateServiceImpl.java
  43. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  44. 0 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java
  45. 51 48
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAgentServiceImpl.java
  46. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportHourlyCampaignServiceImpl.java
  47. 115 0
      module-report/src/main/java/cn/com/ctop/bytedance/controller/KuaiShouYiCheReportController.java
  48. 15 0
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/KuaiShouYiCheReportMapper.java
  49. 114 0
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/KuaiShouYiCheReportMapper.xml
  50. 7 0
      module-report/src/main/java/cn/com/ctop/bytedance/service/IKuaiShouYiCheReportService.java
  51. 0 1
      module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedanceReportServiceImpl.java
  52. 95 0
      module-report/src/main/java/cn/com/ctop/bytedance/service/impl/KuaiShouYiCheReportServiceImpl.java
  53. 0 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceAdvertiserDataServiceImpl.java
  54. 0 1
      moudule-eureca/.mvn/wrapper/MavenWrapperDownloader.java
  55. 8 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/UserEfficientVideoMap.java
  56. 66 24
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/UserEfficientVideoMapMapper.java
  57. 258 12
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml
  58. 243 0
      performance-appraisal/src/main/java/cn/com/ctop/uservideomap/controller/UserVideoMapController.java
  59. 87 0
      performance-appraisal/src/main/java/cn/com/ctop/uservideomap/entity/UserVideoMap.java
  60. 17 0
      performance-appraisal/src/main/java/cn/com/ctop/uservideomap/mapper/UserVideoMapMapper.java
  61. 5 0
      performance-appraisal/src/main/java/cn/com/ctop/uservideomap/mapper/xml/UserVideoMapMapper.xml
  62. 14 0
      performance-appraisal/src/main/java/cn/com/ctop/uservideomap/service/IUserVideoMapService.java
  63. 19 0
      performance-appraisal/src/main/java/cn/com/ctop/uservideomap/service/impl/UserVideoMapServiceImpl.java

+ 14 - 2
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -552,6 +552,16 @@ public class DateUtils extends PropertyEditorSupport {
         return 0;
     }
 
+
+    public static String getDateString(String createTime) throws ParseException {
+        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
+        Date date = sdf1.parse(createTime);
+        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String str = sdf2.format(date);
+
+        return str;
+    }
+
     public static Map<String, Object> getStartEndTime(String createTime) throws ParseException {
 
         SimpleDateFormat smf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -816,7 +826,7 @@ public class DateUtils extends PropertyEditorSupport {
      * @return
      * @throws ParseException
      */
-    public static String getAnotherDay(String format, String date, Integer num)  {
+    public static String getAnotherDay(String format, String date, Integer num) {
 
         SimpleDateFormat sdf = new SimpleDateFormat(format);
         Date getDate = null;
@@ -928,6 +938,7 @@ public class DateUtils extends PropertyEditorSupport {
     /**
      * 根据时间获取季度
      * 1即Q1(1,2,3月),以此类推
+     *
      * @param date
      * @return
      */
@@ -951,6 +962,7 @@ public class DateUtils extends PropertyEditorSupport {
 
     /**
      * 获取【所在周】周五的时间(周五为一周第一天,周四为一周最后一天)
+     *
      * @param date
      */
     public static Date getFriday(Date date) {
@@ -959,7 +971,6 @@ public class DateUtils extends PropertyEditorSupport {
         calendar.setFirstDayOfWeek(Calendar.FRIDAY);
         calendar.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
         DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
-        System.out.println(df.format(calendar.getTime()));
         return calendar.getTime();
     }
 
@@ -1062,6 +1073,7 @@ public class DateUtils extends PropertyEditorSupport {
     /**
      * 计算季度开始、结束时间
      * 原则:周五为本周的第一天,下一周的周四为本周的最后一天
+     *
      * @param year
      * @param quarter
      */

BIN
jeecg-boot-module-system/docs/opencv-420.jar


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

@@ -169,6 +169,12 @@
             <artifactId>poi-ooxml</artifactId>
             <version>3.17</version>
         </dependency>-->
+     <!--   <dependency>
+            <groupId>com.test</groupId>
+            <artifactId>opencv</artifactId>
+            <scope>system</scope>
+            <systemPath>${basedir}/docs/opencv-420.jar</systemPath>
+        </dependency>-->
     </dependencies>
 
     <dependencyManagement>
@@ -186,6 +192,23 @@
     <build>
         <plugins>
             <plugin>
+                <groupId>org.mybatis.generator</groupId>
+                <artifactId>mybatis-generator-maven-plugin</artifactId>
+                <version>1.3.6</version>
+                <configuration>
+                    <!-- 是否覆盖,true表示会替换生成的JAVA文件,false则不覆盖 -->
+                    <overwrite>true</overwrite>
+                </configuration>
+                <dependencies>
+                    <!--mysql驱动包-->
+                    <dependency>
+                        <groupId>mysql</groupId>
+                        <artifactId>mysql-connector-java</artifactId>
+                        <version>5.1.45</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+            <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
             </plugin>

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

@@ -2,10 +2,7 @@ package org.jeecg.modules.ctop.controller;
 
 
 import cn.com.ctop.common.module.entity.MaterialInfo;
-import cn.com.ctop.common.module.service.IMaterialAscriptionService;
-import cn.com.ctop.common.module.service.IMaterialInfoService;
-import cn.com.ctop.common.module.service.IMaterialParameterService;
-import cn.com.ctop.common.module.service.IMaterialTagService;
+import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.JsonUtil;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
@@ -47,10 +44,8 @@ import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import java.text.ParseException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
 /**
  * 素材信息
@@ -76,6 +71,8 @@ public class MaterialInfoController {
     private IByteDanceCleanMaterialReportService byteDanceCleanMaterialReportService;
     @Autowired
     private IKuaiShouCleanMaterialReportService kuaiShouCleanMaterialReportService;
+    @Autowired
+    private IVideoWatermarkTaskService watermarkTaskService;
 
 
 
@@ -152,7 +149,8 @@ public class MaterialInfoController {
         queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
         if (!Check.isNull(createTime)) {
             try {
-                Map<String, Object> map = DateUtils.getStartEndTime(createTime.toString());
+                String dateString = DateUtils.getDateString(String.valueOf(createTime));
+                Map<String, Object> map = DateUtils.getStartEndTime(dateString);
                 queryWrapper.ge("create_time", map.get("start"));
                 queryWrapper.lt("create_time", map.get("end"));
             } catch (ParseException e) {
@@ -204,7 +202,8 @@ public class MaterialInfoController {
             }
             if (!Check.isNull(createTime)) {
                 try {
-                    Map<String, Object> map = DateUtils.getStartEndTime(createTime.toString());
+                    String dateString = DateUtils.getDateString(String.valueOf(createTime));
+                    Map<String, Object> map = DateUtils.getStartEndTime(dateString);
                     queryWrapper.ge("create_time", map.get("start"));
                     queryWrapper.lt("create_time", map.get("end"));
                 } catch (ParseException e) {
@@ -262,6 +261,7 @@ public class MaterialInfoController {
     }
 
 
+
     /**
      * 添加
      *
@@ -349,6 +349,7 @@ public class MaterialInfoController {
 
     }
 
+
     /**
      * 通过id删除
      *
@@ -363,10 +364,13 @@ public class MaterialInfoController {
             materialInfoService.removeById(id);
             Map<String, Object> deleteMap = new HashMap<>();
             deleteMap.put("material_id", id);
-
             materialAscriptionService.removeByMap(deleteMap);
             materialParameterService.removeByMap(deleteMap);
             materialTagService.removeByMap(deleteMap);
+            Map<String, Object> deleteWatermarkMap = new HashMap<>();
+            deleteWatermarkMap.put("video_id", id);
+            watermarkTaskService.removeByMap(deleteWatermarkMap);
+
         } catch (Exception e) {
             log.error("删除失败", e.getMessage());
             return Result.error("删除失败!");

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

@@ -99,10 +99,6 @@ public class TestController {
             String startDate = DateUtils.addMonth(endDateStr, -6);
             QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
             tokenQueryWrapper.eq("media_id", 2);
-            System.err.println(startDate);
-            System.err.println(endDateStr);
-
-
             List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(tokenQueryWrapper);
             if (!Check.isNull(ctopOauthTokens)) {
                 for (CtopOauthToken token : ctopOauthTokens) {
@@ -126,13 +122,8 @@ public class TestController {
             String startDate = DateUtils.addMonth(endDateStr, -6);
             QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
             tokenQueryWrapper.eq("media_id", 2);
-            System.err.println(startDate);
-            System.err.println(endDateStr);
-
-
             historyReportTaskService.getTaskList();
 
-
         } catch (Exception e) {
             e.printStackTrace();
             result.setSuccess(false);
@@ -205,7 +196,6 @@ public class TestController {
                 @Override
                 public void run() {
                     try {
-                        System.err.println("获取创意,accountId:" + token.getAccountId());
                         kuaishouInterfaceService.getCreativeList(token, null, null);
                         //  kuaishouInterfaceService.getVideoList2(token, null, null,1);
                         //3: 获取图片信息数据
@@ -261,7 +251,6 @@ public class TestController {
                 oauthTokenQueryWrapper.eq("account_id", accountId);
                 CtopOauthToken ctopOauthToken = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
 
-                System.err.println("创意报表accountId:" + ctopOauthToken.getAccountId());
                 QueryWrapper<KuaiShouCampaign> campaignQueryWrapper = new QueryWrapper<>();
                 campaignQueryWrapper.eq("account_id", accountId);
                 List<KuaiShouCampaign> list = campaignService.list(campaignQueryWrapper);
@@ -356,7 +345,6 @@ public class TestController {
     public static void main(String[] args) throws ParseException {
         String date = DateUtils.getDate("yyyy-MM-dd");
         String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", date, -1);
-        System.err.println(anotherDay);
     }
 
 
@@ -368,11 +356,9 @@ public class TestController {
         oauthTokenQueryWrapper.last("limit 1");
         CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
         try {
-            System.err.println("获取计划,广告组:" + accountId);
             kuaishouInterfaceService.getCampaignList(token, null, null);
             //1:获取全量广告组数据
             kuaishouInterfaceService.getGroupList(token, null, null);
-            System.err.println("获取计划,广告组:" + accountId);
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -390,9 +376,7 @@ public class TestController {
         CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
 
         try {
-            System.err.println("获取创意,accountId:" + token.getAccountId());
             kuaishouInterfaceService.getCreativeList(token, null, null);
-            System.err.println("获取创意结束,accountId:" + token.getAccountId());
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -416,9 +400,6 @@ public class TestController {
                 oauthTokenQueryWrapper.eq("media_id", 2);
                 oauthTokenQueryWrapper.eq("account_id", accountId);
                 CtopOauthToken ctopOauthToken = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
-                System.err.println("创意报表accountId:" + ctopOauthToken.getAccountId());
-
-
                 QueryWrapper<KuaiShouCampaign> campaignQueryWrapper = new QueryWrapper<>();
                 campaignQueryWrapper.eq("account_id", ctopOauthToken.getAccountId());
 
@@ -451,31 +432,31 @@ public class TestController {
             e.printStackTrace();
         }
         //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
-            log.info("定时获取头条数据异常:为获取到可用的token");
+        QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("project_id", 215);
+        List<UserAllocation> allocations = userAllocationService.list(queryWrapper);
+        if (null == allocations || allocations.size() <= 0) {
+            log.info("定时获取头条数据异常:获取用户信息失败");
         }
         Date finalGetDate = getDate;
-        tokens.forEach(token -> {
+
+        allocations.forEach(allocation -> {
             //3:获取广告计划信息数据
+            CtopOauthToken token = oauthTokenMapper.selectByAccountId(allocation.getAccountId());
             reportService.getAdvertiserPlanReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
         });
 
         //清洗关于作业帮数据
         //1:查询作业帮相关的用户数据
-        QueryWrapper<UserAllocation> wrapper = new QueryWrapper<>();
-        wrapper.eq("project_id", 215);
-        List<UserAllocation> allocations = userAllocationService.list(wrapper);
-        if (null != allocations && allocations.size() > 0) {
             allocations.forEach(allocation -> {
                 //根据accountId和时间,查询相关的日报表信息
-                QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
+                QueryWrapper<BytedancePlanDailyReport> reportQueryWrapper = new QueryWrapper<>();
                 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
                 String dateString = dateFormat.format(finalGetDate) + " 00:00:00";
                 queryWrapper.eq("advertiser_id", allocation.getAccountId())
                         .eq("stat_datetime", dateString)
                 ;
-                List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
+                List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(reportQueryWrapper);
                 if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
                     bytedancePlanDailyReports.forEach(report -> {
                         String adName = report.getAdName();
@@ -505,14 +486,12 @@ public class TestController {
                     });
                 }
             });
-        }
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
 
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
-
     @GetMapping("getBytedanceData")
     public Map<String, Object> getBytedanceData() {
         Map<String, Object> result = new HashMap<>();
@@ -797,7 +776,6 @@ public class TestController {
             executorService.submit(new Runnable() {
                 @Override
                 public void run() {
-                    System.err.println(signature);
                     cleanMaterialService.calculationReport(signature);
                 }
             });
@@ -826,7 +804,6 @@ public class TestController {
                     } catch (ParseException e) {
                         e.printStackTrace();
                     }
-                    System.err.println("获取广告主报表,accountId:" + token.getAccountId());
                     kuaishouInterfaceService.getAdvertiserReportDaily(token, startDate, endDate);
 
                     Thread.sleep(1 * 200);

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

@@ -58,8 +58,5 @@ public class BytedancePlanRealTimeLoadJob implements Job {
         thread.start();
     }
 
-    public static void main(String[] args) {
-        String nowDate = DateUtils.date2Str();
-        System.err.println(nowDate);
-    }
+
 }

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouAppListJob.java

@@ -24,7 +24,7 @@ public class KuaishouAppListJob implements Job {
     @Autowired
     private CtopOauthTokenMapper oauthTokenMapper;
 
-    static ExecutorService executorService = Executors.newFixedThreadPool(3);
+    static ExecutorService executorService = Executors.newFixedThreadPool(2);
 
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {

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

@@ -69,10 +69,4 @@ public class KuaishouDailyLoadFileJob implements Job {
     }
 
 
-    public static void main(String[] args) {
-        String nowDate = DateUtils.getDate("yyyy-MM-dd");
-        String statDate = getAnotherDay("yyyy-MM-dd", nowDate, -1);
-
-        System.err.println(statDate);
-    }
 }

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

@@ -65,16 +65,4 @@ public class KuaishouNowDateGroupJob implements Job {
 
     }
 
-   /* public static void main(String[] args) throws ParseException {
-        Date nowDate  = DateUtils.getDate();
-        String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(nowDate), -1);
-
-
-
-        SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
-        Date endDate = sim.parse(anotherDay);
-        String s = DateUtils.formatDate(endDate);
-        System.err.println(s);
-
-    }*/
 }

+ 3 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/OceanengineJob.java

@@ -14,6 +14,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.http.impl.cookie.BasicClientCookie;
 import org.bytedeco.javacv.FFmpegFrameGrabber;
 import org.bytedeco.javacv.Frame;
@@ -37,6 +38,7 @@ import java.net.URL;
 import java.util.List;
 import java.util.*;
 
+@Slf4j
 public class OceanengineJob implements Job {
     @Value("${jeecg.path.chrome-driver}")
     private String chromeDriver;
@@ -257,7 +259,7 @@ public class OceanengineJob implements Job {
         hotMaterialHandler(1,4,"抖音");
         hotMaterialHandler(1,8,"头条");
         hotMaterialHandler(1,9,"穿山甲");
-        System.out.println("巨量创意抓取完成");
+        log.info("巨量创意抓取完成");
     }
 
     private void login(String account,String password){

+ 1 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/WatermarkVideoJob.java

@@ -40,13 +40,12 @@ public class WatermarkVideoJob implements Job {
 
                             try {
                                 String localPath = LoadFileUtil.downLoadFromUrl(url, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
-                                //                        String localPath = LoadFileUtil.downLoadFromUrl(url,"D:/video/");
-                                String md5 = LoadFileUtil.getMD5(localPath);
                                 LoadFileUtil.delFile(localPath);
                                 QueryWrapper<MaterialInfo> materialInfoQueryWrapper = new QueryWrapper<>();
                                 materialInfoQueryWrapper.eq("watermark_code", job.getJobId());
                                 MaterialInfo materialInfo = materialInfoService.getOne(materialInfoQueryWrapper);
                                 if (Check.isNull(materialInfo)) {
+                                    videoWaterMarkService.removeById(videoWatermarkTask.getId());
                                     continue;
 
                                 }

+ 231 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/opencv/CornerCheck.java

@@ -0,0 +1,231 @@
+/*
+package org.jeecg.modules.demo.opencv;
+
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
+import org.opencv.core.*;
+import org.opencv.imgcodecs.Imgcodecs;
+import org.opencv.imgproc.Imgproc;
+
+import java.util.*;
+
+*/
+/**
+ * 角点检测
+ *//*
+
+public class CornerCheck {
+    static {
+        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
+    }
+
+    private static int EXPAND_SIZE = 3;
+    public static void main(String[] args) {
+//        harris();
+//        detectConers();
+        channelSplit();
+    }
+
+    public static void channelSplit() {
+        Mat srcImage = Imgcodecs.imread("D:\\data\\235.jpg", Imgcodecs.IMREAD_COLOR);
+        List<Mat> channels = new ArrayList<>();
+        Core.split(srcImage, channels);
+
+        //创建类型为Mat,数组长度为3的变量mbgr
+        List<Mat> mbgr = new ArrayList<>();
+        Mat hideChannel = new Mat(srcImage.size(), CvType.CV_8UC1, new Scalar(0));
+
+        Mat imageB = new Mat(srcImage.size(), CvType.CV_8UC3);
+        mbgr.add(channels.get(0));
+        mbgr.add(hideChannel);
+        mbgr.add(hideChannel);
+        Core.merge(mbgr, imageB);
+        Imgcodecs.imwrite("D:\\data\\imageB.jpg", imageB);
+
+    }
+
+    public static Map<String, Object> detectConers() {
+        Map<String, Object> result = new HashMap<>();
+        try {
+            System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
+
+            final int maxCorners = 50, blockSize = 3;
+            final double qualityLevel = 0.01, minDistance = 20.0, k = 0.04;
+            final boolean useHarrisDetector = false;
+            MatOfPoint corners = new MatOfPoint();
+
+            Mat src = Imgcodecs.imread("D:\\data\\235.jpg");
+            if (src.empty()) {
+                throw new Exception("no file");
+            }
+            Mat dst = src.clone();
+            Mat gray = new Mat();
+            //灰度
+            Imgproc.cvtColor(src, gray, Imgproc.COLOR_RGB2GRAY);
+            Imgcodecs.imwrite("D:\\data\\gray.jpg", gray);
+            Mat binary = new Mat();
+            //二值化
+            Imgproc.threshold(gray, binary, 1, 255, Imgproc.THRESH_TOZERO);
+            Imgcodecs.imwrite("D:\\data\\binary.jpg", binary);
+            Imgproc.goodFeaturesToTrack(binary, corners, maxCorners, qualityLevel, minDistance,
+                    new Mat(), blockSize, useHarrisDetector, k);
+            Point[] pCorners = corners.toArray();
+            List<Point> pointList = new ArrayList<>();
+            double maxX = 0d;
+            double maxY = 0d;
+            double minX = 10000d;
+            double minY = 100000d;
+            for (int i = 0; i < pCorners.length; i++) {
+                Imgproc.circle(dst, pCorners[i], 4, new Scalar(0, 0, 0), Imgproc.FILLED);
+                if (pCorners[i].x > 130 && pCorners[i].x < 570 && pCorners[i].y > 200 && pCorners[i].y < 850) {
+                    if (pCorners[i].x >= maxX) {
+                        maxX = pCorners[i].x;
+                    }
+                    if (pCorners[i].y >= maxY) {
+                        maxY = pCorners[i].y;
+                    }
+
+                    if (pCorners[i].x <= minX) {
+                        minX = pCorners[i].x;
+                    }
+
+                    if (pCorners[i].y <= minY) {
+                        minY = pCorners[i].y;
+                    }
+                    pointList.add(pCorners[i]);
+                }
+            }
+            Imgcodecs.imwrite("D:\\data\\allConers.jpg", dst);
+            List<Point> cornerPoints = new ArrayList<>();
+            for (Point point : pointList) {
+                double getX = point.x;
+                double getY = point.y;
+                if ((getY >= (minY + 20) && getY <= (maxY - 20))) {
+                    Imgproc.circle(dst, point, 4, new Scalar(255, 255, 255), Imgproc.FILLED);
+                } else {
+                    cornerPoints.add(point);
+                    Imgproc.circle(dst, point, 4, new Scalar(0, 0, 0), Imgproc.FILLED);
+                }
+            }
+//            {139.0, 240.0} 左上 {144.0, 837.0} 左下
+//            {482.0, 238.0} 右上 {532.0, 825.0} 右下
+            Collections.sort(cornerPoints, new Comparator<Point>() {
+                @Override
+                public int compare(Point p1, Point p2) {
+                    return (int) (p1.x + p1.y - p2.x - p2.y);
+                }
+            });
+            Imgcodecs.imwrite("D:\\data\\coners.jpg", dst);
+            for (Point p : cornerPoints) {
+            }
+            result.put("leftTop", cornerPoints.get(0));
+            result.put("rightBottom", cornerPoints.get(3));
+            if (cornerPoints.get(2).y > cornerPoints.get(1).y) {
+                result.put("rightTop", cornerPoints.get(1));
+                result.put("leftBottom", cornerPoints.get(2));
+            } else {
+                result.put("rightTop", cornerPoints.get(2));
+                result.put("leftBottom", cornerPoints.get(1));
+            }
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+            return result;
+        } catch (Exception e) {
+            e.printStackTrace();
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_SERVER_ERROR);
+            return result;
+        }
+    }
+
+    public static List<Point> matCornerList(List<Point> points) {
+        List<Point> matCornerList = new ArrayList<>();
+        matCornerList.add(points.get(0));
+        matCornerList.add(points.get(1));
+        matCornerList.add(points.get(3));
+        matCornerList.add(points.get(2));
+        return matCornerList;
+    }
+
+    public static List<Point> detectConerList() {
+        List<Point> result = new ArrayList<>();
+        try {
+            System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
+
+            final int maxCorners = 50, blockSize = 3;
+            final double qualityLevel = 0.01, minDistance = 20.0, k = 0.04;
+            final boolean useHarrisDetector = false;
+            MatOfPoint corners = new MatOfPoint();
+
+            Mat src = Imgcodecs.imread("D:\\data\\167.jpg");
+            if (src.empty()) {
+                throw new Exception("no file");
+            }
+            Mat dst = src.clone();
+            Mat gray = new Mat();
+            Imgproc.cvtColor(src, gray, Imgproc.COLOR_RGB2GRAY);
+            Imgproc.goodFeaturesToTrack(gray, corners, maxCorners, qualityLevel, minDistance,
+                    new Mat(), blockSize, useHarrisDetector, k);
+            Point[] pCorners = corners.toArray();
+            List<Point> pointList = new ArrayList<>();
+            double maxX = 0d;
+            double maxY = 0d;
+            double minX = 10000d;
+            double minY = 100000d;
+            for (int i = 0; i < pCorners.length; i++) {
+                if (pCorners[i].x > 130 && pCorners[i].x < 570 && pCorners[i].y > 200 && pCorners[i].y < 850) {
+                    if (pCorners[i].x >= maxX) {
+                        maxX = pCorners[i].x;
+                    }
+                    if (pCorners[i].y >= maxY) {
+                        maxY = pCorners[i].y;
+                    }
+
+                    if (pCorners[i].x <= minX) {
+                        minX = pCorners[i].x;
+                    }
+
+                    if (pCorners[i].y <= minY) {
+                        minY = pCorners[i].y;
+                    }
+                    pointList.add(pCorners[i]);
+                }
+            }
+            List<Point> cornerPoints = new ArrayList<>();
+            for (Point point : pointList) {
+                double getX = point.x;
+                double getY = point.y;
+                if ((getY >= (minY + 20) && getY <= (maxY - 20))) {
+                    Imgproc.circle(dst, point, 4, new Scalar(255, 255, 255), Imgproc.FILLED);
+                } else {
+                    cornerPoints.add(point);
+                    Imgproc.circle(dst, point, 4, new Scalar(0, 0, 255), Imgproc.FILLED);
+                }
+            }
+            Collections.sort(cornerPoints, new Comparator<Point>() {
+                @Override
+                public int compare(Point p1, Point p2) {
+                    return (int) (p1.x + p1.y - p2.x - p2.y);
+                }
+            });
+            //左上
+            result.add(new Point(cornerPoints.get(0).x - EXPAND_SIZE, cornerPoints.get(0).y - EXPAND_SIZE));
+            if (cornerPoints.get(2).y > cornerPoints.get(1).y) {
+                //右上
+                result.add(new Point(cornerPoints.get(1).x + EXPAND_SIZE, cornerPoints.get(1).y - EXPAND_SIZE));
+                //左下
+                result.add(new Point(cornerPoints.get(2).x - EXPAND_SIZE, cornerPoints.get(2).y + EXPAND_SIZE));
+            } else {
+                //右上
+                result.add(new Point(cornerPoints.get(2).x + EXPAND_SIZE, cornerPoints.get(2).y - EXPAND_SIZE));
+                //左下
+                result.add(new Point(cornerPoints.get(1).x - EXPAND_SIZE, cornerPoints.get(1).y + EXPAND_SIZE));
+            }
+            //右下
+            result.add(new Point(cornerPoints.get(3).x + EXPAND_SIZE, cornerPoints.get(3).y + EXPAND_SIZE));
+            return result;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return result;
+        }
+    }
+}
+*/

+ 215 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/opencv/Perspective.java

@@ -0,0 +1,215 @@
+/*
+package org.jeecg.modules.demo.opencv;
+
+
+import org.opencv.core.*;
+import org.opencv.imgcodecs.Imgcodecs;
+import org.opencv.imgproc.Imgproc;
+import org.opencv.utils.Converters;
+
+import java.util.List;
+
+*/
+/**
+ * 透视变换
+ *//*
+
+public class Perspective {
+    public static void main(String[] args) {
+
+    }
+
+    public static void perpectiveImg(String backgroundImgPath, String phoneImgPath, String targetFileName) {
+        try {
+            System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
+
+            Mat src = Imgcodecs.imread(phoneImgPath);
+            Mat dst = Imgcodecs.imread(backgroundImgPath);
+            Mat dst1 = dst.clone();
+            //透视变换点位
+            List<Point> perspectivePoints = CornerCheck.detectConerList();
+            //矩形点位
+            List<Point> matPoints = CornerCheck.matCornerList(perspectivePoints);
+            //读取图像到矩阵中
+            if (src.empty()) {
+                throw new Exception("no file");
+            }
+
+            List<Point> listSrcs = java.util.Arrays.asList(new Point(0, 0), new Point(src.cols(), 0), new Point(0, src.rows()), new Point(src.cols(), src.rows()));
+            Mat srcPoints = Converters.vector_Point_to_Mat(listSrcs, CvType.CV_32F);
+            Mat dstPoints = Converters.vector_Point_to_Mat(perspectivePoints, CvType.CV_32F);
+            Mat perspectiveMmat = Imgproc.getPerspectiveTransform(srcPoints, dstPoints);
+            Imgproc.warpPerspective(src, dst, perspectiveMmat, dst.size(), Imgproc.INTER_LINEAR);
+            for (int i = 0; i < dst1.cols(); i++) {
+                for (int j = 0; j < dst1.rows(); j++) {
+                    Point point = new Point();
+                    point.x = i;
+                    point.y = j;
+                    if (isPtInPoly(point, matPoints)) {
+                        Imgproc.circle(dst1, point, 8, new Scalar(0, 0, 0), Imgproc.FILLED);
+                    }
+                }
+            }
+            Core.addWeighted(dst1, 1, dst, 1, 3, dst);
+            Imgcodecs.imwrite(targetFileName, dst);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static boolean isInner(Point point, List<Point> corners) {
+        int n = corners.size(); //n=4
+        double sum = 0;
+        for (int i = 0; i < n - 1; i++) {
+            sum += area(corners.get(i), corners.get(i + 1), point);
+        }
+        sum += area(corners.get(n - 1), corners.get(0), point);
+
+        double polyArea = area(corners.get(0), corners.get(1), corners.get(2)) + area(corners.get(1), corners.get(2), corners.get(3));
+        if (sum == polyArea) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    //已知坐标,求三角形面积
+    private static double area(Point p1, Point p2, Point p3) {
+        return 0.5 * Math.abs((p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y));
+    }
+
+    public static boolean isPtInPolygon(Point point, List<Point> polygon) {
+        int iSum, iIndex;
+        double dLon1, dLon2, dLat1, dLat2, dLon;
+        int size = polygon.size();
+        iSum = 0;
+        for (iIndex = 0; iIndex < size; iIndex++) {
+            if (iIndex == size - 1) {
+                dLon1 = polygon.get(iIndex).x;
+                dLat1 = polygon.get(iIndex).y;
+                dLon2 = polygon.get(0).x;
+                dLat2 = polygon.get(0).y;
+            } else {
+                dLon1 = polygon.get(iIndex).x;
+                dLat1 = polygon.get(iIndex).y;
+                dLon2 = polygon.get(iIndex + 1).x;
+                dLat2 = polygon.get(iIndex + 1).y;
+            }
+            // 以下语句判断A点是否在边的两端点的水平平行线之间,在则可能有交点,开始判断交点是否在左射线上
+            if (((point.y >= dLat1) && (point.y < dLat2))
+                    || ((point.y >= dLat2) && (point.y < dLat1))) {
+                if (Math.abs(dLat1 - dLat2) > 0) {
+                    //得到 A点向左射线与边的交点的x坐标:
+                    dLon = dLon1 - ((dLon1 - dLon2) * (dLat1 - point.y)) / (dLat1 - dLat2);
+                    // 如果交点在A点左侧(说明是做射线与 边的交点),则射线与边的全部交点数加一:
+                    if (dLon < point.x) {
+                        iSum++;
+                    }
+                }
+            }
+        }
+        return (iSum % 2) != 0;
+    }
+
+    */
+/**
+     * 判断点是否在多边形内,如果点位于多边形的顶点或边上,也算做点在多边形内,直接返回true
+     *
+     * @param point   检测点
+     * @param polygon 多边形的顶点
+     * @return 点在多边形内返回true, 否则返回false
+     *//*
+
+    public static boolean isPtInPoly(Point point, List<Point> polygon) {
+
+        int N = polygon.size();
+        //如果点位于多边形的顶点或边上,也算做点在多边形内,直接返回true
+        boolean boundOrVertex = true;
+        //cross points count of x
+        int intersectCount = 0;
+        //浮点类型计算时候与0比较时候的容差
+        double precision = 2e-10;
+        //neighbour bound vertices
+        Point p1, p2;
+        //当前点
+        Point p = point;
+
+        //left vertex
+        p1 = polygon.get(0);
+        //check all rays
+        for (int i = 1; i <= N; ++i) {
+            if (p.equals(p1)) {
+                //p is an vertex
+                return boundOrVertex;
+            }
+
+            //right vertex
+            p2 = polygon.get(i % N);
+            //ray is outside of our interests
+            if (p.x < Math.min(p1.x, p2.x) || p.x > Math.max(p1.x, p2.x)) {
+                p1 = p2;
+                //next ray left point
+                continue;
+            }
+
+            //ray is crossing over by the algorithm (common part of)
+            if (p.x > Math.min(p1.x, p2.x) && p.x < Math.max(p1.x, p2.x)) {
+                //x is before of ray
+                if (p.y <= Math.max(p1.y, p2.y)) {
+                    //overlies on a horizontal ray
+                    if (p1.x == p2.x && p.y >= Math.min(p1.y, p2.y)) {
+                        return boundOrVertex;
+                    }
+
+                    //ray is vertical
+                    if (p1.y == p2.y) {
+                        //overlies on a vertical ray
+                        if (p1.y == p.y) {
+                            return boundOrVertex;
+                            //before ray
+                        } else {
+                            ++intersectCount;
+                        }
+                        //cross point on the left side
+                    } else {
+                        //cross point of y
+                        double xinters = (p.x - p1.x) * (p2.y - p1.y) / (p2.x - p1.x) + p1.y;
+                        //overlies on a ray
+                        if (Math.abs(p.y - xinters) < precision) {
+                            return boundOrVertex;
+                        }
+
+                        //before ray
+                        if (p.y < xinters) {
+                            ++intersectCount;
+                        }
+                    }
+                }
+                //special case when ray is crossing through the vertex
+            } else {
+                //p crossing over p2
+                if (p.x == p2.x && p.y <= p2.y) {
+                    //next vertex
+                    Point p3 = polygon.get((i + 1) % N);
+                    //p.x lies between p1.x & p3.x
+                    if (p.x >= Math.min(p1.x, p3.x) && p.x <= Math.max(p1.x, p3.x)) {
+                        ++intersectCount;
+                    } else {
+                        intersectCount += 2;
+                    }
+                }
+            }
+            //next ray left point
+            p1 = p2;
+        }
+
+        //偶数在多边形外
+        if (intersectCount % 2 == 0) {
+            return false;
+            //奇数在多边形内
+        } else {
+            return true;
+        }
+    }
+}
+*/

+ 17 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/opencv/Test.java

@@ -0,0 +1,17 @@
+/*
+package org.jeecg.modules.demo.opencv;
+
+public class Test {
+    public static void main(String[] args) {
+        String srcPath = "D://data//images/";
+        String targetPath = "D://data//video/";
+        for (int i = 163; i <= 235; i++) {
+            String backImg = srcPath + (i) + ".jpg";
+            String phoneImg = srcPath + (i - 163) + ".jpg";
+            String targetImg = targetPath + i + ".jpg";
+            Perspective.perpectiveImg(backImg, phoneImg, targetImg);
+        }
+    }
+
+}
+*/

+ 87 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/opencv/VideoProcessing.java

@@ -0,0 +1,87 @@
+/*
+package org.jeecg.modules.demo.opencv;
+
+import org.bytedeco.javacv.FFmpegFrameGrabber;
+import org.bytedeco.javacv.Frame;
+import org.bytedeco.javacv.Java2DFrameConverter;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.File;
+
+*/
+/**
+ * 视频截帧处理
+ *//*
+
+public class VideoProcessing {
+    public static String videoPath = "D:/data";
+
+    //存放截取视频某一帧的图片
+    public static String videoFramesPath = "D:/data/images/";
+
+    */
+/**
+     * 将视频文件帧处理并以“jpg”格式进行存储。
+     * 依赖FrameToBufferedImage方法:将frame转换为bufferedImage对象
+     *
+     * @param videoFileName
+     *//*
+
+    public static String grabberVideoFramer(String videoFileName) {
+        //最后获取到的视频的图片的路径
+        String videPicture = "";
+        //Frame对象
+        Frame frame = null;
+        //标识
+        int flag = 0;
+        try {
+			 */
+/*
+            获取视频文件
+            *//*
+
+            FFmpegFrameGrabber fFmpegFrameGrabber = new FFmpegFrameGrabber(videoPath + "/" + videoFileName);
+            fFmpegFrameGrabber.start();
+
+            //获取视频总帧数
+            int ftp = fFmpegFrameGrabber.getLengthInFrames();
+
+            while (flag <= ftp) {
+                frame = fFmpegFrameGrabber.grabImage();
+				*/
+/*
+				对视频的第五帧进行处理
+				 *//*
+
+                if (frame != null) {
+                    //文件绝对路径+名字
+                    String fileName = videoFramesPath + String.valueOf(flag) + ".jpg";
+
+                    //文件储存对象
+                    File outPut = new File(fileName);
+                    ImageIO.write(FrameToBufferedImage(frame), "jpg", outPut);
+                }
+                flag++;
+            }
+            fFmpegFrameGrabber.stop();
+            fFmpegFrameGrabber.close();
+        } catch (Exception E) {
+            E.printStackTrace();
+        }
+        return videPicture;
+    }
+
+    public static BufferedImage FrameToBufferedImage(Frame frame) {
+        //创建BufferedImage对象
+        Java2DFrameConverter converter = new Java2DFrameConverter();
+        BufferedImage bufferedImage = converter.getBufferedImage(frame);
+        return bufferedImage;
+    }
+
+    public static void main(String[] args) {
+        String videoFileName = "video.mp4";
+        grabberVideoFramer(videoFileName);
+    }
+}
+*/

+ 3 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/test/service/impl/JeecgDemoServiceImpl.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.demo.test.service.impl;
 
+import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.system.base.service.impl.JeecgServiceImpl;
 import org.jeecg.modules.demo.test.entity.JeecgDemo;
 import org.jeecg.modules.demo.test.mapper.JeecgDemoMapper;
@@ -15,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
  * @Date:  2018-12-29
  * @Version: V1.0
  */
+@Slf4j
 @Service
 public class JeecgDemoServiceImpl extends JeecgServiceImpl<JeecgDemoMapper, JeecgDemo> implements IJeecgDemoService {
 	@Autowired
@@ -55,8 +57,7 @@ public class JeecgDemoServiceImpl extends JeecgServiceImpl<JeecgDemoMapper, Jeec
 	@Cacheable(cacheNames="jeecgDemo", key="#id")
 	public JeecgDemo getByIdCacheable(String id) {
 		JeecgDemo t = jeecgDemoMapper.selectById(id);
-		System.err.println("---未读缓存,读取数据库---");
-		System.err.println(t);
+		log.error("---未读缓存,读取数据库---");
 		return t;
 	}
 

+ 20 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/PerformanceController2.java

@@ -140,7 +140,7 @@ public class PerformanceController2 {
 
     @AutoLog(value = "有效视频定时任务")
     @ApiOperation(value = "有效视频定时任务", notes = "calcDate传递yyyy-MM-dd格式的日期")
-    @PostMapping(value = "/efficientVideo")
+    @GetMapping(value = "/efficientVideo")
     public Result<Map<String, Object>> efficientVideo(@RequestParam(name = "calcDate", required = true) String calcDate) {
         log.info("有效视频任务开始,有效视频所属时间为" + calcDate);
         Result<Map<String, Object>> result = new Result<Map<String, Object>>();
@@ -535,6 +535,25 @@ public class PerformanceController2 {
         return result;
     }
 
+    @AutoLog(value = "获取相关视频列表")
+    @ApiOperation(value = "获取相关视频列表", notes = "获取相关视频列表")
+    @PostMapping(value = "/getVideoList")
+    public Result<List<MaterialInfo>> getVideoList(@RequestBody PerformanceTimeDTO dto,
+                                                       HttpServletRequest req) {
+        Result<List<MaterialInfo>> result = new Result<>();
+        String userId = dto.getUserId();
+        String startDate = dto.getStartDate();
+        String endDate = dto.getEndDate();
+        if(userId==null || startDate == null || endDate == null){
+            result.setSuccess(false);
+            result.setMessage("userId和时间不能为空");
+        }
+        List<MaterialInfo> materialInfoList = performanceService.getVideoList(userId, startDate, endDate);
+        result.setSuccess(true);
+        result.setResult(materialInfoList);
+        return result;
+    }
+
     @AutoLog(value = "获取本周相关有效视频列表")
     @ApiOperation(value = "获取本周相关有效视频列表", notes = "获取本周相关有效视频列表")
     @PostMapping(value = "/getWeekEffiVideoList")

+ 3 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IPerformanceService2.java

@@ -90,6 +90,9 @@ public interface IPerformanceService2 extends IService<Performance> {
     //获取有效视频列表
     List<MaterialInfo> effiVideoList(Integer appType, Integer year, Integer quarter, String userId);
 
+    //获取有效视频列表
+    List<MaterialInfo> getVideoList(String userId, String startDate, String endDate);
+
     List<MaterialInfo> getEffiWeekVideoList(Integer appType, String startDate, String endDate, String userId);
 
     //获取快手优化师绩效实时数据

+ 423 - 36
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/PerformanceServiceImpl2.java

@@ -7,7 +7,10 @@ import cn.com.ctop.planeprojectcost.entity.PlaneProjectCost;
 import cn.com.ctop.planeprojectcost.mapper.PlaneProjectCostMapper;
 import cn.com.ctop.userefficientvideomap.entity.*;
 import cn.com.ctop.userefficientvideomap.mapper.UserEfficientVideoMapMapper;
+import cn.com.ctop.uservideomap.entity.UserVideoMap;
+import cn.com.ctop.uservideomap.mapper.UserVideoMapMapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import io.micrometer.core.instrument.util.StringUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.LoginUser;
@@ -42,6 +45,8 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
     private SysRoleMapper sysRoleMapper;
     @Autowired
     private PlaneProjectCostMapper planeProjectCostMapper;
+    @Autowired
+    private UserVideoMapMapper userVideoMapMapper;
 
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //有效视频计算开始
@@ -71,9 +76,12 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             e.printStackTrace();
         }
         //传入时间,获取对应的年份
-        Date friday = DateUtils.getFriday(calcDate);
+        Date friday = DateUtils.getFriday(calcDate); //周的第一天
+        Date thursday = DateUtils.addDay(friday, 6); //周的最后一天
         String effiCalcStart = DateUtils.formatDate(DateUtils.addDay(friday, -14)); //计算有效视频开始的时间
-        log.info("有效视频统计的开始时间为" + effiCalcStart);
+        log.info("有效视频统计的开始时间,同时也是有效视频第一周开始时间为" + effiCalcStart);
+        String effiFirstWeekCalcEnd = DateUtils.formatDate(DateUtils.addDay(friday, -8)); //计算有效视频第一周结束时间
+        log.info("有效视频第一周结束时间为" + effiCalcStart);
         String effiCalcEnd = DateUtils.formatDate(DateUtils.addDay(friday, -1)); //计算有效视频结束的时间
         log.info("有效视频统计的结束时间为" + effiCalcEnd);
         String effiStart = DateUtils.formatDate(DateUtils.addDay(friday, -21)); //有效视频发布开始时间
@@ -89,10 +97,13 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         int thisQuarter = yearQuarterMap.get("quarter"); //获取当天所在周所在的季度
         log.info("统计时间所在年" + thisYear + "月" + thisMonth + "季" + thisQuarter);
 
-        //快手有效视频
-        kuaishouEffiVideo(calcDate, effiCalcStart, effiCalcEnd, effiStart, effiEnd, thisYear, thisMonth, thisQuarter);
-        //头条有效视频
-        toutiaoEffiVideo(calcDate, effiCalcStart, effiCalcEnd, effiStart, effiEnd, thisYear, thisMonth, thisQuarter);
+        //快手有效视频(新)
+        kuaishouNewEffiVideo(calcDate, effiCalcStart, effiFirstWeekCalcEnd, thisYear, thisMonth, thisQuarter, DateUtils.formatDate(friday), DateUtils.formatDate(thursday));
+        //头条有效视频(新)
+        toutiaoNewEffiVideo(calcDate, effiCalcStart, effiFirstWeekCalcEnd, thisYear, thisMonth, thisQuarter, DateUtils.formatDate(friday), DateUtils.formatDate(thursday));
+
+        //总视频
+        kuaishouNewVideo( calcDate,  thisYear,  thisQuarter,  thisMonth, DateUtils.formatDate(friday),  DateUtils.formatDate(thursday));
     }
 
     //快手有效视频统计
@@ -242,6 +253,352 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    //新有效视频计算开始
+    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    //快手有效视频统计
+    private void kuaishouNewEffiVideo(Date calcDate, String effiCalcStart, String effiFirstWeekCalcEnd, int thisYear, int thisMonth, int thisQuarter, String friday, String thursday) {
+        log.info("快手有效视频统计开始,统计时间为 " + calcDate);
+        //List<EffiVideoDTO> effiList = new ArrayList<>();
+        Integer appType = 2;
+
+        //1.计算第一周(周五-下周周四)所有有消耗得md5
+        List<String> md5List = userEfficientVideoMapMapper.getWeekCostMd5(effiCalcStart, effiFirstWeekCalcEnd);
+        //2.排除第一周之前产生消耗的md5以及14天内消耗<5000的md5
+        for (String md5:md5List){
+            //有效视频去重--如果之前在对应的媒体中存在的话就跳过
+            int signatureCount = userEfficientVideoMapMapper.getEffiVideoCountBySignature(md5, appType);//1头条 2快手
+            if (signatureCount != 0) {
+                continue;
+            }
+
+            Integer count = userEfficientVideoMapMapper.beforeWeekCostCount(md5, effiCalcStart);
+            //如果第一周之前就有消耗的话排除
+            if(count>0){
+                continue;
+            }
+            String videoEarlistCostDate = userEfficientVideoMapMapper.getVideoEarlistCostDate(md5);
+            String videoEndCostDate = null;
+            try {
+               videoEndCostDate = DateUtils.formatDate(DateUtils.addDay(videoEarlistCostDate, 13)); //有效视频发布开始时间
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+            //如果从产生消耗开始时间14天内总消耗<5000,则排除掉
+            BigDecimal videoTotalCost = userEfficientVideoMapMapper.videoTotalCostInDates(md5, videoEarlistCostDate, videoEndCostDate);
+            if( (videoTotalCost.subtract(new BigDecimal("5000"))).compareTo(BigDecimal.ZERO) < 0){
+                continue;
+            }
+
+            //获取该视频的编导、剪辑、拍摄、平面等信息
+            EffiVideoDTO effiVideoDTO = userEfficientVideoMapMapper.getDesignerInfoByCode(md5);
+            if(effiVideoDTO == null){
+                effiVideoDTO = new EffiVideoDTO();
+            }
+            effiVideoDTO.setSignature(md5);
+            effiVideoDTO.setCharge(videoTotalCost);
+
+            String companyId = null;
+            //根据编导id获取视频所属分公司
+            if( StringUtils.isNotBlank(effiVideoDTO.getPlanId()) ) {
+                companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId(effiVideoDTO.getPlanId());
+            }else if( StringUtils.isNotBlank(effiVideoDTO.getClipId()) ){
+                companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId( effiVideoDTO.getClipId() );
+            }else if( StringUtils.isNotBlank(effiVideoDTO.getShotId()) ){
+                companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId( effiVideoDTO.getShotId() );
+            }else if ( StringUtils.isNotBlank(effiVideoDTO.getPlaneId()) ){
+                companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId( effiVideoDTO.getPlaneId() );
+            }
+            //
+
+            UserEfficientVideoMap shot = new UserEfficientVideoMap();
+            UserEfficientVideoMap plane = new UserEfficientVideoMap();
+            UserEfficientVideoMap plan = new UserEfficientVideoMap();
+            UserEfficientVideoMap clip = new UserEfficientVideoMap();
+
+            //拍摄
+            shot.setUserId(effiVideoDTO.getShotId());
+            shot.setEfficientVideoSignature(effiVideoDTO.getSignature());
+            shot.setQuarter(thisQuarter);
+            shot.setAppType(appType); //1头条 2快手
+            shot.setYear(thisYear);
+            shot.setMonth(thisMonth);
+            shot.setCalcDate(calcDate);
+            shot.setRoleId("shot");
+            shot.setWeekStart(friday);
+            shot.setWeekEnd(thursday);
+            shot.setCompanyId(companyId);
+            userEfficientVideoMapMapper.insert(shot);
+
+            //平面
+            plane.setUserId(effiVideoDTO.getPlaneId());
+            plane.setEfficientVideoSignature(effiVideoDTO.getSignature());
+            plane.setQuarter(thisQuarter);
+            plane.setAppType(appType); //1头条 2快手
+            plane.setYear(thisYear);
+            plane.setMonth(thisMonth);
+            plane.setCalcDate(calcDate);
+            plane.setRoleId("plane");
+            plane.setWeekStart(friday);
+            plane.setWeekEnd(thursday);
+            plane.setCompanyId(companyId);
+            userEfficientVideoMapMapper.insert(plane);
+
+            //编导
+            plan.setUserId(effiVideoDTO.getPlanId());
+            plan.setEfficientVideoSignature(effiVideoDTO.getSignature());
+            plan.setQuarter(thisQuarter);
+            plan.setAppType(appType); //1头条 2快手
+            plan.setYear(thisYear);
+            plan.setMonth(thisMonth);
+            plan.setCalcDate(calcDate);
+            plan.setRoleId("plan");
+            plan.setWeekStart(friday);
+            plan.setWeekEnd(thursday);
+            plan.setCompanyId(companyId);
+            userEfficientVideoMapMapper.insert(plan);
+
+            //剪辑
+            clip.setUserId(effiVideoDTO.getClipId());
+            clip.setEfficientVideoSignature(effiVideoDTO.getSignature());
+            clip.setQuarter(thisQuarter);
+            clip.setAppType(appType); //1头条 2快手
+            clip.setYear(thisYear);
+            clip.setMonth(thisMonth);
+            clip.setCalcDate(calcDate);
+            clip.setRoleId("clip");
+            clip.setWeekStart(friday);
+            clip.setWeekEnd(thursday);
+            clip.setCompanyId(companyId);
+            userEfficientVideoMapMapper.insert(clip);
+
+            //有效视频同步到有效视频素材库--测试的时候不打开,生产打开
+            //userEfficientVideoMapMapper.updateKuaishouEffiType(2, effiVideoDTO.getSignature());
+        }
+        log.info("快手有效视频统计结束,统计时间为 " + calcDate);
+    }
+
+    //toutiao新有效视频统计
+    private void toutiaoNewEffiVideo(Date calcDate, String effiCalcStart, String effiFirstWeekCalcEnd, int thisYear, int thisMonth, int thisQuarter, String friday, String thursday) {
+        log.info("toutiao有效视频统计开始,统计时间为 " + calcDate);
+        //List<EffiVideoDTO> effiList = new ArrayList<>();
+        Integer appType = 1;
+
+        //1.计算第一周(周五-下周周四)所有有消耗得md5
+        List<String> md5List = userEfficientVideoMapMapper.toutiaoGetWeekCostMd5(effiCalcStart, effiFirstWeekCalcEnd);
+        //2.排除第一周之前产生消耗的md5以及14天内消耗<5000的md5
+        for (String md5:md5List){
+            //有效视频去重--如果之前在对应的媒体中存在的话就跳过
+            int signatureCount = userEfficientVideoMapMapper.getEffiVideoCountBySignature(md5, appType);//1头条 2快手
+            if (signatureCount != 0) {
+                continue;
+            }
+
+            Integer count = userEfficientVideoMapMapper.toutiaoBeforeWeekCostCount(md5, effiCalcStart);
+            //如果第一周之前就有消耗的话排除
+            if(count>0){
+                continue;
+            }
+            String videoEarlistCostDate = userEfficientVideoMapMapper.getToutiaoVideoEarlistCostDate(md5);
+            String videoEndCostDate = null;
+            try {
+                videoEndCostDate = DateUtils.formatDate(DateUtils.addDay(videoEarlistCostDate, 13)); //有效视频发布开始时间
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+            //如果从产生消耗开始时间14天内总消耗<5000,则排除掉
+            BigDecimal videoTotalCost = userEfficientVideoMapMapper.toutiaoVideoTotalCostInDates(md5, videoEarlistCostDate, videoEndCostDate);
+            if( (videoTotalCost.subtract(new BigDecimal("5000"))).compareTo(BigDecimal.ZERO) < 0){
+                continue;
+            }
+
+            //获取该视频的编导、剪辑、拍摄、平面等信息
+            EffiVideoDTO effiVideoDTO = userEfficientVideoMapMapper.getDesignerInfoByCode(md5);
+            if(effiVideoDTO == null){
+                effiVideoDTO = new EffiVideoDTO();
+            }
+            effiVideoDTO.setSignature(md5);
+            effiVideoDTO.setCharge(videoTotalCost);
+
+            String companyId = null;
+            //根据编导id获取视频所属分公司
+            if( StringUtils.isNotBlank(effiVideoDTO.getPlanId()) ) {
+                companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId(effiVideoDTO.getPlanId());
+            }else if( StringUtils.isNotBlank(effiVideoDTO.getClipId()) ){
+                companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId( effiVideoDTO.getClipId() );
+            }else if( StringUtils.isNotBlank(effiVideoDTO.getShotId()) ){
+                companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId( effiVideoDTO.getShotId() );
+            }else if ( StringUtils.isNotBlank(effiVideoDTO.getPlaneId()) ){
+                companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId( effiVideoDTO.getPlaneId() );
+            }
+            //
+
+            UserEfficientVideoMap shot = new UserEfficientVideoMap();
+            UserEfficientVideoMap plane = new UserEfficientVideoMap();
+            UserEfficientVideoMap plan = new UserEfficientVideoMap();
+            UserEfficientVideoMap clip = new UserEfficientVideoMap();
+
+            //拍摄
+            shot.setUserId(effiVideoDTO.getShotId());
+            shot.setEfficientVideoSignature(effiVideoDTO.getSignature());
+            shot.setQuarter(thisQuarter);
+            shot.setAppType(appType); //1头条 2快手
+            shot.setYear(thisYear);
+            shot.setMonth(thisMonth);
+            shot.setCalcDate(calcDate);
+            shot.setRoleId("shot");
+            shot.setWeekStart(friday);
+            shot.setWeekEnd(thursday);
+            shot.setCompanyId(companyId);
+            userEfficientVideoMapMapper.insert(shot);
+
+            //平面
+            plane.setUserId(effiVideoDTO.getPlaneId());
+            plane.setEfficientVideoSignature(effiVideoDTO.getSignature());
+            plane.setQuarter(thisQuarter);
+            plane.setAppType(appType); //1头条 2快手
+            plane.setYear(thisYear);
+            plane.setMonth(thisMonth);
+            plane.setCalcDate(calcDate);
+            plane.setRoleId("plane");
+            plane.setWeekStart(friday);
+            plane.setWeekEnd(thursday);
+            plane.setCompanyId(companyId);
+            userEfficientVideoMapMapper.insert(plane);
+
+            //编导
+            plan.setUserId(effiVideoDTO.getPlanId());
+            plan.setEfficientVideoSignature(effiVideoDTO.getSignature());
+            plan.setQuarter(thisQuarter);
+            plan.setAppType(appType); //1头条 2快手
+            plan.setYear(thisYear);
+            plan.setMonth(thisMonth);
+            plan.setCalcDate(calcDate);
+            plan.setRoleId("plan");
+            plan.setWeekStart(friday);
+            plan.setWeekEnd(thursday);
+            plan.setCompanyId(companyId);
+            userEfficientVideoMapMapper.insert(plan);
+
+            //剪辑
+            clip.setUserId(effiVideoDTO.getClipId());
+            clip.setEfficientVideoSignature(effiVideoDTO.getSignature());
+            clip.setQuarter(thisQuarter);
+            clip.setAppType(appType); //1头条 2快手
+            clip.setYear(thisYear);
+            clip.setMonth(thisMonth);
+            clip.setCalcDate(calcDate);
+            clip.setRoleId("clip");
+            clip.setWeekStart(friday);
+            clip.setWeekEnd(thursday);
+            clip.setCompanyId(companyId);
+            userEfficientVideoMapMapper.insert(clip);
+
+            //有效视频同步到有效视频素材库--测试的时候不打开,生产打开
+            //userEfficientVideoMapMapper.updateToutiaoEffiType(2, effiVideoDTO.getSignature());
+        }
+        log.info("toutiao有效视频统计结束,统计时间为 " + calcDate);
+    }
+    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    //新有效视频计算结束
+    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    //新总视频计算开始
+    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    public void kuaishouNewVideo(Date calcDate, int thisYear, int thisQuarter, int thisMonth, String friday, String thursday){
+        log.info("设计师周总视频计算开始");
+        List<String> videoMd5s = userEfficientVideoMapMapper.getVideoByDates(friday,thursday);
+        for(String md5:videoMd5s){
+            //去重
+            Integer signatureCount = userEfficientVideoMapMapper.getVideoCountByCode(md5);
+            if(signatureCount > 0){
+                continue;
+            }
+            //
+
+            //获取该视频的编导、剪辑、拍摄、平面等信息
+            EffiVideoDTO effiVideoDTO = userEfficientVideoMapMapper.getDesignerInfoByCode(md5);
+            if(effiVideoDTO == null){
+                effiVideoDTO = new EffiVideoDTO();
+            }
+            effiVideoDTO.setSignature(md5);
+
+            String companyId = null;
+            //根据编导id获取视频所属分公司
+            if( StringUtils.isNotBlank(effiVideoDTO.getPlanId()) ) {
+                companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId(effiVideoDTO.getPlanId());
+            }else if( StringUtils.isNotBlank(effiVideoDTO.getClipId()) ){
+                companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId( effiVideoDTO.getClipId() );
+            }else if( StringUtils.isNotBlank(effiVideoDTO.getShotId()) ){
+                companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId( effiVideoDTO.getShotId() );
+            }else if ( StringUtils.isNotBlank(effiVideoDTO.getPlaneId()) ){
+                companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId( effiVideoDTO.getPlaneId() );
+            }
+
+            UserVideoMap shot = new UserVideoMap();
+            UserVideoMap plane = new UserVideoMap();
+            UserVideoMap plan = new UserVideoMap();
+            UserVideoMap clip = new UserVideoMap();
+
+            //拍摄
+            shot.setUserId(effiVideoDTO.getShotId());
+            shot.setVideoSignature(effiVideoDTO.getSignature());
+            shot.setQuarter(thisQuarter);
+            shot.setYear(thisYear);
+            shot.setMonth(thisMonth);
+            shot.setCalcDate(calcDate);
+            shot.setRoleId("shot");
+            shot.setWeekStart(friday);
+            shot.setWeekEnd(thursday);
+            shot.setCompanyId(companyId);
+            userVideoMapMapper.insert(shot);
+
+            //平面
+            plane.setUserId(effiVideoDTO.getPlaneId());
+            plane.setVideoSignature(effiVideoDTO.getSignature());
+            plane.setQuarter(thisQuarter);
+            plane.setYear(thisYear);
+            plane.setMonth(thisMonth);
+            plane.setCalcDate(calcDate);
+            plane.setRoleId("plane");
+            plane.setWeekStart(friday);
+            plane.setWeekEnd(thursday);
+            plane.setCompanyId(companyId);
+            userVideoMapMapper.insert(plane);
+
+            //编导
+            plan.setUserId(effiVideoDTO.getPlanId());
+            plan.setVideoSignature(effiVideoDTO.getSignature());
+            plan.setQuarter(thisQuarter);
+            plan.setYear(thisYear);
+            plan.setMonth(thisMonth);
+            plan.setCalcDate(calcDate);
+            plan.setRoleId("plan");
+            plan.setWeekStart(friday);
+            plan.setWeekEnd(thursday);
+            plan.setCompanyId(companyId);
+            userVideoMapMapper.insert(plan);
+
+            //剪辑
+            clip.setUserId(effiVideoDTO.getClipId());
+            clip.setVideoSignature(effiVideoDTO.getSignature());
+            clip.setQuarter(thisQuarter);
+            clip.setYear(thisYear);
+            clip.setMonth(thisMonth);
+            clip.setCalcDate(calcDate);
+            clip.setRoleId("clip");
+            clip.setWeekStart(friday);
+            clip.setWeekEnd(thursday);
+            clip.setCompanyId(companyId);
+            userVideoMapMapper.insert(clip);
+        }
+        log.info("设计师周总视频计算结束");
+     }
+    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    //新总视频计算结束
+    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //绩效计算开始
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     /**
@@ -925,7 +1282,6 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         //TODO ctop_project表有修改,需要进行相对应的变化
         //获取所有project根据媒体类型获取快手下的项目类型 1-头条 2-快手
         List<ProjectDTO> projectDTOS = userEfficientVideoMapMapper.getProjects("1");
-        System.out.println("头条项目数量为:" + projectDTOS.size());
 
         //循环project
         for (ProjectDTO projectDTO : projectDTOS) {
@@ -1830,24 +2186,22 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         List<UserDto2> userDto2List = userEfficientVideoMapMapper.getKuaishouDepartUserInfo();
         //2 循环所有人,并查询出每个人的有效视频数、总视频数、总消耗
         for (UserDto2 userDto : userDto2List) {
-            String roleCode = userDto.getRoleCode();
             //2.1 获取有效视频数量
-            Integer effiVideoCount = userEfficientVideoMapMapper.getEffiVideoCountByCalcDate(startDate, endDate, userDto.getRoleId(), userDto.getUserId(), 2);
-            //2.2 获取有效视频总数
-            Integer videoCount = userEfficientVideoMapMapper.getQuarterMaterialCountByUserId(userDto.getRoleCode(), startDate, endDate, userDto.getUserId());
+            Integer effiVideoCount = userEfficientVideoMapMapper.getEffiVideoCountByCalcDate(startDate, endDate, userDto.getUserId(), 2);
+            //2.2 获取视频总数
+            Integer videoCount = userEfficientVideoMapMapper.getVideoCountByUserId(userDto.getUserId(), startDate, endDate);
             //2.3 总消耗
-            BigDecimal cost = null;
-            if ("clip".equals(roleCode)) {
-                cost = userEfficientVideoMapMapper.getTotalCostByClipId(userDto.getUserId(), startDate, endDate);
-            } else if ("plan".equals(roleCode)) {
-                cost = userEfficientVideoMapMapper.getTotalCostByPlanId(userDto.getUserId(), startDate, endDate);
-            } else if ("shot".equals(roleCode)) {
-                cost = userEfficientVideoMapMapper.getTotalCostByShotId(userDto.getUserId(), startDate, endDate);
-            }
-            if(cost == null){
-                cost = BigDecimal.ZERO;
+            BigDecimal totalCost = BigDecimal.ZERO;
+            List<String> md5s = userEfficientVideoMapMapper.getTotalSignatureByUserId(userDto.getUserId(), startDate, endDate);
+            for(String md5:md5s){
+                BigDecimal cost = userEfficientVideoMapMapper.getSumChargeBySignature(md5, startDate, endDate);
+                    if(cost== null){
+                        cost = BigDecimal.ZERO;
+                    }
+                totalCost = totalCost.add(cost);
             }
-            userDto.setCost(cost);
+
+            userDto.setCost(totalCost);
             userDto.setVideoCount(videoCount);
             userDto.setEffiVideoCount(effiVideoCount);
         }
@@ -1863,23 +2217,20 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         for (UserDto2 userDto : userDto2List) {
             String roleCode = userDto.getRoleCode();
             //2.1 获取有效视频数量
-            Integer effiVideoCount = userEfficientVideoMapMapper.getEffiVideoCountByCalcDate(startDate, endDate, userDto.getRoleId(), userDto.getUserId(), 1);
+            Integer effiVideoCount = userEfficientVideoMapMapper.getEffiVideoCountByCalcDate(startDate, endDate, userDto.getUserId(), 1);
             //2.2 获取视频总数
-            Integer videoCount = userEfficientVideoMapMapper.getQuarterMaterialCountByUserId(userDto.getRoleCode(), startDate, endDate, userDto.getUserId());
+            Integer videoCount = userEfficientVideoMapMapper.getVideoCountByUserId(userDto.getUserId(), startDate, endDate);
             //2.3 总消耗
-            BigDecimal cost = null;
-            if ("clip".equals(roleCode)) {
-                cost = userEfficientVideoMapMapper.toutiaoGetTotalCostByClipId(userDto.getUserId(), startDate, endDate);
-            } else if ("plan".equals(roleCode)) {
-                cost = userEfficientVideoMapMapper.toutiaoGetTotalCostByPlanId(userDto.getUserId(), startDate, endDate);
-            } else if ("shot".equals(roleCode)) {
-                cost = userEfficientVideoMapMapper.toutiaoGetTotalCostByShotId(userDto.getUserId(), startDate, endDate);
-            }
-
-            if(cost == null){
-                cost = BigDecimal.ZERO;
+            BigDecimal totalCost = BigDecimal.ZERO;
+            List<String> md5s = userEfficientVideoMapMapper.getTotalSignatureByUserId(userDto.getUserId(), startDate, endDate);
+            for(String md5:md5s){
+                BigDecimal cost = userEfficientVideoMapMapper.getToutiaoSumChargeBySignature(md5, startDate, endDate);
+                if(cost== null){
+                    cost = BigDecimal.ZERO;
+                }
+                totalCost = totalCost.add(cost);
             }
-            userDto.setCost(cost);
+            userDto.setCost(totalCost);
             userDto.setVideoCount(videoCount);
             userDto.setEffiVideoCount(effiVideoCount);
         }
@@ -1968,8 +2319,44 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
     }
 
     //根据userid,appType,年度,季度查询有效视频列表
+    public List<MaterialInfo> getVideoList(String userId, String startDate, String endDate){
+        List<MaterialInfo> materialInfoList = userEfficientVideoMapMapper.getVideoList(userId, startDate, endDate);
+        return materialInfoList;
+    }
+
+    //根据userid,appType,年度,季度查询有效视频列表
     public List<MaterialInfo> getEffiWeekVideoList(Integer appType, String startDate, String endDate, String userId){
         List<MaterialInfo> materialInfoList = userEfficientVideoMapMapper.getEffiWeekVideoList(appType, startDate, endDate, userId);
+
+        //String effiCalcStart = null;
+        //String effiCalcEnd =null;
+        //try {
+        //    effiCalcStart = DateUtils.formatDate(DateUtils.addDay(startDate, -14)); //计算有效视频开始的时间
+        //    log.info("周有效视频开始时间:" + effiCalcStart);
+        //    effiCalcEnd = DateUtils.formatDate(DateUtils.addDay(startDate, -1)); //计算有效视频结束的时间
+        //    log.info("周有效视频结束时间:" + effiCalcEnd);
+        //} catch (ParseException e) {
+        //    e.printStackTrace();
+        //}
+        //
+        //BigDecimal cost = null;
+        //if(appType == 2){
+        //    for(MaterialInfo materialInfo:materialInfoList){
+        //        cost = userEfficientVideoMapMapper.videoTotalCostInDates(materialInfo.getCode(),effiCalcStart, effiCalcEnd);
+        //        if(cost == null){
+        //            cost = BigDecimal.ZERO;
+        //        }
+        //        materialInfo.setCost(cost);
+        //    }
+        //}else if(appType == 1){
+        //    for(MaterialInfo materialInfo:materialInfoList){
+        //        cost = userEfficientVideoMapMapper.toutiaoVideoTotalCostInDates(materialInfo.getCode(),effiCalcStart, effiCalcEnd);
+        //        if(cost == null){
+        //            cost = BigDecimal.ZERO;
+        //        }
+        //        materialInfo.setCost(cost);
+        //    }
+        //}
         return materialInfoList;
     }
 

+ 13 - 0
jeecg-boot-module-system/src/main/resources/application-dev.yml

@@ -37,6 +37,19 @@ spring:
   ## quartz定时任务,采用数据库方式
   quartz:
     job-store-type: jdbc
+    #相关属性配置
+    properties:
+      org:
+        quartz:
+          jobStore:
+            class: org.quartz.simpl.RAMJobStore
+            driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
+            clusterCheckinInterval: 10000
+          threadPool:
+            class: org.quartz.simpl.SimpleThreadPool
+            threadCount: 20
+            threadPriority: 5
+            threadsInheritContextClassLoaderOfInitializingThread: true
   #json 时间戳统一转换
   jackson:
     date-format:   yyyy-MM-dd HH:mm:ss

+ 49 - 0
jeecg-boot-module-system/src/main/resources/generatorConfig.xml

@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE generatorConfiguration
+        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
+        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
+<generatorConfiguration>
+    <!-- 导入配置文件 -->
+    <properties resource="application.properties"/>
+
+    <!-- defaultModelType="flat" 设置复合主键时不单独为主键创建实体 -->
+    <context id="MySql" defaultModelType="flat">
+
+        <!-- 生成的POJO实现java.io.Serializable接口 -->
+        <plugin type="org.mybatis.generator.plugins.SerializablePlugin"/>
+
+        <!--注释-->
+        <commentGenerator>
+            <!-- 将数据库中表的字段描述信息添加到注释 -->
+            <property name="addRemarkComments" value="true"/>
+            <!-- 注释里不添加日期 -->
+            <property name="suppressDate" value="true"/>
+        </commentGenerator>
+        <!-- 数据库连接,直接通过${}读取application.properties里的配置 -->
+        <jdbcConnection
+                driverClass="${spring.datasource.driver-class-name}"
+                connectionURL="${spring.datasource.url}"
+                userId="${spring.datasource.username}"
+                password="${spring.datasource.password}"/>
+
+        <!-- 生成POJO对象,并将类放到com.songguoliang.springboot.entity包下 -->
+        <javaModelGenerator targetPackage="com.songguoliang.springboot.entity"
+                            targetProject="src/main/java"></javaModelGenerator>
+        <!-- 生成mapper xml文件,并放到resources下的mapper文件夹下 -->
+        <sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources"></sqlMapGenerator>
+
+
+        <!-- 生成mapper xml对应dao接口,放到com.songguoliang.springboot.mapper包下-->
+        <javaClientGenerator targetPackage="com.songguoliang.springboot.mapper" targetProject="src/main/java"
+                             type="XMLMAPPER"></javaClientGenerator>
+
+        <!-- table标签可以有多个,至少一个,tableName指定表名,可以使用_和%通配符 -->
+        <table tableName="tbl_user">
+            <!-- 是否只生成POJO对象 -->
+            <property name="modelOnly" value="false"/>
+            <!-- 数据库中表名有时我们都会带个前缀,而实体又不想带前缀,这个配置可以把实体的前缀去掉 -->
+            <domainObjectRenamingRule searchString="^Tbl" replaceString=""/>
+
+        </table>
+    </context>
+</generatorConfiguration>

+ 15 - 32
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -1,8 +1,11 @@
 package org.jeecg;
 
+import cn.com.ctop.bytedance.service.IReportService;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
@@ -73,7 +76,6 @@ public class SampleTest {
             param.put("task_ids", taskIds);
             String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
             JSONObject resultJson = JSONObject.parseObject(result);
-            System.err.println(resultJson);*/
 
 
           /*  String url = "https://ad.e.kuaishou.com/rest/openapi/v1/async_task/download";
@@ -132,40 +134,21 @@ public class SampleTest {
 
     @Test
     public void testLoadJob() {
-        log.info("快手获取日报数据任务执行开始");
-        Long start = System.currentTimeMillis();
         Date getDate = DateUtils.addDay(new Date(), -1);
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
-        if (null == tokens || tokens.size() <= 0) {
-            log.info("快手获取日报数据任务执行失败:未获取到可用的token");
-            return;
-        }
-        String getDateStr = DateUtils.formatDate(getDate);
-        countDownLatch = new CountDownLatch(tokens.size());
-        for (CtopOauthToken token : tokens) {
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    //创建任务
-                    try {
-                        reportTaskService.createTask(token.getAccountId(), token.getAccessToken(), getDateStr, getDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    } finally {
-                        countDownLatch.countDown();
-                    }
-                }
-            });
-        }
-        try {
-            countDownLatch.await();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-        Long end = System.currentTimeMillis();
-        log.info("快手获取日报数据任务执行结束,执行耗时:{}秒", (end - start) / 1000);
+        //1:查询当日数据
+        QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("project_id", 222);
+        List<UserAllocation> allocations = userAllocationService.list(queryWrapper);
+        allocations.forEach(allocation -> {
+            CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
+            reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+        });
     }
 
+    @Autowired
+    private IReportService reportService;
+    @Autowired
+    private IUserAllocationService userAllocationService;
 
     @Test
     public void wanHuaTong() {

+ 12 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java

@@ -12,6 +12,7 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
+import java.math.BigDecimal;
 import java.util.Date;
 
 /**
@@ -136,4 +137,15 @@ public class MaterialInfo {
     @TableField(exist = false)
     private JSONObject kuaiShou;
 
+    @TableField(exist = false)
+    private String videoRoleCode;  //拍摄时候担任的角色
+
+    @TableField(exist = false)
+    private String originRoleName;  //原本的角色
+
+    @TableField(exist = false)
+    private BigDecimal cost;
+
+    @TableField(exist = false)
+    private String realname;
 }

+ 0 - 2
module-common/src/main/java/cn/com/ctop/common/module/service/impl/CorpWeixinServiceImpl.java

@@ -36,10 +36,8 @@ public class CorpWeixinServiceImpl implements ICorpWeixinService {
         WxCpOAuth2Service wxCpOAuth2Service = new WxCpOAuth2ServiceImpl(service);
         try {
 //            WxCpOauth2UserInfo userInfo = wxCpOAuth2Service.getUserInfo(1000002,"_Mq0Dx1dynryHsgBkoU1dAk5A3Y7lrfg8V0GDv4ocWQ");
-//            System.out.println(new Gson().toJson(userInfo));
 //            WxCpUserService wxCpUserService = new WxCpUserServiceImpl(service);
 //            WxCpUser user = wxCpUserService.getById("YiErSanSi");
-//            System.out.println(new Gson().toJson(user));
             WxCpMessage message = new WxCpMessage();
             message.setToUser("YiErSanSi");
             message.setAgentId(1000002);

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

@@ -60,7 +60,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         MaterialInfo materialInfo = this.getById(materialId);
         MpsUtils mpsUtils = new MpsUtils();
         String path = materialInfo.getUrl().substring(materialInfo.getUrl().indexOf("/", 10) + 1, materialInfo.getUrl().length());
-        System.out.println(path);
         String jobId = mpsUtils.videoWaterMark(path, videoWatermarkTemplate.getTemplatePath(), videoWatermarkTemplate.getTemplateId(), videoWatermarkTemplate.getHeight());
         QueryJobListResponse.Job job = MpsUtils.getJobStatus(jobId);
         VideoWatermarkTask videoWatermarkTask = new VideoWatermarkTask();
@@ -115,7 +114,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     public static void main(String[] args) {
         String reg = "(mp4|flv|avi|rm|rmvb|wmv)";
         Pattern p = Pattern.compile(reg);
-        System.out.println(p.matcher("https://ctop-media.oss-cn-beijing.aliyuncs.com/video/2019-10-30/ios%E6%8E%A8%E5%B9%BF%E8%A7%86%E9%A2%91-1572437289724.mp4").find());
     }
 
     @Autowired

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

@@ -29,8 +29,6 @@ public class ExportExcelUtils {
      */
     public void exportExcelOld(XSSFWorkbook workbook, int sheetNum,
                                String sheetTitle, String[] headers, List<List<Object>> result) throws Exception {
-        System.out.println("!!!!!!!!!" + XSSFCellStyle.class.getProtectionDomain().getCodeSource().getLocation());
-        System.out.println("!!!!!!!!!" + HSSFCellStyle.class.getProtectionDomain().getCodeSource().getLocation());
         // 生成一个表格
         XSSFSheet sheet = workbook.createSheet();
         workbook.setSheetName(sheetNum, sheetTitle);

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

@@ -678,7 +678,6 @@ public class HttpUtils {
                 }
             }
             HttpEntity respEntity;
-            System.err.println(httpget);
             HttpResponse response = httpclient.execute(httpget);
             respEntity = response.getEntity();
             result = EntityUtils.toString(respEntity);
@@ -755,7 +754,6 @@ public class HttpUtils {
             }
 
             HttpGet httpget = new HttpGet(url + "?" + postBody);
-            System.err.println(url + postBody);
             if (headers != null) {
                 Iterator<String> keyIter = headers.keySet().iterator();
                 while (keyIter.hasNext()) {

+ 0 - 1
module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils2.java

@@ -550,7 +550,6 @@ public class HttpUtils2 {
                 }
             }
             HttpEntity respEntity;
-            System.err.println(httpget);
             HttpResponse response = httpclient.execute(httpget);
             respEntity = response.getEntity();
             result = EntityUtils.toString(respEntity);

+ 0 - 3
module-common/src/main/java/cn/com/ctop/common/module/utils/JavacvUtil.java

@@ -37,14 +37,12 @@ public class JavacvUtil {
         try {
             fFmpegFrameGrabber.start();
             int ftp = fFmpegFrameGrabber.getLengthInFrames();
-            System.out.println("开始视频提取帧");
             for (int i=0 ; i < ftp ; i++){
                 if( i >= start && i <= end){
                     frame = fFmpegFrameGrabber.grabImage();
                     doExecuteFrame(frame, filePath, fileTargetName, i ,files);
                 }
             }
-            System.out.println("============运行结束============");
             fFmpegFrameGrabber.stop();
         } catch (Exception e) {
             e.printStackTrace();
@@ -81,7 +79,6 @@ public class JavacvUtil {
 
     public static void main(String[] args) {
         List<File> files = videoIntercept(new File("C:\\Users\\宋英豪\\Desktop\\nfpHmswW.mp4"), 10, 100);
-        System.out.println(files);
     }
 
     /**

+ 2 - 19
module-common/src/main/java/cn/com/ctop/common/module/utils/MpsUtils.java

@@ -28,7 +28,6 @@ public class MpsUtils {
 //        arrangementSelect(a,3);
 //        String t = "https://ctop-part.oss-cn-beijing.aliyuncs.com/input/VIDEO_HEAD/2019-12-11/25-1576044510677.mp4";
 //        int i = t.indexOf("/",10);
-//        System.out.println(t.substring(i+1,t.length()-1));
 
        // MpsUtils mpsUtils = new MpsUtils();
        // mpsUtils.videoWaterMark("video/2019-12-20/20%E7%BD%91%E6%9C%8D-1576822566069.mp4","watermark/water1080-1920.png","8bcf0c98021c40fc96a95d60f55b1f10",720);
@@ -39,7 +38,6 @@ public class MpsUtils {
 //            while (true){
 //                QueryJobListResponse.Job job = mpsUtils.getJobStatus(jobId);
 //                job.getOutput().getOutputFile().getObject();
-//                System.out.println(new Gson().toJson(job));
 //                Thread.sleep(5000L);
 //            }
 //        } catch (InterruptedException e) {
@@ -57,7 +55,6 @@ public class MpsUtils {
         request.setJobIds(jobId);
         try {
             QueryJobListResponse response = client.getAcsResponse(request);
-            System.out.println(new Gson().toJson(response.getJobList().get(0)));
             job = response.getJobList().get(0);
         } catch (ClientException e) {
             e.printStackTrace();
@@ -80,8 +77,6 @@ public class MpsUtils {
      * @param n 选择个数
      */
     public static void arrangementSelect(String[] dataList, int n) {
-        System.out.println(String.format("A(%d, %d) = %d", dataList.length, n,
-                arrangement(n, dataList.length)));
         arrangementSelect(dataList, new String[n], 0);
     }
 
@@ -95,7 +90,6 @@ public class MpsUtils {
         int resultLen = resultList.length;
         // 全部选择完时,输出排列结果
         if (resultIndex >= resultLen) {
-            System.out.println(Arrays.asList(resultList));
             return;
         }
 
@@ -146,8 +140,7 @@ public class MpsUtils {
      * @param n 选择个数
      */
     public static void combinationSelect(String[] dataList, int n) {
-        System.out.println(String.format("C(%d, %d) = %d",
-                dataList.length, n, combination(n, dataList.length)));
+
         combinationSelect(dataList, 0, new String[n], 0);
     }
 
@@ -163,7 +156,6 @@ public class MpsUtils {
         int resultCount = resultIndex + 1;
         // 全部选择完时,输出组合结果
         if (resultCount > resultLen) {
-            System.out.println(Arrays.asList(resultList));
             return;
         }
 
@@ -256,13 +248,9 @@ public class MpsUtils {
         SubmitJobsResponse response;
         try {
             response = client.getAcsResponse(request);
-            System.out.println("RequestId is:"+response.getRequestId());
             if (response.getJobResultList().get(0).getSuccess()) {
                 jobId = response.getJobResultList().get(0).getJob().getJobId();
-                System.out.println("JobId is:" + response.getJobResultList().get(0).getJob().getJobId());
             } else {
-                System.out.println("SubmitJobs Failed code:" + response.getJobResultList().get(0).getCode() +
-                        " message:" + response.getJobResultList().get(0).getMessage());
             }
         } catch (ServerException e) {
             e.printStackTrace();
@@ -312,13 +300,10 @@ public class MpsUtils {
         SubmitJobsResponse response;
         try {
             response = client.getAcsResponse(request);
-            System.out.println("RequestId is:"+response.getRequestId());
             if (response.getJobResultList().get(0).getSuccess()) {
                 jobId = response.getJobResultList().get(0).getJob().getJobId();
-                System.out.println("JobId is:" + response.getJobResultList().get(0).getJob().getJobId());
             } else {
-                System.out.println("SubmitJobs Failed code:" + response.getJobResultList().get(0).getCode() +
-                        " message:" + response.getJobResultList().get(0).getMessage());
+
             }
         } catch (ServerException e) {
             e.printStackTrace();
@@ -338,8 +323,6 @@ public class MpsUtils {
         try {
             response = client.getAcsResponse(request);
             pipelineId = response.getPipelineList().get(0).getId();
-            System.out.println("PipelineName is:" + response.getPipelineList().get(0).getName());
-            System.out.println("PipelineId is:" + response.getPipelineList().get(0).getId());
         } catch (ServerException e) {
             e.printStackTrace();
         } catch (ClientException e) {

+ 0 - 3
module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/service/impl/AppiumJobServiceImpl.java

@@ -71,7 +71,6 @@ public class AppiumJobServiceImpl extends ServiceImpl<AppiumJobMapper, AppiumJob
                 Thread.sleep(3000L);
                 String packageName = androidDriver.getCurrentPackage();
                 String activityName = androidDriver.currentActivity();
-                System.out.println(packageName + ":" + activityName);
                 List<AppiumTaskItem> taskItems = taskItemMapper.selectByParams(packageName, activityName, taskId);
                 if (null != taskItems || taskItems.size() > 0) {
                     for (AppiumTaskItem item : taskItems) {
@@ -83,7 +82,6 @@ public class AppiumJobServiceImpl extends ServiceImpl<AppiumJobMapper, AppiumJob
         } catch (Exception e) {
             e.printStackTrace();
         }
-        System.out.println(kuaishouId);
         return kuaishouId;
     }
 
@@ -190,7 +188,6 @@ public class AppiumJobServiceImpl extends ServiceImpl<AppiumJobMapper, AppiumJob
             webDriver.get(GET_AGENT_DATA_URL + "st=" + stDate + "&et=" + etDate);
             Thread.sleep(1000L);
             String getData = webDriver.findElement(By.xpath("//pre[@style='word-wrap: break-word; white-space: pre-wrap;']")).getText();
-            System.out.println(getData);
         } catch (Exception e) {
             e.printStackTrace();
             log.error("爬取代理商数据异常");

+ 2 - 16
module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/AppiumUtil.java

@@ -102,8 +102,6 @@ public class AppiumUtil {
         String mobile = setmobile;
         String pkg = androidDriver.getCurrentPackage();
         String activity = androidDriver.currentActivity();
-        System.out.println("当前包:" + pkg);
-        System.out.println("当前activity:" + activity);
         Boolean isContinue = true;
         if ("com.android.packageinstaller".equals(pkg)) {
             switch (activity) {
@@ -124,7 +122,7 @@ public class AppiumUtil {
                     WebElement doneBtn = getElementByType(androidDriver, FIND_ELEMENT_TYPE_ID, "com.android.packageinstaller:id/done_button");
 
                     if (centerText != null) {
-                        System.out.println(centerText.getText());
+                        log.info(centerText.getText());
                     }
                     if (doneBtn != null) {
                         doneBtn.click();
@@ -133,7 +131,7 @@ public class AppiumUtil {
                 default:
                     isContinue = false;
                     androidDriver.quit();
-                    System.out.println("当前activity无法处理");
+                    log.info("当前activity无法处理");
                     break;
             }
         } else if ("com.smile.gifmaker".equals(pkg)) {
@@ -198,7 +196,6 @@ public class AppiumUtil {
                 case "com.yxcorp.gifshow.profile.activity.MyProfileActivity":
                     WebElement loadingTitle = getElementByType(androidDriver, FIND_ELEMENT_TYPE_ID, "com.smile.gifmaker:id/loading_title");
                     if (loadingTitle != null) {
-                        System.out.println(loadingTitle.getText());
                     }
                     tapPoint(androidDriver, 650, 400);
                     break;
@@ -206,7 +203,6 @@ public class AppiumUtil {
                 case "com.yxcorp.plugin.qrcode.MyQRCodeActivity":
                     WebElement kwaiId = getElementByType(androidDriver, FIND_ELEMENT_TYPE_ID, "com.smile.gifmaker:id/kwai_id");
                     if (kwaiId != null) {
-                        System.out.println(kwaiId.getText());
                         isContinue = false;
                         androidDriver.quit();
                     }
@@ -222,7 +218,6 @@ public class AppiumUtil {
                     WebElement loginNameEt = getElementByType(androidDriver, FIND_ELEMENT_TYPE_ID, "com.smile.gifmaker:id/login_name_et");
                     WebElement nextView = getElementByType(androidDriver, FIND_ELEMENT_TYPE_ID, "com.smile.gifmaker:id/next_view");
                     if (loginTitleTv != null) {
-                        System.out.println(loginTitleTv.getText());
                         if ("输入密码".equals(loginTitleTv.getText())) {
                             WebElement forgetPsdBtn = getElementByType(androidDriver, FIND_ELEMENT_TYPE_ID, "com.smile.gifmaker:id/forget_psd_btn");
                             if (forgetPsdBtn != null) {
@@ -329,23 +324,19 @@ public class AppiumUtil {
                     break;
                 default:
                     isContinue = false;
-                    System.out.println("当前activity无法处理");
                     break;
             }
         } else if ("cn.com.longene.www.myapplication".equals(pkg)) {
             switch (activity) {
                 case ".MainActivity":
                     isContinue = false;
-                    System.out.println("快手已崩溃");
                     break;
                 default:
                     isContinue = false;
                     androidDriver.quit();
-                    System.out.println("当前activity无法处理");
                     break;
             }
         } else {
-            System.out.println("当前包为非操作包:" + pkg);
         }
         if (isContinue) {
             isContinue = loginTask(androidDriver, token, mobile);
@@ -440,7 +431,6 @@ public class AppiumUtil {
             WebElement loginNameEt = getElementByType(androidDriver, FIND_ELEMENT_TYPE_ID, "com.smile.gifmaker:id/login_name_et");
             WebElement nextView = getElementByType(androidDriver, FIND_ELEMENT_TYPE_ID, "com.smile.gifmaker:id/next_view");
             if (loginTitleTv != null) {
-                System.out.println(loginTitleTv.getText());
                 if ("输入密码".equals(loginTitleTv.getText())) {
                     WebElement forgetPsdBtn = getElementByType(androidDriver, FIND_ELEMENT_TYPE_ID, "com.smile.gifmaker:id/forget_psd_btn");
                     if (forgetPsdBtn != null) {
@@ -682,7 +672,6 @@ public class AppiumUtil {
             element.click();
         } else if ("point".equals(clickType)) {
             Point point = element.getLocation();
-            System.out.println(point.getX() + ":" + point.getY());
             Integer x = point.getX();
             Integer y = point.getY();
             if (null != taskItem.getOffsiteX()) {
@@ -704,7 +693,6 @@ public class AppiumUtil {
     public String runTask(AndroidDriver androidDriver, AppiumTaskItem appiumTaskItem, WebElement loopElement, String publishName) throws Exception {
         String getText = null;
         if (appiumTaskItem != null) {
-            System.out.println(new Gson().toJson(appiumTaskItem));
             if (appiumTaskItem.getWaitTime() != null && appiumTaskItem.getWaitTime() > 0) {
                 Thread.sleep(appiumTaskItem.getWaitTime());
             }
@@ -740,7 +728,6 @@ public class AppiumUtil {
                                 element.click();
                             } else if ("point".equals(appiumTaskItem.getClickType())) {
                                 Point point = element.getLocation();
-                                System.out.println(point.getX() + ":" + point.getY());
                                 Integer x = point.getX();
                                 Integer y = point.getY();
                                 if (null != appiumTaskItem.getOffsiteX()) {
@@ -782,7 +769,6 @@ public class AppiumUtil {
                 }
             } else if (appiumTaskItem.getLoopType() != null && "loop".equals(appiumTaskItem.getLoopType())) {
                 while (isLoop) {
-                    System.out.println("loop:" + isLoop);
                     if (appiumTaskItem.getFindType() != null) {
                         List<WebElement> list = getElementsByType(androidDriver, appiumTaskItem.getFindType(), appiumTaskItem.getFindKey());
                         if (list != null && list.size() > 0) {

+ 0 - 11
module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/KuaimiUtil.java

@@ -15,7 +15,6 @@ public class KuaimiUtil {
     public static String kuaimiLogin() throws Exception {
         String result = HttpUtils.httpPostNoParamRequest(KUAIMI_API_URL + "?action=loginIn&name=xuzuoyun&password=heaven01");
         if (result != null && result.startsWith("1")) {
-            System.out.println(result);
             return result.split("\\|")[1];
         } else {
             throw new Exception();
@@ -25,9 +24,7 @@ public class KuaimiUtil {
     public static String getMobile(String token, String projectId) throws Exception {
         String url = KUAIMI_API_URL + "?action=getPhone&sid=" + projectId + "&token=" + token;
         String result = HttpUtils.httpPostNoParamRequest(url);
-        System.out.println(result);
         if (result != null && result.startsWith("1")) {
-            System.out.println(result);
             return result.split("\\|")[1];
         } else {
             throw new Exception();
@@ -38,7 +35,6 @@ public class KuaimiUtil {
         String url = KUAIMI_API_URL + "?action=getMessage&sid=" + projectId + "&token=" + token + "&phone=" + phone;
         String result = HttpUtils.httpPostNoParamRequest(url);
         if (result != null && result.startsWith("1")) {
-            System.out.println(result);
             return getNumbers(result.split("\\|")[1]);
         } else {
             throw new Exception();
@@ -49,7 +45,6 @@ public class KuaimiUtil {
         String url = KUAIMI_API_URL + "?action=addBlacklist&sid=" + projectId + "&token=" + token + "&phone=" + phone;
         String result = HttpUtils.httpPostNoParamRequest(url);
         if (result != null && result.startsWith("1")) {
-            System.out.println(result);
             return result.split("\\|")[1];
         } else {
             throw new Exception();
@@ -60,7 +55,6 @@ public class KuaimiUtil {
         String url = KUAIMI_API_URL + "?action=cancelRecv&sid=" + projectId + "&token=" + token + "&phone=" + phone;
         String result = HttpUtils.httpPostNoParamRequest(url);
         if (result != null && result.startsWith("1")) {
-            System.out.println(result);
             return result.split("\\|")[1];
         } else {
             throw new Exception();
@@ -79,26 +73,21 @@ public class KuaimiUtil {
     public static void main(String[] args) {
         String s = "【快手科技】重置密码的验证码469801,15分钟内有效,为保证信息安全,切勿将验证码告知他人。";
 //        String s = "【快手科技】503730快手验证码,15分钟内有效,仅用于登录,请勿告知他人。";
-        System.out.println(getNumbers(s));
 //
 //        KuaimiUtil k = new KuaimiUtil();
 //        try {
 //            String token = k.kuaimiLogin();
-//            System.out.println(token);
 //            String mobile = k.getMobile(token, "2307");
 //            int times = 0;
 //            while (times < 100) {
 //                Thread.sleep(5000);
 //                try {
 //                    String msg = k.getMessage(token, "2307", mobile);
-//                    System.out.println(msg);
 //                    break;
 //                } catch (Exception e) {
-//                    System.out.println("等待短信");
 //                }
 //                times++;
 //            }
-//            System.out.println("完成");
 //        } catch (Exception e) {
 //            e.printStackTrace();
 //        }

+ 0 - 3
module-crawler/src/main/java/cn/com/ctop/crawler/modules/dataeye/service/impl/DataeyeCompanyServiceImpl.java

@@ -41,7 +41,6 @@ public class DataeyeCompanyServiceImpl extends ServiceImpl<DataeyeCompanyMapper,
         paramMap.put("thisTimes",(long)(new Date().getTime()/100));
         String sign = SignUtil.getDataeyeSign(paramMap);
         paramMap.put("sign",sign);
-        System.out.println(new Gson().toJson(paramMap));
         String response = HttpUtils.httpPostFormRequest("https://adx.dataeye.com/company/getCompanyInfo",paramMap,headerMap);
         ObjectMapper mapper = new ObjectMapper();
         mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
@@ -56,7 +55,6 @@ public class DataeyeCompanyServiceImpl extends ServiceImpl<DataeyeCompanyMapper,
         } catch (IOException e) {
             e.printStackTrace();
         }
-        System.out.println(response);
     }
 
 
@@ -64,7 +62,6 @@ public class DataeyeCompanyServiceImpl extends ServiceImpl<DataeyeCompanyMapper,
         DataeyeCompanyServiceImpl i = new DataeyeCompanyServiceImpl();
         i.getCompanyInfo(1);
 //        Date date = new Date(1582598505897L);
-//        System.out.println(DateUtils.formatDate(1582598505897L));
 
 
     }

+ 0 - 10
module-crawler/src/main/java/cn/com/ctop/crawler/modules/jiema/service/impl/KuaimiServiceImpl.java

@@ -8,7 +8,6 @@ public class KuaimiServiceImpl {
     public String kuaimiLogin() throws Exception {
         String result = HttpUtils.httpPostNoParamRequest(KUAIMI_API_URL + "?action=loginIn&name=xuzuoyun&password=heaven01");
         if (result != null && result.startsWith("1")) {
-            System.out.println(result);
             return result.split("\\|")[1];
         } else {
             throw new Exception();
@@ -18,9 +17,7 @@ public class KuaimiServiceImpl {
     public String getMobile(String token, String projectId) throws Exception {
         String url = KUAIMI_API_URL + "?action=getPhone&sid=" + projectId + "&token=" + token;
         String result = HttpUtils.httpPostNoParamRequest(url);
-        System.out.println(result);
         if (result != null && result.startsWith("1")) {
-            System.out.println(result);
             return result.split("\\|")[1];
         } else {
             throw new Exception();
@@ -31,7 +28,6 @@ public class KuaimiServiceImpl {
         String url = KUAIMI_API_URL + "?action=getMessage&sid=" + projectId + "&token=" + token + "&phone=" + phone;
         String result = HttpUtils.httpPostNoParamRequest(url);
         if (result != null && result.startsWith("1")) {
-            System.out.println(result);
             return result.split("\\|")[1].substring(6, 12);
         } else {
             throw new Exception();
@@ -42,7 +38,6 @@ public class KuaimiServiceImpl {
         String url = KUAIMI_API_URL + "?action=addBlacklist&sid=" + projectId + "&token=" + token + "&phone=" + phone;
         String result = HttpUtils.httpPostNoParamRequest(url);
         if (result != null && result.startsWith("1")) {
-            System.out.println(result);
             return result.split("\\|")[1];
         } else {
             throw new Exception();
@@ -53,7 +48,6 @@ public class KuaimiServiceImpl {
         String url = KUAIMI_API_URL + "?action=cancelRecv&sid=" + projectId + "&token=" + token + "&phone=" + phone;
         String result = HttpUtils.httpPostNoParamRequest(url);
         if (result != null && result.startsWith("1")) {
-            System.out.println(result);
             return result.split("\\|")[1];
         } else {
             throw new Exception();
@@ -64,21 +58,17 @@ public class KuaimiServiceImpl {
         KuaimiServiceImpl k = new KuaimiServiceImpl();
         try {
             String token = k.kuaimiLogin();
-            System.out.println(token);
             String mobile = k.getMobile(token, "2307");
             int times = 0;
             while (times < 100) {
                 Thread.sleep(5000);
                 try {
                     String msg = k.getMessage(token, "2307", mobile);
-                    System.out.println(msg);
                     break;
                 } catch (Exception e) {
-                    System.out.println("等待短信");
                 }
                 times++;
             }
-            System.out.println("完成");
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 0 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/jiema/service/impl/WumaServiceImpl.java

@@ -24,7 +24,6 @@ public class WumaServiceImpl {
         try {
             String token = k.login();
             String mobile = k.getMobile(token);
-            System.out.println(mobile);
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 0 - 9
module-crawler/src/main/java/cn/com/ctop/crawler/modules/test/AppiumTest.java

@@ -208,7 +208,6 @@
 //                runTask(androidDriver, task, null);
 //            }
 //            androidDriver.quit();
-//            System.out.println("task success");
 //        } catch (Exception e) {
 //            e.printStackTrace();
 //        }
@@ -218,7 +217,6 @@
 //
 //    public void runTask(AndroidDriver androidDriver, AppiumTask appiumTask, WebElement loopElement) throws Exception {
 //        if (appiumTask != null) {
-//            System.out.println(new Gson().toJson(appiumTask));
 //            if (appiumTask.getWaitTime() != null && appiumTask.getWaitTime() > 0) {
 //                Thread.sleep(appiumTask.getWaitTime());
 //            }
@@ -286,7 +284,6 @@
 //                }
 //            } else if (appiumTask.getLoopType() != null && "loop".equals(appiumTask.getLoopType())) {
 //                while (isLoop) {
-//                    System.out.println("loop:" + isLoop);
 //                    if (appiumTask.getFindType() != null) {
 //                        List<WebElement> list = null;
 //                        if ("id".equals(appiumTask.getFindType())) {
@@ -375,7 +372,6 @@
 ////                            appiumTest.swipeToUp(androidDriver);
 ////                            Thread.sleep(5000);
 //////                            String text = androidDriver.findElementById("com.smile.gifmaker:id/label").getText();
-//////                            System.out.println(text);
 //////                            String title = text.split(":")[1].trim();
 ////
 //////                            if(title.startsWith("超级有趣的小游戏")){
@@ -393,7 +389,6 @@
 ////                                    Thread.sleep(5000);
 ////                                        List<WebElement> element1 = androidDriver.findElementsById("com.android.packageinstaller:id/ok_button");
 ////                                        if(element1 != null && element1.size() > 0){
-////                                            System.out.println(element1.get(0).getText());
 ////                                            element1.get(0).click();
 ////                                            break;
 ////                                        }
@@ -402,7 +397,6 @@
 ////                                        Thread.sleep(5000);
 ////                                        List<WebElement> element1 = androidDriver.findElementsById("com.android.packageinstaller:id/launch_button");
 ////                                        if(element1 != null && element1.size() > 0){
-////                                            System.out.println(element1.get(0).getText());
 ////                                            element1.get(0).click();
 ////                                            break;
 ////                                        }
@@ -425,7 +419,6 @@
 ////                                        Thread.sleep(2000);
 ////                                        appiumTest.swipeToUp(androidDriver);
 ////                                    }
-////                                    System.out.println("操作完成");
 ////                                }else {
 ////                                    androidDriver.findElementById("com.smile.gifmaker:id/back_btn").click();
 ////                                }
@@ -445,14 +438,12 @@
 ////                                //评论提交 com.smile.gifmaker:id/finish_button
 ////
 //////                            }else {
-//////                                System.out.println(title);
 //////                                androidDriver.findElementById("com.smile.gifmaker:id/back_btn").click();
 //////                            }
 ////
 ////
 //////                            Thread.sleep(5000);
 //////                            androidDriver.findElementById("com.smile.gifmaker:id/back_btn").click();
-//////                            System.out.println("广告坐标为:"+point.getX()+","+point.getY());
 ////                        }
 ////                    }
 ////                }

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

@@ -78,7 +78,6 @@ public class KuaishouAppServiceImpl implements IKuaishouAppService {
                             ad.setHeight(ad.getAdCover().getHeight());
                             ad.setType(appFeeds.getType());
                             ad.setAppName(ad.getAppName().replace(".apk","").replace(".APK","").replace("ios","").replace("IOS",""));
-                            System.out.println(ad.getAdCover());
                             appAdService.saveOrUpdate(ad);
                             try {
                                 KuaishouAdAccount kuaishouAdAccount = kuaishouAdAccountService.getById(ad.getUserId());

+ 0 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouController.java

@@ -38,7 +38,6 @@ public class KuaiShouController {
         requestJson.put("type", 2);
         requestJson.put("day_budget", 0L);
         Map<String, Object> stringObjectMap = kuaishouInterfaceService.campaignCreate(accessToken, advertiserId, requestJson);
-        System.err.println(JSON.toJSONString(stringObjectMap));
     }
 
     /**
@@ -72,7 +71,6 @@ public class KuaiShouController {
         targetJson.put("android_osv", 3);
         targetJson.put("network", 0);
         Map<String, Object> stringObjectMap = kuaishouInterfaceService.adUnitCreate(accessToken, advertiserId, requestJson);
-        System.err.println(JSON.toJSONString(stringObjectMap));
     }
 
 

+ 0 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouConversionTypesController.java

@@ -68,7 +68,6 @@ public class KuaiShouConversionTypesController {
         Map<String, Object> resultMap = kuaishouInterfaceService.getDeepConversionInfos(accountId, token.getAccessToken());
         if ((Integer) resultMap.get("code") == 0) {
             result.setResult(resultMap);
-            System.err.println(result);
         }
         result.setSuccess(true);
 

+ 0 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouGroupCreateLogController.java

@@ -109,7 +109,6 @@ public class KuaiShouGroupCreateLogController {
         queryWrapper.orderByDesc("create_time");
         queryWrapper.last("limit 1");
         KuaiShouGroupCreateLog groupCreateLog = (KuaiShouGroupCreateLog) kuaiShouGroupCreateLogService.getObj(queryWrapper);
-        System.err.println(groupCreateLog);
 
         return groupCreateLog;
     }

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

@@ -493,7 +493,6 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
             params.put("description", description);
             String result = HttpUtils.httpPostRequest(url, params, header);
             JSONObject resultJson = JSONObject.parseObject(result);
-            System.err.println("返回结果: " + resultJson);
             if (!Check.isNull(resultJson)) {
                 Integer code = resultJson.getInteger("code");
                 if (code == 0) {

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

@@ -1548,7 +1548,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         try {
             String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
             JSONObject resultJson = JSONObject.parseObject(result);
-            System.err.println(resultJson);
             if (!Check.isNull(resultJson)) {
                 Integer code = resultJson.getInteger("code");
                 if (code == 0) {

+ 0 - 5
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java

@@ -620,7 +620,6 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
 //                FileUtils.copyFile(scrFile, new File(savePath));
 //                webDriver.switchTo().frame(webDriver.findElement(By.tagName("iframe")));
 //                String result = ChaojiyingUtils.process(Base64Utils.imageToBase64(savePath));
-//                System.out.println(result);
 //                ((JavascriptExecutor) webDriver).executeScript("arguments[0].click();", webDriver.findElement(By.className("aq_icon_refresh")));
 //            }
             webDriver.get("https://b.e.kuaishou.com/#/home/profile");
@@ -691,7 +690,6 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
             bodys.put("userIds", userList);
             String securityUrl = "https://ad.e.kuaishou.com/rest/dsp/control-panel/creative/preview?kuaishou.ad.dsp_ph=" + ph;
             String html2 = HttpUtils2.httpPostRequest(securityUrl, bodys, headers);
-            System.out.println(html2);
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -727,9 +725,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
 
 
             webDriver.get("https://ad.e.kuaishou.com/#/index");
-            System.out.println(webDriver.getPageSource());
             webDriver.get("https://ad.e.kuaishou.com/#/manage?campaignId=5012466&unitId=6577717&tab=creative");
-            System.out.println(webDriver.getPageSource());
             //获取Cookie并打印
             Set<org.openqa.selenium.Cookie> cookies = webDriver.manage().getCookies();
             Iterator iterator = cookies.iterator();
@@ -751,7 +747,6 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
                 HttpUtils2.cookieStore.addCookie(clientCookie);
             }
             String result = HttpUtils2.httpGetRequest("https://uc.e.kuaishou.com/rest/web/login?sid=kuaishou.ad.dsp&followUrl=https%3A%2F%2Fad.e.kuaishou.com%2F%23%2Findex");
-            System.out.println(result);
         } catch (Exception e) {
             e.printStackTrace();
         } finally {

+ 51 - 48
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAgentServiceImpl.java

@@ -9,10 +9,11 @@ import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAgentMapper
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAgentSumMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.gson.Gson;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.http.client.CookieStore;
 import org.apache.http.impl.client.BasicCookieStore;
 import org.apache.http.impl.cookie.BasicClientCookie;
@@ -27,18 +28,18 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
 /**
  * 代理商日报
+ *
  * @author jeecg-boot
- * @date   2019-12-13
  * @version V1.0
+ * @date 2019-12-13
  */
+@Slf4j
 @Service
 public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouReportDailyAgentMapper, KuaishouReportDailyAgent> implements IKuaishouReportDailyAgentService {
     @Autowired
@@ -49,12 +50,13 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
     private KuaishouAgentAccountMapper kuaishouAgentAccountMapper;
     @Value("${jeecg.path.chrome-driver}")
     private String chromeDriver;
+
     @Override
     public void replaceBatch(List<KuaishouReportDailyAgent> list) {
         kuaishouReportDailyAgentMapper.replaceBatch(list);
     }
 
-    public boolean loginAgent(){
+    public boolean loginAgent() {
         boolean loginStatus = false;
         System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
         String url = "https://agent.e.kuaishou.com";
@@ -104,10 +106,10 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
                 HttpUtils2.cookieStore.addCookie(clientCookie);
             }
             loginStatus = true;
-        }catch (Exception e) {
+        } catch (Exception e) {
             e.printStackTrace();
             loginStatus = false;
-        }finally {
+        } finally {
             webDriver.manage().deleteAllCookies();
 //            webDriver.close();
             webDriver.quit();
@@ -115,38 +117,38 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
         return loginStatus;
     }
 
-    public boolean getAccount(int currentPage){
+    public boolean getAccount(int currentPage) {
         boolean hasNextPage = false;
         try {
-            if(currentPage == 1){
-                if (!loginAgent()){
+            if (currentPage == 1) {
+                if (!loginAgent()) {
                     return hasNextPage;
                 }
             }
-            Map<String,String> headerMap = new HashMap<String,String>();
-            headerMap.put("Accept","application/json");
-            headerMap.put("Accept-Encoding","gzip, deflate, br");
-            headerMap.put("Accept-Language","zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
-            headerMap.put("Connection","keep-alive");
-            headerMap.put("Host","agent.e.kuaishou.com");
-            headerMap.put("Referer","https://agent.e.kuaishou.com/");
-            headerMap.put("Content-Type","application/json;charset=utf-8");
-            headerMap.put("User-Agent",HttpUtils2.USER_AGENT);
-            String postData = "{\"pageInfo\":{\"currentPage\":"+currentPage+",\"pageSize\":200,\"total\":1000},\"reviewStatus\":\"-1\",\"selectType\":1,\"selectValue\":\"\",\"createBeginTime\":0,\"createEndTime\":0}";
+            Map<String, String> headerMap = new HashMap<String, String>();
+            headerMap.put("Accept", "application/json");
+            headerMap.put("Accept-Encoding", "gzip, deflate, br");
+            headerMap.put("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
+            headerMap.put("Connection", "keep-alive");
+            headerMap.put("Host", "agent.e.kuaishou.com");
+            headerMap.put("Referer", "https://agent.e.kuaishou.com/");
+            headerMap.put("Content-Type", "application/json;charset=utf-8");
+            headerMap.put("User-Agent", HttpUtils2.USER_AGENT);
+            String postData = "{\"pageInfo\":{\"currentPage\":" + currentPage + ",\"pageSize\":200,\"total\":1000},\"reviewStatus\":\"-1\",\"selectType\":1,\"selectValue\":\"\",\"createBeginTime\":0,\"createEndTime\":0}";
             String listUrl = "https://agent.e.kuaishou.com/rest/dsp/agent/account/list";
-            String result = HttpUtils2.httpPostRequestTest(listUrl,postData,headerMap);
+            String result = HttpUtils2.httpPostRequestTest(listUrl, postData, headerMap);
             ObjectMapper mapper = new ObjectMapper();
             mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
             JsonNode resultNode = mapper.readTree(result);
             Integer code = resultNode.get("result").intValue();
-            if(code == 1) {
+            if (code == 1) {
                 Iterator<JsonNode> iterator1 = resultNode.get("adDspAccountList").elements();
                 int i = 0;
                 List<KuaishouAgentAccount> accountList = new ArrayList<>();
                 while (iterator1.hasNext()) {
                     hasNextPage = true;
                     JsonNode dataNode = iterator1.next();
-                    KuaishouAgentAccount agentAccount = mapper.readValue(dataNode.toString(),KuaishouAgentAccount.class);
+                    KuaishouAgentAccount agentAccount = mapper.readValue(dataNode.toString(), KuaishouAgentAccount.class);
                     agentAccount.setBalance(agentAccount.getBalance().divide(new BigDecimal(1000)));
                     agentAccount.setContractRebate(agentAccount.getContractRebate().divide(new BigDecimal(1000)));
                     agentAccount.setCreditBalance(agentAccount.getCreditBalance().divide(new BigDecimal(1000)));
@@ -159,48 +161,48 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
                     agentAccount.setTotalBalance(agentAccount.getTotalBalance().divide(new BigDecimal(1000)));
                     accountList.add(agentAccount);
                 }
-                if (accountList != null && accountList.size() > 0){
+                if (accountList != null && accountList.size() > 0) {
                     kuaishouAgentAccountMapper.replaceBatch(accountList);
                 }
             }
 
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
         return hasNextPage;
     }
 
-    public void getReport(String startDate,String endDate){
-        try{
-            if (!loginAgent()){
+    public void getReport(String startDate, String endDate) {
+        try {
+            if (!loginAgent()) {
                 return;
             }
             String currentDate = startDate;
-            Map<String,String> headerMap = new HashMap<String,String>();
-            headerMap.put("Accept","application/json");
-            headerMap.put("Accept-Encoding","gzip, deflate, br");
-            headerMap.put("Accept-Language","zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
-            headerMap.put("Connection","keep-alive");
-            headerMap.put("Host","agent.e.kuaishou.com");
-            headerMap.put("Referer","https://agent.e.kuaishou.com/");
-            headerMap.put("Content-Type","application/json;charset=utf-8");
-            headerMap.put("User-Agent",HttpUtils2.USER_AGENT);
-            while(DateUtils.compareDate(currentDate,endDate)<=0){
+            Map<String, String> headerMap = new HashMap<String, String>();
+            headerMap.put("Accept", "application/json");
+            headerMap.put("Accept-Encoding", "gzip, deflate, br");
+            headerMap.put("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
+            headerMap.put("Connection", "keep-alive");
+            headerMap.put("Host", "agent.e.kuaishou.com");
+            headerMap.put("Referer", "https://agent.e.kuaishou.com/");
+            headerMap.put("Content-Type", "application/json;charset=utf-8");
+            headerMap.put("User-Agent", HttpUtils2.USER_AGENT);
+            while (DateUtils.compareDate(currentDate, endDate) <= 0) {
                 //{"agentId":403756224,"startDate":"2020-03-05","endDate":"2020-03-05","sortKey":"","isAscending":false,"pageInfo":{"pageSize":19,"currentPage":1,"totalCount":100}}
                 String listUrl = "https://agent.e.kuaishou.com/rest/dsp/agent/account/data/list";
-                String postData = "{\"agentId\":403756224,\"startDate\":\""+currentDate+"\",\"endDate\":\""+currentDate+"\",\"isAscending\":false,\"pageInfo\":{\"pageSize\":19,\"currentPage\":1,\"totalCount\":999999}}";
-                String result = HttpUtils2.httpPostRequestTest(listUrl,postData,headerMap);
+                String postData = "{\"agentId\":403756224,\"startDate\":\"" + currentDate + "\",\"endDate\":\"" + currentDate + "\",\"isAscending\":false,\"pageInfo\":{\"pageSize\":19,\"currentPage\":1,\"totalCount\":999999}}";
+                String result = HttpUtils2.httpPostRequestTest(listUrl, postData, headerMap);
                 ObjectMapper mapper = new ObjectMapper();
                 JsonNode resultNode = mapper.readTree(result);
                 Integer code = resultNode.get("result").intValue();
-                if(code == 1){
+                if (code == 1) {
                     Iterator<JsonNode> iterator1 = resultNode.get("data").elements();
                     int i = 0;
                     List<KuaishouReportDailyAgent> reportList = new ArrayList<>();
-                    while (iterator1.hasNext()){
+                    while (iterator1.hasNext()) {
                         JsonNode dataNode = iterator1.next();
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-                        if(i == 0){
+                        if (i == 0) {
                             KuaishouReportDailyAgentSum kuaishouReportDailyAgentSum = new KuaishouReportDailyAgentSum();
                             kuaishouReportDailyAgentSum.setBalance(dataNode.get("totalBalanceDouble").decimalValue());
                             kuaishouReportDailyAgentSum.setConvertClickRate(dataNode.get("actionbarClickRatio").decimalValue());
@@ -218,10 +220,10 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
                             kuaishouReportDailyAgentSum.setXianjinCost(dataNode.get("realChargedInYuan").decimalValue());
                             kuaishouReportDailyAgentSum.setXinyongCost(dataNode.get("creditRealChargedInYuan").decimalValue());
                             QueryWrapper<KuaishouReportDailyAgentSum> queryWrapper = new QueryWrapper<>();
-                            queryWrapper.eq("date",currentDate);
+                            queryWrapper.eq("date", currentDate);
                             kuaishouReportDailyAgentSumMapper.delete(queryWrapper);
                             kuaishouReportDailyAgentSumMapper.insert(kuaishouReportDailyAgentSum);
-                        }else {
+                        } else {
                             KuaishouReportDailyAgent kuaishouReportDailyAgent = new KuaishouReportDailyAgent();
                             kuaishouReportDailyAgent.setAccountId(dataNode.get("accountId").asInt());
                             kuaishouReportDailyAgent.setAdvertiserCreateTime(new Date(dataNode.get("createTime").asLong()));
@@ -246,12 +248,13 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
                         }
                         i++;
                     }
-                    if(reportList != null && reportList.size() > 0){
+                    if (reportList != null && reportList.size() > 0) {
                         replaceBatch(reportList);
                     }
                 }
-                System.out.println("代理商日报"+currentDate+"入库完成");
-                currentDate = DateUtils.addDay(currentDate,1);
+
+                log.info("代理商日报:{}入库完成", currentDate);
+                currentDate = DateUtils.addDay(currentDate, 1);
             }
         } catch (Exception e) {
             e.printStackTrace();

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

@@ -26,6 +26,5 @@ public class KuaishouReportHourlyCampaignServiceImpl extends ServiceImpl<Kuaisho
             return;
         }
         List<String> getList = new ArrayList<>(list.size());
-        System.out.println(list.size());
     }
 }

+ 115 - 0
module-report/src/main/java/cn/com/ctop/bytedance/controller/KuaiShouYiCheReportController.java

@@ -0,0 +1,115 @@
+package cn.com.ctop.bytedance.controller;
+
+import cn.com.ctop.bytedance.service.IKuaiShouYiCheReportService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.jeecg.common.api.vo.Result;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+
+@RestController
+@RequestMapping("/ctop/yiche/report/")
+public class KuaiShouYiCheReportController {
+    @Autowired
+    private IKuaiShouYiCheReportService yiCheReportService;
+
+
+    @PostMapping("hourReport")
+    public Result<JSONObject> advertiserReport(@RequestBody JSONObject requestJson) {
+        Result<JSONObject> result = new Result<>();
+        JSONObject hourReport = yiCheReportService.getHourReport(requestJson);
+        result.setResult(hourReport);
+        return result;
+    }
+
+
+    /**
+     * 导出报表
+     *
+     * @return
+     */
+    @RequestMapping(value = "/exportHourReport")
+    @ResponseBody
+    public void export(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject requestJson) throws Exception {
+
+        JSONObject hourReport = yiCheReportService.getHourReport(requestJson);
+        JSONArray androidArr = hourReport.getJSONArray("android");
+
+        // 安卓相关
+        List<List<Object>> androidList = new ArrayList<>();
+        if (!Check.isNull(androidArr)) {
+            for (int i = 0; i < androidArr.size(); i++) {
+                JSONObject jsonObject = androidArr.getJSONObject(i);
+
+                List<Object> android = new ArrayList();
+                android.add(jsonObject.getString("systemType"));
+                android.add(jsonObject.getString("authName"));
+                android.add(jsonObject.getBigDecimal("charge"));
+                android.add(jsonObject.getLong("activation"));
+                android.add(jsonObject.getBigDecimal("activationCost"));
+                android.add(jsonObject.getBigDecimal("estimatedCost"));
+                androidList.add(android);
+            }
+        }
+
+
+        // ios 相关
+        JSONArray iosArr = hourReport.getJSONArray("ios");
+        List<List<Object>> iosList = new ArrayList<>();
+        if (!Check.isNull(iosArr)) {
+            for (int i = 0; i < iosArr.size(); i++) {
+                JSONObject jsonObject = iosArr.getJSONObject(i);
+                List<Object> ios = new ArrayList();
+                ios.add(jsonObject.getString("systemType"));
+                ios.add(jsonObject.getString("authName"));
+                ios.add(jsonObject.getBigDecimal("charge"));
+                ios.add(jsonObject.getLong("activation"));
+                ios.add(jsonObject.getBigDecimal("activationCost"));
+                ios.add(jsonObject.getBigDecimal("estimatedCost"));
+                iosList.add(ios);
+            }
+        }
+
+
+        String[] androidHeaders = {"投放设备", "分类", "现金花费", "账户激活量", "激活成本", "预估成本"};
+        String[] iosHeaders = {"投放设备", "分类", "现金花费", "账户激活量", "激活成本", "预估成本"};
+        OutputStream os = response.getOutputStream();
+        ExportExcelUtils eeu = new ExportExcelUtils();
+        XSSFWorkbook workbook = new XSSFWorkbook();
+        eeu.exportExcel(workbook, 0, "安卓时报统计", androidHeaders, androidList);
+        eeu.exportExcel(workbook, 1, "ios时报统计", iosHeaders, iosList);
+        this.setResponseHeader(response, "易车时报.xls");
+        workbook.write(os);
+        os.flush();
+        os.close();
+    }
+
+    //发送响应流方法
+    public void setResponseHeader(HttpServletResponse response, String fileName) {
+        try {
+            try {
+                fileName = new String(fileName.getBytes(), "ISO8859-1");
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+            }
+            response.setContentType("application/octet-stream;charset=ISO8859-1");
+            response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
+            response.addHeader("Pargam", "no-cache");
+            response.addHeader("Cache-Control", "no-cache");
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+
+}

+ 15 - 0
module-report/src/main/java/cn/com/ctop/bytedance/mapper/KuaiShouYiCheReportMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.bytedance.mapper;
+
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+public interface KuaiShouYiCheReportMapper {
+    Integer getMaxHourByProjectIdAndStatDate(@Param("statDate") String statDate, @Param("projectId") Long projectId);
+
+    List<JSONObject> selectReportByMap(Map<String, Object> requestMap);
+
+    JSONObject selectSumReportByMap(Map<String, Object> requestMap);
+}

+ 114 - 0
module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/KuaiShouYiCheReportMapper.xml

@@ -0,0 +1,114 @@
+<?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.bytedance.mapper.KuaiShouYiCheReportMapper">
+
+    <select id="getMaxHourByProjectIdAndStatDate" resultType="java.lang.Integer">
+    SELECT
+	max(t2.stat_hour)
+    FROM
+	ctop_user_allocation t1
+    LEFT JOIN ctop_kuaishou_report_hourly_account t2 ON t1.account_id = t2.account_id
+    WHERE
+	t1.project_id = #{projectId}
+    AND t2.stat_date = #{statDate}
+    </select>
+
+
+    <select id="selectReportByMap" parameterType="java.util.Map" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.system_type systemType,
+        t1.auth_name authName,
+        ROUND(sum(t2.charge) / #{disCount},3) charge,
+        sum(t2.charge) charge,
+        sum(t2.activation) activation,
+        (
+        case
+        when sum(t2.activation) != 0
+        then
+        ROUND((sum(t2.charge) / sum(t2.activation))/ #{disCount},3)
+        else
+        0
+        end
+        ) activationCost,
+
+        (
+        case
+        when t1.system_type = 'android'
+        then 16
+        when t1.system_type = 'IOS'
+        then 23
+        else 0
+        end
+        ) estimatedCost
+
+        FROM
+        ctop_user_allocation t1
+        LEFT JOIN ctop_kuaishou_report_hourly_account t2 ON t1.account_id = t2.account_id
+        where 1 = 1
+        <if test="projectId != null">
+            and t1.project_id = #{projectId}
+        </if>
+
+        <if test="statDate != null">
+            and t2.stat_date = #{statDate}
+        </if>
+
+        <if test="statHour != null">
+            and t2.stat_hour &lt;= #{statHour}
+        </if>
+        <if test="systemType != null">
+            and t1.system_type = #{systemType}
+        </if>
+        group by t1.account_id
+
+    </select>
+
+
+    <select id="selectSumReportByMap" parameterType="java.util.Map" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.system_type systemType,
+        #{dateDesc} authName,
+        ROUND(sum(t2.charge) / #{disCount},3) charge,
+        sum(t2.charge) charge,
+        sum(t2.activation) activation,
+        (
+        case
+        when sum(t2.activation) != 0
+        then
+        ROUND((sum(t2.charge) / sum(t2.activation))/ #{disCount},3)
+        else
+        0
+        end
+        ) activationCost,
+
+        (
+        case
+        when t1.system_type = 'android'
+        then 16
+        when t1.system_type = 'IOS'
+        then 23
+        else 0
+        end
+        ) estimatedCost
+        FROM
+        ctop_user_allocation t1
+        LEFT JOIN ctop_kuaishou_report_hourly_account t2 ON t1.account_id = t2.account_id
+        where 1 = 1
+        <if test="projectId != null">
+            and t1.project_id = #{projectId}
+        </if>
+
+        <if test="statDate != null">
+            and t2.stat_date = #{statDate}
+        </if>
+
+        <if test="statHour != null">
+            and t2.stat_hour &lt;= #{statHour}
+        </if>
+        <if test="systemType != null">
+            and t1.system_type = #{systemType}
+        </if>
+    </select>
+
+
+</mapper>

+ 7 - 0
module-report/src/main/java/cn/com/ctop/bytedance/service/IKuaiShouYiCheReportService.java

@@ -0,0 +1,7 @@
+package cn.com.ctop.bytedance.service;
+
+import com.alibaba.fastjson.JSONObject;
+
+public interface IKuaiShouYiCheReportService {
+    JSONObject getHourReport(JSONObject requestJson);
+}

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

@@ -194,7 +194,6 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
             kuaishouJson.put("active", kuaishouActive);
             returnJson.put("kuaishou", kuaishouJson);
             returnJson.put("kuaishouDetail", kuaishouDetail);
-            System.err.println(returnJson);
 
         }
 

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

@@ -0,0 +1,95 @@
+package cn.com.ctop.bytedance.service.impl;
+
+import cn.com.ctop.bytedance.mapper.KuaiShouYiCheReportMapper;
+import cn.com.ctop.bytedance.service.IKuaiShouYiCheReportService;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+@Service
+public class KuaiShouYiCheReportServiceImpl implements IKuaiShouYiCheReportService {
+    @Autowired
+    private KuaiShouYiCheReportMapper kuaiShouYiCheReportMapper;
+
+    @Override
+    public JSONObject getHourReport(JSONObject requestJson) {
+        log.info("易车时报数据统计开始:requestJson:{}", requestJson);
+        Long projectId = requestJson.getLong("projectId");
+        BigDecimal disCount = requestJson.getBigDecimal("disCount");
+        String statDate = DateUtils.getNowDate("yyyy-MM-dd");
+
+        JSONObject returnJson = new JSONObject();
+        Integer maxHour = kuaiShouYiCheReportMapper.getMaxHourByProjectIdAndStatDate(statDate, projectId);
+        if (maxHour != null) {
+            Map<String, Object> requestMap = new HashMap<>();
+            requestMap.put("projectId", projectId);
+            requestMap.put("disCount", disCount);
+            requestMap.put("statDate", statDate);
+            requestMap.put("statHour", maxHour);
+
+
+            String yesterday = DateUtils.getAnotherDay("yyyy-MM-dd", statDate, -1);
+            String weekAgoDay = DateUtils.getAnotherDay("yyyy-MM-dd", statDate, -6);
+
+            // 安卓
+            requestMap.put("systemType", "android");
+            // 账号
+            List<JSONObject> androidReportArr = kuaiShouYiCheReportMapper.selectReportByMap(requestMap);
+
+            // 今日
+            requestMap.put("statDate", statDate);
+            requestMap.put("dateDesc", statDate + "整体数据");
+            JSONObject nowJson = kuaiShouYiCheReportMapper.selectSumReportByMap(requestMap);
+            androidReportArr.add(nowJson);
+
+            // 昨日
+            requestMap.put("statDate", yesterday);
+            requestMap.put("dateDesc", "昨日整体数据");
+            JSONObject yesterdayJson = kuaiShouYiCheReportMapper.selectSumReportByMap(requestMap);
+            androidReportArr.add(yesterdayJson);
+            // 七日
+            requestMap.put("statDate", weekAgoDay);
+            requestMap.put("dateDesc", "上周同期整体数据");
+
+            JSONObject weekAgoJson = kuaiShouYiCheReportMapper.selectSumReportByMap(requestMap);
+            androidReportArr.add(weekAgoJson);
+
+
+            // ios
+            requestMap.put("systemType", "IOS");
+            // 账号
+            List<JSONObject> iosReportArr = kuaiShouYiCheReportMapper.selectReportByMap(requestMap);
+
+            // 今日
+            requestMap.put("statDate", statDate);
+            requestMap.put("dateDesc", statDate + "整体数据");
+            JSONObject iosNowJson = kuaiShouYiCheReportMapper.selectSumReportByMap(requestMap);
+            iosReportArr.add(iosNowJson);
+
+
+            // 昨日
+            requestMap.put("statDate", yesterday);
+            requestMap.put("dateDesc", "昨日整体数据");
+            JSONObject iosYesterdayJson = kuaiShouYiCheReportMapper.selectSumReportByMap(requestMap);
+            iosReportArr.add(iosYesterdayJson);
+            // 七日
+            requestMap.put("statDate", weekAgoDay);
+            requestMap.put("dateDesc", "上周同期整体数据");
+            JSONObject iosWeekAgoJson = kuaiShouYiCheReportMapper.selectSumReportByMap(requestMap);
+            iosReportArr.add(iosWeekAgoJson);
+
+            returnJson.put("android", androidReportArr);
+            returnJson.put("ios", iosReportArr);
+        }
+
+        return returnJson;
+    }
+}

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

@@ -929,7 +929,6 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         }
 
         JSONObject resultObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, param);
-        System.out.println(resultObject.toJSONString());
         Integer code = resultObject.getInteger("code");
         if (null == code || !code.equals(0)) {
             log.error("获取图片素材库接口异常==》accountId:{},message:{}", token.getAccountId(), resultObject.getString("message"));

+ 0 - 1
moudule-eureca/.mvn/wrapper/MavenWrapperDownloader.java

@@ -47,7 +47,6 @@ public class MavenWrapperDownloader {
     private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
 
     public static void main(String args[]) {
-        System.out.println("- Downloader started");
         File baseDirectory = new File(args[0]);
         System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
 

+ 8 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/UserEfficientVideoMap.java

@@ -76,4 +76,12 @@ public class UserEfficientVideoMap {
 	/**updateTime*/
     @ApiModelProperty(value = "updateTime")
 	private Date updateTime;
+
+    private String weekStart;
+
+    private String weekEnd;
+
+    private String companyId;
+
+
 }

+ 66 - 24
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/UserEfficientVideoMapMapper.java

@@ -18,39 +18,43 @@ import java.util.List;
 @Component
 public interface UserEfficientVideoMapMapper extends BaseMapper<UserEfficientVideoMap> {
 
-    List<EffiVideoDTO> getUserVideoMap(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("startCalcDate")String startCalcDate, @Param("endCalcDate")String endCalcDate);
+    List<EffiVideoDTO> getUserVideoMap(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("startCalcDate") String startCalcDate, @Param("endCalcDate") String endCalcDate);
 
-    int getEffiVideoCountBySignature(@Param("signature")String signature, @Param("appType")Integer appType);
+    int getEffiVideoCountBySignature(@Param("signature") String signature, @Param("appType") Integer appType);
 
     int getEffiVideoCountByUserId(@Param("appType") int appType, @Param("year") int year, @Param("quarter") int quarter, @Param("userId") String userId, @Param("roleId") String roleId);
 
-    int getQuarterMaterialCountByUserId(@Param("roleCode")String roleCode, @Param("startTime")String startTime, @Param("endTime")String endTime, @Param("userId")String userId);
+    int getQuarterMaterialCountByUserId(@Param("roleCode") String roleCode, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("userId") String userId);
 
-    BigDecimal getTotalCostByClipId(@Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
+    int getVideoCountByUserId(@Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);
 
-    BigDecimal getTotalCostByShotId(@Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
+    BigDecimal getTotalCostByUserId(@Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);
 
-    BigDecimal getTotalCostByPlanId(@Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
+    BigDecimal getTotalCostByClipId(@Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);
 
-    BigDecimal getTotalCostByPlaneId(@Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
+    BigDecimal getTotalCostByShotId(@Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);
 
-    BigDecimal getProjectTotalCostByUserId(@Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
+    BigDecimal getTotalCostByPlanId(@Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);
 
-    List<ProjectDTO> getProjectsByUserId(@Param("userId")String userId);
+    BigDecimal getTotalCostByPlaneId(@Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);
 
-    int getPlaneCountByProjectId(@Param("projectId")Long projectId);
+    BigDecimal getProjectTotalCostByUserId(@Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);
 
-    int getPlaneCountByUserId(@Param("userId")String userId);
+    List<ProjectDTO> getProjectsByUserId(@Param("userId") String userId);
 
-    List<DesignMaterialInfo> designMaterialInfoList(@Param("roleCode")String roleCode, @Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
+    int getPlaneCountByProjectId(@Param("projectId") Long projectId);
 
-    List<DesignMaterialInfo> getMaterialAccountInfoByMaterialId(@Param("materialId")String materialId, @Param("startDate")String startDate, @Param("endDate")String endDate);
+    int getPlaneCountByUserId(@Param("userId") String userId);
 
-    List<ProjectDTO> getProjects(@Param("mediaId")String mediaId);
+    List<DesignMaterialInfo> designMaterialInfoList(@Param("roleCode") String roleCode, @Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);
 
-    BigDecimal getProjectQuarterCostById(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("projectId")Long projectId);
+    List<DesignMaterialInfo> getMaterialAccountInfoByMaterialId(@Param("materialId") String materialId, @Param("startDate") String startDate, @Param("endDate") String endDate);
 
-    List<UserDto2> getPlaneByProjectId(@Param("projectId")Long projectId);
+    List<ProjectDTO> getProjects(@Param("mediaId") String mediaId);
+
+    BigDecimal getProjectQuarterCostById(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projectId") Long projectId);
+
+    List<UserDto2> getPlaneByProjectId(@Param("projectId") Long projectId);
 
     List<UserDto2> getKuaishouDesignLeaderList();
 
@@ -68,7 +72,7 @@ public interface UserEfficientVideoMapMapper extends BaseMapper<UserEfficientVid
 
     List<UserDto2> getToutiaoDesignLeaderList();
 
-    List<String> getClip(@Param("depId")String depId);
+    List<String> getClip(@Param("depId") String depId);
 
     BigDecimal getClipQuarterCost(@Param("appType") int appType, @Param("quarter") int quarter, @Param("year") int year, @Param("userId") String userId);
 
@@ -108,28 +112,66 @@ public interface UserEfficientVideoMapMapper extends BaseMapper<UserEfficientVid
     void updateToutiaoEffiType(@Param("toutiaoEffiType") Integer toutiaoEffiType, @Param("signature") String signature);
 
     List<UserDto2> getKuaishouDepartUserInfo();
+
     List<UserDto2> getKuaishouDepartAllUserInfo();
+
     List<UserDto2> getToutiaoDepartUserInfo();
+
     List<UserDto2> getToutiaoDepartAllUserInfo();
 
     //根据天数的区间获取userId获取有效视频数量
-    Integer getEffiVideoCountByCalcDate(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("roleId") String roleId, @Param("userId") String userId, @Param("appType") Integer appType);
+    Integer getEffiVideoCountByCalcDate(@Param("startDate") String startDate, @Param("endDate") String endDate,  @Param("userId") String userId, @Param("appType") Integer appType);
 
-    List<MaterialInfo> getEffiVideoList(@Param("appType")Integer appType, @Param("year")Integer year, @Param("quarter")Integer quarter, @Param("userId")String userId);
+    List<MaterialInfo> getEffiVideoList(@Param("appType") Integer appType, @Param("year") Integer year, @Param("quarter") Integer quarter, @Param("userId") String userId);
 
     List<UserDto2> getKuaishouYunyingDepartUserInfo();
 
     List<UserDto2> getToutiaoYunyingDepartUserInfo();
+
     //获取快手单个优化师当前账户下的总消耗
-    BigDecimal getKuaishouYunyingTotalCost(@Param("userId")String userId, @Param("appType")Integer appType, @Param("startDate")String startDate, @Param("endDate")String endDate);
+    BigDecimal getKuaishouYunyingTotalCost(@Param("userId") String userId, @Param("appType") Integer appType, @Param("startDate") String startDate, @Param("endDate") String endDate);
+
     //获取快手单个优化师当前账户下的总消耗
-    BigDecimal getToutiaoYunyingTotalCost(@Param("userId")String userId, @Param("appType")Integer appType, @Param("startDate")String startDate, @Param("endDate")String endDate);
+    BigDecimal getToutiaoYunyingTotalCost(@Param("userId") String userId, @Param("appType") Integer appType, @Param("startDate") String startDate, @Param("endDate") String endDate);
+
     //获取快手单个优化师其下所有的账户下当前的消耗
-    List<AccountDTO> getKuaishouAccountTotalCost(@Param("userId")String userId, @Param("appType")Integer appType, @Param("startDate")String startDate, @Param("endDate")String endDate);
+    List<AccountDTO> getKuaishouAccountTotalCost(@Param("userId") String userId, @Param("appType") Integer appType, @Param("startDate") String startDate, @Param("endDate") String endDate);
+
     //获取头条单个优化师其下所有的账户下当前的消耗
-    List<AccountDTO> getToutiaoAccountTotalCost(@Param("userId")String userId, @Param("appType")Integer appType, @Param("startDate")String startDate, @Param("endDate")String endDate);
+    List<AccountDTO> getToutiaoAccountTotalCost(@Param("userId") String userId, @Param("appType") Integer appType, @Param("startDate") String startDate, @Param("endDate") String endDate);
+
+    List<MaterialInfo> getEffiWeekVideoList(@Param("appType") Integer appType, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("userId") String userId);
+
+    List<String> getWeekCostMd5(@Param("startDate") String startDate, @Param("endDate") String endDate);
+
+    List<String> toutiaoGetWeekCostMd5(@Param("startDate") String startDate, @Param("endDate") String endDate);
+
+    Integer beforeWeekCostCount(@Param("md5") String md5, @Param("date") String date);
+
+    Integer toutiaoBeforeWeekCostCount(@Param("md5") String md5, @Param("date") String date);
+
+    String getVideoEarlistCostDate(@Param("md5")String md5);
+
+    String getToutiaoVideoEarlistCostDate(@Param("md5")String md5);
+
+    BigDecimal videoTotalCostInDates(@Param("md5")String md5, @Param("startDate")String startDate, @Param("endDate")String endDate);
+
+    BigDecimal toutiaoVideoTotalCostInDates(@Param("md5")String md5, @Param("startDate")String startDate, @Param("endDate")String endDate);
+
+    EffiVideoDTO getDesignerInfoByCode(@Param("code")String code);
+
+    String getCompanyInfoByUserId(@Param("userId")String userId);
+
+    List<String> getVideoByDates(@Param("startDate")String startDate, @Param("endDate")String endDate);
+
+    Integer getVideoCountByCode(@Param("signature")String signature);
+
+    List<String> getTotalSignatureByUserId(@Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
+
+    BigDecimal getSumChargeBySignature(@Param("signature")String signature, @Param("startDate")String startDate, @Param("endDate")String endDate);
 
-    List<MaterialInfo> getEffiWeekVideoList(@Param("appType")Integer appType, @Param("startDate")String startDate, @Param("endDate")String endDate, @Param("userId")String userId);
+    BigDecimal getToutiaoSumChargeBySignature(@Param("signature")String signature, @Param("startDate")String startDate, @Param("endDate")String endDate);
 
+    List<MaterialInfo> getVideoList(@Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
 }
 

+ 258 - 12
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml

@@ -15,7 +15,7 @@
             d3.realname as plan_name,
             d4.id as plane_id,
             d4.realname as plane_name
-        from ctop_kuaishou_report_daily_creative_statistic a
+        from ctop_kuaishou_report_daily_creative a
         left join (select id, create_time ,code from ctop_material_info group by code) b on a.signature = b.code
         left join ctop_material_ascription c on b.id = c.material_id
         left join sys_user d1 on c.clip_id = d1.id
@@ -75,11 +75,21 @@
         </choose>
     </select>
 
+    <select id="getVideoCountByUserId" resultType="integer">
+            select
+            count(1)
+        from
+        ctop_user_video_map
+        where user_id = #{userId}
+            and DATE_FORMAT(calc_date,'%Y-%m-%d') &gt;= #{startDate}
+            and DATE_FORMAT(calc_date,'%Y-%m-%d') &lt;= #{endDate}
+    </select>
+
     <!-- 根据clip_id获取视频总消耗 -->
     <select id="getTotalCostByClipId" resultType="java.math.BigDecimal">
             select
             sum(a.charge) as charge
-        from ctop_kuaishou_report_daily_creative_statistic a
+        from ctop_kuaishou_report_daily_creative a
         left join ctop_material_info b on a.signature = b.code
         left join ctop_material_ascription c on b.id = c.material_id
         left join sys_user d1 on c.clip_id = d1.id
@@ -92,11 +102,68 @@
         and c.clip_id = #{userId}
     </select>
 
+    <select id="getTotalCostByUserId" resultType="java.math.BigDecimal">
+            select
+            sum(a.charge) as charge
+        from
+        ctop_kuaishou_report_daily_creative a
+        left join
+        (
+        select
+        video_signature as signature
+        from
+        ctop_user_video_map
+        where user_id = #{userId}
+        and DATE_FORMAT(calc_date,'%Y-%m-%d') &gt;= #{startDate}
+        and DATE_FORMAT(calc_date,'%Y-%m-%d') &lt;= #{endDate}
+        group by video_signature) b
+        on a.signature = b.signature
+        where
+        DATE_FORMAT(a.stat_date,'%Y-%m-%d') &gt;= #{startDate}
+        and DATE_FORMAT(a.stat_date,'%Y-%m-%d') &lt;= #{endDate}
+    </select>
+
+    <select id="getTotalSignatureByUserId" resultType="string">
+        select
+        video_signature as signature
+        from
+        ctop_user_video_map
+        where user_id = #{userId}
+        and DATE_FORMAT(calc_date,'%Y-%m-%d') &gt;= #{startDate}
+        and DATE_FORMAT(calc_date,'%Y-%m-%d') &lt;= #{endDate}
+        group by video_signature
+    </select>
+
+    <select id="getToutiaoSumChargeBySignature" resultType="java.math.BigDecimal">
+        select
+            sum(a.cost) as charge
+        from
+        ctop_bytedance_report_creative_daily a
+        where a.signature = #{signature}
+        and
+        DATE_FORMAT(a.stat_datetime,'%Y-%m-%d') &gt;= #{startDate}
+        and
+        DATE_FORMAT(a.stat_datetime,'%Y-%m-%d') &lt;= #{endDate}
+    </select>
+
+    <select id="getSumChargeBySignature" resultType="java.math.BigDecimal">
+        select
+            sum(a.charge) as charge
+        from
+        ctop_kuaishou_report_daily_creative a
+        where a.signature = #{signature}
+        and
+        DATE_FORMAT(a.stat_date,'%Y-%m-%d') &gt;= #{startDate}
+        and
+        DATE_FORMAT(a.stat_date,'%Y-%m-%d') &lt;= #{endDate}
+    </select>
+
+
     <!-- 根据shot_id获取视频总消耗 -->
     <select id="getTotalCostByShotId" resultType="java.math.BigDecimal">
             select
             sum(a.charge) as charge
-        from ctop_kuaishou_report_daily_creative_statistic a
+        from ctop_kuaishou_report_daily_creative a
         left join ctop_material_info b on a.signature = b.code
         left join ctop_material_ascription c on b.id = c.material_id
         left join sys_user d1 on c.clip_id = d1.id
@@ -113,7 +180,7 @@
     <select id="getTotalCostByPlanId" resultType="java.math.BigDecimal">
             select
             sum(a.charge) as charge
-        from ctop_kuaishou_report_daily_creative_statistic a
+        from ctop_kuaishou_report_daily_creative a
         left join ctop_material_info b on a.signature = b.code
         left join ctop_material_ascription c on b.id = c.material_id
         left join sys_user d1 on c.clip_id = d1.id
@@ -130,7 +197,7 @@
     <select id="getTotalCostByPlaneId" resultType="java.math.BigDecimal">
             select
             sum(a.charge) as charge
-        from ctop_kuaishou_report_daily_creative_statistic a
+        from ctop_kuaishou_report_daily_creative a
         left join ctop_material_info b on a.signature = b.code
         left join ctop_material_ascription c on b.id = c.material_id
         left join sys_user d1 on c.clip_id = d1.id
@@ -203,7 +270,7 @@
         from
         ctop_material_info b
         left join ctop_material_ascription c on b.id = c.material_id
-        left join ctop_kuaishou_report_daily_creative_statistic a on b.code = a.signature
+        left join ctop_kuaishou_report_daily_creative a on b.code = a.signature
         where
         <choose>
             <when test=" roleCode == 'plan' ">
@@ -231,7 +298,7 @@
         from
         ctop_material_info b
         left join ctop_material_ascription c on b.id = c.material_id
-        left join ctop_kuaishou_report_daily_creative_statistic a on b.code = a.signature
+        left join ctop_kuaishou_report_daily_creative a on b.code = a.signature
         where
         b.id = #{materialId}
         and DATE_FORMAT(b.create_time,'%Y-%m-%d') &gt;= #{startDate}
@@ -897,7 +964,7 @@
         from
         ctop_user_efficient_video_map
         where user_id = #{userId}
-        and role_id = #{roleId}
+       <!-- and role_id = #{roleId}  -->
         and app_type = #{appType}
         and calc_date &lt;= #{endDate}
         and calc_date &gt;= #{startDate}
@@ -910,10 +977,14 @@
             i.code as code,
             i.url as url,
             i.material_name as materialName,
-            i.watermark_material_name as watermarkMaterialName
+            i.watermark_material_name as watermarkMaterialName,
+            m.role_id as videoRoleCode,  <!-- 拍摄时候担任的角色 -->
+            r.role_name as originRoleName  <!-- 原本的角色 -->
         from
         ctop_user_efficient_video_map m
-        left join ctop_material_info i on m.efficient_video_signature = i.code
+        left join (select id,code,url,material_name,watermark_material_name from ctop_material_info group by code) i on m.efficient_video_signature = i.code
+        left join sys_user_role sr on m.user_id = sr.user_id
+        left join sys_role r on sr.role_id = r.id
         where
         m.user_id = #{userId} and
         m.app_type =#{appType} and
@@ -928,10 +999,16 @@
             i.code as code,
             i.url as url,
             i.material_name as materialName,
-            i.watermark_material_name as watermarkMaterialName
+            i.watermark_material_name as watermarkMaterialName,
+            m.role_id as videoRoleCode,  <!-- 拍摄时候担任的角色 -->
+            r.role_name as originRoleName,  <!-- 原本的角色 -->
+            su.realname as realname
         from
         ctop_user_efficient_video_map m
-        left join ctop_material_info i on m.efficient_video_signature = i.code
+        left join (select id,code,url,material_name,watermark_material_name from ctop_material_info group by code) i on m.efficient_video_signature = i.code
+        left join sys_user_role sr on m.user_id = sr.user_id
+        left join sys_role r on sr.role_id = r.id
+        left join sys_user su on m.user_id = su.id
         where
         m.user_id = #{userId} and
         m.app_type =#{appType} and
@@ -939,4 +1016,173 @@
         m.calc_date &gt;= #{startDate}
     </select>
 
+    <!-- 获取有效视频第一周所有产生消耗的视频的md5 -->
+    <select id="getWeekCostMd5" resultType="string">
+        select
+        signature
+        from ctop_kuaishou_report_daily_creative
+        where
+        DATE_FORMAT(stat_date,'%Y-%m-%d') &gt;= #{startDate}
+        and DATE_FORMAT(stat_date,'%Y-%m-%d') &lt;= #{endDate}
+        and signature is not null
+        group by signature
+    </select>
+
+    <!-- 获取toutiao有效视频第一周所有产生消耗的视频的md5 -->
+    <select id="toutiaoGetWeekCostMd5" resultType="string">
+        select
+        signature
+        from ctop_bytedance_report_creative_daily
+        where
+        DATE_FORMAT(stat_datetime,'%Y-%m-%d') &gt;= #{startDate}
+        and DATE_FORMAT(stat_datetime,'%Y-%m-%d') &lt;= #{endDate}
+        and signature is not null
+        group by signature
+    </select>
+
+    <!-- 获取有效视频第一周开始时间之前消耗次数 -->
+    <select id="beforeWeekCostCount" resultType="integer">
+        select
+        count(1)
+        from ctop_kuaishou_report_daily_creative
+        where
+        signature = #{md5} and
+        DATE_FORMAT(stat_date,'%Y-%m-%d') &lt; #{date}
+    </select>
+
+    <!-- 获取有效视频第一周开始时间之前消耗次数 -->
+    <select id="toutiaoBeforeWeekCostCount" resultType="integer">
+        select
+        count(1)
+        from ctop_bytedance_report_creative_daily
+        where
+        signature = #{md5} and
+        DATE_FORMAT(stat_datetime,'%Y-%m-%d') &lt; #{date}
+    </select>
+
+    <!-- 获取视频最早产生消耗的日期 -->
+    <select id="getVideoEarlistCostDate" resultType="string">
+        select
+        DATE_FORMAT(stat_date,'%Y-%m-%d')
+        from ctop_kuaishou_report_daily_creative
+        where
+        signature = #{md5}
+        order by stat_date asc limit 1
+    </select>
+
+    <!-- 获取视频最早产生消耗的日期 -->
+    <select id="getToutiaoVideoEarlistCostDate" resultType="string">
+        select
+        DATE_FORMAT(stat_datetime,'%Y-%m-%d')
+        from ctop_bytedance_report_creative_daily
+        where
+        signature = #{md5}
+        order by stat_datetime asc limit 1
+    </select>
+
+    <!-- 获取视频在时间范围内的总消耗 -->
+    <select id="videoTotalCostInDates" resultType="java.math.BigDecimal">
+        select
+        sum(charge)
+        from ctop_kuaishou_report_daily_creative
+        where
+        signature = #{md5}
+        and DATE_FORMAT(stat_date,'%Y-%m-%d') &lt;= #{endDate}
+        and DATE_FORMAT(stat_date, '%Y-%m-%d') &gt;= #{startDate}
+    </select>
+
+    <!-- 获取视频在时间范围内的总消耗 -->
+    <select id="toutiaoVideoTotalCostInDates" resultType="java.math.BigDecimal">
+        select
+        sum(cost)
+        from ctop_bytedance_report_creative_daily
+        where
+        signature = #{md5}
+        and DATE_FORMAT(stat_datetime,'%Y-%m-%d') &lt;= #{endDate}
+        and DATE_FORMAT(stat_datetime, '%Y-%m-%d') &gt;= #{startDate}
+    </select>
+
+    <select id="getDesignerInfoByCode" resultType="cn.com.ctop.userefficientvideomap.entity.EffiVideoDTO">
+        select
+        a.id,
+        b.clip_id as clipId,
+        u1.realname as clipName,
+        b.shot_id as shotId,
+        u2.realname as shotName,
+        b.plan_id as planId,
+        u3.realname as planName,
+        b.plane_id as planeId,
+        u4.realname as planeName
+        from
+        ctop_material_info a
+        left join ctop_material_ascription b on a.id=b.material_id
+        left join sys_user u1 on b.clip_id = u1.id
+        left join sys_user u2 on b.shot_id = u2.id
+        left join sys_user u3 on b.plan_id = u3.id
+        left join sys_user u4 on b.plane_id = u4.id
+        where a.code = #{code}
+        limit 1
+    </select>
+
+    <!-- 根据user_id获取员工所属分公司的company_id -->
+    <select id="getCompanyInfoByUserId" resultType="string">
+        select
+        company_id
+        from
+        user_company
+        where user_id = #{userId}
+    </select>
+
+    <!-- 按时间段获取视频总量 -->
+    <select id="getVideoByDates" resultType="string">
+        select
+        code
+        from (
+            select
+            code,
+            create_time
+            from
+            ctop_material_info
+            where
+            date_format(create_time, '%Y-%m-%d') &gt;= #{startDate} and
+            date_format(create_time, '%Y-%m-%d') &lt;= #{endDate}
+            order by create_time
+            ) a
+        group by code
+    </select>
+
+    <select id="getVideoCountByCode" resultType="integer">
+        select
+        count(1)
+        from
+        ctop_user_video_map
+        where video_signature = #{signature}
+    </select>
+
+    <!-- 视频素材 -->
+    <select id="getVideoList" resultType="cn.com.ctop.common.module.entity.MaterialInfo">
+            select
+            i.id as id,
+            i.code as code,
+            i.url as url,
+            i.material_name as materialName,
+            i.watermark_material_name as watermarkMaterialName,
+            m.role_id as videoRoleCode,  <!-- 拍摄时候担任的角色 -->
+            r.role_name as originRoleName  <!-- 原本的角色 -->
+        from
+        ctop_user_video_map m
+        left join (
+                    select
+                    id,code,url,material_name,watermark_material_name
+                    from
+                    ctop_material_info group by code
+                    ) i on m.video_signature = i.code
+        left join sys_user_role sr on m.user_id = sr.user_id
+        left join sys_role r on sr.role_id = r.id
+        where
+        m.user_id = #{userId} and
+        m.calc_date &gt;= #{startDate} and
+        m.calc_date &lt;= #{endDate}
+    </select>
+
 </mapper>

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

@@ -0,0 +1,243 @@
+package cn.com.ctop.uservideomap.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.util.oConvertUtils;
+import cn.com.ctop.uservideomap.entity.UserVideoMap;
+import cn.com.ctop.uservideomap.service.IUserVideoMapService;
+import java.util.Date;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+ /**
+ * 视频和设计师对应关系表
+ * @author jeecg-boot
+ * @date   2020-03-17
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="视频和设计师对应关系表")
+@RestController
+@RequestMapping("/uservideomap/userVideoMap")
+public class UserVideoMapController {
+	@Autowired
+	private IUserVideoMapService userVideoMapService;
+	
+	/**
+	  * 分页列表查询
+	 * @param userVideoMap
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@AutoLog(value = "视频和设计师对应关系表-分页列表查询")
+	@ApiOperation(value="视频和设计师对应关系表-分页列表查询", notes="视频和设计师对应关系表-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<UserVideoMap>> queryPageList(UserVideoMap userVideoMap,
+									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+									  HttpServletRequest req) {
+		Result<IPage<UserVideoMap>> result = new Result<IPage<UserVideoMap>>();
+		QueryWrapper<UserVideoMap> queryWrapper = QueryGenerator.initQueryWrapper(userVideoMap, req.getParameterMap());
+		Page<UserVideoMap> page = new Page<UserVideoMap>(pageNo, pageSize);
+		IPage<UserVideoMap> pageList = userVideoMapService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+	
+	/**
+	  *   添加
+	 * @param userVideoMap
+	 * @return
+	 */
+	@AutoLog(value = "视频和设计师对应关系表-添加")
+	@ApiOperation(value="视频和设计师对应关系表-添加", notes="视频和设计师对应关系表-添加")
+	@PostMapping(value = "/add")
+	public Result<UserVideoMap> add(@RequestBody UserVideoMap userVideoMap) {
+		Result<UserVideoMap> result = new Result<UserVideoMap>();
+		try {
+			userVideoMapService.save(userVideoMap);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+	
+	/**
+	  *  编辑
+	 * @param userVideoMap
+	 * @return
+	 */
+	@AutoLog(value = "视频和设计师对应关系表-编辑")
+	@ApiOperation(value="视频和设计师对应关系表-编辑", notes="视频和设计师对应关系表-编辑")
+	@PutMapping(value = "/edit")
+	public Result<UserVideoMap> edit(@RequestBody UserVideoMap userVideoMap) {
+		Result<UserVideoMap> result = new Result<UserVideoMap>();
+		UserVideoMap userVideoMapEntity = userVideoMapService.getById(userVideoMap.getId());
+		if(userVideoMapEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = userVideoMapService.updateById(userVideoMap);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+		
+		return result;
+	}
+	
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "视频和设计师对应关系表-通过id删除")
+	@ApiOperation(value="视频和设计师对应关系表-通过id删除", notes="视频和设计师对应关系表-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			userVideoMapService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+	
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "视频和设计师对应关系表-批量删除")
+	@ApiOperation(value="视频和设计师对应关系表-批量删除", notes="视频和设计师对应关系表-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<UserVideoMap> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<UserVideoMap> result = new Result<UserVideoMap>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.userVideoMapService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+	
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "视频和设计师对应关系表-通过id查询")
+	@ApiOperation(value="视频和设计师对应关系表-通过id查询", notes="视频和设计师对应关系表-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<UserVideoMap> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<UserVideoMap> result = new Result<UserVideoMap>();
+		UserVideoMap userVideoMap = userVideoMapService.getById(id);
+		if(userVideoMap==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(userVideoMap);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<UserVideoMap> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              UserVideoMap userVideoMap = JSON.parseObject(deString, UserVideoMap.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(userVideoMap, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<UserVideoMap> pageList = userVideoMapService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "视频和设计师对应关系表列表");
+      mv.addObject(NormalExcelConstants.CLASS, UserVideoMap.class);
+      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("视频和设计师对应关系表列表数据", "导出人:Jeecg", "导出信息"));
+      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+      return mv;
+  }
+
+  /**
+      * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+          MultipartFile file = entity.getValue();
+          ImportParams params = new ImportParams();
+          params.setTitleRows(2);
+          params.setHeadRows(1);
+          params.setNeedSave(true);
+          try {
+              List<UserVideoMap> listUserVideoMaps = ExcelImportUtil.importExcel(file.getInputStream(), UserVideoMap.class, params);
+              userVideoMapService.saveBatch(listUserVideoMaps);
+              return Result.ok("文件导入成功!数据行数:" + listUserVideoMaps.size());
+          } catch (Exception e) {
+              log.error(e.getMessage(),e);
+              return Result.error("文件导入失败:"+e.getMessage());
+          } finally {
+              try {
+                  file.getInputStream().close();
+              } catch (IOException e) {
+                  e.printStackTrace();
+              }
+          }
+      }
+      return Result.ok("文件导入失败!");
+  }
+
+}

+ 87 - 0
performance-appraisal/src/main/java/cn/com/ctop/uservideomap/entity/UserVideoMap.java

@@ -0,0 +1,87 @@
+package cn.com.ctop.uservideomap.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 视频和设计师对应关系表
+ * @author jeecg-boot
+ * @date   2020-03-17
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_user_video_map")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_user_video_map对象", description="视频和设计师对应关系表")
+public class UserVideoMap {
+
+	/**id*/
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+	private Integer id;
+	/**有效视频md5*/
+	@Excel(name = "有效视频md5", width = 15)
+    @ApiModelProperty(value = "有效视频md5")
+	private String videoSignature;
+	/**视频制作中担任的角色-不一定是自己原本的角色*/
+	@Excel(name = "视频制作中担任的角色-不一定是自己原本的角色", width = 15)
+    @ApiModelProperty(value = "视频制作中担任的角色-不一定是自己原本的角色")
+	private String roleId;
+	/**用户id*/
+	@Excel(name = "用户id", width = 15)
+    @ApiModelProperty(value = "用户id")
+	private String userId;
+	/**季度*/
+	@Excel(name = "季度", width = 15)
+    @ApiModelProperty(value = "季度")
+	private Integer quarter;
+	/**年*/
+	@Excel(name = "年", width = 15)
+    @ApiModelProperty(value = "年")
+	private Integer year;
+	/**所属月*/
+	@Excel(name = "所属月", width = 15)
+    @ApiModelProperty(value = "所属月")
+	private Integer month;
+	/**有效视频所属周开始时间*/
+	@Excel(name = "有效视频所属周开始时间", width = 15, format = "yyyy-MM-dd")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @ApiModelProperty(value = "有效视频所属周开始时间")
+	private String weekStart;
+	/**有效视频所属周结束时间*/
+	@Excel(name = "有效视频所属周结束时间", width = 15, format = "yyyy-MM-dd")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @ApiModelProperty(value = "有效视频所属周结束时间")
+	private String weekEnd;
+	/**用于计算所属年月季的基础日期*/
+	@Excel(name = "用于计算所属年月季的基础日期", width = 15, format = "yyyy-MM-dd")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @ApiModelProperty(value = "用于计算所属年月季的基础日期")
+	private Date calcDate;
+	/**视频所属分公司的id*/
+	@Excel(name = "视频所属分公司的id", width = 15)
+    @ApiModelProperty(value = "视频所属分公司的id")
+	private String companyId;
+	/**createTime*/
+    @ApiModelProperty(value = "createTime")
+	private Date createTime;
+	/**updateTime*/
+    @ApiModelProperty(value = "updateTime")
+	private Date updateTime;
+}

+ 17 - 0
performance-appraisal/src/main/java/cn/com/ctop/uservideomap/mapper/UserVideoMapMapper.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.uservideomap.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import cn.com.ctop.uservideomap.entity.UserVideoMap;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 视频和设计师对应关系表
+ * @author: jeecg-boot
+ * @date:   2020-03-17
+ * @cersion: V1.0
+ */
+public interface UserVideoMapMapper extends BaseMapper<UserVideoMap> {
+
+}

+ 5 - 0
performance-appraisal/src/main/java/cn/com/ctop/uservideomap/mapper/xml/UserVideoMapMapper.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.uservideomap.mapper.UserVideoMapMapper">
+
+</mapper>

+ 14 - 0
performance-appraisal/src/main/java/cn/com/ctop/uservideomap/service/IUserVideoMapService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.uservideomap.service;
+
+import cn.com.ctop.uservideomap.entity.UserVideoMap;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 视频和设计师对应关系表
+ * @author jeecg-boot
+ * @date   2020-03-17
+ * @version V1.0
+ */
+public interface IUserVideoMapService extends IService<UserVideoMap> {
+
+}

+ 19 - 0
performance-appraisal/src/main/java/cn/com/ctop/uservideomap/service/impl/UserVideoMapServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.uservideomap.service.impl;
+
+import cn.com.ctop.uservideomap.entity.UserVideoMap;
+import cn.com.ctop.uservideomap.mapper.UserVideoMapMapper;
+import cn.com.ctop.uservideomap.service.IUserVideoMapService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * 视频和设计师对应关系表
+ * @author jeecg-boot
+ * @date   2020-03-17
+ * @version V1.0
+ */
+@Service
+public class UserVideoMapServiceImpl extends ServiceImpl<UserVideoMapMapper, UserVideoMap> implements IUserVideoMapService {
+
+}