Browse Source

Merge remote-tracking branch 'origin/master'

xuzuoyun 5 years ago
parent
commit
af90c218c4
87 changed files with 4650 additions and 573 deletions
  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. 22 0
      jeecg-boot-module-system/pom.xml
  4. 8 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java
  5. 10 13
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaInfoController.java
  6. 1 17
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaItemInfoController.java
  7. 336 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialImageInfoController.java
  8. 40 11
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  9. 78 69
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  10. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/Advertiser.java
  11. 37 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/DramaInfo.java
  12. 18 8
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/DramaItemInfo.java
  13. 1 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanRealTimeLoadJob.java
  14. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouAppListJob.java
  15. 0 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyLoadFileJob.java
  16. 0 12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouNowDateGroupJob.java
  17. 3 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/OceanengineJob.java
  18. 1 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/WatermarkVideoJob.java
  19. 231 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/opencv/CornerCheck.java
  20. 141 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/opencv/FFmpegUtils.java
  21. 215 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/opencv/Perspective.java
  22. 72 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/opencv/Test.java
  23. 87 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/opencv/VideoProcessing.java
  24. 3 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/test/service/impl/JeecgDemoServiceImpl.java
  25. 38 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/fileupload/controller/FileController.java
  26. 20 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/PerformanceController2.java
  27. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IPerformanceService2.java
  28. 423 36
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/PerformanceServiceImpl2.java
  29. 13 0
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  30. 5 8
      jeecg-boot-module-system/src/main/resources/application-test.yml
  31. 49 0
      jeecg-boot-module-system/src/main/resources/generatorConfig.xml
  32. 91 34
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  33. 0 1
      module-common/src/main/java/cn/com/ctop/common/module/entity/CtopOauthToken.java
  34. 145 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialImageInfo.java
  35. 17 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java
  36. 16 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialImageInfoMapper.java
  37. 122 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialImageInfoMapper.xml
  38. 26 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialImageInfoService.java
  39. 19 2
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  40. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountAuthServiceImpl.java
  41. 0 2
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CorpWeixinServiceImpl.java
  42. 99 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialImageInfoServiceImpl.java
  43. 119 6
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  44. 6 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/Check.java
  45. 5 83
      module-common/src/main/java/cn/com/ctop/common/module/utils/ExportExcelUtils.java
  46. 0 2
      module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils.java
  47. 0 1
      module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils2.java
  48. 0 3
      module-common/src/main/java/cn/com/ctop/common/module/utils/JavacvUtil.java
  49. 2 19
      module-common/src/main/java/cn/com/ctop/common/module/utils/MpsUtils.java
  50. 0 3
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/service/impl/AppiumJobServiceImpl.java
  51. 2 16
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/AppiumUtil.java
  52. 0 11
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/KuaimiUtil.java
  53. 0 3
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/dataeye/service/impl/DataeyeCompanyServiceImpl.java
  54. 0 10
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/jiema/service/impl/KuaimiServiceImpl.java
  55. 0 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/jiema/service/impl/WumaServiceImpl.java
  56. 0 9
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/test/AppiumTest.java
  57. 7 0
      module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/IMaterialUploadImageService.java
  58. 164 0
      module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadImageServiceImpl.java
  59. 31 57
      module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java
  60. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/service/impl/KuaishouAppServiceImpl.java
  61. 0 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouController.java
  62. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouConversionTypesController.java
  63. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouGroupCreateLogController.java
  64. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouUpdateServiceImpl.java
  65. 61 17
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  66. 0 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java
  67. 51 48
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAgentServiceImpl.java
  68. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportHourlyCampaignServiceImpl.java
  69. 1 0
      module-kuaishou/src/main/resources/kuaishou_config.properties
  70. 284 0
      module-report/src/main/java/cn/com/ctop/bytedance/controller/KuaiShouYiCheReportController.java
  71. 21 0
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/KuaiShouYiCheReportMapper.java
  72. 632 0
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/KuaiShouYiCheReportMapper.xml
  73. 9 0
      module-report/src/main/java/cn/com/ctop/bytedance/service/IKuaiShouYiCheReportService.java
  74. 0 1
      module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedanceReportServiceImpl.java
  75. 127 0
      module-report/src/main/java/cn/com/ctop/bytedance/service/impl/KuaiShouYiCheReportServiceImpl.java
  76. 1 0
      module-report/src/main/java/cn/com/ctop/bytedance/service/impl/ReportServiceImpl.java
  77. 0 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceAdvertiserDataServiceImpl.java
  78. 0 1
      moudule-eureca/.mvn/wrapper/MavenWrapperDownloader.java
  79. 8 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/UserEfficientVideoMap.java
  80. 66 24
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/UserEfficientVideoMapMapper.java
  81. 258 12
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml
  82. 243 0
      performance-appraisal/src/main/java/cn/com/ctop/uservideomap/controller/UserVideoMapController.java
  83. 87 0
      performance-appraisal/src/main/java/cn/com/ctop/uservideomap/entity/UserVideoMap.java
  84. 17 0
      performance-appraisal/src/main/java/cn/com/ctop/uservideomap/mapper/UserVideoMapMapper.java
  85. 5 0
      performance-appraisal/src/main/java/cn/com/ctop/uservideomap/mapper/xml/UserVideoMapMapper.xml
  86. 14 0
      performance-appraisal/src/main/java/cn/com/ctop/uservideomap/service/IUserVideoMapService.java
  87. 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


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

@@ -169,6 +169,11 @@
             <artifactId>poi-ooxml</artifactId>
             <version>3.17</version>
         </dependency>-->
+        <!--<dependency>
+            <groupId>cn.com.ctop</groupId>
+            <artifactId>moudule-opencv</artifactId>
+            <version>4.20.0</version>
+        </dependency>-->
     </dependencies>
 
     <dependencyManagement>
@@ -186,6 +191,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>

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

@@ -21,9 +21,11 @@ import org.jeecg.modules.ctop.mapper.ProjectMemberMapper;
 import org.jeecg.modules.ctop.service.IAdvertiserService;
 import org.jeecg.modules.ctop.service.IProjectService;
 import org.jeecg.modules.system.entity.SysCategory;
+import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.entity.UserCompany;
 import org.jeecg.modules.system.mapper.UserCompanyMapper;
 import org.jeecg.modules.system.service.ISysCategoryService;
+import org.jeecg.modules.system.service.ISysUserService;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -142,6 +144,10 @@ public class AdvertiserController {
                 if (sysCategory != null) {
                     advertiserRecord.setIndustryId(sysCategory.getName());
                 }
+                SysUser user = sysUserService.getById(advertiserRecord.getSaleId());
+                if (null != user) {
+                    advertiserRecord.setSaleName(user.getRealname());
+                }
                 list.add(advertiserRecord);
             }
             pageList.setRecords(list);
@@ -151,6 +157,8 @@ public class AdvertiserController {
         return result;
     }
 
+    @Autowired
+    private ISysUserService sysUserService;
     /**
      * 添加
      *

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

@@ -51,20 +51,17 @@ public class DramaInfoController {
 	public Map<String, Object> getDetail(Long dramaId) {
 		Map<String, Object> result = new HashMap<>();
 		List<DramaItemInfo> itemInfos = dramaItemInfoService.getByDramaId(dramaId);
+        List<DramaItemInfo> getItemInfos = new ArrayList<>();
+        for (DramaItemInfo itemInfo : itemInfos) {
+            if (itemInfo.getType() == 2) {
+                DramaRoleInfo roleInfo = dramaRoleInfoService.getById(itemInfo.getRoleId());
+                itemInfo.setRoleName(roleInfo.getName());
+            }
+            getItemInfos.add(itemInfo);
+        }
 		List<DramaRoleInfo> roleInfos = dramaRoleInfoService.getByDramaId(dramaId);
-		List<DramaRoleInfo> returnRoleInfos = new ArrayList<>();
-		DramaRoleInfo dramaRoleInfo1 = new DramaRoleInfo("情节描述", "scence");
-		returnRoleInfos.add(dramaRoleInfo1);
-		if (null != roleInfos && roleInfos.size() > 0) {
-			for (DramaRoleInfo roleInfo : roleInfos) {
-				roleInfo.setButtonType("dialogue_" + roleInfo.getId());
-				returnRoleInfos.add(roleInfo);
-			}
-		}
-		DramaRoleInfo dramaRoleInfo2 = new DramaRoleInfo("创建角色", "createRole");
-		returnRoleInfos.add(dramaRoleInfo2);
-		result.put("itemInfos", itemInfos);
-		result.put("roleInfos", returnRoleInfos);
+        result.put("itemInfos", getItemInfos);
+        result.put("roleInfos", roleInfos);
 		ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
 		return result;
 	}

+ 1 - 17
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaItemInfoController.java

@@ -51,6 +51,7 @@ public class DramaItemInfoController {
         Result<IPage<DramaItemInfo>> result = new Result<IPage<DramaItemInfo>>();
         QueryWrapper<DramaItemInfo> queryWrapper = QueryGenerator.initQueryWrapper(dramaItemInfo, req.getParameterMap());
         Page<DramaItemInfo> page = new Page<DramaItemInfo>(pageNo, pageSize);
+        queryWrapper.orderByAsc("rank");
         IPage<DramaItemInfo> pageList = dramaItemInfoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -69,14 +70,6 @@ public class DramaItemInfoController {
     public Result<DramaItemInfo> add(@RequestBody DramaItemInfo dramaItemInfo) {
         Result<DramaItemInfo> result = new Result<>();
         try {
-            String buttonType = dramaItemInfo.getButtonType();
-            if (buttonType.startsWith("dialogue")) {
-                dramaItemInfo.setType("dialogue");
-                String[] infos = buttonType.split("_");
-                dramaItemInfo.setRoleId(Long.parseLong(infos[1]));
-            } else if (buttonType.startsWith("scence")) {
-                dramaItemInfo.setType("scence");
-            }
             dramaItemInfoService.save(dramaItemInfo);
             result.success("添加成功!");
         } catch (Exception e) {
@@ -101,20 +94,11 @@ public class DramaItemInfoController {
         if (dramaItemInfoEntity == null) {
             result.error500("未找到对应实体");
         } else {
-            String buttonType = dramaItemInfo.getButtonType();
-            if (buttonType.startsWith("dialogue")) {
-                dramaItemInfo.setType("dialogue");
-                String[] infos = buttonType.split("_");
-                dramaItemInfo.setRoleId(Long.parseLong(infos[1]));
-            } else if (buttonType.startsWith("scence")) {
-                dramaItemInfo.setType("scence");
-            }
             boolean ok = dramaItemInfoService.updateById(dramaItemInfo);
             if (ok) {
                 result.success("修改成功!");
             }
         }
-
         return result;
     }
 

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

@@ -0,0 +1,336 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.entity.MaterialImageInfo;
+import cn.com.ctop.common.module.entity.MaterialInfo;
+import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
+import cn.com.ctop.common.module.service.IMaterialImageInfoService;
+import cn.com.ctop.common.module.service.IMaterialInfoService;
+import cn.com.ctop.common.module.utils.Check;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.oConvertUtils;
+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 javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 素材
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-16
+ */
+@Slf4j
+@Api(tags = "素材")
+@RestController
+@RequestMapping("/ctop/MaterialImageInfo")
+public class MaterialImageInfoController {
+    @Autowired
+    private IMaterialImageInfoService MaterialImageInfoService;
+    @Autowired
+    private IMaterialInfoService materialInfoService;
+    @Autowired
+    private MaterialInfoMapper materialInfoMapper;
+
+
+    @ApiOperation(value = "截屏-分页列表查询", notes = "截屏-分页列表查询")
+    @GetMapping(value = "/pageList")
+    public Result<IPage<MaterialImageInfo>> pageList(MaterialImageInfo materialImageInfo,
+                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                     HttpServletRequest req) {
+        Result<IPage<MaterialImageInfo>> result = new Result<IPage<MaterialImageInfo>>();
+        QueryWrapper<MaterialImageInfo> queryWrapper = QueryGenerator.initQueryWrapper(materialImageInfo, req.getParameterMap());
+        Page<MaterialImageInfo> page = new Page<MaterialImageInfo>(pageNo, pageSize);
+        IPage<MaterialImageInfo> pageList = MaterialImageInfoService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+
+    /**
+     * 分页列表查询
+     *
+     * @param MaterialImageInfo
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "素材-分页列表查询")
+    @ApiOperation(value = "素材-分页列表查询", notes = "素材-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<List<MaterialImageInfo>> queryPageList(MaterialImageInfo MaterialImageInfo,
+                                                         HttpServletRequest req) {
+        Result<List<MaterialImageInfo>> result = new Result<>();
+        QueryWrapper<MaterialImageInfo> queryWrapper = QueryGenerator.initQueryWrapper(MaterialImageInfo, req.getParameterMap());
+        List<MaterialImageInfo> list = MaterialImageInfoService.list(queryWrapper);
+        result.setSuccess(true);
+        result.setResult(list);
+        return result;
+    }
+
+
+    @GetMapping(value = "/getDetail")
+    public Result<MaterialImageInfo> getDetail(String id) {
+        Result<MaterialImageInfo> result = new Result<>();
+        MaterialImageInfo materialImageInfo = MaterialImageInfoService.getById(id);
+        if (!Check.isNull(materialImageInfo)) {
+            MaterialInfo materialmInfo = materialInfoService.getById(materialImageInfo.getVideoId());
+            if (!Check.isNull(materialmInfo)) {
+                materialImageInfo.setVideoUrl(materialmInfo.getUrl());
+
+            }
+
+            String auditorName = materialInfoMapper.selectUserNameById(materialImageInfo.getAuditorId());
+            materialImageInfo.setAuditorName(auditorName);
+
+        }
+
+        result.setSuccess(true);
+        result.setResult(materialImageInfo);
+        return result;
+    }
+
+
+    /**
+     * 添加
+     *
+     * @param MaterialImageInfo
+     * @return
+     */
+    @AutoLog(value = "素材-添加")
+    @ApiOperation(value = "素材-添加", notes = "素材-添加")
+    @PostMapping(value = "/add")
+    public Result<MaterialImageInfo> add(@RequestBody MaterialImageInfo MaterialImageInfo) {
+        Result<MaterialImageInfo> result = new Result<MaterialImageInfo>();
+        try {
+            MaterialImageInfoService.save(MaterialImageInfo);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param
+     * @return
+     */
+    @AutoLog(value = "素材-编辑")
+
+    @ApiOperation(value = "素材-编辑", notes = "素材-编辑")
+    @PutMapping(value = "/edit")
+    public Result<MaterialImageInfo> edit(@RequestBody MaterialImageInfo MaterialImageInfo) {
+        Result<MaterialImageInfo> result = new Result<MaterialImageInfo>();
+        MaterialImageInfo MaterialImageInfoEntity = MaterialImageInfoService.getById(MaterialImageInfo.getId());
+        if (MaterialImageInfoEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            String url = (String) MaterialImageInfo.getUrl();
+            String urlStr = "https:" + url;
+            MaterialImageInfo.setUrl(urlStr);
+            boolean ok = MaterialImageInfoService.updateById(MaterialImageInfo);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+
+    @AutoLog(value = "素材-编辑")
+    @ApiOperation(value = "素材-编辑", notes = "素材-编辑")
+    @PutMapping(value = "/batchEdit")
+    public Result<MaterialImageInfo> batchEdit(@RequestBody JSONArray updateArr) {
+        Result<MaterialImageInfo> result = new Result<MaterialImageInfo>();
+        try {
+            if (!Check.isNull(updateArr)) {
+                LoginUser user = (LoginUser) SecurityUtils.getSubject()
+                        .getPrincipal();
+                for (int i = 0; i < updateArr.size(); i++) {
+                    JSONObject updateJson = updateArr.getJSONObject(i);
+                    if (!Check.isNull(updateJson)) {
+                        MaterialImageInfo materialImageInfo = new MaterialImageInfo();
+                        Long id = updateJson.getLong("id");
+                        materialImageInfo.setId(id);
+                        Integer status = updateJson.getInteger("status");
+                        materialImageInfo.setStatus(status);
+                        if (status == 2) {
+                            materialImageInfo.setRefuseReason(updateJson.getString("refuseReason"));
+                        }
+                        materialImageInfo.setAuditorId(user.getId());
+                        MaterialImageInfoService.updateById(materialImageInfo);
+                    }
+                }
+            }
+            result.success("修改成功!");
+            result.setSuccess(true);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            e.printStackTrace();
+        }
+
+        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 {
+            MaterialImageInfoService.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<MaterialImageInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<MaterialImageInfo> result = new Result<MaterialImageInfo>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.MaterialImageInfoService.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<MaterialImageInfo> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<MaterialImageInfo> result = new Result<MaterialImageInfo>();
+        MaterialImageInfo MaterialImageInfo = MaterialImageInfoService.getById(id);
+        if (MaterialImageInfo == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(MaterialImageInfo);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<MaterialImageInfo> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                MaterialImageInfo MaterialImageInfo = JSON.parseObject(deString, MaterialImageInfo.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(MaterialImageInfo, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<MaterialImageInfo> pageList = MaterialImageInfoService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "素材列表");
+        mv.addObject(NormalExcelConstants.CLASS, MaterialImageInfo.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<MaterialImageInfo> listMaterialImageInfos = ExcelImportUtil.importExcel(file.getInputStream(), MaterialImageInfo.class, params);
+                MaterialImageInfoService.saveBatch(listMaterialImageInfos);
+                return Result.ok("文件导入成功!数据行数:" + listMaterialImageInfos.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("文件导入失败!");
+    }
+
+}

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

@@ -1,11 +1,9 @@
 package org.jeecg.modules.ctop.controller;
 
 
+import cn.com.ctop.common.module.entity.MaterialImageInfo;
 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;
@@ -76,6 +74,19 @@ public class MaterialInfoController {
     private IByteDanceCleanMaterialReportService byteDanceCleanMaterialReportService;
     @Autowired
     private IKuaiShouCleanMaterialReportService kuaiShouCleanMaterialReportService;
+    @Autowired
+    private IVideoWatermarkTaskService watermarkTaskService;
+
+
+    @PostMapping("/correlationUpload")
+    public Map<String, Object> insertFile(@RequestBody JSONObject json) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject()
+                .getPrincipal();
+
+        json.put("userId", user.getId());
+        return materialInfoService.correlationUpload(json);
+    }
+
 
     @GetMapping(value = "/report")
     public JSONObject report(String userId) {
@@ -136,7 +147,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) {
@@ -151,6 +163,9 @@ public class MaterialInfoController {
         return result;
     }
 
+    @Autowired
+    private IMaterialImageInfoService iMaterialImageInfoService;
+
     @AutoLog(value = "素材信息-分页列表查询")
     @ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")
     @GetMapping(value = "/list")
@@ -182,13 +197,13 @@ public class MaterialInfoController {
                         return result;
                     }
                 }
-
             } else {
                 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) {
@@ -196,12 +211,9 @@ public class MaterialInfoController {
                 }
             }
         }
-
         Page<MaterialInfo> page = new Page<>(pageNo, pageSize);
         IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper);
-
         List<MaterialInfo> materialInfoList = pageList.getRecords();
-
         if (materialInfoList.size() != 0) {
             for (MaterialInfo material : materialInfoList) {
                 //判断是否已经同步到快手平台
@@ -237,7 +249,20 @@ public class MaterialInfoController {
                     material.setGeneralization(generalizationJson);
                 }*/
 
+
+                QueryWrapper<MaterialImageInfo> imageInfoQueryWrapper = new QueryWrapper<>();
+                imageInfoQueryWrapper.eq("video_id", material.getId());
+                imageInfoQueryWrapper.eq("status", 0);
+                List<MaterialImageInfo> imageInfoList = iMaterialImageInfoService.list(imageInfoQueryWrapper);
+                if (Check.isNull(imageInfoList)) {
+                    material.setWhetherUnaudited(false);
+                } else {
+                    material.setWhetherUnaudited(true);
+                }
+
             }
+
+
         }
 
         result.setSuccess(true);
@@ -333,6 +358,7 @@ public class MaterialInfoController {
 
     }
 
+
     /**
      * 通过id删除
      *
@@ -347,10 +373,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("删除失败!");

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

@@ -90,7 +90,6 @@ public class TestController {
     private IKuaishouInterfaceService kuaishouInterfaceService;
 
 
-
     @GetMapping(value = "/getHistoryData")
     public String getHistoryData() {
         Result<String> result = new Result<String>();
@@ -99,10 +98,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 +121,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 +195,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 +250,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 +344,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 +355,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 +375,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 +399,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,61 +431,60 @@ 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<>();
-                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);
-                if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
-                    bytedancePlanDailyReports.forEach(report -> {
-                        String adName = report.getAdName();
-                        String[] tags = adName.split("-");
-                        report.setAdsense(tags[1]);
-                        report.setPlanCode(tags[2]);
-                        String materialName = tags[3];
-                        report.setMaterialName(materialName);
-                        if (materialName.contains("其他")) {
-                            report.setMaterialType("其他");
-                        } else if (materialName.contains("图片轮播")) {
-                            report.setMaterialType("图片轮播");
-                        } else if (materialName.contains("大字报")) {
-                            report.setMaterialType("大字报");
-                        } else if (materialName.contains("文字动画")) {
-                            report.setMaterialType("文字动画");
-                        } else if (materialName.contains("采访形式")) {
-                            report.setMaterialType("采访形式");
-                        } else if (materialName.contains("剧情")) {
-                            report.setMaterialType("剧情");
-                        } else if (materialName.contains("口播")) {
-                            report.setMaterialType("口播");
-                        } else {
-                            report.setMaterialType("其他");
-                        }
-                        planDailyReportService.updateById(report);
-                    });
-                }
-            });
-        }
+        allocations.forEach(allocation -> {
+            //根据accountId和时间,查询相关的日报表信息
+            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(reportQueryWrapper);
+            if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
+                bytedancePlanDailyReports.forEach(report -> {
+                    String adName = report.getAdName();
+                    String[] tags = adName.split("-");
+                    report.setAdsense(tags[1]);
+                    report.setPlanCode(tags[2]);
+                    String materialName = tags[3];
+                    report.setMaterialName(materialName);
+                    if (materialName.contains("其他")) {
+                        report.setMaterialType("其他");
+                    } else if (materialName.contains("图片轮播")) {
+                        report.setMaterialType("图片轮播");
+                    } else if (materialName.contains("大字报")) {
+                        report.setMaterialType("大字报");
+                    } else if (materialName.contains("文字动画")) {
+                        report.setMaterialType("文字动画");
+                    } else if (materialName.contains("采访形式")) {
+                        report.setMaterialType("采访形式");
+                    } else if (materialName.contains("剧情")) {
+                        report.setMaterialType("剧情");
+                    } else if (materialName.contains("口播")) {
+                        report.setMaterialType("口播");
+                    } else {
+                        report.setMaterialType("其他");
+                    }
+                    planDailyReportService.updateById(report);
+                });
+            }
+        });
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
@@ -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);
@@ -837,4 +814,36 @@ public class TestController {
             }
         });
     }
+
+
+    @GetMapping(value = "/getAllCreativeList")
+    public void getAllCreativeList() {
+
+        try {
+
+            QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
+            oauthTokenQueryWrapper.eq("media_id", 2);
+            List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(oauthTokenQueryWrapper);
+
+            if (!Check.isNull(ctopOauthTokens)) {
+                for (CtopOauthToken token : ctopOauthTokens) {
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            if (!Check.isNull(token)) {
+                                log.info("获取创意,账号id:{}", token.getAccountId());
+                                kuaishouInterfaceService.getCreativeList(token, null, null);
+                            }
+                        }
+                    });
+
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+
+
 }

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/Advertiser.java

@@ -1,6 +1,7 @@
 package org.jeecg.modules.ctop.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -114,5 +115,8 @@ public class Advertiser {
 
     private String companyId;
 
+    @TableField(exist = false)
+    private String saleName;
+
 
 }

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

@@ -32,6 +32,43 @@ public class DramaInfo {
 	private Integer nonpublic;
 	private String introduction;
 	private Integer status;
+    /**
+     * 场景
+     */
+    private String scnece;
+    /**
+     * 视频类型
+     */
+    private String videoType;
+    /**
+     * 时长
+     */
+    private Long timeLong;
+    /**
+     * 演员id
+     */
+    private String actorId;
+    /**
+     * 卖点
+     */
+    private String usp;
+    /**
+     * 演员/服化道备注
+     */
+    private String actorRemark;
+    /**
+     * 拍摄要求
+     */
+    private String shootReq;
+    /**
+     * 封面文案
+     */
+    private String coverText;
+    /**
+     * 剪辑备注
+     */
+    private String clipRemark;
+
 	private Date createTime;
 	private Date updateTime;
 }

+ 18 - 8
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/DramaItemInfo.java

@@ -36,9 +36,9 @@ public class DramaItemInfo {
     /**
      * 元素类型1:描述 2:对话
      */
-    @Excel(name = "元素类型1:描述 2:对话", width = 15)
+    @Excel(name = "元素类型1:情节描述 2:对话", width = 15)
     @ApiModelProperty(value = "元素类型1:描述 2:对话")
-    private String type;
+    private Integer type;
     /**
      * 剧本id
      */
@@ -52,11 +52,11 @@ public class DramaItemInfo {
     @ApiModelProperty(value = "roleId")
     private Long roleId;
     /**
-     * content
+     * 台词
      */
-    @Excel(name = "content", width = 15)
+    @Excel(name = "line", width = 15)
     @ApiModelProperty(value = "content")
-    private String content;
+    private String line;
     /**
      * 排序号
      */
@@ -80,10 +80,20 @@ public class DramaItemInfo {
     @ApiModelProperty(value = "updateTime")
     private Date updateTime;
 
-    @TableField(exist = false)
-    private String roleName;
+    /**
+     * 场景
+     */
+    private String scene;
+    /**
+     * 剪辑描述
+     */
+    private String clipRemark;
+    /**
+     * 画面内容
+     */
+    private String picContent;
 
     @TableField(exist = false)
-    private String buttonType;
+    private String roleName;
 
 }

+ 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;
+        }
+    }
+}
+*/

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

@@ -0,0 +1,141 @@
+//package org.jeecg.modules.demo.opencv;
+//
+//import java.io.BufferedReader;
+//import java.io.IOException;
+//import java.io.InputStream;
+//import java.io.InputStreamReader;
+//import java.text.SimpleDateFormat;
+//import java.util.ArrayList;
+//import java.util.Date;
+//import java.util.List;
+//import java.util.UUID;
+//
+//public class FFmpegUtils {
+//    public static void videoToPcm(String vedioUrl,String m4aUrl,String ffmpegUrl) throws InterruptedException, IOException {
+//        List<String> commend = new ArrayList<String>();
+//        commend.add(ffmpegUrl);
+//        commend.add("-i");
+//        commend.add(vedioUrl);
+//        commend.add("-vn");
+//        commend.add("y");
+//        commend.add("-acodec");
+//        commend.add("copy");
+//        commend.add(m4aUrl);
+//        ProcessBuilder builder = new ProcessBuilder();
+//        builder.command(commend);
+//        builder.redirectErrorStream(true);
+//        Process process = builder.start();
+//        process.waitFor();// 等待进程执行结束
+//    }
+//
+//    public static void mergeVideodioAndPcm(String videoInputPath, String audioInputPath, String videoOutPath,String ffmpegUrl) throws InterruptedException, IOException {
+//        /**
+//         *  String command = FFMPEG_PATH + " -i " + videoInputPath + " -i " + audioInputPath
+//         *   + " -c:v copy -c:a aac -strict experimental " +
+//         *   " -map 0:v:0 -map 1:a:0 "
+//         *   + " -y " + videoOutPath;
+//         */
+//        List<String> commend = new ArrayList<String>();
+//        commend.add(ffmpegUrl);
+//        commend.add("-i");
+//        commend.add(videoInputPath);
+//        commend.add("-i");
+//        commend.add(audioInputPath);
+//        commend.add(" -c:v");
+//        commend.add("copy");
+//        commend.add("-c:a");
+//        commend.add("acc");
+//        commend.add("-strict");
+//        commend.add("experimental");
+//        commend.add(videoOutPath);
+//        ProcessBuilder builder = new ProcessBuilder();
+//        builder.command(commend);
+//        builder.redirectErrorStream(true);
+//        Process process = builder.start();
+//        process.waitFor();// 等待进程执行结束
+//    }
+//
+//    public static void main(String[] args) throws InterruptedException, IOException {
+////        videoToPcm("D:\\data\\fill.mp4","D:\\data\\fill.m4a","D:\\java\\ffmpeg\\bin\\ffmpeg.exe");
+////        mergeVideodioAndPcm("D:\\data\\merge.mp4","D:\\data\\fill.m4a","D:\\data\\fill2.mp4","D:\\java\\ffmpeg\\bin\\ffmpeg.exe");
+//        try {
+//			videoToAudio("D:\\data\\test\\fill.mp4","D:\\data\\test\\123.mp3");
+//            String videoInputPath = "D:\\data\\test\\merge.mp4";
+//            String audioInputPath = "D:\\data\\test\\123.mp3";
+//            String videoOutPath = "D:\\data\\test\\fill.mp4";
+//            convetor(videoInputPath,audioInputPath,videoOutPath);
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+//        System.out.println("---------获取音频文件成功!-----------");
+//    }
+//
+//    /**
+//     * @param videoInputPath 原视频的全路径
+//     * @param audioInputPath 音频的全路径
+//     * @param videoOutPath   视频与音频结合之后的视频的路径
+//     * @throws Exception
+//     */
+//    public static void convetor(String videoInputPath, String audioInputPath, String videoOutPath)
+//            throws Exception {
+//        Process process = null;
+//        try {
+//            String command =FFMPEG_PATH + " -i " + videoInputPath + " -i " + audioInputPath + " -c:v copy -c:a aac -strict experimental " +
+//                    " -map 0:v:0 -map 1:a:0 "
+//                    + " -y " + videoOutPath;
+//            System.out.println(command);
+//            process = Runtime.getRuntime().exec(command);
+//            process.waitFor();
+//        } catch (IOException e) {
+//            // TODO Auto-generated catch block
+//            e.printStackTrace();
+//        }
+//        // 使用这种方式会在瞬间大量消耗CPU和内存等系统资源,所以这里我们需要对流进行处理
+//        InputStream errorStream = process.getErrorStream();
+//        InputStreamReader inputStreamReader = new InputStreamReader(errorStream);
+//        BufferedReader br = new BufferedReader(inputStreamReader);
+//
+//        String line = "";
+//        while ((line = br.readLine()) != null) {
+//        }
+//        if (br != null) {
+//            br.close();
+//        }
+//        if (inputStreamReader != null) {
+//            inputStreamReader.close();
+//        }
+//        if (errorStream != null) {
+//            errorStream.close();
+//        }
+//
+//    }
+//
+//    /**
+//     * 从视频中提取音频信息
+//     * @param videoUrl
+//     * @return
+//     */
+//    public static String videoToAudio(String videoUrl,String accFile){
+//        String aacFile = "";
+//        try {
+//            aacFile = TMP_PATH + "/" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date())
+//                    + UUID.randomUUID().toString().replaceAll("-", "") + ".mp3";
+//            String command =   FFMPEG_PATH + " -i "+ videoUrl + " -vn -acodec copy "+ aacFile;
+//            System.out.println("video to audio command : " + command);
+//            Process process = Runtime.getRuntime().exec(command);
+//            process.waitFor();
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+//        return "";
+//    }
+//
+//    /**
+//     * FFmpeg全路径
+//     */
+//    private static final String FFMPEG_PATH = "D:\\java\\ffmpeg\\bin\\ffmpeg.exe";
+//    /**
+//     * 音频保存路径
+//     */
+//    private static final String TMP_PATH = "D:\\data\\test";
+//}

+ 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;
+        }
+    }
+}
+*/

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

@@ -0,0 +1,72 @@
+//package org.jeecg.modules.demo.opencv;
+//
+//import org.opencv.core.Core;
+//import org.opencv.core.Mat;
+//import org.opencv.core.Size;
+//import org.opencv.imgcodecs.Imgcodecs;
+//import org.opencv.imgproc.Imgproc;
+//
+//public class Test {
+//    public static void initVideo(){
+//        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
+//        String srcPath = "D:\\data\\images\\";
+//        String fillPath = "D:\\data\\fill\\";
+//        String targetPath = "D:\\data\\video\\";
+//        //1:切分视频
+////        VideoProcessing.grabberVideoFramer("D://data//video.mp4",srcPath);
+////        VideoProcessing.grabberVideoFramer("D://data//fill.mp4",fillPath);
+//        //2:合并图片
+//        int srcPhoneFrameNumFrom = 163;
+//        int changeSenceFrameNumFrom = 234;
+//        //2.1 复制原始视频无变化图片
+////        for(int i=1;i<srcPhoneFrameNumFrom;i++){
+////            Mat srcNoChangeImage = Imgcodecs.imread(srcPath+i+".jpg");
+////            Imgcodecs.imwrite(targetPath+i+".jpg",srcNoChangeImage);
+////        }
+//        String getImageName = "";
+//        //2.2 填充手机内部图片画面
+//        for (int i = 163; i < changeSenceFrameNumFrom; i++) {
+//            String backImg = srcPath + (i) + ".jpg";
+//            String phoneImg = fillPath + (i - 162) + ".jpg";
+//            String targetImg = targetPath + i + ".jpg";
+//            Perspective.perpectiveImg(backImg, phoneImg, targetImg);
+//            getImageName = targetImg;
+//        }
+//        //2.3 转场动画
+//        Mat image = Imgcodecs.imread(getImageName, Imgcodecs.IMREAD_COLOR);
+//        //(1)径向模糊图片
+//        Mat radialBlur = ImageUtils.radialBlur(image);
+//        Imgcodecs.imwrite(targetPath + changeSenceFrameNumFrom + ".jpg", radialBlur);
+//        changeSenceFrameNumFrom++;
+//        //(2)放大后径向模糊图片
+//        Mat bigImamge = new Mat();
+//        Imgproc.resize(image, bigImamge, new Size(image.cols() * 1.25, image.rows() * 1.25));
+//        Mat destBigImamge = ImageUtils.cutFromCenter(bigImamge, image.width(), image.height());
+//        Mat radialBlurDestBigImamge = ImageUtils.radialBlur(destBigImamge);
+//        Imgcodecs.imwrite(targetPath + changeSenceFrameNumFrom + ".jpg", radialBlurDestBigImamge);
+//        changeSenceFrameNumFrom++;
+//        //(3)缩小之后重复平铺加径向模糊
+//        Mat smallImage = new Mat();
+//        Mat halfImage = new Mat();
+//        Mat wholeImage = new Mat();
+//        Imgproc.resize(image, smallImage, new Size(image.cols() / 2, image.rows() / 2));
+//        ImageUtils.hconcat(smallImage, smallImage, halfImage);
+//        ImageUtils.vconcat(halfImage, halfImage, wholeImage);
+//        wholeImage = ImageUtils.radialBlur(wholeImage);
+//        Imgcodecs.imwrite(targetPath + changeSenceFrameNumFrom + ".jpg", wholeImage);
+//        changeSenceFrameNumFrom++;
+//        //复制填充视频无变化图片
+////        for(int i=changeSenceFrameNumFrom;i<100000;i++){
+////            int checkNum = i-3-srcPhoneFrameNumFrom+1;
+////            String fillImagePath = fillPath+checkNum+".jpg";
+////            File file = new File(fillImagePath);
+////            if(file.exists()){
+////                Mat srcMat = Imgcodecs.imread(fillImagePath);
+////                Imgcodecs.imwrite(targetPath+i+".jpg",srcMat);
+////            }else{
+////                break;
+////            }
+////        }
+//    }
+//
+//}

+ 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;
 	}
 

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

@@ -1,5 +1,6 @@
 package org.jeecg.modules.fileupload.controller;
 
+import cn.com.ctop.common.module.service.IMaterialImageInfoService;
 import cn.com.ctop.common.module.service.IMaterialInfoService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
@@ -27,11 +28,48 @@ public class FileController {
     @Autowired
     private IMaterialInfoService materialInfoService;
 
+    @Autowired
+    private IMaterialImageInfoService materialImageInfoService;
+
     @RequestMapping("file/check")
     public Map<String, Object> chenckFile(String code, Long projectId) {
         return materialInfoService.checkMaterialInfo(code, projectId);
     }
 
+
+
+    @RequestMapping("file/imageCheck")
+    public Map<String, Object> imageCheck(String code, Long projectId) {
+        return materialImageInfoService.checkMaterialInfo(code, projectId);
+    }
+
+
+
+    @PostMapping("/insertV2")
+    public Map<String, Object> insertV2(@RequestBody JSONObject json) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject()
+                .getPrincipal();
+
+        json.put("userId", user.getId());
+        return materialInfoService.correlationUpload(json);
+    }
+
+
+
+
+    @PostMapping("/insertImage")
+    public Map<String, Object> insertImage(@RequestBody JSONObject json) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject()
+                .getPrincipal();
+
+        json.put("userId", user.getId());
+        return materialInfoService.insertImage(json);
+    }
+
+
+
+
+
     @PostMapping("file/insert")
     public Map<String, Object> insertFile(@RequestBody JSONObject json) {
         LoginUser user = (LoginUser) SecurityUtils.getSubject()

+ 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

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

@@ -1,5 +1,6 @@
 server:
   port: 8080
+  ip: 39.106.184.70
   servlet:
     context-path: /jeecg-boot
     compression:
@@ -14,7 +15,7 @@ management:
 
 spring:
   rabbitmq:
-    host: 127.0.0.1
+    host: 39.106.184.70
     port: 5672
     username: guest
     password: guest
@@ -64,10 +65,6 @@ spring:
   autoconfigure:
     exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
   datasource:
-    url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-    username: hcst
-    password: test@20190531
-    driver-class-name: com.mysql.jdbc.Driver
     druid:
       stat-view-servlet:
         enabled: true
@@ -104,8 +101,8 @@ spring:
       datasource:
         master:
           url: jdbc:mysql://39.106.184.70:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-          username: root
-          password: hcst2019
+          username: hcst
+          password: test@20190531
           driver-class-name: com.mysql.jdbc.Driver
           # 多数据源配置
           #multi-datasource1:
@@ -171,4 +168,4 @@ oss:
   replace:
     replace-value: oss-cn-beijing-internal
     replace-old-value: oss-cn-beijing
-    download: /mnt/file/video/
+    download: /mnt/file/video/

+ 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>

+ 91 - 34
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -1,11 +1,17 @@
 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;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
@@ -41,12 +47,12 @@ public class SampleTest {
         try {
 
             QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
-            queryWrapper.eq("account_id",3727345L);
+            queryWrapper.eq("account_id", 3727345L);
             CtopOauthToken token = tokenMapper.selectOne(queryWrapper);
 
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
             Date parse = simpleDateFormat.parse("2020-03-12");
-            kuaishouInterfaceService.getAdvertiserReportDaily(token,parse,parse);
+            kuaishouInterfaceService.getAdvertiserReportDaily(token, parse, parse);
 
 
 //            reportTaskService.createTask(3727345L, "871fc2c248782a94ad2962c941555abc", "");
@@ -70,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";
@@ -129,38 +134,77 @@ 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() {
+        String url = "https://ad.oceanengine.com/open_api/2/kaleidoscope/job/smart_cut/submit/";
+
+        JSONObject conditions = new JSONObject();
+
+        // 1629785592929294
+
+        conditions.put("advertiser_id", "109437044830");
+        JSONObject job = new JSONObject();
+        job.put("job_conf_id", 10);
+        JSONArray input = new JSONArray();
+        JSONObject inputJson = new JSONObject();
+        inputJson.put("task_id", 1);
+        JSONArray videoIds = new JSONArray();
+        videoIds.add("v02033290000bgq1cejpqv6e4k29b2jg");
+        inputJson.put("video_ids", videoIds);
+        JSONArray music_id = new JSONArray();
+        JSONArray image_urls = new JSONArray();
+        JSONArray texts = new JSONArray();
+
+        texts.add("哈哈哈哈,这是一个测试文案");
+        inputJson.put("texts", texts);
+
+        JSONArray tts = new JSONArray();
+        tts.add("true");
+        inputJson.put("tts", tts);
+
+        JSONArray video_ratio = new JSONArray();
+        video_ratio.add("1");
+        inputJson.put("video_ratio", video_ratio);
+
+
+        JSONArray music_style = new JSONArray();
+        music_style.add("1");
+        inputJson.put("music_style", music_style);
+
+        JSONArray video_duration = new JSONArray();
+        video_duration.add("8");
+        inputJson.put("video_duration", video_duration);
+
+
+        JSONArray speed = new JSONArray();
+        speed.add("1.2");
+        inputJson.put("speed", speed);
+
+        job.put("input", inputJson);
+        job.put("mesg", "测试万花筒");
+        conditions.put("job", job);
+
+
+        JSONObject jsonObject = HttpUtils.bytedancePostRequest("8ea30cb02cab8d92b480c4ab01cfc4545fdce33e", url, conditions);
+        System.err.println(jsonObject);
+
+
     }
 
 
@@ -168,3 +212,16 @@ public class SampleTest {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 0 - 1
module-common/src/main/java/cn/com/ctop/common/module/entity/CtopOauthToken.java

@@ -133,7 +133,6 @@ public class CtopOauthToken {
         Date now = new Date();
         this.accessTokenExpiresIn = addSecond(now, expiresIn);
         this.refreshTokenExpiresIn = addSecond(now, refreshTokenExpiresIn);
-        this.createTime = now;
         this.updateTime = now;
     }
 

+ 145 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialImageInfo.java

@@ -0,0 +1,145 @@
+package cn.com.ctop.common.module.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 素材
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-16
+ */
+@Data
+@TableName("ctop_material_image_info")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_material_image_info对象", description = "素材")
+public class MaterialImageInfo {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * code
+     */
+    @Excel(name = "code", width = 15)
+    @ApiModelProperty(value = "code")
+    private String code;
+    /**
+     * url
+     */
+    @Excel(name = "url", width = 15)
+    @ApiModelProperty(value = "url")
+    private Object url;
+    /**
+     * 素材名称
+     */
+    @Excel(name = "素材名称", width = 15)
+    @ApiModelProperty(value = "素材名称")
+    private String videoId;
+    /**
+     * 素材名称
+     */
+    @Excel(name = "素材名称", width = 15)
+    @ApiModelProperty(value = "素材名称")
+    private String materialName;
+    /**
+     * 创建人id
+     */
+    @Excel(name = "创建人id", width = 15)
+    @ApiModelProperty(value = "创建人id")
+    private String userId;
+    /**
+     * 审核人
+     */
+    @Excel(name = "审核人", width = 15)
+    @ApiModelProperty(value = "审核人")
+    private String auditorId;
+    /**
+     * 0-待审核 1-审核通过 2-审核拒绝
+     */
+    @Excel(name = "0-待审核 1-审核通过 2-审核拒绝", width = 15)
+    @ApiModelProperty(value = "0-待审核 1-审核通过 2-审核拒绝")
+    private Integer status;
+    /**
+     * 素材描述
+     */
+    @Excel(name = "素材描述", width = 15)
+    @ApiModelProperty(value = "素材描述")
+    private Object materialDescribe;
+    /**
+     * 项目id
+     */
+    @Excel(name = "项目id", width = 15)
+    @ApiModelProperty(value = "项目id")
+    private Long projectId;
+    /**
+     * 拒绝原因
+     */
+    @Excel(name = "拒绝原因", width = 15)
+    @ApiModelProperty(value = "拒绝原因")
+    private Object refuseReason;
+    /**
+     * 拒绝截图
+     */
+    @Excel(name = "拒绝截图", width = 15)
+    @ApiModelProperty(value = "拒绝截图")
+    private Object refuseFile;
+    /**
+     * width
+     */
+    @Excel(name = "width", width = 15)
+    @ApiModelProperty(value = "width")
+    private String width;
+    /**
+     * 素材类型
+     */
+    @Excel(name = "素材类型", width = 15)
+    @ApiModelProperty(value = "素材类型")
+    private String type;
+    /**
+     * height
+     */
+    @Excel(name = "height", width = 15)
+    @ApiModelProperty(value = "height")
+    private String height;
+    /**
+     * size
+     */
+    @Excel(name = "size", width = 15)
+    @ApiModelProperty(value = "size")
+    private String size;
+
+    private Integer excellent;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+
+    @TableField(exist = false)
+    private String videoUrl;
+
+    @TableField(exist = false)
+    private String auditorName;
+
+}

+ 17 - 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,20 @@ 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;
+
+    @TableField(exist = false)
+    private Boolean whetherUnaudited;  // 是否有未审核封面
+
+
 }

+ 16 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialImageInfoMapper.java

@@ -0,0 +1,16 @@
+package cn.com.ctop.common.module.mapper;
+
+import cn.com.ctop.common.module.entity.MaterialImageInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 素材
+ *
+ * @author: jeecg-boot
+ * @date: 2020-03-16
+ * @cersion: V1.0
+ */
+public interface MaterialImageInfoMapper extends BaseMapper<MaterialImageInfo> {
+    void insertSelective(MaterialImageInfo materialImageInfo);
+
+}

+ 122 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialImageInfoMapper.xml

@@ -0,0 +1,122 @@
+<?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.common.module.mapper.MaterialImageInfoMapper">
+
+    <insert id="insertSelective" parameterType="cn.com.ctop.common.module.entity.MaterialImageInfo" >
+        replace into ctop_material_image_info
+        <trim prefix="(" suffix=")" suffixOverrides="," >
+            <if test="id != null" >
+                id,
+            </if>
+            <if test="code != null" >
+                code,
+            </if>
+            <if test="videoId != null" >
+                video_id,
+            </if>
+            <if test="materialName != null" >
+                material_name,
+            </if>
+            <if test="userId != null" >
+                user_id,
+            </if>
+            <if test="auditorId != null" >
+                auditor_id,
+            </if>
+            <if test="status != null" >
+                status,
+            </if>
+            <if test="projectId != null" >
+                project_id,
+            </if>
+            <if test="width != null" >
+                width,
+            </if>
+            <if test="type != null" >
+                type,
+            </if>
+            <if test="height != null" >
+                height,
+            </if>
+            <if test="size != null" >
+                size,
+            </if>
+            <if test="createTime != null" >
+                create_time,
+            </if>
+            <if test="updateTime != null" >
+                update_time,
+            </if>
+            <if test="url != null" >
+                url,
+            </if>
+            <if test="materialDescribe != null" >
+                material_describe,
+            </if>
+            <if test="refuseReason != null" >
+                refuse_reason,
+            </if>
+            <if test="refuseFile != null" >
+                refuse_file,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides="," >
+            <if test="id != null" >
+                #{id,jdbcType=VARCHAR},
+            </if>
+            <if test="code != null" >
+                #{code,jdbcType=VARCHAR},
+            </if>
+            <if test="videoId != null" >
+                #{videoId,jdbcType=VARCHAR},
+            </if>
+            <if test="materialName != null" >
+                #{materialName,jdbcType=VARCHAR},
+            </if>
+            <if test="userId != null" >
+                #{userId,jdbcType=VARCHAR},
+            </if>
+            <if test="auditorId != null" >
+                #{auditorId,jdbcType=VARCHAR},
+            </if>
+            <if test="status != null" >
+                #{status,jdbcType=INTEGER},
+            </if>
+            <if test="projectId != null" >
+                #{projectId,jdbcType=BIGINT},
+            </if>
+            <if test="width != null" >
+                #{width,jdbcType=VARCHAR},
+            </if>
+            <if test="type != null" >
+                #{type,jdbcType=VARCHAR},
+            </if>
+            <if test="height != null" >
+                #{height,jdbcType=VARCHAR},
+            </if>
+            <if test="size != null" >
+                #{size,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime != null" >
+                #{createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="updateTime != null" >
+                #{updateTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="url != null" >
+                #{url},
+            </if>
+            <if test="materialDescribe != null" >
+                #{materialDescribe},
+            </if>
+            <if test="refuseReason != null" >
+                #{refuseReason},
+            </if>
+            <if test="refuseFile != null" >
+                #{refuseFile},
+            </if>
+        </trim>
+    </insert>
+
+
+</mapper>

+ 26 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialImageInfoService.java

@@ -0,0 +1,26 @@
+package cn.com.ctop.common.module.service;
+
+import cn.com.ctop.common.module.entity.MaterialImageInfo;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.Map;
+
+/**
+ * 素材
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-16
+ */
+public interface IMaterialImageInfoService extends IService<MaterialImageInfo> {
+
+    /**
+     * 根据视频id  关联封面
+     */
+    void insertImage(JSONObject imageJson);
+
+    Map<String, Object> checkMaterialInfo(String code, Long projectId);
+
+
+}

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

@@ -35,9 +35,26 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
 
     void setExcellent(String id, Integer excellent);
 
-    Integer getKuaishouUpVideoCount(@Param("code")String code);
+    Integer getKuaishouUpVideoCount(@Param("code") String code);
 
-    Integer getToutiaoUpVideoCount(@Param("code")String code);
+    Integer getToutiaoUpVideoCount(@Param("code") String code);
 
     JSONObject getGeneralizationInfo(String code);
+
+    /**
+     * 素材库 关联上传素材
+     *
+     * @param json
+     * @return
+     */
+    Map<String, Object> correlationUpload(JSONObject json);
+
+
+    /**
+     * 关联上传封面
+     *
+     * @param json
+     * @return
+     */
+    Map<String, Object> insertImage(JSONObject json);
 }

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

@@ -63,7 +63,7 @@ public class BindAccountAuthServiceImpl extends ServiceImpl<BindAccountAuthMappe
                 .append(KuaishouInterfaceConstant.AUTH_PATH)
                 .append("?app_id=" + PropertiesUtils.getValue("kuaishou_config", "kuaishou_appid"))
                 .append("&state=" + URLEncoder.encode(URLEncoder.encode(state)))
-                .append("&scope=%5B%22report_service%22%2C%22ad_query%22%2C%22ad_manage%22%5D")
+                .append("&scope=%5B%22report_service%22%2C%22ad_query%22%2C%22account_service%22%2C%22ad_manage%22%5D")
                 .append("&redirect_uri=" + URLEncoder.encode(PropertiesUtils.getValue("kuaishou_config", "kuaishou_callback_url"), "UTF-8"));
         return sb.toString();
     }

+ 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);

+ 99 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialImageInfoServiceImpl.java

@@ -0,0 +1,99 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.MaterialImageInfo;
+import cn.com.ctop.common.module.mapper.MaterialImageInfoMapper;
+import cn.com.ctop.common.module.service.IMaterialImageInfoService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 素材
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-16
+ */
+@Slf4j
+@Service
+public class MaterialImageInfoServiceImpl extends ServiceImpl<MaterialImageInfoMapper, MaterialImageInfo> implements IMaterialImageInfoService {
+
+    @Value("${oss.replace.download}")
+    private String downloadUrl;
+
+    @Autowired
+    private MaterialImageInfoMapper materialImageInfoMapper;
+
+
+    @Override
+    public void insertImage(JSONObject imageJson) {
+        String videoId = imageJson.getString("videoId");
+        if (Check.isNull(videoId)) {
+            log.error("视频id不能为空");
+
+        }
+        String userId = imageJson.getString("userId");
+        Long projectId = imageJson.getLong("projectId");
+        JSONArray imageArr = imageJson.getJSONArray("imageArr");
+        for (int i = 0; i < imageArr.size(); i++) {
+            JSONObject json = imageArr.getJSONObject(i);
+            if (!Check.isNull(json)) {
+                MaterialImageInfo materialImageInfo = new MaterialImageInfo();
+                materialImageInfo.setVideoId(videoId);
+                materialImageInfo.setCode(json.getString("code"));
+                materialImageInfo.setMaterialDescribe(json.getString("materialDescribe"));
+                materialImageInfo.setType("IMAGE");
+                materialImageInfo.setHeight(json.getString("height"));
+                materialImageInfo.setWidth(json.getString("width"));
+
+
+                materialImageInfo.setSize(String.valueOf(json.getLong("size") / 1024));
+                materialImageInfo.setUrl("https:" + json.getString("url"));
+                materialImageInfo.setMaterialName(json.getString("materialName"));
+                materialImageInfo.setStatus(0);
+                materialImageInfo.setProjectId(projectId);
+                materialImageInfo.setUserId(userId);
+                materialImageInfoMapper.insertSelective(materialImageInfo);
+
+            }
+
+        }
+
+    }
+
+    @Override
+    public Map<String, Object> checkMaterialInfo(String code, Long projectId) {
+
+
+        Map<String, Object> result = new HashMap<>();
+        QueryWrapper<MaterialImageInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("code", code);
+        queryWrapper.eq("project_id", projectId);
+        queryWrapper.last("limit 1");
+        MaterialImageInfo info = this.getOne(queryWrapper);
+        if (null != info) {
+            //文件已存在
+            ResultMapUtils.setResultMap(result, StatusCode.FILE_HAS_UPLOAD.getCode());
+            result.put("url", info.getUrl());
+            return result;
+        } else {
+            //文件尚未上传
+            ResultMapUtils.setResultMap(result, StatusCode.FILE_HAS_NOT_UPLOAD.getCode());
+            return result;
+        }
+
+    }
+
+
+}

+ 119 - 6
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -5,10 +5,7 @@ import cn.com.ctop.common.module.mapper.MaterialAscriptionMapper;
 import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
 import cn.com.ctop.common.module.mapper.MaterialParameterMapper;
 import cn.com.ctop.common.module.mapper.MaterialTagMapper;
-import cn.com.ctop.common.module.service.IMaterialCutFrameService;
-import cn.com.ctop.common.module.service.IMaterialInfoService;
-import cn.com.ctop.common.module.service.IVideoWatermarkTaskService;
-import cn.com.ctop.common.module.service.IVideoWatermarkTemplateService;
+import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -63,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();
@@ -118,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
@@ -426,6 +421,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
 
     /**
      * 获取素材概括信息
+     *
      * @param code
      * @return
      */
@@ -433,4 +429,121 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     public JSONObject getGeneralizationInfo(String code) {
         return materialInfoMapper.getGeneralizationInfo(code);
     }
+
+
+    @Autowired
+    private IMaterialImageInfoService materialImageInfoService;
+
+    /**
+     * 素材库关联上传素材 1
+     *
+     * @param json
+     * @return
+     */
+    @Override
+    public Map<String, Object> correlationUpload(JSONObject json) {
+        String userId = json.getString("userId");
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            String type = json.getString("type");
+            String url = "";
+            if (!Check.isNull(json.getString("url"))) {
+                url = "https:" + json.getString("url");
+            }
+
+            MaterialInfo info = new MaterialInfo();
+            Long projectId = json.getLong("projectId");
+            String code = json.getString("code");
+            info.setId(code + projectId);
+            info.setCode(code);
+            if (!Check.isNull(json.getString("watermarkUrl"))) {
+                info.setWatermarkUrl(json.getString("watermarkUrl"));
+            }
+            info.setUrl(url);
+            info.setUserId(userId);
+            info.setProjectId(projectId);
+            info.setWatermarkCode(json.getString("watermarkCode"));
+            info.setStatus(0);
+            info.setMaterialName(json.getString("materialName"));
+            info.setWatermarkMaterialName(json.getString("watermarkMaterialName"));
+            info.setMaterialDescribe(json.getString("materialDescribe"));
+            info.setCreateTime(new Date());
+            info.setUpdateTime(new Date());
+            info.setType(type);
+            this.save(info);
+
+            JSONArray imageArr = json.getJSONArray("imageArr");
+            if (!Check.isNull(imageArr)) {
+                JSONObject imageJson = new JSONObject();
+                imageJson.put("videoId", info.getId());
+                imageJson.put("userId", userId);
+                imageJson.put("projectId", projectId);
+                imageJson.put("imageArr", imageArr);
+                materialImageInfoService.insertImage(imageJson);
+            }
+
+            Map<String, Object> deleteMap = new HashMap<>();
+            deleteMap.put("material_id", info.getId());
+            JSONObject ascription = json.getJSONObject("ascription");
+            if (!Check.isNull(ascription)) {
+                MaterialAscription materialAscription = new MaterialAscription();
+                materialAscription.setMaterialId(info.getId());
+                // 剪辑人
+                materialAscription.setClipId(ascription.getString("clipId"));
+                // 拍摄人id
+                materialAscription.setShotId(ascription.getString("shotId"));
+                // 策划id
+                materialAscription.setPlanId(ascription.getString("planId"));
+                //平面id
+                materialAscription.setPlaneId(ascription.getString("planeId"));
+                materialAscriptionMapper.deleteByMap(deleteMap);
+                int i = materialAscriptionMapper.insert(materialAscription);
+                if (i > 0) {
+                    log.info("素材归属信息入库完成,MaterialId:{}", info.getId());
+                }
+
+            }
+
+            JSONArray tag = json.getJSONArray("tag");
+            if (!Check.isNull(tag)) {
+                materialTagMapper.deleteByMap(deleteMap);
+                for (int i = 0; i < tag.size(); i++) {
+                    String tagStr = tag.getString(i);
+                    if (!Check.isNull(tagStr)) {
+                        MaterialTag materialTag = new MaterialTag();
+                        materialTag.setMaterialId(info.getId());
+                        materialTag.setTag(tagStr);
+                        materialTagMapper.insert(materialTag);
+                    }
+                }
+            }
+
+            getFile(info);
+
+            ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
+        } catch (Exception e) {
+            ResultMapUtils.setResultMap(resultMap, StatusCode.MATERIAL_UPLOAD_FAIL.getCode());
+            e.printStackTrace();
+
+        }
+
+
+        return resultMap;
+
+
+    }
+
+    @Override
+    public Map<String, Object> insertImage(JSONObject imageJson) {
+        Map<String, Object> resultMap = new HashMap<>();
+        ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
+        try {
+            materialImageInfoService.insertImage(imageJson);
+        } catch (Exception e) {
+            ResultMapUtils.setResultMap(resultMap, StatusCode.MATERIAL_UPLOAD_FAIL.getCode());
+            e.printStackTrace();
+        }
+
+        return resultMap;
+    }
 }

+ 6 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/Check.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.common.module.utils;
 
+import com.alibaba.fastjson.JSONArray;
 import org.apache.commons.lang3.StringUtils;
 
 import java.util.Collection;
@@ -20,6 +21,11 @@ public class Check {
         return collection == null || collection.size() == 0 ? true : false;
     }
 
+    public static boolean isNull(JSONArray jsonArray) {
+        return jsonArray == null || jsonArray.size() == 0 ? true : false;
+    }
+
+
     public static boolean isNull(String str) {
         return str == null || str.length() <= 0;
     }

+ 5 - 83
module-common/src/main/java/cn/com/ctop/common/module/utils/ExportExcelUtils.java

@@ -1,13 +1,7 @@
 package cn.com.ctop.common.module.utils;
 
-import org.apache.poi.hssf.usermodel.HSSFCellStyle;
-import org.apache.poi.hssf.usermodel.HSSFFont;
-import org.apache.poi.hssf.usermodel.HSSFRichTextString;
-import org.apache.poi.hssf.util.HSSFColor;
-import org.apache.poi.ss.usermodel.BorderStyle;
-import org.apache.poi.ss.usermodel.FillPatternType;
-import org.apache.poi.ss.usermodel.HorizontalAlignment;
-import org.apache.poi.ss.usermodel.IndexedColors;
+
+import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.xssf.usermodel.*;
 
 import java.math.BigDecimal;
@@ -27,82 +21,9 @@ public class ExportExcelUtils {
      * @Title: exportExcel
      * @Description: 导出Excel的方法
      */
-    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);
-        // 设置表格默认列宽度为20个字节
-        sheet.setDefaultColumnWidth((short) 20);
-        // 生成一个样式
-        XSSFCellStyle style = workbook.createCellStyle();
-        // 设置这些样式
-        style.setFillForegroundColor(HSSFColor.PALE_BLUE.index);
-      //  style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
-        style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
-        style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
-        style.setBorderRight(HSSFCellStyle.BORDER_THIN);
-        style.setBorderTop(HSSFCellStyle.BORDER_THIN);
-        style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
-        // 生成一个字体
-        XSSFFont font = workbook.createFont();
-        font.setColor(HSSFColor.BLACK.index);
-        font.setFontHeightInPoints((short) 12);
-        font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
-        // 把字体应用到当前的样式
-        style.setFont(font);
-
-        // 指定当单元格内容显示不下时自动换行
-        style.setWrapText(true);
-
-        // 产生表格标题行
-        XSSFRow row = sheet.createRow(0);
-        for (int i = 0; i < headers.length; i++) {
-            XSSFCell cell = row.createCell((short) i);
-
-            cell.setCellStyle(style);
-            HSSFRichTextString text = new HSSFRichTextString(headers[i]);
-            cell.setCellValue(text.toString());
-        }
-        // 遍历集合数据,产生数据行
-        if (result != null) {
-            int index = 1;
-            for (List<Object> m : result) {
-                row = sheet.createRow(index);
-                int cellIndex = 0;
-                for (Object obj : m) {
-                    XSSFCell cell = row.createCell((short) cellIndex);
-                    if (!Check.isNull(obj)) {
-                        if (obj instanceof String) {
-                            cell.setCellValue((String) obj);
-                        } else if (obj instanceof Double) {
-                            cell.setCellValue((Double) obj);
-                        } else if (obj instanceof BigDecimal) {
-                            BigDecimal bigDecimal = (BigDecimal) obj;
-                            cell.setCellValue(bigDecimal.doubleValue());
-                        } else if (obj instanceof Long) {
-                            Long aLong = Long.valueOf(String.valueOf(obj));
-                            cell.setCellValue(aLong.doubleValue());
-                        } else {
-                            cell.setCellValue(obj.toString());
-                        }
-                    } else {
-                        cell.setCellValue(0);
-                    }
-
-                    cellIndex++;
-                }
-                index++;
-            }
-        }
-    }
 
     public void exportExcel(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);
@@ -117,7 +38,9 @@ public class ExportExcelUtils {
         style.setBorderLeft(BorderStyle.THIN);
         style.setBorderRight(BorderStyle.THIN);
         style.setBorderTop(BorderStyle.THIN);
+        // style.setAlignment(HorizontalAlignment.CENTER);
         style.setAlignment(HorizontalAlignment.CENTER);
+        style.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
         // 生成一个字体
         XSSFFont font = workbook.createFont();
         font.setColor(IndexedColors.BLACK.index);
@@ -133,10 +56,9 @@ public class ExportExcelUtils {
         XSSFRow row = sheet.createRow(0);
         for (int i = 0; i < headers.length; i++) {
             XSSFCell cell = row.createCell((short) i);
-
             cell.setCellStyle(style);
             XSSFRichTextString text = new XSSFRichTextString(headers[i]);
-            cell.setCellValue(headers[i]);
+            cell.setCellValue(text.toString());
         }
         // 遍历集合数据,产生数据行
         if (result != null) {

+ 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());
 ////                        }
 ////                    }
 ////                }

+ 7 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/IMaterialUploadImageService.java

@@ -0,0 +1,7 @@
+package cn.com.ctop.manage.modules.material.service;
+
+public interface IMaterialUploadImageService {
+
+
+    void uploadImage(String id, Long accountId, String accessToken);
+}

+ 164 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadImageServiceImpl.java

@@ -0,0 +1,164 @@
+package cn.com.ctop.manage.modules.material.service.impl;
+
+import cn.com.ctop.common.module.entity.MaterialImageInfo;
+import cn.com.ctop.common.module.enums.MaterialEnum;
+import cn.com.ctop.common.module.service.IMaterialImageInfoService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.LoadFileUtil;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
+import cn.com.ctop.manage.modules.material.service.IMaterialUploadImageService;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.http.ParseException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestTemplate;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Slf4j
+@Service
+public class MaterialUploadImageServiceImpl implements IMaterialUploadImageService {
+    static ExecutorService executorService = Executors.newFixedThreadPool(4);
+    @Value("${oss.replace.replace-value}")
+    private String replaceValue;
+    @Value("${oss.replace.replace-old-value}")
+    private String replaceOldValue;
+    @Value("${oss.replace.download}")
+    private String downloadUrl;
+
+
+    @Autowired
+    private IMaterialImageInfoService materialImageInfoService;
+    @Autowired
+    private IKuaiShouImageGetService imageGetService;
+
+
+    /**
+     * 同步素材到账号下
+     */
+    @Override
+    public void uploadImage(String videoId, Long accountId, String accessToken) {
+
+
+        try {
+            QueryWrapper<MaterialImageInfo> imageInfoQueryWrapper = new QueryWrapper<>();
+            imageInfoQueryWrapper.eq("video_id", videoId);
+            imageInfoQueryWrapper.eq("status", 0);
+            List<MaterialImageInfo> imageList = materialImageInfoService.list(imageInfoQueryWrapper);
+            if (!Check.isNull(imageList)) {
+                for (MaterialImageInfo imageInfo : imageList) {
+
+                    QueryWrapper<KuaiShouImageGet> imageQueryWrapper = new QueryWrapper<>();
+                    imageQueryWrapper.eq("account_id", accountId);
+                    imageQueryWrapper.eq("signature", imageInfo.getCode());
+                    List<KuaiShouImageGet> imageGetList = imageGetService.list(imageQueryWrapper);
+                    if (!Check.isNull(imageGetList)) {
+                        log.info("此封面已上传");
+                        continue;
+                    }
+
+                    String url = String.valueOf(imageInfo.getUrl());
+                    String localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
+                    FileSystemResource resource = new FileSystemResource(new File(localUrl));
+                    Map<String, String> headerMap = new HashMap<>();
+                    JSONObject requestJson = new JSONObject();
+                    requestJson.put("advertiser_id", accountId);
+                    headerMap.put("Access-Token", accessToken);
+                    headerMap.put("Content-Type", "multipart/form-data");
+
+                    requestJson.put("file", resource);
+                    requestJson.put("signature", imageInfo.getCode());
+                    requestJson.put("type", "2");
+                    requestJson.put("upload_type", "1");
+                    String requestUrl = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.IMAGE_UPLOAD;
+                    String result = exceptInfoForRestTemplate(requestUrl, requestJson, headerMap);
+                    JSONObject resultJson = JSONObject.parseObject(result);
+                    if (!Check.isNull(resultJson)) {
+                        if (resultJson.getInteger("code") == 0) {
+                            JSONObject dataJson = resultJson.getJSONObject("data");
+                            if (!Check.isNull(dataJson)) {
+                                String signature = dataJson.getString("signature");
+                                String image_token = dataJson.getString("image_token");
+                                KuaiShouImageGet imageGet = new KuaiShouImageGet();
+                                imageGet.setId(accountId + image_token);
+                                imageGet.setAccountId(accountId);
+                                imageGet.setUrl(dataJson.getString("url"));
+                                imageGet.setWidth(dataJson.getInteger("width"));
+                                imageGet.setHeight(dataJson.getInteger("height"));
+                                imageGet.setSize(dataJson.getInteger("size"));
+                                imageGet.setFormat(dataJson.getString("format"));
+                                Integer type = MaterialEnum.getTypeBySize(dataJson.getInteger("width"), dataJson.getInteger("height"));
+                                if (!Check.isNull(type)) {
+                                    imageGet.setMaterialType(type);
+                                }
+                                imageGet.setSignature(signature);
+                                imageGet.setImageToken(image_token);
+                                imageGetService.saveOrUpdate(imageGet);
+                            }
+
+
+                            log.info("快手封面素材素材同步完成,accountId:{},code:{},返回信息:{}", accountId, imageInfo.getCode(), resultJson);
+                        } else {
+                            log.error("快手同步封面素材失败,返回信息:{},请求参数:{}", resultJson, requestJson);
+                        }
+                    }
+
+
+                }
+
+
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+
+        }
+
+    }
+
+
+    @Autowired
+    private RestTemplate rest;
+
+    private String exceptInfoForRestTemplate(String url, Map<String, Object> paramMap, Map<String, String> headerMap) throws ParseException {
+        try {
+            MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
+            if (!Check.isNullMap(paramMap)) {
+                for (String key : paramMap.keySet()) {
+                    param.add(key, paramMap.get(key));
+                }
+                HttpHeaders headers = new HttpHeaders();
+                if (!Check.isNullMap(headerMap)) {
+                    for (String key : headerMap.keySet()) {
+                        headers.add(key, headerMap.get(key));
+                    }
+                }
+                HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<MultiValueMap<String, Object>>(param, headers);
+                ResponseEntity<String> responseEntity = rest.exchange(url, HttpMethod.POST, httpEntity, String.class);
+                return responseEntity.getBody();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+
+}

+ 31 - 57
module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java

@@ -13,11 +13,11 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import cn.com.ctop.common.module.utils.LoadFileUtil;
 import cn.com.ctop.common.module.utils.PropertiesUtils;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.manage.modules.material.service.IMaterialUploadImageService;
 import cn.com.ctop.manage.modules.material.service.IMaterialUploadService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -71,6 +71,8 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
     private MaterialParameterMapper parameterMapper;
     @Autowired
     private IKuaiShouVideoGetService kuaiShouVideoGetService;
+    @Autowired
+    private IMaterialUploadImageService materialUploadImageService;
 
 
     /**
@@ -195,15 +197,7 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                         public void run() {
                             try {
                                 log.info("快手文件多线程上传:{},accountId:{}", Thread.currentThread().getName(), accountId);
-                                String url = "";
-                                if ("VIDEO".equals(materialInfo.getType())) {
-                                    url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_UPLOAD;
-
-                                } else if ("IMAGE".equals(materialInfo.getType())) {
-                                    url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.IMAGE_UPLOAD;
-                                    requestJson.put("type", "2");
-                                    requestJson.put("upload_type", "1");
-                                }
+                                String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_UPLOAD;
 
                                 String result = exceptInfoForRestTemplate(url, requestJson, headerMap);
                                 JSONObject resultJson = JSONObject.parseObject(result);
@@ -211,56 +205,36 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                                     if (resultJson.getInteger("code") == 0) {
                                         JSONObject dataJson = resultJson.getJSONObject("data");
                                         if (!Check.isNull(dataJson)) {
-                                            if ("IMAGE".equals(materialInfo.getType())) {
-                                                //   kuaishouInterfaceService.imageGet(accountId, ctopOauthToken.getAccessToken(), dataJson.getString("image_token"));
-                                                if (!Check.isNull(dataJson)) {
-                                                    String signature = dataJson.getString("signature");
-                                                    String image_token = dataJson.getString("image_token");
-                                                    KuaiShouImageGet imageGet = new KuaiShouImageGet();
-                                                    imageGet.setId(accountId + image_token);
-                                                    imageGet.setAccountId(accountId);
-                                                    imageGet.setUrl(dataJson.getString("url"));
-                                                    imageGet.setWidth(dataJson.getInteger("width"));
-                                                    imageGet.setHeight(dataJson.getInteger("height"));
-                                                    imageGet.setSize(dataJson.getInteger("size"));
-                                                    imageGet.setFormat(dataJson.getString("format"));
-                                                    Integer type = MaterialEnum.getTypeBySize(dataJson.getInteger("width"), dataJson.getInteger("height"));
-                                                    if (!Check.isNull(type)) {
-                                                        imageGet.setMaterialType(type);
-                                                    }
-                                                    imageGet.setSignature(signature);
-                                                    imageGet.setImageToken(image_token);
-                                                    iKuaiShouImageGetService.saveOrUpdate(imageGet);
-                                                }
 
-                                            } else if ("VIDEO".equals(materialInfo.getType())) {
-                                                // kuaishouInterfaceService.videoGet(accountId, ctopOauthToken.getAccessToken(), dataJson.getString("photo_id"), dataJson.getString("signature"));
-                                                String photoId = dataJson.getString("photo_id");
-                                                String signature = dataJson.getString("signature");
-                                                KuaiShouVideoGet videoGet = new KuaiShouVideoGet();
-                                                videoGet.setAccountId(accountId);
-                                                videoGet.setId(accountId + photoId);
-                                                videoGet.setUrl(materialInfo.getUrl());
-                                                QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
-                                                parameterQueryWrapper.eq("material_id", materialId);
-                                                parameterQueryWrapper.last("limit 1");
-
-                                                MaterialParameter materialParameter = parameterMapper.selectOne(parameterQueryWrapper);
-                                                if (!Check.isNull(materialParameter)) {
-                                                    String width = materialParameter.getWidth();
-                                                    String height = materialParameter.getHeight();
-                                                    videoGet.setWidth(Integer.valueOf(width));
-                                                    videoGet.setHeight(Integer.valueOf(height));
-                                                    Integer type = MaterialEnum.getTypeBySize(Integer.valueOf(width), Integer.valueOf(height));
-                                                    if (!Check.isNull(type)) {
-                                                        videoGet.setMaterialType(type);
-                                                    }
+
+                                            // kuaishouInterfaceService.videoGet(accountId, ctopOauthToken.getAccessToken(), dataJson.getString("photo_id"), dataJson.getString("signature"));
+                                            String photoId = dataJson.getString("photo_id");
+                                            String signature = dataJson.getString("signature");
+                                            KuaiShouVideoGet videoGet = new KuaiShouVideoGet();
+                                            videoGet.setAccountId(accountId);
+                                            videoGet.setId(accountId + photoId);
+                                            videoGet.setUrl(materialInfo.getUrl());
+                                            QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
+                                            parameterQueryWrapper.eq("material_id", materialId);
+                                            parameterQueryWrapper.last("limit 1");
+
+                                            MaterialParameter materialParameter = parameterMapper.selectOne(parameterQueryWrapper);
+                                            if (!Check.isNull(materialParameter)) {
+                                                String width = materialParameter.getWidth();
+                                                String height = materialParameter.getHeight();
+                                                videoGet.setWidth(Integer.valueOf(width));
+                                                videoGet.setHeight(Integer.valueOf(height));
+                                                Integer type = MaterialEnum.getTypeBySize(Integer.valueOf(width), Integer.valueOf(height));
+                                                if (!Check.isNull(type)) {
+                                                    videoGet.setMaterialType(type);
                                                 }
-                                                videoGet.setPhotoId(photoId);
-                                                //    videoGet.setCoverUrl(dataJson.getString("cover_url"));
-                                                videoGet.setSignature(signature);
-                                                kuaiShouVideoGetService.saveOrUpdate(videoGet);
                                             }
+                                            videoGet.setPhotoId(photoId);
+                                            //    videoGet.setCoverUrl(dataJson.getString("cover_url"));
+                                            videoGet.setSignature(signature);
+                                            kuaiShouVideoGetService.saveOrUpdate(videoGet);
+                                            materialUploadImageService.uploadImage(videoGet.getId(), accountId, ctopOauthToken.getAccessToken());
+
                                         }
                                         log.info("快手素材同步完成,accountId:{},code:{},返回信息:{}", accountId, materialInfo.getCode(), resultJson);
                                     } else {

+ 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) {

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

@@ -1052,12 +1052,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
     @Override
     public void loadKuaishouDataSingle(CtopOauthToken token) throws java.text.ParseException {
-        log.info("----------------开始历史数据获取,accountId:{}", token.getAccountId());
-
-        String endDateStr = DateUtils.getDate("yyyy-MM-dd");
-        String startDate = DateUtils.addMonth(endDateStr, -6);
 
-        historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
 
         Date endDate = new Date();
         for (int i = 0; i < 7; i++) {
@@ -1083,9 +1078,15 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         //获取图片信息数据
         getImageList(token, null, null);
 
-
         getAppList(token.getAccountId(), token.getAccessToken());
 
+        log.info("----------------开始历史数据获取,accountId:{}", token.getAccountId());
+
+        String endDateStr = DateUtils.getDate("yyyy-MM-dd");
+        String startDate = DateUtils.addMonth(endDateStr, -6);
+
+        historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
+
 
     }
 
@@ -1547,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) {
@@ -1838,7 +1838,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             JSONObject param = new JSONObject();
             param.put("advertiser_id", advertiserId);
             param.put("creative_id", creativeId);
-            param.put("page_size", 200);
+            param.put("page_size", 500);
             param.put("page", 1);
 
             String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
@@ -1870,7 +1870,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     creative.setCreativeId(detailJson.getLong("creative_id"));
                     creative.setCreativeName(detailJson.getString("creative_name"));
                     creative.setCreativeMaterialType(detailJson.getInteger("creative_material_type"));
-                    creative.setPhotoId(detailJson.getString("photo_id"));
+                    //  creative.setPhotoId(detailJson.getString("photo_id"));
                     if (!Check.isNull(detailJson.getJSONArray("material_url"))) {
                         creative.setMaterialUrl(detailJson.getJSONArray("material_url").toJSONString());
                     }
@@ -1900,7 +1900,30 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     }
                     creative.setCreateTime(new Date());
                     creative.setUpdateTime(new Date());
-                    creatives.add(creative);
+
+
+                    if (detailJson.getLong("photo_id") == 0) {
+                        JSONObject programmed_creative_material = detailJson.getJSONObject("programmed_creative_material");
+                        if (!Check.isNull(programmed_creative_material)) {
+                            JSONArray materials = programmed_creative_material.getJSONArray("materials");
+                            if (!Check.isNull(materials)) {
+                                for (int j = 0; j < materials.size(); j++) {
+                                    JSONObject materialJson = materials.getJSONObject(j);
+                                    if (!Check.isNull(materialJson)) {
+                                        Long photo_id = materialJson.getLong("photo_id");
+                                        creative.setPhotoId(String.valueOf(photo_id));
+                                        creatives.add(creative);
+                                    }
+                                }
+                            }
+                        }
+
+                    } else {
+                        creative.setPhotoId(detailJson.getString("photo_id"));
+                        creatives.add(creative);
+                    }
+
+
                 }
             }
             creativeService.replaceBatch(creatives);
@@ -1955,7 +1978,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     creative.setCreativeId(detailJson.getLong("creative_id"));
                     creative.setCreativeName(detailJson.getString("creative_name"));
                     creative.setCreativeMaterialType(detailJson.getInteger("creative_material_type"));
-                    creative.setPhotoId(detailJson.getString("photo_id"));
+                    //
                     if (!Check.isNull(detailJson.getJSONArray("material_url"))) {
                         creative.setMaterialUrl(detailJson.getJSONArray("material_url").toJSONString());
                     }
@@ -1978,19 +2001,40 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     creative.setClickTrackUrl(detailJson.getString("click_track_url"));
                     creative.setImpressionUrl(detailJson.getString("impression_url"));
                     creative.setAdPhotoPlayedT3sUrl(detailJson.getString("ad_photo_played_t3s_url"));
+                    creative.setCreativeCreateTime(detailJson.getDate("create_time"));
+                    creative.setCreativeUpdateTime(detailJson.getDate("update_time"));
+                    creative.setFirstFrameType(detailJson.getInteger("first_frame_type"));
                     JSONObject displayInfoJson = detailJson.getJSONObject("display_info");
                     if (!Check.isNull(displayInfoJson)) {
                         creative.setDescription(displayInfoJson.getString("description"));
                         creative.setActionBarText(displayInfoJson.getString("action_bar_text"));
                     }
-
-                    creative.setFirstFrameType(detailJson.getInteger("first_frame_type"));
-                    creative.setCreativeCreateTime(detailJson.get("create_time") == null ? null : detailJson.getDate("create_time"));
-                    creative.setCreativeUpdateTime(detailJson.get("update_time") == null ? null : detailJson.getDate("update_time"));
-
                     creative.setCreateTime(new Date());
                     creative.setUpdateTime(new Date());
-                    creatives.add(creative);
+
+                    if (detailJson.getLong("photo_id") == 0) {
+                        JSONObject programmed_creative_material = detailJson.getJSONObject("programmed_creative_material");
+                        if (!Check.isNull(programmed_creative_material)) {
+                            JSONArray materials = programmed_creative_material.getJSONArray("materials");
+                            if (!Check.isNull(materials)) {
+                                for (int j = 0; j < materials.size(); j++) {
+                                    JSONObject materialJson = materials.getJSONObject(j);
+                                    if (!Check.isNull(materialJson)) {
+                                        Long photo_id = materialJson.getLong("photo_id");
+                                        creative.setPhotoId(String.valueOf(photo_id));
+                                        creatives.add(creative);
+                                    }
+                                }
+                            }
+                        }
+
+
+                    } else {
+                        creative.setPhotoId(detailJson.getString("photo_id"));
+                        creatives.add(creative);
+                    }
+
+
                 }
             }
             creativeService.replaceBatch(creatives);

+ 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());
     }
 }

+ 1 - 0
module-kuaishou/src/main/resources/kuaishou_config.properties

@@ -1,6 +1,7 @@
 kuaishou_api_url=https://ad.e.kuaishou.com
 kuaishou_auth_url=https://ad.e.kuaishou.com
 kuaishou_appid=27
+oauth_type=agent
 kuaishou_secret=QovprB1tNhXptgDc
 kuaishou_callback_url=http://adsp.c-top.com.cn:8080/jeecg-boot/kuaishou
 

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

@@ -0,0 +1,284 @@
+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;
+    }
+
+
+    @PostMapping("dailyReport")
+    public Result<JSONObject> dailyReport(@RequestBody JSONObject requestJson) {
+        Result<JSONObject> result = new Result<>();
+        JSONObject hourReport = yiCheReportService.getDailyReport(requestJson);
+        result.setResult(hourReport);
+        return result;
+    }
+
+
+    /**
+     * 导出报表
+     *
+     * @return
+     */
+    @RequestMapping(value = "/exportHourReport")
+    @ResponseBody
+    public void exportHourReport(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();
+    }
+
+
+    @RequestMapping(value = "/exportDailyReport")
+    @ResponseBody
+    public void exportDailyReport(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject requestJson) throws Exception {
+        JSONObject dailyReport = yiCheReportService.getDailyReport(requestJson);
+        JSONObject androidJson = dailyReport.getJSONObject("android");
+
+        // 安卓相关
+        List<List<Object>> androidList = new ArrayList<>();
+        if (!Check.isNull(androidJson)) {
+            List<Object> android = new ArrayList();
+            android.add(androidJson.getString("agent"));
+            android.add(androidJson.getString("media"));
+            android.add(androidJson.getString("systemType"));
+            android.add(androidJson.getString("statDate").replace("-","/"));
+            android.add(androidJson.getBigDecimal("charge"));
+            android.add(androidJson.getBigDecimal("cashCost"));
+            android.add(androidJson.getLong("photoShow"));
+            android.add(androidJson.getLong("photoClick"));
+            android.add(androidJson.getString("clickRate"));
+            android.add(androidJson.getString("impression1kCost"));
+            android.add(androidJson.getLong("bclick"));
+            android.add(androidJson.getString("eventJinJianApp"));
+            android.add(androidJson.getLong("activation"));
+            android.add(androidJson.getLong("youMengactivation"));
+            android.add(androidJson.getLong("tdActivation"));
+            android.add(androidJson.getBigDecimal("activationCost"));
+            android.add(androidJson.getBigDecimal("youMengactivationCost"));
+            android.add(androidJson.getBigDecimal("tdActivationCost"));
+            android.add(androidJson.getBigDecimal("actionCost"));
+            android.add(androidJson.getBigDecimal("clickCost"));
+            android.add(androidJson.getString("actionRatio"));
+            android.add(androidJson.getString("eventJinJianAppRatio"));
+            android.add(androidJson.getString("activationRatio"));
+            androidList.add(android);
+
+        }
+
+
+        JSONObject iosJson = dailyReport.getJSONObject("ios");
+
+        // 安卓相关
+        List<List<Object>> iosList = new ArrayList<>();
+        if (!Check.isNull(iosJson)) {
+            List<Object> ios = new ArrayList();
+            ios.add(iosJson.getString("agent"));
+            ios.add(iosJson.getString("media"));
+            ios.add(iosJson.getString("systemType"));
+            ios.add(iosJson.getString("statDate").replace("-","/"));
+            ios.add(iosJson.getBigDecimal("charge"));
+            ios.add(iosJson.getBigDecimal("cashCost"));
+            ios.add(iosJson.getLong("photoShow"));
+            ios.add(iosJson.getLong("photoClick"));
+            ios.add(iosJson.getString("clickRate"));
+            ios.add(iosJson.getString("impression1kCost"));
+            ios.add(iosJson.getLong("bclick"));
+            ios.add(iosJson.getString("eventJinJianApp"));
+            ios.add(iosJson.getLong("activation"));
+            ios.add(iosJson.getLong("youMengactivation"));
+            ios.add(iosJson.getLong("tdActivation"));
+            ios.add(iosJson.getBigDecimal("activationCost"));
+            ios.add(iosJson.getBigDecimal("youMengactivationCost"));
+            ios.add(iosJson.getBigDecimal("tdActivationCost"));
+            ios.add(iosJson.getBigDecimal("actionCost"));
+            ios.add(iosJson.getBigDecimal("clickCost"));
+            ios.add(iosJson.getString("actionRatio"));
+            ios.add(iosJson.getString("eventJinJianAppRatio"));
+            ios.add(iosJson.getString("activationRatio"));
+            iosList.add(ios);
+        }
+
+
+        // 应用直达
+        JSONObject directApplicationJson = dailyReport.getJSONObject("directApplication");
+        List<List<Object>> directApplicationList = new ArrayList<>();
+        if (!Check.isNull(directApplicationJson)) {
+            List<Object> directApplication = new ArrayList();
+            directApplication.add(directApplicationJson.getString("agent"));
+            directApplication.add(directApplicationJson.getString("media"));
+            directApplication.add(directApplicationJson.getString("systemType"));
+            directApplication.add(directApplicationJson.getString("statDate").replace("-","/"));
+            directApplication.add(directApplicationJson.getBigDecimal("charge"));
+            directApplication.add(directApplicationJson.getBigDecimal("cashCost"));
+            directApplication.add(directApplicationJson.getLong("photoShow"));
+            directApplication.add(directApplicationJson.getLong("photoClick"));
+            directApplication.add(directApplicationJson.getString("clickRate"));
+            directApplication.add(directApplicationJson.getString("impression1kCost"));
+            directApplication.add(directApplicationJson.getLong("bclick"));
+            directApplication.add(directApplicationJson.getString("eventJinJianApp"));
+            directApplication.add(directApplicationJson.getLong("activation"));
+            directApplication.add(directApplicationJson.getLong("youMengactivation"));
+            directApplication.add(directApplicationJson.getLong("tdActivation"));
+            directApplication.add(directApplicationJson.getBigDecimal("activationCost"));
+            directApplication.add(directApplicationJson.getBigDecimal("youMengactivationCost"));
+            directApplication.add(directApplicationJson.getBigDecimal("tdActivationCost"));
+            directApplication.add(directApplicationJson.getBigDecimal("actionCost"));
+            directApplication.add(directApplicationJson.getBigDecimal("clickCost"));
+            directApplication.add(directApplicationJson.getString("actionRatio"));
+            directApplication.add(directApplicationJson.getString("eventJinJianAppRatio"));
+            directApplication.add(directApplicationJson.getString("activationRatio"));
+            directApplicationList.add(directApplication);
+        }
+
+
+        // 应用直达
+        JSONArray channelSubcontractingArr = dailyReport.getJSONArray("channelSubcontracting");
+        List<List<Object>> channelSubcontractingList = new ArrayList<>();
+        if (!Check.isNull(channelSubcontractingArr)) {
+            for (int i = 0; i < channelSubcontractingArr.size(); i++) {
+                JSONObject channelSubcontractingJson = channelSubcontractingArr.getJSONObject(i);
+                List<Object> channelSubcontracting = new ArrayList();
+                channelSubcontracting.add(channelSubcontractingJson.getString("agent"));
+                channelSubcontracting.add(channelSubcontractingJson.getString("systemType"));
+                channelSubcontracting.add(channelSubcontractingJson.getString("statDate").replace("-","/"));
+                channelSubcontracting.add(channelSubcontractingJson.getString("campaignName"));
+                channelSubcontracting.add(channelSubcontractingJson.getBigDecimal("charge"));
+                channelSubcontracting.add(channelSubcontractingJson.getBigDecimal("cashCost"));
+                channelSubcontracting.add(channelSubcontractingJson.getLong("photoShow"));
+                channelSubcontracting.add(channelSubcontractingJson.getLong("photoClick"));
+                channelSubcontracting.add(channelSubcontractingJson.getString("clickRate"));
+                channelSubcontracting.add(channelSubcontractingJson.getString("impression1kCost"));
+                channelSubcontracting.add(channelSubcontractingJson.getLong("bclick"));
+                channelSubcontracting.add(channelSubcontractingJson.getString("eventJinJianApp"));
+                channelSubcontracting.add(channelSubcontractingJson.getLong("activation"));
+                channelSubcontracting.add(channelSubcontractingJson.getLong("youMengactivation"));
+                channelSubcontracting.add(channelSubcontractingJson.getLong("tdActivation"));
+                channelSubcontracting.add(channelSubcontractingJson.getBigDecimal("activationCost"));
+                channelSubcontracting.add(channelSubcontractingJson.getBigDecimal("youMengactivationCost"));
+                channelSubcontracting.add(channelSubcontractingJson.getBigDecimal("tdActivationCost"));
+                channelSubcontracting.add(channelSubcontractingJson.getBigDecimal("actionCost"));
+                channelSubcontracting.add(channelSubcontractingJson.getBigDecimal("clickCost"));
+                channelSubcontracting.add(channelSubcontractingJson.getString("actionRatio"));
+                channelSubcontracting.add(channelSubcontractingJson.getString("eventJinJianAppRatio"));
+                channelSubcontracting.add(channelSubcontractingJson.getString("activationRatio"));
+                channelSubcontractingList.add(channelSubcontracting);
+            }
+
+        }
+
+        String[] iosHeaders = {"代理商", "媒体", "设备", "日期", "账面花费", "现金花费", "曝光", "点击", "点击率", "千次曝光花费", "行为量", "下载完成数", "账户激活量", "友盟激活量", "TD激活量", "账户激活成本", "友盟激活成本", "TD激活成本", "平均行为单价", "平均点击单价", "行为率", "下载完成行为率", "下载完成激活率"};
+        String[] androidHeaders = {"代理商", "媒体", "设备", "日期", "账面花费", "现金花费", "曝光", "点击", "点击率", "千次曝光花费", "行为量", "下载完成数", "账户激活量", "友盟激活量", "TD激活量", "账户激活成本", "友盟激活成本", "TD激活成本", "平均行为单价", "平均点击单价", "行为率", "下载完成行为率", "下载完成激活率"};
+        String[] directApplicationHeaders = {"代理商", "媒体", "设备", "日期", "账面花费", "现金花费", "曝光", "点击", "点击率", "千次曝光花费", "行为量", "下载完成数", "账户激活量", "友盟激活量", "TD激活量", "账户激活成本", "友盟激活成本", "TD激活成本", "平均行为单价", "平均点击单价", "行为率", "下载完成行为率", "下载完成激活率"};
+        String[] channelSubcontractingHeaders = {"代理商", "设备", "日期", "渠道包", "账面花费", "现金花费", "曝光", "点击", "点击率", "千次曝光花费", "行为量", "下载完成数", "账户激活量", "友盟激活量", "TD激活量", "账户激活成本", "友盟激活成本", "TD激活成本", "平均行为单价", "平均点击单价", "行为率", "下载完成行为率", "下载完成激活率"};
+
+        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);
+        eeu.exportExcel(workbook, 2, "应用直达", directApplicationHeaders, directApplicationList);
+        eeu.exportExcel(workbook, 3, "渠道包分包", channelSubcontractingHeaders, channelSubcontractingList);
+
+
+        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();
+        }
+    }
+
+
+}

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

@@ -0,0 +1,21 @@
+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);
+
+    JSONObject getDailyReportByMap(Map<String, Object> requestMap);
+
+    JSONObject getDirectApplicationReportByMap(Map<String, Object> requestMap);
+
+    List<JSONObject> getChannelSubcontractingReportByMap(Map<String, Object> requestMap);
+}

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

@@ -0,0 +1,632 @@
+<?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>
+
+
+    <select id="getDailyReportByMap" parameterType="java.util.Map" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        '汇创' agent, -- 代理商
+        (
+        CASE
+        WHEN t1.media_id = 1 THEN
+        '头条'
+        WHEN t1.media_id = 2 THEN
+        '快手'
+        ELSE
+        '未知'
+        END
+        ) media, -- 媒体
+        t1.system_type systemType, -- 设备
+        t2.stat_date statDate, -- 日期
+        sum(t2.charge) charge, -- 账面花费
+        ROUND(sum(t2.charge) / #{disCount}, 3) cashCost, -- 现金花费
+        sum(t2.photo_show) photoShow, -- 嚗光
+        sum(t2.photo_click) photoClick, -- 点击
+        (
+        CASE
+        WHEN sum(t2.photo_show) != 0 THEN
+        CONCAT(
+        ROUND(
+        (
+        sum(t2.photo_click) / sum(t2.photo_show)
+        ) * 100,
+        3
+        ),
+        '%'
+        )
+        ELSE
+        0
+        END
+        ) clickRate, -- 点击率
+        (
+        CASE
+        WHEN sum(t2.photo_show) != 0 THEN
+        ROUND(
+        (
+        sum(t2.charge) / sum(t2.photo_show)
+        ) * 1000,
+        3
+        )
+        ELSE
+        0
+        END
+        ) impression1kCost, -- 千次嚗光花费
+        sum(t2.bclick) bclick, -- 行为量
+        sum(t2.download_completed) eventJinJianApp, -- 下载完成数
+        sum(t2.activation) activation, -- 账户激活量
+        0 youMengactivation, -- 友盟激活量
+        sum(t2.activation) tdActivation, -- TD激活量
+        (
+        CASE
+        WHEN sum(t2.activation) != 0 THEN
+        ROUND(
+        (sum(t2.charge) / #{disCount}) / sum(t2.activation),
+        3
+        )
+        ELSE
+        0
+        END
+        ) activationCost, -- 账户激活成本
+        0 youMengactivationCost, -- 友盟激活成本
+        (
+        CASE
+        WHEN sum(t2.activation) != 0 THEN
+        ROUND(
+        (sum(t2.charge) / #{disCount}) / sum(t2.activation),
+        3
+        )
+        ELSE
+        0
+        END
+        ) tdActivationCost, -- TD激活成本
+        (
+        CASE
+        WHEN sum(t2.bclick) != 0 THEN
+        ROUND(
+        sum(t2.charge) / sum(t2.bclick),
+        3
+        )
+        ELSE
+        0
+        END
+        ) actionCost, -- 平均行为单价
+        (
+        CASE
+        WHEN sum(t2.photo_click) != 0 THEN
+        ROUND(
+        sum(t2.charge) / sum(t2.photo_click),
+        3
+        )
+        ELSE
+        0
+        END
+        ) clickCost, -- 平均点击单价
+        (
+        CASE
+        WHEN sum(t2.photo_click) != 0 THEN
+        CONCAT(
+        ROUND(
+        sum(t2.bclick) / sum(t2.photo_click),
+        3
+        ) * 100,
+        '%'
+        )
+        ELSE
+        CONCAT(0, '%')
+        END
+        ) actionRatio, -- 行为率
+        (
+        CASE
+        WHEN sum(t2.bclick) != 0 THEN
+        CONCAT(
+        ROUND(
+        sum(t2.download_completed) / sum(t2.bclick),
+        3
+        ) * 100,
+        '%'
+        )
+        ELSE
+        CONCAT(0, '%')
+        END
+        ) eventJinJianAppRatio, -- 下载完成行为率
+        (
+        CASE
+        WHEN sum(t2.download_completed) != 0 THEN
+        CONCAT(
+        ROUND(
+        sum(t2.activation) / sum(t2.download_completed),
+        3
+        ) * 100,
+        '%'
+        )
+        ELSE
+        CONCAT(0, '%')
+        END
+        ) activationRatio -- 下载完成激活率
+        FROM
+        ctop_user_allocation t1
+        LEFT JOIN ctop_kuaishou_report_daily_account t2 ON t1.account_id = t2.account_id
+        where 1 = 1
+        <if test="projectId != null">
+            and t1.project_id = #{projectId}
+        </if>
+        <if test="systemType != null">
+            and t2.stat_date = #{statDate}
+        </if>
+        <if test="systemType != null">
+            and t1.system_type = #{systemType}
+        </if>
+
+    </select>
+
+
+    <select id="getDirectApplicationReportByMap" parameterType="java.util.Map"
+            resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        '汇创' agent, -- 代理商
+        (
+        CASE
+        WHEN t2.media_id = 1 THEN
+        '头条'
+        WHEN t2.media_id = 2 THEN
+        '快手'
+        ELSE
+        '未知'
+        END
+        ) media, -- 媒体
+        t2.system_type systemType, -- 设备
+        t2.stat_date statDate, -- 日期
+        sum(t2.charge) charge, -- 账面花费
+        ROUND(sum(t2.charge) / #{disCount}, 3) cashCost, -- 现金花费
+        sum(t2.photo_show) photoShow, -- 嚗光
+        sum(t2.photo_click) photoClick, -- 点击
+        (
+        CASE
+        WHEN sum(t2.photo_show) != 0 THEN
+        CONCAT(
+        ROUND(
+        (
+        sum(t2.photo_click) / sum(t2.photo_show)
+        ) * 100,
+        3
+        ),
+        '%'
+        )
+        ELSE
+        0
+        END
+        ) clickRate,-- 点击率
+        (
+        CASE
+        WHEN sum(t2.photo_show) != 0 THEN
+        ROUND(
+        (
+        sum(t2.charge) / sum(t2.photo_show)
+        ) * 1000,
+        3
+        )
+        ELSE
+        0
+        END
+        ) impression1kCost, -- 千次嚗光花费
+        sum(t2.bclick) bclick, -- 行为量
+        sum(t2.download_completed) eventJinJianApp, -- 下载完成数
+        sum(t2.activation) activation, -- 账户激活量
+        0 youMengactivation, -- 友盟激活量
+        sum(t2.activation) tdActivation, -- TD激活量
+        (
+        CASE
+        WHEN sum(t2.activation) != 0 THEN
+        ROUND(
+        (sum(t2.charge) / #{disCount}) / sum(t2.activation),
+        3
+        )
+        ELSE
+        0
+        END
+        ) activationCost, -- 账户激活成本
+        0 youMengactivationCost,-- 友盟激活成本
+        (
+        CASE
+        WHEN sum(t2.activation) != 0 THEN
+        ROUND(
+        (sum(t2.charge) / #{disCount}) / sum(t2.activation),
+        3
+        )
+        ELSE
+        0
+        END
+        ) tdActivationCost,-- TD激活成本
+        (
+        CASE
+        WHEN sum(t2.bclick) != 0 THEN
+        ROUND(
+        sum(t2.charge) / sum(t2.bclick),
+        3
+        )
+        ELSE
+        0
+        END
+        ) actionCost,-- 平均行为单价
+        (
+        CASE
+        WHEN sum(t2.photo_click) != 0 THEN
+        ROUND(
+        sum(t2.charge) / sum(t2.photo_click),
+        3
+        )
+        ELSE
+        0
+        END
+        ) clickCost, -- 平均点击单价
+        (
+        CASE
+        WHEN sum(t2.photo_click) != 0 THEN
+        CONCAT(
+        ROUND(
+        sum(t2.bclick) / sum(t2.photo_click),
+        3
+        ) * 100,
+        '%'
+        )
+        ELSE
+        CONCAT(0, '%')
+        END
+        ) actionRatio, -- 行为率
+        (
+        CASE
+        WHEN sum(t2.bclick) != 0 THEN
+        CONCAT(
+        ROUND(
+        sum(t2.download_completed) / sum(t2.bclick),
+        3
+        ) * 100,
+        '%'
+        )
+        ELSE
+        CONCAT(0, '%')
+        END
+        ) eventJinJianAppRatio, -- 下载完成行为率
+        (
+        CASE
+        WHEN sum(t2.download_completed) != 0 THEN
+        CONCAT(
+        ROUND(
+        sum(t2.activation) / sum(t2.download_completed),
+        3
+        ) * 100,
+        '%'
+        )
+        ELSE
+        CONCAT(0, '%')
+        END
+        ) activationRatio -- 下载完成激活率
+        FROM
+        (
+        SELECT
+        t.system_type,
+        t1.*,
+        t.media_id,
+        (
+        CASE
+        WHEN t.system_type = 'android' THEN
+        REPLACE (
+        SUBSTRING_INDEX(t1.campaign_name, '-', 1),
+        'c',
+        ''
+        )
+        WHEN t.system_type = 'ios' THEN
+        REPLACE (
+        SUBSTRING_INDEX(t1.campaign_name, '-', 1),
+        'ks',
+        ''
+        )
+
+        ELSE
+        ''
+        END
+        ) campaignName
+        FROM
+        ctop_user_allocation t
+
+        LEFT JOIN ctop_kuaishou_report_daily_campaign t1 ON t.account_id = t1.account_id
+        WHERE
+        1 = 1
+        <if test="projectId != null">
+            and t.project_id = #{projectId}
+        </if>
+        <if test="systemType != null">
+            and t1.stat_date = #{statDate}
+        </if>
+        ) t2
+        WHERE t2.campaignName &gt;= 845
+        and t2.campaignName &lt;= 850;
+
+    </select>
+
+
+    <select id="getChannelSubcontractingReportByMap" parameterType="java.util.Map"
+            resultType="com.alibaba.fastjson.JSONObject">
+
+
+        SELECT
+        '汇创' agent, -- 代理商
+        (
+        CASE
+        WHEN t2.media_id = 1 THEN
+        '头条'
+        WHEN t2.media_id = 2 THEN
+        '快手'
+        ELSE
+        '未知'
+        END
+        ) media, -- 媒体
+        t2.system_type systemType, -- 设备
+        t2.stat_date statDate, -- 日期
+        t2.campaignName campaignName ,
+        sum(t2.charge) charge, -- 账面花费
+        ROUND(sum(t2.charge) / #{disCount}, 3) cashCost, -- 现金花费
+        sum(t2.photo_show) photoShow, -- 嚗光
+        sum(t2.photo_click) photoClick, -- 点击
+        (
+        CASE
+        WHEN sum(t2.photo_show) != 0 THEN
+        CONCAT(
+        ROUND(
+        (
+        sum(t2.photo_click) / sum(t2.photo_show)
+        ) * 100,
+        3
+        ),
+        '%'
+        )
+        ELSE
+        0
+        END
+        ) clickRate,-- 点击率
+        (
+        CASE
+        WHEN sum(t2.photo_show) != 0 THEN
+        ROUND(
+        (
+        sum(t2.charge) / sum(t2.photo_show)
+        ) * 1000,
+        3
+        )
+        ELSE
+        0
+        END
+        ) impression1kCost, -- 千次嚗光花费
+        sum(t2.bclick) bclick, -- 行为量
+        sum(t2.download_completed) eventJinJianApp, -- 下载完成数
+        sum(t2.activation) activation, -- 账户激活量
+        0 youMengactivation, -- 友盟激活量
+        sum(t2.activation) tdActivation, -- TD激活量
+        (
+        CASE
+        WHEN sum(t2.activation) != 0 THEN
+        ROUND(
+        (sum(t2.charge) / #{disCount}) / sum(t2.activation),
+        3
+        )
+        ELSE
+        0
+        END
+        ) activationCost, -- 账户激活成本
+        0 youMengactivationCost,-- 友盟激活成本
+        (
+        CASE
+        WHEN sum(t2.activation) != 0 THEN
+        ROUND(
+        (sum(t2.charge) / #{disCount}) / sum(t2.activation),
+        3
+        )
+        ELSE
+        0
+        END
+        ) tdActivationCost,-- TD激活成本
+        (
+        CASE
+        WHEN sum(t2.bclick) != 0 THEN
+        ROUND(
+        sum(t2.charge) / sum(t2.bclick),
+        3
+        )
+        ELSE
+        0
+        END
+        ) actionCost,-- 平均行为单价
+        (
+        CASE
+        WHEN sum(t2.photo_click) != 0 THEN
+        ROUND(
+        sum(t2.charge) / sum(t2.photo_click),
+        3
+        )
+        ELSE
+        0
+        END
+        ) clickCost, -- 平均点击单价
+        (
+        CASE
+        WHEN sum(t2.photo_click) != 0 THEN
+        CONCAT(
+        ROUND(
+        sum(t2.bclick) / sum(t2.photo_click),
+        3
+        ) * 100,
+        '%'
+        )
+        ELSE
+        CONCAT(0, '%')
+        END
+        ) actionRatio, -- 行为率
+        (
+        CASE
+        WHEN sum(t2.bclick) != 0 THEN
+        CONCAT(
+        ROUND(
+        sum(t2.download_completed) / sum(t2.bclick),
+        3
+        ) * 100,
+        '%'
+        )
+        ELSE
+        CONCAT(0, '%')
+        END
+        ) eventJinJianAppRatio, -- 下载完成行为率
+        (
+        CASE
+        WHEN sum(t2.download_completed) != 0 THEN
+        CONCAT(
+        ROUND(
+        sum(t2.activation) / sum(t2.download_completed),
+        3
+        ) * 100,
+        '%'
+        )
+        ELSE
+        CONCAT(0, '%')
+        END
+        ) activationRatio -- 下载完成激活率
+        FROM
+        (
+        SELECT
+        t.system_type,
+        t1.*,
+        t.media_id,
+        (
+        CASE
+        WHEN t.system_type = 'android' THEN
+        SUBSTRING_INDEX(t1.campaign_name, '-', 1)
+        WHEN t.system_type = 'ios' THEN
+        SUBSTRING_INDEX(t1.campaign_name, '-', 1)
+        ELSE
+        ''
+        END
+        ) campaignName
+        FROM
+        ctop_user_allocation t
+        LEFT JOIN ctop_kuaishou_report_daily_campaign t1 ON t.account_id = t1.account_id
+        WHERE
+        1 = 1
+        <if test="projectId != null">
+            and t.project_id = #{projectId}
+        </if>
+        <if test="systemType != null">
+            and t1.stat_date = #{statDate}
+        </if>
+        ) t2
+
+        GROUP BY t2.campaignName
+    </select>
+
+
+</mapper>

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

@@ -0,0 +1,9 @@
+package cn.com.ctop.bytedance.service;
+
+import com.alibaba.fastjson.JSONObject;
+
+public interface IKuaiShouYiCheReportService {
+    JSONObject getHourReport(JSONObject requestJson);
+
+    JSONObject getDailyReport(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);
 
         }
 

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

@@ -0,0 +1,127 @@
+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 = requestJson.getString("statDate");
+
+        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");
+            requestMap.put("statDate", statDate);
+            // 账号
+            List<JSONObject> iosReportArr = kuaiShouYiCheReportMapper.selectReportByMap(requestMap);
+
+            // 今日
+
+            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;
+    }
+
+    @Override
+    public JSONObject getDailyReport(JSONObject requestJson) {
+
+        JSONObject returnJson = new JSONObject();
+        try {
+            String statDate = requestJson.getString("statDate");
+            BigDecimal disCount = requestJson.getBigDecimal("disCount");
+            Long projectId = requestJson.getLong("projectId");
+            Map<String, Object> requestMap = new HashMap<>();
+            requestMap.put("disCount", disCount);
+            requestMap.put("projectId", projectId);
+            requestMap.put("statDate", statDate);
+            requestMap.put("systemType", "IOS");
+            JSONObject iosReport = kuaiShouYiCheReportMapper.getDailyReportByMap(requestMap);
+            requestMap.put("systemType", "android");
+            JSONObject androidReport = kuaiShouYiCheReportMapper.getDailyReportByMap(requestMap);
+            returnJson.put("ios", iosReport);
+            returnJson.put("android", androidReport);
+            returnJson.remove("systemType");
+            JSONObject directApplicationReport = kuaiShouYiCheReportMapper.getDirectApplicationReportByMap(requestMap);
+            returnJson.put("directApplication", directApplicationReport); // 应用直达
+            List<JSONObject> channelSubcontractingReport = kuaiShouYiCheReportMapper.getChannelSubcontractingReportByMap(requestMap);
+            returnJson.put("channelSubcontracting", channelSubcontractingReport); // 渠道包分析
+
+        } catch (Exception e) {
+            e.printStackTrace();
+
+        }
+        return returnJson;
+    }
+}

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

@@ -224,6 +224,7 @@ public class ReportServiceImpl implements IReportService {
         config.propertyNamingStrategy = PropertyNamingStrategy.SnakeCase;
         var jsonObject = JSONObject.parseObject(JSON.toJSONString(conditions, config));
         JSONObject getObject = getAdStat(token, jsonObject);
+//        log.warn(getObject.toJSONString());
         if (null == getObject) {
             log.error("广告计划报表数据获取异常=》account:{};message:{}", token.getAccountId(), "返回数据异常");
             return;

+ 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 {
+
+}