Jelajahi Sumber

Merge remote-tracking branch 'origin/V1.1.8' into V1.1.8

zhaoxian 4 tahun lalu
induk
melakukan
9197cd6c3b
100 mengubah file dengan 3277 tambahan dan 770 penghapusan
  1. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  2. 15 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AiKuaishouAdvertiserStrategyController.java
  3. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  4. 53 66
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  5. 25 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProductController.java
  6. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  7. 72 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  8. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ProjectMember.java
  9. 6 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/ProjectMemberMapper.java
  10. 15 15
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MaterialReportOverViewMapper.xml
  11. 50 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ProjectMemberMapper.xml
  12. 7 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IProjectMemberService.java
  13. 37 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java
  14. 63 58
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java
  15. 2 2
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  16. 2 2
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  17. 6 6
      jeecg-boot-module-system/src/main/resources/application-test.yml
  18. 11 11
      jeecg-boot-module-system/src/main/resources/application-wps.yml
  19. 1 0
      jeecg-boot-module-system/src/main/resources/application.yml
  20. 21 15
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  21. 9 1
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java
  22. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/Product.java
  23. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/entity/SysUserDepart.java
  24. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java
  25. 4 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/ProductMapper.java
  26. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java
  27. 4 4
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml
  28. 34 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ProductMapper.xml
  29. 27 1
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml
  30. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/ICtopCorpWexinUserService.java
  31. 3 3
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  32. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IProductService.java
  33. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java
  34. 11 2
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopCorpWexinUserServiceImpl.java
  35. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java
  36. 72 54
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  37. 7 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/ProductServiceImpl.java
  38. 2 2
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/SysDepartServiceImpl.java
  39. 10 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java
  40. 95 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/ChaojiyingUtils.java
  41. 4 0
      module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java
  42. 34 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceVideoETLReportReloadJob.java
  43. 20 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/SendHourlyMessageJob.java
  44. 11 0
      module-job-bytedance/src/main/resources/application.yml
  45. 2 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCreateUnitJob.java
  46. 2 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouLandpageJob.java
  47. 1 1
      module-job-kuaishou/src/main/resources/application-prod.yml
  48. 12 1
      module-job-kuaishou/src/main/resources/application.yml
  49. 21 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouCreateCreativeController.java
  50. 257 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaiShouAppMultipleBidsController.java
  51. 7 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAdvertiserStrategy.java
  52. 135 68
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouCreativeLevelOperationRecord.java
  53. 295 148
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouUnitLevelOperationRecord.java
  54. 79 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/KuaiShouAppMultipleBids.java
  55. 21 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaiShouAppMultipleBidsMapper.java
  56. 36 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaiShouAppMultipleBidsMapper.xml
  57. 4 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouDirectionalPackageMapper.xml
  58. 2 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouDirectionalPckageRelMapper.xml
  59. 5 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouCreateCreativeService.java
  60. 21 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaiShouAppMultipleBidsService.java
  61. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaishouAccountCreativeOverrunInfoService.java
  62. 446 164
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java
  63. 48 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaiShouAppMultipleBidsServiceImpl.java
  64. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouAppListService.java
  65. 6 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/CrossAccountBatchServiceImpl.java
  66. 10 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouAppListServiceImpl.java
  67. 4 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java
  68. 27 66
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  69. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java
  70. 18 18
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsNewGroupReportCtrl.java
  71. 6 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAccount.java
  72. 6 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportHourlyAccount.java
  73. 30 28
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouAccountMaterialReportDailyMapper.xml
  74. 8 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml
  75. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportHourlyAccountMapper.xml
  76. 3 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/constant/QYWxConstant.java
  77. 9 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/IAppchatCreateService.java
  78. 2 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/IWechatUserListService.java
  79. 108 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/AppchatCreateServiceImpl.java
  80. 10 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatUserListServiceImpl.java
  81. 247 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceCreativeWordPackageController.java
  82. 202 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/BytedanceAccountCommonSlogenController.java
  83. 108 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceCreativeWordPackage.java
  84. 53 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/BytedanceAccountCommonSlogen.java
  85. 4 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/BytedanceVideoSlogenInfo.java
  86. 18 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/ByteDanceCreativeWordPackageMapper.java
  87. 17 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/BytedanceAccountCommonSlogenMapper.java
  88. 29 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/ByteDanceCreativeWordPackageMapper.xml
  89. 5 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/BytedanceAccountCommonSlogenMapper.xml
  90. 21 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IByteDanceCreativeWordPackageService.java
  91. 14 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IBytedanceAccountCommonSlogenService.java
  92. 5 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IEtlBytedanceVideoInfoService.java
  93. 66 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceCreativeWordPackageServiceImpl.java
  94. 18 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceAccountCommonSlogenServiceImpl.java
  95. 5 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceVideoSlogenInfoServiceImpl.java
  96. 17 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/EtlBytedanceVideoInfoServiceImpl.java
  97. 4 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/EtlBytedanceReportVideoDailyMapper.java
  98. 34 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/EtlBytedanceReportVideoDailyMapper.xml
  99. 1 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java
  100. 0 0
      module-toutiao/src/main/resources/bytedance_config.properties

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

@@ -198,6 +198,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/ai/create/*", "anon");
         //filterChainDefinitionMap.put("/overView/*", "anon");
         filterChainDefinitionMap.put("/kuaishouCrowdPack/**", "anon");
+        filterChainDefinitionMap.put("/kuaishou/batch/*", "anon");
 
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);

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

@@ -3,13 +3,16 @@ package org.jeecg.modules.ctop.controller;
 import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.QueryGenerator;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAdvertiserStrategyService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaiShouAppMultipleBidsService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouVideoRelateCreativesService;
 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;
@@ -43,6 +46,8 @@ public class AiKuaishouAdvertiserStrategyController {
     private IUserAllocationService allocationService;
     @Autowired
     private ISysRoleService sysRoleService;
+    @Autowired
+    private IKuaiShouAppMultipleBidsService kuaiShouAppMultipleBidsService;
 
     /**
      * 分页列表查询
@@ -254,6 +259,8 @@ public class AiKuaishouAdvertiserStrategyController {
      * @param id
      * @return
      */
+
+
     @GetMapping(value = "/queryById")
     public Result<AiKuaishouAdvertiserStrategy> queryById(@RequestParam(name = "id", required = true) String id) {
         Result<AiKuaishouAdvertiserStrategy> result = new Result<>();
@@ -261,6 +268,14 @@ public class AiKuaishouAdvertiserStrategyController {
         if (aiKuaishouAdvertiserStrategy == null) {
             result.error500("未找到对应实体");
         } else {
+            if (aiKuaishouAdvertiserStrategy.getMultipleBids() == 1) {
+                List<JSONObject> appInfoList = kuaiShouAppMultipleBidsService.getAppInfiList(aiKuaishouAdvertiserStrategy.getAccountId(), aiKuaishouAdvertiserStrategy.getAppIdArray());
+                if (!Check.isNull(appInfoList)) {
+                    aiKuaishouAdvertiserStrategy.setAppInfoList(appInfoList);
+
+                }
+            }
+
             result.setResult(aiKuaishouAdvertiserStrategy);
             result.setSuccess(true);
         }

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

@@ -64,6 +64,8 @@ public class CallbackController {
                         HttpServletResponse response,
                         @RequestParam("code") String code,
                         @RequestParam("state") String state) throws IOException {
+        System.err.println("code:" + code);
+        System.err.println("state:" + state);
         response.sendRedirect(state + "?code=" + code);
     }
 

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

@@ -20,6 +20,7 @@ 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.constant.CommonConstant;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
@@ -64,8 +65,6 @@ public class MaterialInfoController {
     @Autowired
     private IMaterialImageInfoService iMaterialImageInfoService;
     @Autowired
-    private IProjectService projectService;
-    @Autowired
     private IMessageTemplate messageTemplate;
     @Autowired
     private ISysRoleService roleService;
@@ -73,6 +72,8 @@ public class MaterialInfoController {
     private ISendMessageService sendMessageService;
     @Autowired
     private IBytedanceVideoSlogenInfoService slogenInfoService;
+    @Autowired
+    private IProductService productService;
 
 
     @GetMapping("/supplierWatermark")
@@ -219,10 +220,10 @@ public class MaterialInfoController {
                 String userId = materialInfo.getUserId();
                 materialInfo.setUserId(null);
                 queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
-                if (Check.isNull(materialInfo.getProjectId())) {
-                    List<Long> projects = memberService.selectProjectsByUserId(userId);
-                    if (!Check.isNull(projects)) {
-                        queryWrapper.in("project_id", projects);
+                if (Check.isNull(materialInfo.getProductId())) {
+                    List<Long> products = memberService.selectProductsByUserId(userId);
+                    if (!Check.isNull(products)) {
+                        queryWrapper.in("product_id", products);
                     } else {
                         result.setSuccess(true);
                         result.setResult(null);
@@ -272,13 +273,6 @@ public class MaterialInfoController {
                     String byteDanceString = JsonUtil.objectToJson(byteDance);
                     material.setByteDance(JSONObject.parseObject(byteDanceString));
                 }
-
-                Project project = projectService.getById(material.getProjectId());
-                if (!Check.isNull(project)) {
-                    material.setMediaId(project.getMediaId());
-                    material.setProjectName(project.getProjectName());
-                }
-
                 QueryWrapper<MaterialImageInfo> imageInfoQueryWrapper = new QueryWrapper<>();
                 imageInfoQueryWrapper.eq("video_id", material.getCode());
                 imageInfoQueryWrapper.eq("status", 0);
@@ -292,12 +286,12 @@ public class MaterialInfoController {
     }
 
     @GetMapping(value = "/listV2")
-    public Map<String, Object> queryPageList(String type, Integer status, Long projectId, String materialName, String code,
+    public Map<String, Object> queryPageList(String type, Integer status, Long productId, String materialName, String code,
                                              String startDate, String endDate, String tagCode,
                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        List<Long> projectIds = null;
+        List<Long> productIds = null;
         String userId = user.getId();
         String roleCode = roleService.getRoleCodeByUserId(userId);
         if (null == tagCode || "".equals(tagCode.trim())) {
@@ -305,27 +299,28 @@ public class MaterialInfoController {
         }
         if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || roleCode.contains("sale")) {
             //查询所有
-            if (null != projectId && projectId != 0) {
-                projectIds = new ArrayList<>();
-                projectIds.add(projectId);
+            if (null != productId && productId != 0) {
+                productIds = new ArrayList<>();
+                productIds.add(productId);
             }
-            return materialInfoService.getListByParams(tagCode, type, status, projectIds, materialName, code, startDate, endDate, null, pageNo, pageSize);
+            return materialInfoService.getListByParams(tagCode, type, status, productIds, materialName, code, startDate, endDate, null, pageNo, pageSize);
         } else if ("designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode) || "plane".equals(roleCode) || "plan".equals(roleCode) || "shot".equals(roleCode)) {
             //查询自己所在项目下的数据
-            if (null == projectId || projectId == 0) {
-                projectIds = memberService.selectProjectsByUserId(userId);
+            if (null == productId || productId == 0) {
+                productIds = memberService.selectProductsByUserId(userId);
+
             } else {
-                projectIds = new ArrayList<>();
-                projectIds.add(projectId);
+                productIds = new ArrayList<>();
+                productIds.add(productId);
             }
-            return materialInfoService.getListByParams(tagCode, type, status, projectIds, materialName, code, startDate, endDate, null, pageNo, pageSize);
+            return materialInfoService.getListByParams(tagCode, type, status, productIds, materialName, code, startDate, endDate, null, pageNo, pageSize);
         } else {
             //查询自己上传的视频
-            if (null != projectId && projectId != 0) {
-                projectIds = new ArrayList<>();
-                projectIds.add(projectId);
+            if (null != productId && productId != 0) {
+                productIds = new ArrayList<>();
+                productIds.add(productId);
             }
-            return materialInfoService.getListByParams(tagCode, type, status, projectIds, materialName, code, startDate, endDate, userId, pageNo, pageSize);
+            return materialInfoService.getListByParams(tagCode, type, status, productIds, materialName, code, startDate, endDate, userId, pageNo, pageSize);
         }
     }
 
@@ -378,12 +373,6 @@ public class MaterialInfoController {
         List<MaterialInfo> materialInfoList = pageList.getRecords();
         if (materialInfoList.size() != 0) {
             for (MaterialInfo material : materialInfoList) {
-                Project project = projectService.getById(material.getProjectId());
-                if (!Check.isNull(project)) {
-                    material.setMediaId(project.getMediaId());
-                    material.setProjectName(project.getProjectName());
-                }
-
                 QueryWrapper<MaterialImageInfo> imageInfoQueryWrapper = new QueryWrapper<>();
                 imageInfoQueryWrapper.eq("video_id", material.getCode());
                 imageInfoQueryWrapper.eq("status", 0);
@@ -427,7 +416,7 @@ public class MaterialInfoController {
 
 
     /**
-     * 批量修改项目
+     * 批量修改产品
      *
      * @param jsonObject
      * @return
@@ -436,13 +425,13 @@ public class MaterialInfoController {
     public Result<MaterialInfo> batchEdit(@RequestBody JSONObject jsonObject) {
         Result<MaterialInfo> result = new Result<>();
         try {
-            Long projectId = jsonObject.getLong("projectId");
+            Long productId = jsonObject.getLong("productId");
             JSONArray materialIds = jsonObject.getJSONArray("materialIds");
             for (int i = 0; i < materialIds.size(); i++) {
                 String materialId = materialIds.getString(i);
                 MaterialInfo updateMaterial = new MaterialInfo();
                 updateMaterial.setId(materialId);
-                updateMaterial.setProjectId(projectId);
+                updateMaterial.setProductId(productId);
                 materialInfoService.updateById(updateMaterial);
 
             }
@@ -533,13 +522,33 @@ public class MaterialInfoController {
         Integer status = materialInfo.getStatus();
         // 如果状态为2 审核拒绝 给上传人发送消息
         if (status == 2) {
-            Project project = projectService.getById(materialInfoEntity.getProjectId());
-            String text = messageTemplate.getMaterialRejectTemplate(project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
+            Product product = productService.getById(materialInfoEntity.getProductId());
+            String text = messageTemplate.getMaterialRejectTemplate(product.getProductName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
             sendMessageService.sendMessage(materialInfoEntity.getUserId(), text);
         }
         return result;
 
     }
+
+    /**
+     * 头条素材信息编辑 -- 批量通过审核
+     * @param materialInfo
+     * @return
+     */
+    @PutMapping(value = "/bytedance/batchedit")
+    public Result<MaterialInfo> bytedanceBatchEdit(@RequestBody MaterialInfo materialInfo) {
+        Result<MaterialInfo> result = new Result<>();
+        String[] ids = materialInfo.getIds();
+        int successNum = 0;
+        for (String id : ids) {
+            materialInfo.setId(id);
+            Result<MaterialInfo> materialInfoResult = bytedanceEdit(materialInfo);
+            if(materialInfoResult.getCode().equals(CommonConstant.SC_OK_200)){ successNum++;}
+        }
+        return result.success("批量修改成功"+successNum+"个");
+
+    }
+
     /**
      * 通过id删除
      *
@@ -724,28 +733,6 @@ public class MaterialInfoController {
             }
         }
 
-        //  审核通过自动同步到到媒体后台
-       /* Long projectId = materialInfoEntity.getProjectId();
-        Project project = projectService.getById(projectId);
-        if (!Check.isNull(projectId)) {
-            if ("2".equals(project.getMediaId())) {
-                if (!Check.isNull(materialInfo.getStatus())) {
-                    Integer status = materialInfo.getStatus();
-                    if (status == 1) {
-                        Thread thread = new Thread() {
-                            @Override
-                            public void run() {
-                                log.info("开始自动同步素材,code:{}", materialInfoEntity.getCode());
-                                uploadService.upload(materialInfoEntity);
-                            }
-                        };
-                        thread.start();
-                    }
-                }
-            }
-
-        }*/
-
         boolean ok = materialInfoService.updateById(materialInfo);
         if (ok) {
             result.success("修改成功!");
@@ -754,8 +741,8 @@ public class MaterialInfoController {
         Integer status = materialInfo.getStatus();
         // 如果状态为2 审核拒绝 给上传人发送消息
         if (status == 2) {
-            Project project = projectService.getById(materialInfoEntity.getProjectId());
-            String text = messageTemplate.getMaterialRejectTemplate(project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
+            Product product = productService.getById(materialInfoEntity.getProductId());
+            String text = messageTemplate.getMaterialRejectTemplate(product.getProductName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
             sendMessageService.sendMessage(materialInfoEntity.getUserId(), text);
         }
         return result;
@@ -771,9 +758,9 @@ public class MaterialInfoController {
         QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
         if (!Check.isNull(requestBody.getString("userId"))) {
             queryWrapper.eq("user_id", requestBody.getString("userId"));
-            List<Long> projects = memberService.getProjectByAccountIds(requestBody.getJSONArray("accountIds"));
-            if (!Check.isNull(projects)) {
-                queryWrapper.in("project_id", projects);
+            List<Long> products = memberService.getProductByAccountIds(requestBody.getJSONArray("accountIds"));
+            if (!Check.isNull(products)) {
+                queryWrapper.in("product_id", products);
             }
         }
         queryWrapper.orderByDesc(true, "create_time");

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

@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.entity.Product;
 import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.mapper.ProjectMapper;
 import cn.com.ctop.common.module.service.IProductService;
+import cn.com.ctop.common.module.service.ISysRoleExtService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.QueryGenerator;
@@ -17,6 +18,7 @@ import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.ctop.entity.ProjectMember;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -52,7 +54,8 @@ import java.util.Map;
 public class ProductController {
     @Autowired
     private IProductService productService;
-
+    @Autowired
+    private ISysRoleExtService sysRoleService;
     /**
      * 分页列表查询
      *
@@ -97,6 +100,27 @@ public class ProductController {
         return result;
     }
 
+    @GetMapping(value = "/getUserProductList")
+    public Result<IPage<Product>> getUserProductList(String userId,String productName,
+                                                          @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                          HttpServletRequest req) {
+        Result<IPage<Product>> result = new Result<>();
+        if (Check.isNull(userId)) {
+            result.setSuccess(false);
+            result.setMessage("未获取到用户信息");
+            return result;
+        }
+        String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+        if ("admin".equals(roleCode) || roleCode.contains("sale") || "meidaManager".equals(roleCode)) {
+            userId = null;
+        }
+        Page<Product> page = new Page<>(pageNo, pageSize);
+        IPage<Product> pageList = productService.getUserProductList(page,userId,productName);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
 
     /**
      * 添加

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

@@ -1441,7 +1441,7 @@ public class TestController {
     public Map<String, Object> getData(Long accountId) {
         Map<String, Object> result = new HashMap<>();
         CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
-        reportService.getAdvertiserReport(token, DateUtils.parseDate("2021-01-01", "yyyy-MM-dd"), DateUtils.parseDate("2021-01-31", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        reportService.getAdvertiserReport(token, DateUtils.parseDate("2021-03-01", "yyyy-MM-dd"), DateUtils.parseDate("2021-03-31", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }

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

@@ -15,6 +15,8 @@ import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.QueryGenerator;
 import cn.com.ctop.common.module.utils.StringUtils;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAdvertiserBaseInfo;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAdvertiserBaseInfoService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import com.alibaba.fastjson.JSONObject;
@@ -35,6 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -69,8 +72,76 @@ public class UserAllocationController {
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
     @Autowired
+    private IKuaiShouAdvertiserBaseInfoService kuaiShouAdvertiserBaseInfoService;
+    @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
-
+    @GetMapping(value = "/getUserIdListByProductId")
+    public Result<List<JSONObject>> getUserIdListByProductId(Long productId) {
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+            if (Check.isNull(productId)) {
+                throw new Exception("请选择产品id");
+            }
+            List<JSONObject> userIdList = userAllocationService.getUserIdListByProductId(productId);
+            result.setSuccess(true);
+            result.setResult(userIdList);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.success(e.getMessage());
+        }
+        return result;
+    }
+    @GetMapping(value = "/getAccountListByUserIdAndProductId")
+    public Result<List<ProjectMember>> getAccountListByUserIdAndProductId(String userId,Long productId,Integer mediaId){
+        Result<List<ProjectMember>> result = new Result<>();
+        String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+        if ("admin".equals(roleCode)) {
+            userId = null;
+        }
+        List<Integer> mediaList = new ArrayList<>();
+        mediaList.add(mediaId);
+    //    List<ProjectMember> projectList = projectMemberService.getOwnProjects(mediaList);
+        List<ProjectMember> productList = projectMemberService.getOwnProducts(mediaList,productId);
+        log.info("產品列表:{}",productList);
+
+      //  projectMemberService.getOwnProjects(mediaList);
+        List<ProjectMember> projectMemberList = new ArrayList<>();
+        for (ProjectMember projectMember: productList){
+            if (!projectMember.getProductId().equals(productId)){
+                continue;
+            }
+            List<UserAllocation> userAllocationList = userAllocationService.getAccountListByUserIdAndProductId(userId,projectMember.getProjectId(),productId);
+            projectMember.setUserAllocationList(userAllocationList);
+            projectMemberList.add(projectMember);
+        }
+        result.setResult(projectMemberList);
+        result.setSuccess(true);
+        return result;
+    }
+    @GetMapping(value = "/getBytedanceAccountListByUserIdAndProductId")
+    public Result<List<ProjectMember>> getBytedanceAccountListByUserIdAndProductId(String userId,Long productId,Integer mediaId){
+        Result<List<ProjectMember>> result = new Result<>();
+        String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+        if ("admin".equals(roleCode)) {
+            userId = null;
+        }
+        List<Integer> mediaList = new ArrayList<>();
+        mediaList.add(mediaId);
+        List<ProjectMember> projectList = projectMemberService.getOwnProjects(mediaList);
+        projectMemberService.getOwnProjects(mediaList);
+        List<ProjectMember> projectMemberList = new ArrayList<>();
+        for (ProjectMember projectMember: projectList){
+            if (projectMember.getProductId() != productId){
+                continue;
+            }
+            List<UserAllocation> userAllocationList = userAllocationService.getAccountListByUserIdAndProductId(userId,projectMember.getProjectId(),productId);
+            projectMember.setUserAllocationList(userAllocationList);
+            projectMemberList.add(projectMember);
+        }
+        result.setResult(projectMemberList);
+        result.setSuccess(true);
+        return result;
+    }
 
     @GetMapping(value = "/accountTurnProject")
     public Result<Object> getAccountList(Long accountId, Long projectId) {

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

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ctop.entity;
 
+import cn.com.ctop.common.module.entity.UserAllocation;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -15,6 +16,7 @@ import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 项目成员
@@ -95,6 +97,9 @@ public class ProjectMember implements Serializable {
     @TableField(exist = false)
     private String productName;
 
+    @TableField(exist = false)
+    private List<UserAllocation> userAllocationList;
+
 
     /**
      * 创建时间

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

@@ -20,6 +20,8 @@ public interface ProjectMemberMapper extends BaseMapper<ProjectMember> {
 
     List<Long> selectProjectsByUserId(@Param("userId") String userId);
 
+    List<Long> selectProductsByUserId(@Param("userId") String userId);
+
     List<ProjectMember> adminProjects(@Param("mediaIds")List<Integer> mediaIds);
 
     List<ProjectMember> designLeaderProjects(@Param("companyId")String companyId ,@Param("mediaIds")List<Integer> mediaIds);
@@ -43,5 +45,9 @@ public interface ProjectMemberMapper extends BaseMapper<ProjectMember> {
 
     List<Long> getProjectByAccountIds(@Param("accountIds")JSONArray accountIds);
 
+    List<Long> getProductByAccountIds(@Param("accountIds")JSONArray accountIds);
+
     List<JSONObject> getProjectByUserIdAndMediaIds(@Param("userId") String userId, @Param("mediaIds") List<Integer> mediaIds);
+
+    List<ProjectMember> getProductIds(@Param("userId") String userId,@Param("mediaList") List<Integer> mediaList,@Param("productId") Long productId);
 }

+ 15 - 15
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MaterialReportOverViewMapper.xml

@@ -88,7 +88,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_datetime >= #{startDate}
+        AND stat_datetime &gt;= #{startDate}
         AND stat_datetime &lt;= #{endDate}
     </select>
 
@@ -106,7 +106,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_date >= #{startDate}
+        AND stat_date &gt;= #{startDate}
         AND stat_date &lt;= #{endDate}
     </select>
 
@@ -122,7 +122,7 @@
                 #{item}
             </foreach>
         </if>
-        AND DATE_FORMAT(create_time, '%Y-%m-%d')>= #{startDate}
+        AND DATE_FORMAT(create_time, '%Y-%m-%d')&gt;= #{startDate}
         AND DATE_FORMAT(create_time, '%Y-%m-%d')&lt;= #{endDate}
     </select>
 
@@ -155,7 +155,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_datetime >= #{startDate}
+        AND stat_datetime &gt;= #{startDate}
         AND stat_datetime &lt;= #{endDate}
         group by stat_datetime
         order by stat_datetime
@@ -176,7 +176,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_datetime >= #{startDate}
+        AND stat_datetime &gt; #{startDate}
         AND stat_datetime &lt;= #{endDate}
         group by DATE_FORMAT(stat_datetime, '%Y-%m')
         order by stat_datetime asc
@@ -197,7 +197,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_date >= #{startDate}
+        AND stat_date &gt;= #{startDate}
         AND stat_date &lt;= #{endDate}
         group by stat_date
         order by stat_date
@@ -218,7 +218,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_date >= #{startDate}
+        AND stat_date &gt; #{startDate}
         AND stat_date &lt;= #{endDate}
         group by DATE_FORMAT(stat_date, '%Y-%m')
         order by stat_date
@@ -242,7 +242,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_datetime >= #{startDate}
+        AND stat_datetime &gt; #{startDate}
         AND stat_datetime &lt;= #{endDate}
         AND md5!=''
         GROUP BY md5
@@ -274,7 +274,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_datetime >= #{startDate}
+        AND stat_datetime &gt;= #{startDate}
         AND stat_datetime &lt;= #{endDate}
         GROUP BY t1.md5
         ORDER BY ${target} ${order}
@@ -298,7 +298,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_datetime >= #{startDate}
+        AND stat_datetime &gt;= #{startDate}
         AND stat_datetime &lt;= #{endDate}
         GROUP BY t1.md5) t
     </select>
@@ -323,7 +323,7 @@
                 #{item}
             </foreach>
         </if>
-        AND t1.stat_date >= #{startDate}
+        AND t1.stat_date &gt;= #{startDate}
         AND t1.stat_date &lt;= #{endDate}
         GROUP BY t1.signature
         ORDER BY charge desc
@@ -357,7 +357,7 @@
                 #{item}
             </foreach>
         </if>
-        AND t1.stat_date >= #{startDate}
+        AND t1.stat_date &gt;= #{startDate}
         AND t1.stat_date &lt;= #{endDate}
         GROUP BY t1.signature
         ) t1
@@ -388,7 +388,7 @@
                 #{item}
             </foreach>
         </if>
-        AND t1.stat_date >= #{startDate}
+        AND t1.stat_date &gt;= #{startDate}
         AND t1.stat_date &lt;= #{endDate}
         GROUP BY t1.signature
         ) t1
@@ -418,7 +418,7 @@
         FROM
         etl_design_daily_report,(SELECT @i:=0) i
         where
-        stat_date >= #{startDate}
+        stat_date &gt;= #{startDate}
         AND stat_date &lt;= #{endDate}
         AND user_id IN
         <foreach collection="userIds" item="item" separator=","
@@ -441,7 +441,7 @@
         FROM
         etl_design_daily_report
         where
-        stat_date >= #{startDate}
+        stat_date &gt;= #{startDate}
         AND stat_date &lt;= #{endDate}
         AND user_id IN
         <foreach collection="userIds" item="item" separator=","

+ 50 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ProjectMemberMapper.xml

@@ -9,6 +9,13 @@
         where user_id = #{userId}
     </select>
 
+    <select id="selectProductsByUserId" resultType="java.lang.Long">
+        select  DISTINCT(product_id) from ctop_project where product_id is not NULL  and id in
+         (select
+              DISTINCT(project_id)
+          from ctop_project_member where user_id = #{userId})
+    </select>
+
     <!-- 设计师展示所有自己的角色下制作的视频 -->
     <select id="adminProjects" resultType="org.jeecg.modules.ctop.entity.ProjectMember">
         select
@@ -21,7 +28,7 @@
         as advertiserName,
         t1.media_id as mediaId,
         t1.max_bid as maxBid,
-
+        t1.product_id as productId,
         t1.responsible_name as responsibleName
         from
         ctop_project t1
@@ -41,6 +48,7 @@
         b.project_name as projectName,
         b.advertiser_id as advertiserId,
         b.advertiser_name as advertiserName,
+        b.product_id as productId,
         b.media_id as mediaId
         from
         ctop_project_member a
@@ -61,7 +69,8 @@
         b.project_name as projectName,
         b.advertiser_id as advertiserId,
         b.advertiser_name as advertiserName,
-        b.media_id as mediaId
+        b.media_id as mediaId,
+        b.product_id as productId
         from
         ctop_project_member a
         left join ctop_project b on a.project_id = b.id
@@ -73,6 +82,30 @@
         </foreach>
     </select>
 
+    <select id="getProductIds" resultType="org.jeecg.modules.ctop.entity.ProjectMember">
+        select
+        a.project_id as projectId,
+        b.project_name as projectName,
+        b.advertiser_id as advertiserId,
+        b.advertiser_name as advertiserName,
+        b.media_id as mediaId,
+        b.product_id as productId
+        from
+        ctop_project_member a
+        left join ctop_project b on a.project_id = b.id
+        where b.product_id = #{productId}
+        <if test="userId !=null and userId!=''">
+            and a.user_id = #{userId}
+        </if>
+        and b.media_id in
+        <foreach collection="mediaList" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        group by a.project_id
+    </select>
+
+
     <!-- 运营和运营负责人展示所在项目视频 -->
     <select id="operationProjects" resultType="org.jeecg.modules.ctop.entity.ProjectMember">
         select
@@ -80,6 +113,7 @@
         b.project_name as projectName,
         b.advertiser_id as advertiserId,
         b.advertiser_name as advertiserName,
+        b.product_id as productId,
         b.media_id as mediaId
         from
         ctop_user_allocation a
@@ -191,6 +225,20 @@
         </foreach>
     </select>
 
+    <select id="getProductByAccountIds" resultType="java.lang.Long">
+        select DISTINCT(product_id) from ctop_project where product_id is not NULL and id in
+        (SELECT
+        project_id
+        FROM
+        ctop_user_allocation
+        WHERE
+        account_id IN
+        <foreach collection="accountIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>)
+    </select>
+
 
     <select id="getProjectByUserIdAndMediaIds" resultType="com.alibaba.fastjson.JSONObject">
         select

+ 7 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IProjectMemberService.java

@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.entity.SysUser;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.ctop.entity.ProjectMember;
 
 import java.util.List;
@@ -22,6 +23,8 @@ public interface IProjectMemberService extends IService<ProjectMember> {
 
     List<Long> selectProjectsByUserId(String userId);
 
+    List<Long> selectProductsByUserId(String userId);
+
     List<ProjectMember> getProjects(List<Integer> mediaIds);
 
     List<Map<String, Object>> getProjectAccountByUserId(String userId, String mediaType);
@@ -42,5 +45,9 @@ public interface IProjectMemberService extends IService<ProjectMember> {
 
     List<Map<String, Object>> getAllProjectAccount(String mediaType);
 
+    List<Long> getProductByAccountIds(JSONArray accountIds);
+
     List<ProjectMember> getMapsByProjectList(List<ProjectMember> projectMembers);
+
+    List<ProjectMember> getOwnProducts(List<Integer> mediaList, Long productId);
 }

+ 37 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java

@@ -83,6 +83,18 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
         return memberMapper.selectProjectsByUserId(userId);
     }
 
+    /**
+     * 查询所有产品
+     *
+     * @param userId
+     * @return
+     */
+    @Override
+    public List<Long> selectProductsByUserId(String userId) {
+        return memberMapper.selectProductsByUserId(userId);
+    }
+
+
     //视频报表
     @Override
     public List<ProjectMember> getProjects(List<Integer> mediaIds) {
@@ -266,6 +278,10 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
         return memberMapper.getProjectByAccountIds(accountIds);
     }
 
+    @Override
+    public List<Long> getProductByAccountIds(JSONArray accountIds) {
+        return memberMapper.getProductByAccountIds(accountIds);
+    }
 
     //视频报表
     @Override
@@ -412,6 +428,27 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
         return projectMembers;
     }
 
+    @Override
+    public List<ProjectMember> getOwnProducts(List<Integer> mediaList, Long productId) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = sysUser.getId();
+        String roleCode = memberMapper.getRoleCodeByUserId(userId);
+
+        if ("admin".equals(roleCode)) {
+            userId = null;
+        }
+        //如果以上角色都不是的话直接查询此角色所属项目
+        //   projectMemberList = memberMapper.designProjects(userId, mediaList);
+        List<ProjectMember> projectMemberList  = memberMapper.getProductIds(userId, mediaList,productId);
+
+
+        if (null == projectMemberList) {
+            projectMemberList = new ArrayList<>();
+        }
+
+        return projectMemberList;
+    }
+
 }
 
 

+ 63 - 58
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java

@@ -4,10 +4,7 @@ import cn.com.ctop.common.module.entity.CorpFeishuUser;
 import cn.com.ctop.common.module.entity.CtopCorpWexinUser;
 import cn.com.ctop.common.module.entity.SysDepart;
 import cn.com.ctop.common.module.entity.SysUser;
-import cn.com.ctop.common.module.service.ICorpFeishuUserService;
-import cn.com.ctop.common.module.service.ICtopCorpWexinUserService;
-import cn.com.ctop.common.module.service.ISysDepartService;
-import cn.com.ctop.common.module.service.ISysUserService;
+import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.AesEncryptUtil;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
@@ -31,14 +28,12 @@ import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.CacheConstant;
 import org.jeecg.common.constant.CommonConstant;
-import cn.com.ctop.common.module.service.ISysBaseApi;
 import org.jeecg.common.system.util.JwtUtil;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.*;
 import org.jeecg.common.util.encryption.EncryptedString;
 import org.jeecg.modules.shiro.vo.DefContants;
 import org.jeecg.modules.system.model.SysLoginModel;
-import cn.com.ctop.common.module.service.ISysDictService;
 import org.jeecg.modules.system.service.ISysLogService;
 import org.jeecg.modules.system.util.RandImageUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -55,7 +50,7 @@ import java.util.*;
  */
 @RestController
 @RequestMapping("/sys")
-@Api(tags="用户登录")
+@Api(tags = "用户登录")
 @Slf4j
 public class LoginController {
     @Autowired
@@ -75,12 +70,13 @@ public class LoginController {
     @Autowired
     private ICtopCorpWexinUserService ctopCorpWexinUserService;
     private static final String BASE_CHECK_CODES = "qwertyuiplkjhgfdsazxcvbnmQWERTYUPLKJHGFDSAZXCVBNM1234567890";
+
     @GetMapping("feishu/url")
-    public Map<String,Object> getUrl(){
-        Map<String,Object>result = new HashMap<>();
+    public Map<String, Object> getUrl() {
+        Map<String, Object> result = new HashMap<>();
         try {
             String url = AuthProvider.getAuthUrl("");
-            result.put("url",url);
+            result.put("url", url);
             ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
             return result;
         } catch (Exception e) {
@@ -89,19 +85,20 @@ public class LoginController {
             return result;
         }
     }
+
     @GetMapping("/feishu/auth")
     public Result<JSONObject> feishuAuth(HttpServletRequest request,
                                          HttpServletResponse response,
-                                         @RequestParam(name = "code",defaultValue = "code") String code,
-                                         @RequestParam(name = "state",defaultValue = "_t") String state) throws IOException {
+                                         @RequestParam(name = "code", defaultValue = "code") String code,
+                                         @RequestParam(name = "state", defaultValue = "_t") String state) throws IOException {
         Result<JSONObject> result = new Result<>();
         //1:根据code值获取用户飞书信息
         try {
-            if("code".equals(code.trim())){
+            if ("code".equals(code.trim())) {
                 JSONObject setData = new JSONObject();
                 String url = AuthProvider.getAuthUrl("");
-                setData.put("url",url);
-                setData.put("type",1);
+                setData.put("url", url);
+                setData.put("type", 1);
                 result.setResult(setData);
                 result.success("重定向");
                 return result;
@@ -113,14 +110,14 @@ public class LoginController {
             JSONObject userData = AuthProvider.getUserInfo(accessToken);
             JSONObject dataObject = userData.getJSONObject("data");
             String email = dataObject.getString("email");
-            if(null == email|| "".equals(email.trim())){
+            if (null == email || "".equals(email.trim())) {
                 return result.error500(StatusCode.CTOP_FEISHU_EMAIL_NOT_EXIST.getDesc());
             }
             SysUser sysUser = sysUserService.getUserByEmail(email);
             if (sysUser == null) {
                 return result.error500(StatusCode.CTOP_FEISHU_ACCOUNT_NOT_EXIST.getDesc());
             }
-            if(sysUser.getStatus() != 1){
+            if (sysUser.getStatus() != 1) {
                 return result.error500(StatusCode.CTOP_FEISHU_ACCOUNT_NOT_EXIST.getDesc());
             }
             String departId = sysDepartService.selectIdByOrdCode(sysUser.getOrgCode());
@@ -180,7 +177,7 @@ public class LoginController {
                     result.error500("该用户未注册系统账户,请联系管理员");
                     return result;
                 }
-                if(sysUser.getStatus() != 1){
+                if (sysUser.getStatus() != 1) {
                     result.error500("该用户已冻结,请联系管理员");
                     return result;
                 }
@@ -303,22 +300,23 @@ public class LoginController {
 
     /**
      * 退出登录
+     *
      * @param request
      * @param response
      * @return
      */
     @RequestMapping(value = "/logout")
-    public Result<Object> logout(HttpServletRequest request,HttpServletResponse response) {
+    public Result<Object> logout(HttpServletRequest request, HttpServletResponse response) {
         //用户退出逻辑
         String token = request.getHeader(DefContants.X_ACCESS_TOKEN);
-        if(oConvertUtils.isEmpty(token)) {
+        if (oConvertUtils.isEmpty(token)) {
             return Result.error("退出登录失败!");
         }
         String username = JwtUtil.getUsername(token);
         LoginUser sysUser = sysBaseApi.getUserByName(username);
-        if(sysUser!=null) {
-            sysBaseApi.addLog("用户名: "+sysUser.getRealname()+",退出成功!", CommonConstant.LOG_TYPE_1, null);
-            log.info(" 用户名:  "+sysUser.getRealname()+",退出成功! ");
+        if (sysUser != null) {
+            sysBaseApi.addLog("用户名: " + sysUser.getRealname() + ",退出成功!", CommonConstant.LOG_TYPE_1, null);
+            log.info(" 用户名:  " + sysUser.getRealname() + ",退出成功! ");
             //清空用户登录Token缓存
             redisUtil.del(CommonConstant.PREFIX_USER_TOKEN + token);
             //清空用户登录Shiro权限缓存
@@ -328,13 +326,14 @@ public class LoginController {
             //调用shiro的logout
             SecurityUtils.getSubject().logout();
             return Result.ok("退出登录成功!");
-        }else {
+        } else {
             return Result.error("Token无效!");
         }
     }
 
     /**
      * 获取访问量
+     *
      * @return
      */
     @GetMapping("loginfo")
@@ -354,9 +353,9 @@ public class LoginController {
         // 获取系统访问记录
         Long totalVisitCount = logService.findTotalVisitCount();
         obj.put("totalVisitCount", totalVisitCount);
-        Long todayVisitCount = logService.findTodayVisitCount(dayStart,dayEnd);
+        Long todayVisitCount = logService.findTodayVisitCount(dayStart, dayEnd);
         obj.put("todayVisitCount", todayVisitCount);
-        Long todayIp = logService.findTodayIp(dayStart,dayEnd);
+        Long todayIp = logService.findTodayIp(dayStart, dayEnd);
         //update-end--Author:zhangweijian  Date:20190428 for:传入开始时间,结束时间参数
         obj.put("todayIp", todayIp);
         result.setResult(obj);
@@ -366,21 +365,22 @@ public class LoginController {
 
     /**
      * 获取访问量
+     *
      * @return
      */
     @GetMapping("visitInfo")
-    public Result<List<Map<String,Object>>> visitInfo() {
-        Result<List<Map<String,Object>>> result = new Result<List<Map<String,Object>>>();
+    public Result<List<Map<String, Object>>> visitInfo() {
+        Result<List<Map<String, Object>>> result = new Result<List<Map<String, Object>>>();
         Calendar calendar = new GregorianCalendar();
-        calendar.set(Calendar.HOUR_OF_DAY,0);
-        calendar.set(Calendar.MINUTE,0);
-        calendar.set(Calendar.SECOND,0);
-        calendar.set(Calendar.MILLISECOND,0);
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
         calendar.add(Calendar.DAY_OF_MONTH, 1);
         Date dayEnd = calendar.getTime();
         calendar.add(Calendar.DAY_OF_MONTH, -7);
         Date dayStart = calendar.getTime();
-        List<Map<String,Object>> list = logService.findVisitCount(dayStart, dayEnd);
+        List<Map<String, Object>> list = logService.findVisitCount(dayStart, dayEnd);
         result.setResult(oConvertUtils.toLowerCasePageList(list));
         return result;
     }
@@ -388,6 +388,7 @@ public class LoginController {
 
     /**
      * 登陆成功选择用户当前部门
+     *
      * @param user
      * @return
      */
@@ -395,11 +396,11 @@ public class LoginController {
     public Result<JSONObject> selectDepart(@RequestBody SysUser user) {
         Result<JSONObject> result = new Result<JSONObject>();
         String username = user.getUsername();
-        if(oConvertUtils.isEmpty(username)) {
-            LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
+        if (oConvertUtils.isEmpty(username)) {
+            LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
             username = sysUser.getUsername();
         }
-        String orgCode= user.getOrgCode();
+        String orgCode = user.getOrgCode();
         this.sysUserService.updateUserDepart(username, orgCode);
         SysUser sysUser = sysUserService.getUserByName(username);
         JSONObject obj = new JSONObject();
@@ -419,9 +420,9 @@ public class LoginController {
         Result<String> result = new Result<String>();
         String mobile = jsonObject.get("mobile").toString();
         //手机号模式 登录模式: "2"  注册模式: "1"
-        String smsmode=jsonObject.get("smsmode").toString();
+        String smsmode = jsonObject.get("smsmode").toString();
         log.info(mobile);
-        if(oConvertUtils.isEmpty(mobile)){
+        if (oConvertUtils.isEmpty(mobile)) {
             result.setMessage("手机号不允许为空!");
             result.setSuccess(false);
             return result;
@@ -442,17 +443,17 @@ public class LoginController {
             //注册模板
             if (CommonConstant.SMS_TPL_TYPE_1.equals(smsmode)) {
                 SysUser sysUser = sysUserService.getUserByPhone(mobile);
-                if(sysUser!=null) {
+                if (sysUser != null) {
                     result.error500(" 手机号已经注册,请直接登录!");
                     sysBaseApi.addLog("手机号已经注册,请直接登录!", CommonConstant.LOG_TYPE_1, null);
                     return result;
                 }
                 b = DySmsHelper.sendSms(mobile, obj, DySmsEnum.REGISTER_TEMPLATE_CODE);
-            }else {
+            } else {
                 //登录模式,校验用户有效性
                 SysUser sysUser = sysUserService.getUserByPhone(mobile);
                 result = sysUserService.checkUserIsEffective(sysUser);
-                if(!result.isSuccess()) {
+                if (!result.isSuccess()) {
                     return result;
                 }
 
@@ -462,7 +463,7 @@ public class LoginController {
                 if (CommonConstant.SMS_TPL_TYPE_0.equals(smsmode)) {
                     //登录模板
                     b = DySmsHelper.sendSms(mobile, obj, DySmsEnum.LOGIN_TEMPLATE_CODE);
-                } else if(CommonConstant.SMS_TPL_TYPE_2.equals(smsmode)) {
+                } else if (CommonConstant.SMS_TPL_TYPE_2.equals(smsmode)) {
                     //忘记密码模板
                     b = DySmsHelper.sendSms(mobile, obj, DySmsEnum.FORGET_PASSWORD_TEMPLATE_CODE);
                 }
@@ -504,7 +505,7 @@ public class LoginController {
         //校验用户有效性
         SysUser sysUser = sysUserService.getUserByPhone(phone);
         result = sysUserService.checkUserIsEffective(sysUser);
-        if(!result.isSuccess()) {
+        if (!result.isSuccess()) {
             return result;
         }
 
@@ -537,7 +538,7 @@ public class LoginController {
         String token = JwtUtil.sign(username, syspassword);
         // 设置token缓存有效时间
         redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
-        redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME*2 / 1000);
+        redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000);
 
         // 获取用户部门信息
         JSONObject obj = new JSONObject();
@@ -561,29 +562,31 @@ public class LoginController {
 
     /**
      * 获取加密字符串
+     *
      * @return
      */
     @GetMapping(value = "/getEncryptedString")
-    public Result<Map<String,String>> getEncryptedString(){
-        Result<Map<String,String>> result = new Result<>();
-        Map<String,String> map = new HashMap<>();
+    public Result<Map<String, String>> getEncryptedString() {
+        Result<Map<String, String>> result = new Result<>();
+        Map<String, String> map = new HashMap<>();
         map.put("key", EncryptedString.key);
-        map.put("iv",EncryptedString.iv);
+        map.put("iv", EncryptedString.iv);
         result.setResult(map);
         return result;
     }
 
     /**
      * 后台生成图形验证码 :有效
+     *
      * @param response
      * @param key
      */
     @ApiOperation("获取验证码")
     @GetMapping(value = "/randomImage/{key}")
-    public Result<String> randomImage(HttpServletResponse response,@PathVariable String key){
+    public Result<String> randomImage(HttpServletResponse response, @PathVariable String key) {
         Result<String> res = new Result<String>();
         try {
-            String code = RandomUtil.randomString(BASE_CHECK_CODES,4);
+            String code = RandomUtil.randomString(BASE_CHECK_CODES, 4);
             String lowerCaseCode = code.toLowerCase();
             String realKey = MD5Util.getMd5(lowerCaseCode);
             redisUtil.set(realKey, lowerCaseCode, 60);
@@ -591,7 +594,7 @@ public class LoginController {
             res.setSuccess(true);
             res.setResult(base64);
         } catch (Exception e) {
-            res.error500("获取验证码出错"+e.getMessage());
+            res.error500("获取验证码出错" + e.getMessage());
             e.printStackTrace();
         }
         return res;
@@ -599,6 +602,7 @@ public class LoginController {
 
     /**
      * app登录
+     *
      * @param sysLoginModel
      * @return
      * @throws Exception
@@ -612,7 +616,7 @@ public class LoginController {
         //1. 校验用户是否有效
         SysUser sysUser = sysUserService.getUserByName(username);
         result = sysUserService.checkUserIsEffective(sysUser);
-        if(!result.isSuccess()) {
+        if (!result.isSuccess()) {
             return result;
         }
 
@@ -625,7 +629,7 @@ public class LoginController {
         }
 
         String orgCode = sysUser.getOrgCode();
-        if(oConvertUtils.isEmpty(orgCode)) {
+        if (oConvertUtils.isEmpty(orgCode)) {
             //如果当前用户无选择部门 查看部门关联信息
             List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId());
             if (departs == null || departs.size() == 0) {
@@ -644,7 +648,7 @@ public class LoginController {
         String token = JwtUtil.sign(username, syspassword);
         // 设置超时时间
         redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
-        redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME*2 / 1000);
+        redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000);
         //token 信息
         obj.put("token", token);
         result.setResult(obj);
@@ -656,20 +660,21 @@ public class LoginController {
 
     /**
      * 图形验证码
+     *
      * @param sysLoginModel
      * @return
      */
     @RequestMapping(value = "/checkCaptcha", method = RequestMethod.POST)
-    public Result<?> checkCaptcha(@RequestBody SysLoginModel sysLoginModel){
+    public Result<?> checkCaptcha(@RequestBody SysLoginModel sysLoginModel) {
         String captcha = sysLoginModel.getCaptcha();
         String checkKey = sysLoginModel.getCheckKey();
-        if(captcha==null){
+        if (captcha == null) {
             return Result.error("验证码无效");
         }
         String lowerCaseCaptcha = captcha.toLowerCase();
-        String realKey = MD5Util.getMd5(lowerCaseCaptcha+checkKey);
+        String realKey = MD5Util.getMd5(lowerCaseCaptcha + checkKey);
         Object checkCode = redisUtil.get(realKey);
-        if(checkCode==null || !checkCode.equals(lowerCaseCaptcha)) {
+        if (checkCode == null || !checkCode.equals(lowerCaseCaptcha)) {
             return Result.error("验证码错误");
         }
         return Result.ok();

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

@@ -130,12 +130,12 @@ spring:
         poolPreparedStatements: true
         maxPoolPreparedStatementPerConnectionSize: 20
         # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
-        filters: stat,slf4j
+        filters: stat,wall,slf4j
         # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true
+          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
           username: data
           password: hcst@2021
           driver-class-name: com.mysql.jdbc.Driver

+ 2 - 2
jeecg-boot-module-system/src/main/resources/application-prod.yml

@@ -28,8 +28,8 @@ spring:
           starttls:
             enable: true
             required: true
-  ## quartz定时任务,采用数据库方式
-  #quartz:
+    ## quartz定时任务,采用数据库方式
+    #quartz:
     #job-store-type: jdbc
   #json 时间戳统一转换
   jackson:

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

@@ -101,12 +101,12 @@ spring:
           username: hcst
           password: hcst@2020
           driver-class-name: com.mysql.jdbc.Driver
-#      datasource:
-#        master:
-#          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true
-#          username: data
-#          password: hcst@2021
-#          driver-class-name: com.mysql.jdbc.Driver
+  #      datasource:
+  #        master:
+  #          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true
+  #          username: data
+  #          password: hcst@2021
+  #          driver-class-name: com.mysql.jdbc.Driver
   #redis 配置
   redis:
     database: 0

+ 11 - 11
jeecg-boot-module-system/src/main/resources/application-wps.yml

@@ -95,21 +95,21 @@ spring:
         # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
-#        master:
-#          url: jdbc:mysql://139.186.27.96:4000/jiaoyang?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-#          username: data
-#          password: hcst@2021
-#          driver-class-name: com.mysql.jdbc.Driver
-#        master:
-#          url: jdbc:mysql://139.186.165.84:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true
-#          username: hcst
-#          password: hcst@2020
-#          driver-class-name: com.mysql.jdbc.Driver
         master:
-          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          url: jdbc:mysql://139.186.27.96:4000/jiaoyang?characterEncoding=UTF-8&useUnicode=true&useSSL=false
           username: data
           password: hcst@2021
           driver-class-name: com.mysql.jdbc.Driver
+#        master:
+#          url: jdbc:mysql://139.186.151.174:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true
+#          username: hcst
+#          password: hcst@2020
+#          driver-class-name: com.mysql.jdbc.Driver
+#        master:
+#          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+#          username: data
+#          password: hcst@2021
+#          driver-class-name: com.mysql.jdbc.Driver
   #redis 配置
   redis:
     database: 0

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

@@ -1,5 +1,6 @@
 spring:
   profiles:
+    # active: wps
     active: @activatedProperties@
 swagger:
   production: false

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

@@ -9,12 +9,13 @@ import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouAccountMaterialReportDailyMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyImageService;
+import cn.com.ctop.oa.modules.service.IAppchatCreateService;
 import cn.com.ctop.oa.modules.service.IWechatNoListService;
+import cn.com.ctop.oa.modules.service.IWechatUserListService;
 import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceCampaignService;
 import cn.com.ctop.toutiao.modules.report.service.*;
-import com.csvreader.CsvReader;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.RedisUtil;
@@ -26,10 +27,7 @@ import org.springframework.test.context.ActiveProfiles;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import javax.annotation.Resource;
-import java.io.IOException;
-import java.nio.charset.Charset;
 import java.text.ParseException;
-import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -52,13 +50,21 @@ public class SampleTest {
     private IKuaishouInterfaceService kuaishouInterfaceService;
     @Autowired
     private RedisUtil redisUtil;
+    @Autowired
+    private IAppchatCreateService appchatCreateService;
+    @Autowired
+    private IWechatUserListService wechatUserInfoService;
+
 
     @Test
     public void loadKuaishouCookie() throws ParseException {
+        wechatUserInfoService.getUserList();
 
-        redisUtil.set("11sdfhgjksdhfjksdhfjksdhfkjsjkfhkjsddhfjksdhfkjhsjkfhjkshfjksdhfjksdhfjkshdjkfhsjkdfhkjsd1","hahahaha",5);
+        // appchatCreateService.createAppChat(null, null, null);
+        appchatCreateService.getChatInfo(null);
+       /* redisUtil.set("11sdfhgjksdhfjksdhfjksdhfkjsjkfhkjsddhfjksdhfkjhsjkfhjkshfjksdhfjksdhfjkshdjkfhsjkdfhkjsd1","hahahaha",5);
         Object o = redisUtil.get("11sdfhgjksdhfjksdhfjksdhfkjsjkfhkjsddhfjksdhfkjhsjkfhjkshfjksdhfjksdhfjkshdjkfhsjkdfhkjsd1");
-        System.err.println(o);
+        System.err.println(o);*/
 
 
         /*try {
@@ -222,7 +228,7 @@ public class SampleTest {
     private IEtlBytedanceReportVideoDailyService etlBytedanceReportVideoDailyService;
 
     @Test
-    public void etlBytedanceVideoReportInfo()throws Exception{
+    public void etlBytedanceVideoReportInfo() throws Exception {
         etlBytedanceReportVideoDailyService.etlBytedanceVideo();
     }
 
@@ -230,7 +236,7 @@ public class SampleTest {
     private IReportService reportService;
 
     @Test
-    public void loadBytedanceAccountReport(){
+    public void loadBytedanceAccountReport() {
         /**
          * 1692555408132110
          * 1692555631713287
@@ -238,19 +244,19 @@ public class SampleTest {
          * 1696734333251598
          */
         CtopOauthToken token1 = tokenService.getTokenByAccountId(1692555408132110L);
-        reportService.getAdvertiserReport(token1, DateUtils.parseDate("2021-05-01","yyyy-MM-dd"), DateUtils.parseDate("2021-05-12","yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        reportService.getAdvertiserReport(token1, DateUtils.parseDate("2021-05-01", "yyyy-MM-dd"), DateUtils.parseDate("2021-05-12", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
         CtopOauthToken token2 = tokenService.getTokenByAccountId(1692555631713287L);
-        reportService.getAdvertiserReport(token2, DateUtils.parseDate("2021-05-01","yyyy-MM-dd"), DateUtils.parseDate("2021-05-12","yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        reportService.getAdvertiserReport(token2, DateUtils.parseDate("2021-05-01", "yyyy-MM-dd"), DateUtils.parseDate("2021-05-12", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
         CtopOauthToken token3 = tokenService.getTokenByAccountId(1696734332089352L);
-        reportService.getAdvertiserReport(token3, DateUtils.parseDate("2021-05-01","yyyy-MM-dd"), DateUtils.parseDate("2021-05-12","yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        reportService.getAdvertiserReport(token3, DateUtils.parseDate("2021-05-01", "yyyy-MM-dd"), DateUtils.parseDate("2021-05-12", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
         CtopOauthToken token4 = tokenService.getTokenByAccountId(1696734333251598L);
-        reportService.getAdvertiserReport(token4, DateUtils.parseDate("2021-05-01","yyyy-MM-dd"), DateUtils.parseDate("2021-05-12","yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        reportService.getAdvertiserReport(token4, DateUtils.parseDate("2021-05-01", "yyyy-MM-dd"), DateUtils.parseDate("2021-05-12", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
 
         CtopOauthToken token5 = tokenService.getTokenByAccountId(10129666L);
-        kuaishouInterfaceService.getAdvertiserReportDaily(token5, DateUtils.parseDate("2021-05-07","yyyy-MM-dd"), DateUtils.parseDate("2021-05-11","yyyy-MM-dd"), null);
+        kuaishouInterfaceService.getAdvertiserReportDaily(token5, DateUtils.parseDate("2021-05-07", "yyyy-MM-dd"), DateUtils.parseDate("2021-05-11", "yyyy-MM-dd"), null);
         CtopOauthToken token6 = tokenService.getTokenByAccountId(10097961L);
-        kuaishouInterfaceService.getAdvertiserReportDaily(token6, DateUtils.parseDate("2021-05-07","yyyy-MM-dd"), DateUtils.parseDate("2021-05-11","yyyy-MM-dd"), null);
+        kuaishouInterfaceService.getAdvertiserReportDaily(token6, DateUtils.parseDate("2021-05-07", "yyyy-MM-dd"), DateUtils.parseDate("2021-05-11", "yyyy-MM-dd"), null);
         CtopOauthToken token7 = tokenService.getTokenByAccountId(10098039L);
-        kuaishouInterfaceService.getAdvertiserReportDaily(token7, DateUtils.parseDate("2021-05-07","yyyy-MM-dd"), DateUtils.parseDate("2021-05-11","yyyy-MM-dd"), null);
+        kuaishouInterfaceService.getAdvertiserReportDaily(token7, DateUtils.parseDate("2021-05-07", "yyyy-MM-dd"), DateUtils.parseDate("2021-05-11", "yyyy-MM-dd"), null);
     }
 }

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

@@ -14,6 +14,7 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
+import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.Date;
 
@@ -29,7 +30,7 @@ import java.util.Date;
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
 @ApiModel(value = "ctop_material_info对象", description = "素材信息")
-public class MaterialInfo {
+public class MaterialInfo implements Serializable {
 
     /**
      * id
@@ -38,6 +39,11 @@ public class MaterialInfo {
     @ApiModelProperty(value = "id")
     private String id;
     /**
+     * 存放id的数组
+     */
+    @TableField(exist = false)
+    private String[] ids;
+    /**
      * code
      */
     @Excel(name = "code", width = 15)
@@ -86,6 +92,8 @@ public class MaterialInfo {
 
     private Long projectId;
 
+    private Long productId;
+
     /**
      * 素材名称
      */

+ 3 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/Product.java

@@ -2,6 +2,7 @@ package cn.com.ctop.common.module.entity;
 
 import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
@@ -72,4 +73,6 @@ public class Product {
      */
     @ApiModelProperty(value = "updateTime")
     private Date updateTime;
+    @TableField(exist = false)
+    private String advertiserName;
 }

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

@@ -14,7 +14,7 @@ public class SysUserDepart implements Serializable {
 	private static final long serialVersionUID = 1L;
 
 	/**主键id*/
-    @TableId(type = IdType.ID_WORKER_STR)
+	@TableId(type = IdType.ID_WORKER_STR)
 	private String id;
 	/**用户id*/
 	private String userId;

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java

@@ -36,7 +36,7 @@ public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> {
 
     List<MaterialInfo> getListByDate(@Param("startDate") String startDate,@Param("endDate") String endDate);
 
-    List<MaterialInfo> getListByParams(@Param("tagCode")String tagCode,@Param("type")String type, @Param("status")Integer status, @Param("projectIds")List<Long> projectIds, @Param("materialName")String materialName, @Param("code")String code, @Param("startDate")String startDate, @Param("endDate")String endDate, @Param("userId")String userId);
+    List<MaterialInfo> getListByParams(@Param("tagCode")String tagCode,@Param("type")String type, @Param("status")Integer status, @Param("productIds")List<Long> productIds, @Param("materialName")String materialName, @Param("code")String code, @Param("startDate")String startDate, @Param("endDate")String endDate, @Param("userId")String userId);
 
     JSONArray getIdListByProject(Long projectId);
 }

+ 4 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/ProductMapper.java

@@ -3,6 +3,8 @@ package cn.com.ctop.common.module.mapper;
 import cn.com.ctop.common.module.entity.Product;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -20,4 +22,6 @@ public interface ProductMapper extends BaseMapper<Product> {
     String getUserNameByUserId(@Param("userId") String userId);
 
     List<JSONObject> getProductByMap(@Param("ids") Map<Long, Long> productIdMap);
+
+    IPage<Product> getUserProductList(Page<Product> page, @Param("userId")String userId, @Param("productName")String productName);
 }

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

@@ -46,4 +46,6 @@ public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
     List<JSONObject> getAccountListByProjectList(@Param("list") List list);
 
     List<Long> getValidProjectIds(@Param("mediaId")  Integer mediaId);
+
+    List<UserAllocation> getAccountListByUserIdAndProductId(@Param("userId")String userId,@Param("projectId")Long projectId,@Param("productId")Long productId);
 }

+ 4 - 4
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml

@@ -112,9 +112,9 @@
         <if test="materialName!=null">
             and matInfo.material_name like concat('%',#{materialName},'%')
         </if>
-        <if test="projectIds!=null">
-            and matInfo.project_id in
-            <foreach item="item" index="index" collection="projectIds" open="(" separator="," close=")">
+        <if test="productIds!=null">
+            and matInfo.product_id in
+            <foreach item="item" index="index" collection="productIds" open="(" separator="," close=")">
                 #{item}
             </foreach>
         </if>
@@ -134,11 +134,11 @@
         and DATE_FORMAT(create_time,'%Y-%m-%d') &gt;= #{startDate}
         and DATE_FORMAT(create_time,'%Y-%m-%d') &lt;= #{endDate}
     </select>
+
     <select id="getIdListByProject" resultType="java.lang.String">
         select id  from  ctop_material_info
         where project_id = #{projectId}
         and status != 2
-        and DATE_FORMAT(create_time,'%Y-%m-%d') &gt;= '2021-04-28'
 
     </select>
 

+ 34 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ProductMapper.xml

@@ -17,4 +17,38 @@
         </foreach>
     </select>
 
+    <select id="getUserProductList" resultType="cn.com.ctop.common.module.entity.Product">
+        select
+            cp.id,
+            cp.product_name as 'productName',
+            ca.name as 'advertiserName'
+        from
+            ctop_product cp
+                left join ctop_advertiser ca on
+                cp.advertiser_id = ca.id
+        where
+                cp.id in (
+                select
+                    DISTINCT(product_id)
+                from
+                    ctop_project
+                where
+                    product_id is not NULL
+                  and id in (
+                    select
+                        DISTINCT(project_id)
+                    from
+                        ctop_project_member
+                    <if test="userId !=null and userId!=''">
+                    where
+                            user_id =
+                            #{userId}
+                    </if>
+                      ) )
+
+                <if test="productName != null and productName != ''">
+                    and cp.product_name like concat('%',#{productName},'%')
+                </if>
+    </select>
+
 </mapper>

+ 27 - 1
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml

@@ -14,6 +14,19 @@
         where b.id = #{projectId}
         and account_status = 0
     </select>
+    <select id="getAccountListByUserIdAndProductId" resultType="cn.com.ctop.common.module.entity.UserAllocation">
+        select cua.account_id, cua.auth_name, cua.user_name
+        from ctop_user_allocation cua
+                 left join ctop_project cp on cua.project_id = cp.id
+        where
+              cua.project_id = #{projectId}
+          and
+              cp.product_id=#{productId}
+          <if test="userId != null and userId != ''">
+              and cua.user_id = #{userId}
+          </if>
+
+    </select>
 
     <select id="queryAdvertiserId" resultType="String">
         select
@@ -70,7 +83,20 @@
     AND t2.account_status = 0
     GROUP BY t1.user_id;
     </select>
-
+    <select id="getUserIdListByProductId" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t1.user_id as 'userId',
+               t1.account_id as 'accountId',
+               t1.user_name  as 'userName'
+        from  ctop_kuaishou_advertiser_base_info t1  LEFT JOIN
+              ctop_user_allocation  t2
+              ON t1.account_id = t2.account_id
+                                                     left join
+              ctop_project t3
+                on t2.project_id=t3.id
+        WHERE t3.product_id = #{productId}
+          AND t2.account_status = 0
+        GROUP BY t1.user_id;
+    </select>
 
     <select id="getValidProjectIds" resultType="java.lang.Long">
         SELECT project_id FROM ctop_user_allocation t1

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

@@ -13,4 +13,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
 public interface ICtopCorpWexinUserService extends IService<CtopCorpWexinUser> {
 
     String getEmailByUserId(String userId);
+
+    CtopCorpWexinUser getInfoByUserId(String userId);
 }

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

@@ -27,11 +27,11 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
      */
     String watermarkVideoBySupplierCode(String videoSignature, String videoUrl, Long templateId);
 
-    MaterialInfo getMaterialInfoByCodeAndProjectId(String code, Long projectId);
+    MaterialInfo getMaterialInfoByCodeAndProductId(String code, Long productId);
 
     MaterialInfo getMaterialInfoByCode(String code);
 
-    Map<String, Object> checkMaterialInfo(String code, Long projectId);
+    Map<String, Object> checkMaterialInfo(String code, Long productId);
 
     Map<String, Object> insert(JSONObject jsonObject);
 
@@ -41,7 +41,7 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
 
     void watermarkVideo(String materialId, Long videoWatermarkTemplateId, String userId);
 
-    void getFile(MaterialInfo materialInfo, String mediaId);
+    void getFile(MaterialInfo materialInfo);
 
     void setExcellent(String id, Integer excellent);
 

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IProductService.java

@@ -2,7 +2,10 @@ package cn.com.ctop.common.module.service;
 
 import cn.com.ctop.common.module.entity.Product;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
@@ -18,4 +21,6 @@ public interface IProductService extends IService<Product> {
     String getUserNameByUserId(String userId);
 
     List<JSONObject> getProductByMap(Map<Long, Long> productIdMap);
+
+    IPage<Product> getUserProductList(Page<Product> page, String userId, String productName);
 }

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java

@@ -3,6 +3,7 @@ package cn.com.ctop.common.module.service;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
@@ -43,8 +44,12 @@ public interface IUserAllocationService extends IService<UserAllocation> {
 
     List<Long> getAccountsByDeleteComment();
 
+    List<UserAllocation> getAccountListByUserIdAndProductId(String userId,Long projectId,Long productId);
+
     Map<Long, List<JSONObject>> getAccountListByProjectList(List<JSONObject> projectList);
 
+    List<JSONObject> getUserIdListByProductId(Long productId);
+
     /**
      * 获取有效的项目ID集合
      *

+ 11 - 2
module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopCorpWexinUserServiceImpl.java

@@ -3,12 +3,12 @@ package cn.com.ctop.common.module.service.impl;
 import cn.com.ctop.common.module.entity.CtopCorpWexinUser;
 import cn.com.ctop.common.module.mapper.CtopCorpWexinUserMapper;
 import cn.com.ctop.common.module.service.ICtopCorpWexinUserService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-
 /**
  * 企业微信用户表
  *
@@ -27,4 +27,13 @@ public class CtopCorpWexinUserServiceImpl extends ServiceImpl<CtopCorpWexinUserM
     public String getEmailByUserId(String userId) {
         return ctopCorpWexinUserMapper.queryEmailByUserId(userId);
     }
+
+    @Override
+    public CtopCorpWexinUser getInfoByUserId(String userId) {
+        QueryWrapper<CtopCorpWexinUser> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("wexin_id", userId);
+        queryWrapper.orderByDesc("create_time");
+        queryWrapper.last("limit 1");
+        return this.getOne(queryWrapper);
+    }
 }

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

@@ -73,6 +73,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
                 Integer code = jsonObject.getInteger("code");
                 if (code == 0) {
                     log.info("头条上传素材成功,返回信息:{},accountId:{}", jsonObject, accountId);
+                    //TODO 信息返回之后同步入库
                 } else {
                     log.error("头条上传素材失败,返回信息:{},accountId:{}", jsonObject, accountId);
                     UserAllocation allocation = userAllocationService.getByAccountId(Long.valueOf(accountId));

+ 72 - 54
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -3,9 +3,13 @@ package cn.com.ctop.common.module.service.impl;
 import cn.com.ctop.common.module.constant.CosConstant;
 import cn.com.ctop.common.module.entity.*;
 import cn.com.ctop.common.module.enums.MaterialSupplierEnum;
-import cn.com.ctop.common.module.mapper.*;
+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.*;
 import cn.com.ctop.common.module.utils.*;
+import cn.com.ctop.common.module.vo.ResFileDTO;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -23,10 +27,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
+import java.io.*;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.net.URLDecoder;
@@ -67,7 +68,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     private IMaterialCutFrameService materialCutFrameService;
     @Autowired
     private ISupplierWatermarkService supplierWatermarkService;
-
+    @Resource
+    private IProductService productService;
 
     @Value("${oss.replace.download}")
     private String downloadUrl;
@@ -76,7 +78,23 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     public void watermarkVideo(String materialId, Long videoWatermarkTemplateId, String userId) {
         TencentWatermarkTemplate tentcentWatermarkTemplate = tencentWatermarkTemplateService.getById(videoWatermarkTemplateId);
         MaterialInfo materialInfo = this.getById(materialId);
-        String path = URLDecoder.decode(materialInfo.getUrl().substring(materialInfo.getUrl().indexOf("/", 10) + 1, materialInfo.getUrl().length()));
+        if (Check.isNull(materialInfo)) {
+            return;
+        }
+        if (Check.isNull(materialInfo.getUrl())) {
+            return;
+        }
+        String fileUrl = "";
+        InputStream imageStream = LoadFileUtil.getFileStream(materialInfo.getUrl());
+        if (!Check.isNull(imageStream)) {
+            long time = System.currentTimeMillis();
+            ResFileDTO file = CosUtils.uploadDetailInputStreamV2(imageStream, time + ".mp4", "mp4", 0L, "temp/");
+            fileUrl = file.getFileUrl();
+        }
+        if (Check.isNull(fileUrl)) {
+            return;
+        }
+        String path = URLDecoder.decode(fileUrl.substring(fileUrl.indexOf("/", 10) + 1, fileUrl.length()));
         String taskId = videoWatermarkHandle(path, tentcentWatermarkTemplate.getTemplateId());
         DescribeTaskDetailResponse taskDetailResponse = null;
         for (int i = 0; i < 30; i++) {
@@ -154,10 +172,10 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
 
 
     @Override
-    public MaterialInfo getMaterialInfoByCodeAndProjectId(String code, Long projectId) {
+    public MaterialInfo getMaterialInfoByCodeAndProductId(String code, Long productId) {
         QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("code", code);
-        queryWrapper.eq("project_id", projectId);
+        queryWrapper.eq("product_id", productId);
         queryWrapper.orderByDesc("id").last("limit 1");
         return this.getOne(queryWrapper);
     }
@@ -172,9 +190,9 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
 
     @Override
-    public Map<String, Object> checkMaterialInfo(String code, Long projectId) {
+    public Map<String, Object> checkMaterialInfo(String code, Long productId) {
         Map<String, Object> result = new HashMap<>();
-        MaterialInfo info = this.getMaterialInfoByCodeAndProjectId(code, projectId);
+        MaterialInfo info = this.getMaterialInfoByCodeAndProductId(code, productId);
         if (null != info) {
             //文件已存在
             ResultMapUtils.setResultMap(result, StatusCode.FILE_HAS_UPLOAD.getCode());
@@ -240,16 +258,18 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
 
     private void insertMaterialInfo(String url, String type, JSONObject jsonObject) {
         MaterialInfo info = new MaterialInfo();
-        Long projectId = jsonObject.getLong("projectId");
+//        Long projectId = jsonObject.getLong("projectId");
+        Long productId = jsonObject.getLong("productId");
         String code = jsonObject.getString("code");
-        info.setId(code + projectId);
+        info.setId(code + productId);
         info.setCode(code);
         if (!Check.isNull(jsonObject.getString("watermarkUrl"))) {
             info.setWatermarkUrl(jsonObject.getString("watermarkUrl"));
         }
         info.setUrl(url);
         info.setUserId(jsonObject.getString("userId"));
-        info.setProjectId(projectId);
+//        info.setProjectId(projectId);
+        info.setProductId(productId);
         info.setWatermarkCode(jsonObject.getString("watermarkCode"));
         info.setStatus(0);
         info.setMaterialName(jsonObject.getString("materialName"));
@@ -295,7 +315,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             }
         }
 
-        // getFile(info,);
+        getFile(info);
 
     }
 
@@ -369,7 +389,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
 
     @Override
-    public void getFile(MaterialInfo materialInfo, String mediaId) {
+    public void getFile(MaterialInfo materialInfo) {
         uploadExecutorService.submit(new Runnable() {
             @Override
             public void run() {
@@ -415,21 +435,16 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                         if (insert > 0) {
                             log.info("素材基本信息入库完成,用时:{} s", (System.currentTimeMillis() - l) / 1000);
                         }
-
-                        if ("2".equals(mediaId) || "4".equals(mediaId)) {
-                            if (!"kuaishou_001".equals(materialInfo.getSupplierCode())) {
-                                // 默认抽帧 素造供应商
-                                Long templateId = MaterialSupplierEnum.getTemplateIdBySize(Integer.valueOf(width), Integer.valueOf(height));
-                                if (!Check.isNull(templateId)) {
-                                    Thread thread = new Thread() {
-                                        @Override
-                                        public void run() {
-                                            watermarkVideoBySupplierCode(materialInfo.getCode(), materialInfo.getUrl(), templateId);
-                                        }
-                                    };
-                                    thread.start();
+                        // 默认抽帧 素造供应商
+                        Long templateId = MaterialSupplierEnum.getTemplateIdBySize(Integer.valueOf(width), Integer.valueOf(height));
+                        if (!Check.isNull(templateId)) {
+                            Thread thread = new Thread() {
+                                @Override
+                                public void run() {
+                                    watermarkVideoBySupplierCode(materialInfo.getCode(), materialInfo.getUrl(), templateId);
                                 }
-                            }
+                            };
+                            thread.start();
                         }
                     } catch (FileNotFoundException e) {
                         e.printStackTrace();
@@ -472,8 +487,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
 
 
-
-
     @Autowired
     private IMaterialImageInfoService materialImageInfoService;
     @Autowired
@@ -497,6 +510,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             }
             MaterialInfo info = new MaterialInfo();
             Long projectId = json.getLong("projectId");
+            Project project = projectService.getById(projectId);
+            Long productId = project.getProductId();
             String code = json.getString("code");
             info.setId(UUID.randomUUID().toString().replace("-", ""));
             info.setCode(code);
@@ -506,6 +521,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             info.setUrl(url);
             info.setUserId(userId);
             info.setProjectId(projectId);
+            info.setProductId(productId);
             info.setWatermarkCode(json.getString("watermarkCode"));
             info.setStatus(0);
             info.setMaterialName(StringUtils.getFileNameNoEx(json.getString("materialName")));
@@ -514,7 +530,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             info.setCreateTime(new Date());
             info.setUpdateTime(new Date());
             info.setType(type);
-            Project project = projectService.getById(projectId);
+            //TODO 此处逻辑待调整
+            //      Project project = projectService.getById(projectId);
             if (!Check.isNull(project)) {
                 if (!Check.isNull(project.getSupplierCode())) {
                     info.setSupplierCode(project.getSupplierCode());
@@ -547,7 +564,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 JSONObject imageJson = new JSONObject();
                 imageJson.put("videoId", info.getCode());
                 imageJson.put("userId", userId);
-                imageJson.put("projectId", projectId);
                 imageJson.put("imageArr", imageArr);
                 materialImageInfoService.insertImage(imageJson);
             }
@@ -558,7 +574,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 MaterialAscription materialAscription = new MaterialAscription();
                 materialAscription.setMaterialId(info.getCode());
                 String clipId = ascription.getString("clipId");
-                if(null!=clipId&&!"".equals(clipId.trim())){
+                if (null != clipId && !"".equals(clipId.trim())) {
                     materialAscription.setClipId(clipId);
                 }
                 materialAscription.setShotId(ascription.getString("shotId"));
@@ -580,7 +596,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             insertTagList(code, userId, senceTagList);
             JSONArray modTagList = json.getJSONArray("modTagList");
             insertTagList(code, userId, modTagList);
-            getFile(info, project.getMediaId());
+            getFile(info);
             ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         } catch (Exception e) {
             ResultMapUtils.setResultMap(resultMap, StatusCode.MATERIAL_UPLOAD_FAIL.getCode());
@@ -600,28 +616,30 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             url = "https:" + json.getString("url");
 
         }
-        Long projectId = json.getLong("projectId");
+//        Long projectId = json.getLong("projectId");
+        Long productId = json.getLong("productId");
         String code = json.getString("code");
         info.setCode(code);
-        String id = code + "_" + projectId;
+        String id = code + "_" + productId;
         info.setId(id);
         if (!Check.isNull(json.getString("watermarkUrl"))) {
             info.setWatermarkUrl(json.getString("watermarkUrl"));
         }
         info.setUrl(url);
         info.setUserId(userId);
-        info.setProjectId(projectId);
+        info.setProductId(productId);
         info.setWatermarkCode(json.getString("watermarkCode"));
         info.setStatus(0);
         info.setMaterialName(json.getString("materialName"));
         info.setWatermarkMaterialName(json.getString("watermarkMaterialName"));
         info.setMaterialDescribe(json.getString("materialDescribe"));
-        Project project = projectService.getById(projectId);
-        if (!Check.isNull(project)) {
-            if (!Check.isNull(project.getSupplierCode())) {
-                info.setSupplierCode(project.getSupplierCode());
-            }
-        }
+        //TODO 此处逻辑待调整
+//        Project project = projectService.getById(projectId);
+//        if (!Check.isNull(project)) {
+//            if (!Check.isNull(project.getSupplierCode())) {
+//                info.setSupplierCode(project.getSupplierCode());
+//            }
+//        }
         MaterialCutFrame cutFrame = materialCutFrameService.getCutFrameByCode(code);
         if (Check.isNull(cutFrame)) {
             String videoUrl = URLDecoder.decode(info.getUrl()).replace("https://media-1301855440.cos.ap-chongqing.myqcloud.com/", "");
@@ -649,7 +667,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             JSONObject imageJson = new JSONObject();
             imageJson.put("videoId", info.getCode());
             imageJson.put("userId", userId);
-            imageJson.put("projectId", projectId);
             imageJson.put("imageArr", imageArr);
             materialImageInfoService.insertImage(imageJson);
         }
@@ -678,7 +695,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         insertTagList(code, userId, senceTagList);
         JSONArray modTagList = json.getJSONArray("modTagList");
         insertTagList(code, userId, modTagList);
-        getFile(info, project.getMediaId());
+        getFile(info);
 
         return id;
     }
@@ -756,10 +773,10 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
 
     @Override
-    public Map<String, Object> getListByParams(String tagCode, String type, Integer status, List<Long> projectIds, String materialName, String code, String startDate, String endDate, String userId, Integer pageNo, Integer pageSize) {
+    public Map<String, Object> getListByParams(String tagCode, String type, Integer status, List<Long> productId, String materialName, String code, String startDate, String endDate, String userId, Integer pageNo, Integer pageSize) {
         Map<String, Object> result = new HashMap<>();
         PageHelper.startPage(pageNo, pageSize);
-        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, projectIds, materialName, code, startDate, endDate, userId);
+        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, productId, materialName, code, startDate, endDate, userId);
         List<MaterialInfo> setList = new ArrayList<>();
         PageInfo<MaterialInfo> pageInfo = new PageInfo<>(dailyList);
         if (null != dailyList && !dailyList.isEmpty()) {
@@ -794,11 +811,12 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                     materialInfo.setBytedanceCost(new BigDecimal(0));
                 }
 
-                Project project = projectService.getById(info.getProjectId());
-                if (!Check.isNull(project)) {
-                    materialInfo.setMediaId(project.getMediaId());
-                    materialInfo.setProjectName(project.getProjectName());
-                }
+                //TODO 待删除
+//                Project project = projectService.getById(info.getProjectId());
+//                if (!Check.isNull(project)) {
+//                    materialInfo.setMediaId(project.getMediaId());
+//                    materialInfo.setProjectName(project.getProjectName());
+//                }
 
                 QueryWrapper<MaterialImageInfo> imageInfoQueryWrapper = new QueryWrapper<>();
                 imageInfoQueryWrapper.eq("video_id", info.getCode());

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

@@ -4,7 +4,10 @@ import cn.com.ctop.common.module.entity.Product;
 import cn.com.ctop.common.module.mapper.ProductMapper;
 import cn.com.ctop.common.module.service.IProductService;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -32,4 +35,8 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
     public List<JSONObject> getProductByMap(Map<Long, Long> productIdMap) {
         return productMapper.getProductByMap(productIdMap);
     }
+    @Override
+    public IPage<Product> getUserProductList(Page<Product> page, String userId, String productName){
+        return productMapper.getUserProductList(page,userId,productName);
+    }
 }

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

@@ -81,7 +81,7 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
     /**
      * queryTreeList 对应 queryTreeList 查询所有的部门数据,以树结构形式响应给前端
      */
-    @Cacheable(value = CacheConstant.SYS_DEPARTS_CACHE)
+    // @Cacheable(value = CacheConstant.SYS_DEPARTS_CACHE)
     @Override
     public List<SysDepartTreeModel> queryTreeList() {
         LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
@@ -101,7 +101,7 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
         return listResult;
     }
 
-    @Cacheable(value = CacheConstant.SYS_DEPART_IDS_CACHE)
+  //  @Cacheable(value = CacheConstant.SYS_DEPART_IDS_CACHE)
     @Override
     public List<DepartIdModel> queryDepartIdTreeList() {
         LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();

+ 10 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java

@@ -158,6 +158,11 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
     }
 
     @Override
+    public List<UserAllocation> getAccountListByUserIdAndProductId(String userId, Long projectId,Long productId) {
+        return userAllocationMapper.getAccountListByUserIdAndProductId(userId,projectId,productId);
+    }
+
+    @Override
     public Map<Long, List<JSONObject>> getAccountListByProjectList(List<JSONObject> projectList) {
         Map<Long, List<JSONObject>> map = new HashMap<>();
         List list = new ArrayList();
@@ -177,6 +182,11 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
     }
 
     @Override
+    public List<JSONObject> getUserIdListByProductId(Long productId) {
+        return userAllocationMapper.getUserIdListByProductId(productId);
+    }
+
+    @Override
     public List<Long> getValidProjectIds(Integer mediaId) {
         return userAllocationMapper.getValidProjectIds(mediaId);
     }

File diff ditekan karena terlalu besar
+ 95 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/ChaojiyingUtils.java


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

@@ -168,6 +168,10 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                         requestJson.put("type", type);
                     }
                 }
+                String materialName = materialInfo.getMaterialName();
+                if (!Check.isNull(materialName)) {
+                    requestJson.put("photo_name", materialName);
+                }
                 for (int i = 0; i < accountArray.size(); i++) {
                     Long accountId = accountArray.getLong(i);
                     QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();

+ 34 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceVideoETLReportReloadJob.java

@@ -0,0 +1,34 @@
+package cn.com.ctop.job.bytedance.handler;
+
+import cn.com.ctop.toutiao.modules.link.entity.ETLReportBytedanceVideo;
+import cn.com.ctop.toutiao.modules.material.service.IEtlBytedanceVideoInfoService;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 头条视频报表etl剪辑员信息二次再刷新
+ * @author 黄学超
+ */
+public class BytedanceVideoETLReportReloadJob {
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+    @Autowired
+    private IEtlBytedanceVideoInfoService iEtlBytedanceVideoInfoService;
+
+    @XxlJob("bytedanceETLReportData")
+    public void execute() throws Exception {
+        //查询素材归属表所有的信息md5,clip_id,clip_name,shot_id,shot_name,plan_id,plan_name
+        List<ETLReportBytedanceVideo> etlReportBytedanceVideoList = iEtlBytedanceVideoInfoService.selectAllETLReportBytedanceVideo();
+        if (null == etlReportBytedanceVideoList || etlReportBytedanceVideoList.isEmpty()) {
+            XxlJobHelper.log("定时获取头条报表数据异常:未获取到素材归属信息");
+            XxlJobHelper.handleFail();
+            return ;
+        }
+        //动态sql更新md5,clip_id,clip_name,shot_id,shot_name,plan_id,plan_name不为空的数据
+        etlReportBytedanceVideoList.forEach(etlReportBytedanceVideo -> executorService.submit(() -> iEtlBytedanceVideoInfoService.updateETLReportNameIsNull(etlReportBytedanceVideo)));
+    }
+}

+ 20 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/SendHourlyMessageJob.java

@@ -0,0 +1,20 @@
+package cn.com.ctop.job.bytedance.handler;
+
+import cn.com.ctop.oa.modules.service.IAppchatCreateService;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SendHourlyMessageJob {
+    @Autowired
+    private IAppchatCreateService appchatCreateService;
+
+    /**
+     *
+     **/
+    @XxlJob("sendHourlyMessageJob")
+    public void execute() {
+        appchatCreateService.getChatInfo("wrSHhWEAAAhWApP92IL0nAuA9pQZ1W7w");
+    }
+}

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

@@ -12,3 +12,14 @@ swagger:
     enable: true
     username: jeecg
     password: jeecg1314
+xxl:
+  job:
+    accessToken:
+    executor:
+      appname: module-job-bytedance
+      port: 9998
+      ip:
+      logpath: /data/applogs/xxl-job/jobhandler
+      logretentiondays: 30
+    admin:
+      addresses: http://118.24.244.213:8090/xxl-job-admin

+ 2 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCreateUnitJob.java

@@ -25,13 +25,13 @@ public class KuaishouCreateUnitJob {
     @XxlJob("kuaihouCreateUnit")
     public void execute() {
         String url = jobUrl + "/jeecg-boot/batch/kuaiShouGroupTemplate/createUnit";
-        System.err.println("请求地址" + url);
+        System.err.println("请求地址为:" + url);
         List<Long> idList = groupTemplateService.getIdList();
         if (Check.isNull(idList)) {
             XxlJobHelper.log("批量2.0暂时没有未创建的组");
             return;
         }
-    //    String url = jobUrl + "/jeecg-boot/batch/kuaiShouGroupTemplate/createUnit";
+
         for (int i = 0; i < idList.size(); i++) {
             Long id = idList.get(i);
             Map<String, Object> requestMap = new HashMap<>();

+ 2 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouLandpageJob.java

@@ -12,14 +12,14 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
 @Component
-public class KuaishouLandpageJob {
+public class KuaishouLandpagesJob {
     @Autowired
     private IKuaishouLandpagePackageService landpagePackageService;
     @Autowired
     private IUserAllocationService userAllocationService;
     static ExecutorService executorService = Executors.newFixedThreadPool(3);
 
-    @XxlJob("kuaishouCampaignJob")
+    @XxlJob("kuaishouLandpagesJob")
     public void execute() {
         //获取快手有效的账户
         List<Long> list = userAllocationService.getValidProjectIds(2);

+ 1 - 1
module-job-kuaishou/src/main/resources/application-prod.yml

@@ -94,7 +94,7 @@ spring:
   redis:
     database: 0
     host: 172.30.0.17
-#    host: 127.0.0.1
+    #    host: 127.0.0.1
     lettuce:
       pool:
         max-active: 8   #最大连接数据库连接数,设 0 为没有限制

+ 12 - 1
module-job-kuaishou/src/main/resources/application.yml

@@ -3,6 +3,7 @@ server:
 spring:
   profiles:
     active: @activatedProperties@
+#    active: prod
   application:
     name: system-web
 swagger:
@@ -11,4 +12,14 @@ swagger:
     enable: true
     username: jeecg
     password: jeecg1314
-
+xxl:
+  job:
+    accessToken:
+    executor:
+      appname: module-job-kuaishou
+      port: 9997
+      ip:
+      logpath: /data/applogs/xxl-job/jobhandler
+      logretentiondays: 30
+    admin:
+      addresses: http://118.24.244.213:8090/xxl-job-admin

+ 21 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouCreateCreativeController.java

@@ -48,6 +48,12 @@ public class AiKuaishouCreateCreativeController {
             if (Check.isNull(strategy)) {
                 throw new Exception("根据id获取详细信息为空");
             }
+            Boolean unitOverrun = createCreativeService.getUnitOverrun(strategy.getAccountId());
+            if (unitOverrun) {
+                log.error("组创建超限,accountId:{}", strategy.getAccountId());
+                throw new Exception("今日组创建已超限");
+            }
+
             executorService.submit(() ->
                     createCreativeService.customCreativeLimit(strategy)
             );
@@ -79,6 +85,11 @@ public class AiKuaishouCreateCreativeController {
             if (Check.isNull(strategy)) {
                 throw new Exception("根据id获取详细信息为空");
             }
+            Boolean unitOverrun = createCreativeService.getUnitOverrun(strategy.getAccountId());
+            if (unitOverrun) {
+                log.error("组创建超限,accountId:{}", strategy.getAccountId());
+                throw new Exception("今日组创建已超限");
+            }
             if (Check.isNull(hour)) {
                 throw new Exception("小时数据为空");
             }
@@ -121,6 +132,11 @@ public class AiKuaishouCreateCreativeController {
             if (Check.isNull(strategy)) {
                 throw new Exception("根据id获取详细信息为空");
             }
+            Boolean unitOverrun = createCreativeService.getUnitOverrun(strategy.getAccountId());
+            if (unitOverrun) {
+                log.error("组创建超限,accountId:{}", strategy.getAccountId());
+                throw new Exception("今日组创建已超限");
+            }
             if (Check.isNull(videoCnt)) {
                 throw new Exception("视频数量不能为空");
             }
@@ -156,6 +172,11 @@ public class AiKuaishouCreateCreativeController {
             if (Check.isNull(strategy)) {
                 throw new Exception("根据id获取详细信息为空");
             }
+            Boolean unitOverrun = createCreativeService.getUnitOverrun(strategy.getAccountId());
+            if (unitOverrun) {
+                log.error("组创建超限,accountId:{}", strategy.getAccountId());
+                throw new Exception("今日组创建已超限");
+            }
             if (Check.isNull(videoCnt)) {
                 throw new Exception("视频数量不能为空");
             }

+ 257 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaiShouAppMultipleBidsController.java

@@ -0,0 +1,257 @@
+package cn.com.ctop.kuaishou.modules.ai.controller;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaiShouAppMultipleBids;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaiShouAppMultipleBidsService;
+import com.alibaba.fastjson.JSON;
+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.jeecg.common.api.vo.Result;
+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 2021-05-18
+ */
+@Slf4j
+@Api(tags = "多应用分别出价")
+@RestController
+@RequestMapping("/adsp/kuaiShouAppMultipleBids")
+public class KuaiShouAppMultipleBidsController {
+    @Autowired
+    private IKuaiShouAppMultipleBidsService kuaiShouAppMultipleBidsService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaiShouAppMultipleBids
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "多应用分别出价-分页列表查询", notes = "多应用分别出价-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaiShouAppMultipleBids>> queryPageList(KuaiShouAppMultipleBids kuaiShouAppMultipleBids,
+                                                                @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                HttpServletRequest req) {
+        Result<IPage<KuaiShouAppMultipleBids>> result = new Result<>();
+        QueryWrapper<KuaiShouAppMultipleBids> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouAppMultipleBids, req.getParameterMap());
+        Page<KuaiShouAppMultipleBids> page = new Page<KuaiShouAppMultipleBids>(pageNo, pageSize);
+        IPage<KuaiShouAppMultipleBids> pageList = kuaiShouAppMultipleBidsService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaiShouAppMultipleBids
+     * @return
+     */
+    @ApiOperation(value = "多应用分别出价-添加", notes = "多应用分别出价-添加")
+    @PostMapping(value = "/saveOrUpdate")
+    public Result<KuaiShouAppMultipleBids> add(@RequestBody KuaiShouAppMultipleBids kuaiShouAppMultipleBids) {
+        Result<KuaiShouAppMultipleBids> result = new Result<>();
+        try {
+            Long accountId = kuaiShouAppMultipleBids.getAccountId();
+            Long appId = kuaiShouAppMultipleBids.getAppId();
+            QueryWrapper<KuaiShouAppMultipleBids> appMultipleBidsQueryWrapper = new QueryWrapper<>();
+            appMultipleBidsQueryWrapper.eq("account_id", accountId);
+            appMultipleBidsQueryWrapper.eq("app_id", appId);
+            appMultipleBidsQueryWrapper.orderByDesc("create_time");
+            appMultipleBidsQueryWrapper.last("limit 1");
+            KuaiShouAppMultipleBids one = kuaiShouAppMultipleBidsService.getOne(appMultipleBidsQueryWrapper);
+            if (Check.isNull(one)) {
+                kuaiShouAppMultipleBidsService.save(kuaiShouAppMultipleBids);
+            } else {
+                kuaiShouAppMultipleBids.setId(one.getId());
+                kuaiShouAppMultipleBidsService.updateById(kuaiShouAppMultipleBids);
+            }
+
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouAppMultipleBids
+     * @return
+     */
+    @ApiOperation(value = "多应用分别出价-编辑", notes = "多应用分别出价-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaiShouAppMultipleBids> edit(@RequestBody KuaiShouAppMultipleBids kuaiShouAppMultipleBids) {
+        Result<KuaiShouAppMultipleBids> result = new Result<KuaiShouAppMultipleBids>();
+        KuaiShouAppMultipleBids kuaiShouAppMultipleBidsEntity = kuaiShouAppMultipleBidsService.getById(kuaiShouAppMultipleBids.getId());
+        if (kuaiShouAppMultipleBidsEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouAppMultipleBidsService.updateById(kuaiShouAppMultipleBids);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "多应用分别出价-通过id删除", notes = "多应用分别出价-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id") String id) {
+        try {
+            kuaiShouAppMultipleBidsService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @ApiOperation(value = "多应用分别出价-批量删除", notes = "多应用分别出价-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<KuaiShouAppMultipleBids> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<KuaiShouAppMultipleBids> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaiShouAppMultipleBidsService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "多应用分别出价-通过id查询", notes = "多应用分别出价-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaiShouAppMultipleBids> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaiShouAppMultipleBids> result = new Result<>();
+        KuaiShouAppMultipleBids kuaiShouAppMultipleBids = kuaiShouAppMultipleBidsService.getById(id);
+        if (kuaiShouAppMultipleBids == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouAppMultipleBids);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouAppMultipleBids> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouAppMultipleBids kuaiShouAppMultipleBids = JSON.parseObject(deString, KuaiShouAppMultipleBids.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouAppMultipleBids, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouAppMultipleBids> pageList = kuaiShouAppMultipleBidsService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "多应用分别出价列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouAppMultipleBids.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<KuaiShouAppMultipleBids> listKuaiShouAppMultipleBidss = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouAppMultipleBids.class, params);
+                kuaiShouAppMultipleBidsService.saveBatch(listKuaiShouAppMultipleBidss);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouAppMultipleBidss.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("文件导入失败!");
+    }
+
+}

+ 7 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAdvertiserStrategy.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.ai.entity;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -8,6 +9,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * 快手账户策略设置信息表
@@ -71,7 +73,7 @@ public class AiKuaishouAdvertiserStrategy {
     /**
      * 深度出价
      */
-    private Long cpaBid;
+    private String cpaBid;
     private Long deepConversionBid;
     /**
      * 优先低成本出价
@@ -376,7 +378,11 @@ public class AiKuaishouAdvertiserStrategy {
     private Long programUnitCnt;
     private String materialKeyword;
     private Integer historyTop;
+    private Integer multipleBids;
 
     @TableField(exist = false)
     private String authName;
+
+    @TableField(exist = false)
+    private List<JSONObject> appInfoList;
 }

+ 135 - 68
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouCreativeLevelOperationRecord.java

@@ -9,79 +9,146 @@ import java.util.Date;
 
 /**
  * 自定义创意创建记录
+ *
  * @author jeecg-boot
- * @date   2021-04-12
  * @version V1.0
+ * @date 2021-04-12
  */
 @Data
 @TableName("ctop_ai_kuaishou_creative_level_operation_record")
 public class AiKuaishouCreativeLevelOperationRecord {
 
-	/**创意操作表uuid*/
-	@TableId(type = IdType.ASSIGN_UUID)
-	private String creativeUuid;
-	/**AI策略ID*/
-	private String aiStrategyUuid;
-	/**账户ID*/
-	private Long accountId;
-	/**广告计划ID*/
-	private Long campaignId;
-	/**广告组ID*/
-	private Long unitId;
-	/**广告创意ID*/
-	private Long creativeId;
-	/**是否为便利贴,默认为0*/
-	private Integer isSticky;
-	/**创意名称*/
-	private String creativeName;
-	/**视频ID*/
-	private String photoId;
-	/**封面md5*/
-	private String imageMd5;
-	/**封面图片token*/
-	private String imageToken;
-	/**素材类型*/
-	private Integer creativeMaterialType;
-	/**便利贴单图图片创意token*/
-	private String imageTokens;
-	/**行动号召按钮文案*/
-	private String actionBarText;
-	/**广告语*/
-	private String description;
-	/**便利贴创意短广告语*/
-	private String shortSlogan;
-	/**封面广告语标题*/
-	private String stickerTitle;
-	/**贴纸样式类型*/
-	private String overlayType;
-	/**广告标签*/
-	private String exposeTag;
-	/**广告标签2期*/
-	private String newExposeTag;
-	/**安卓下载中间页ID*/
-	private Integer siteId;
-	/**第三方点击检测链接*/
-	private String clickTrackUrl;
-	/**第三方开始播放监测链接*/
-	private String impressionUrl;
-	/**第三方有效播放监测链接*/
-	private String adPhotoPlayedT3sUrl;
-	/**第三方点击按钮监测链接*/
-	private String actionbarClickUrl;
-	/**创意分类*/
-	private Integer creativeCategory;
-	/**创意标签*/
-	private String creativeTag;
-	/**操作类型 1-新增 2-修改*/
-	private Integer operationType;
-	/**创意创建时间*/
-	private Date creativeCreateTime;
-	/**创意更新时间*/
-	private Date creativeUpdateTime;
-	/**创建时间*/
-	private Date createTime;
-	/**状态*/
-	private Integer status;
-	/**状态详情*/
-	private String message;
+    /**
+     * 创意操作表uuid
+     */
+    @TableId(type = IdType.ASSIGN_UUID)
+    private String creativeUuid;
+    /**
+     * AI策略ID
+     */
+    private String aiStrategyUuid;
+    /**
+     * 账户ID
+     */
+    private Long accountId;
+    /**
+     * 广告计划ID
+     */
+    private Long campaignId;
+    /**
+     * 广告组ID
+     */
+    private Long unitId;
+    /**
+     * 广告创意ID
+     */
+    private Long creativeId;
+    /**
+     * 是否为便利贴,默认为0
+     */
+    private Integer isSticky;
+    /**
+     * 创意名称
+     */
+    private String creativeName;
+    /**
+     * 视频ID
+     */
+    private String photoId;
+    /**
+     * 封面md5
+     */
+    private String imageMd5;
+    /**
+     * 封面图片token
+     */
+    private String imageToken;
+    /**
+     * 素材类型
+     */
+    private Integer creativeMaterialType;
+    /**
+     * 便利贴单图图片创意token
+     */
+    private String imageTokens;
+    /**
+     * 行动号召按钮文案
+     */
+    private String actionBarText;
+    /**
+     * 广告语
+     */
+    private String description;
+    /**
+     * 便利贴创意短广告语
+     */
+    private String shortSlogan;
+    /**
+     * 封面广告语标题
+     */
+    private String stickerTitle;
+    /**
+     * 贴纸样式类型
+     */
+    private String overlayType;
+    /**
+     * 广告标签
+     */
+    private String exposeTag;
+    /**
+     * 广告标签2期
+     */
+    private String newExposeTag;
+    /**
+     * 安卓下载中间页ID
+     */
+    private Integer siteId;
+    /**
+     * 第三方点击检测链接
+     */
+    private String clickTrackUrl;
+    /**
+     * 第三方开始播放监测链接
+     */
+    private String impressionUrl;
+    /**
+     * 第三方有效播放监测链接
+     */
+    private String adPhotoPlayedT3sUrl;
+    /**
+     * 第三方点击按钮监测链接
+     */
+    private String actionbarClickUrl;
+    /**
+     * 创意分类
+     */
+    private Integer creativeCategory;
+    /**
+     * 创意标签
+     */
+    private String creativeTag;
+    /**
+     * 操作类型 1-新增 2-修改
+     */
+    private Integer operationType;
+    /**
+     * 创意创建时间
+     */
+    private Date creativeCreateTime;
+    /**
+     * 创意更新时间
+     */
+    private Date creativeUpdateTime;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 状态
+     */
+    private Integer status;
+    /**
+     * 状态详情
+     */
+    private String message;
 }

+ 295 - 148
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouUnitLevelOperationRecord.java

@@ -9,159 +9,306 @@ import java.util.Date;
 
 /**
  * 组创建记录
+ *
  * @author jeecg-boot
- * @date   2021-04-12
  * @version V1.0
+ * @date 2021-04-12
  */
 @Data
 @TableName("ctop_ai_kuaishou_unit_level_operation_record")
 public class AiKuaishouUnitLevelOperationRecord {
 
-	/**组操作表uuid*/
-	@TableId(type = IdType.ASSIGN_UUID)
-	private String groupUuid;
-	/**AI策略ID*/
-	private String aiStrategyUuid;
-	/**账户ID*/
-	private Long accountId;
-	/**广告计划ID*/
-	private Long campaignId;
-	/**广告组ID*/
-	private Long unitId;
-	/**广告组名称*/
-	private String groupName;
-	/**定向模板id*/
-	private Integer templateId;
-	/**优化目标出价类型*/
-	private Integer bidType;
-	/**优先从系统应用商店下载*/
-	private Integer useAppMarket;
-	/**应用商店列表*/
-	private String appStore;
-	/**出价*/
-	private Integer bid;
-	/**出价*/
-	private Integer cpaBid;
-	/**优先低成本出价*/
-	private Integer smartBid;
-	/**优化目标*/
-	private Integer ocpxActionType;
-	/**深度转化目标*/
-	private Integer deepConversionType;
-	/**付费ROI系数*/
-	private Float roiRatio;
-	/**资源位置*/
-	private String sceneId;
-	/** 创意制作方式*/
-	private Integer unitType;
-	/**投放开始时间*/
-	private String beginTime;
-	/**投放结束时间*/
-	private String endTime;
-	/**投放时间段*/
-	private String scheduleTime;
-	/**单日预算*/
-	private Integer dayBudget;
-	/**分日预算*/
-	private String dayBudgetSchedule;
-	/**转化目标ID*/
-	private Integer convertId;
-	/**url类型*/
-	private Integer urlType;
-	/**url类型*/
-	private Integer webUriType;
-	/**投放链接*/
-	private String url;
-	/**调起链接*/
-	private String schemaUri;
-	/**应用ID*/
-	private Integer appId;
-	/**创意展现方式*/
-	private Integer showMode;
-	/**投放方式*/
-	private Integer speed;
-	/**预约广告*/
-	private Integer siteType;
-	/**游戏礼包码*/
-	private String giftData;
-	/**是否使用落地页前置功能*/
-	private Integer videoLandingPage;
-	/**智能定向*/
-	private Integer autoTarget;
-	/**是否开启自动生成视频*/
-	private Integer autoCreatePhoto;
-	/**地域*/
-	private String region;
-	/**商圈定向*/
-	private String districtIds;
-	/**用户类型*/
-	private Integer userType;
-	/**最大年龄*/
-	private Integer ageMin;
-	/**最小年龄*/
-	private Integer ageMax;
-	/**固定年龄段*/
-	private String agesRange;
-	/**性别*/
-	private Integer gender;
-	/**操作系统*/
-	private Integer platformOs;
-	/**Android版本*/
-	private Integer androidOsv;
-	/**iOS版本*/
-	private Integer iosOsv;
-	/**网络环境*/
-	private Integer network;
-	/**设备品牌*/
-	private String deviceBrand;
-	/**设备价格*/
-	private String devicePrice;
-	/**商业兴趣类型*/
-	private Integer businessInterestType;
-	/**商业兴趣*/
-	private String businessInterest;
-	/**网红粉丝*/
-	private String fansStar;
-	/**兴趣视频用户*/
-	private String interestVideo;
-	/**APP行为-按分类*/
-	private String appInterest;
-	/**APP行为-按APP名称*/
-	private String appIds;
-	/**过滤已转化人群纬度*/
-	private Integer filterConvertedLevel;
-	/**人群包定向*/
-	private String population;
-	/**人群包排除*/
-	private String excludePopulation;
-	/**付费人群包id*/
-	private String paidAudience;
-	/**开启智能扩量*/
-	private Integer isOpen;
-	/**不可突破年龄*/
-	private Integer noAgeBreak;
-	/**不可突破性别*/
-	private Integer noGenderBreak;
-	/**不可突破地域*/
-	private Integer noAreaBreak;
-	/**行为兴趣定向*/
-	private String behaviorInterest;
-	/**操作类型 1-新增 2-修改*/
-	private Integer operationType;
-	/**组创建时间*/
-	private Date groupCreateTime;
-	/**组更新时间*/
-	private Date groupUpdateTime;
-	/**创建时间*/
-	private Date createTime;
-	/**状态*/
-	private Integer status;
-	/**状态详情*/
-	private String message;
-	/**程序化创意2.0-是否开启智能抽帧*/
-	private Integer smartCover;
-	/**程序化创意2.0-是否开启素材挖掘*/
-	private Integer assetMining;
-	/**深度转化目标出价*/
-	private Integer deepConversionBid;
+    /**
+     * 组操作表uuid
+     */
+    @TableId(type = IdType.ASSIGN_UUID)
+    private String groupUuid;
+    /**
+     * AI策略ID
+     */
+    private String aiStrategyUuid;
+    /**
+     * 账户ID
+     */
+    private Long accountId;
+    /**
+     * 广告计划ID
+     */
+    private Long campaignId;
+    /**
+     * 广告组ID
+     */
+    private Long unitId;
+    /**
+     * 广告组名称
+     */
+    private String groupName;
+    /**
+     * 定向模板id
+     */
+    private Integer templateId;
+    /**
+     * 优化目标出价类型
+     */
+    private Integer bidType;
+    /**
+     * 优先从系统应用商店下载
+     */
+    private Integer useAppMarket;
+    /**
+     * 应用商店列表
+     */
+    private String appStore;
+    /**
+     * 出价
+     */
+    private Integer bid;
+    /**
+     * 出价
+     */
+    private Integer cpaBid;
+    /**
+     * 优先低成本出价
+     */
+    private Integer smartBid;
+    /**
+     * 优化目标
+     */
+    private Integer ocpxActionType;
+    /**
+     * 深度转化目标
+     */
+    private Integer deepConversionType;
+    /**
+     * 付费ROI系数
+     */
+    private Float roiRatio;
+    /**
+     * 资源位置
+     */
+    private String sceneId;
+    /**
+     * 创意制作方式
+     */
+    private Integer unitType;
+    /**
+     * 投放开始时间
+     */
+    private String beginTime;
+    /**
+     * 投放结束时间
+     */
+    private String endTime;
+    /**
+     * 投放时间段
+     */
+    private String scheduleTime;
+    /**
+     * 单日预算
+     */
+    private Integer dayBudget;
+    /**
+     * 分日预算
+     */
+    private String dayBudgetSchedule;
+    /**
+     * 转化目标ID
+     */
+    private Integer convertId;
+    /**
+     * url类型
+     */
+    private Integer urlType;
+    /**
+     * url类型
+     */
+    private Integer webUriType;
+    /**
+     * 投放链接
+     */
+    private String url;
+    /**
+     * 调起链接
+     */
+    private String schemaUri;
+    /**
+     * 应用ID
+     */
+    private Integer appId;
+    /**
+     * 创意展现方式
+     */
+    private Integer showMode;
+    /**
+     * 投放方式
+     */
+    private Integer speed;
+    /**
+     * 预约广告
+     */
+    private Integer siteType;
+    /**
+     * 游戏礼包码
+     */
+    private String giftData;
+    /**
+     * 是否使用落地页前置功能
+     */
+    private Integer videoLandingPage;
+    /**
+     * 智能定向
+     */
+    private Integer autoTarget;
+    /**
+     * 是否开启自动生成视频
+     */
+    private Integer autoCreatePhoto;
+    /**
+     * 地域
+     */
+    private String region;
+    /**
+     * 商圈定向
+     */
+    private String districtIds;
+    /**
+     * 用户类型
+     */
+    private Integer userType;
+    /**
+     * 最大年龄
+     */
+    private Integer ageMin;
+    /**
+     * 最小年龄
+     */
+    private Integer ageMax;
+    /**
+     * 固定年龄段
+     */
+    private String agesRange;
+    /**
+     * 性别
+     */
+    private Integer gender;
+    /**
+     * 操作系统
+     */
+    private Integer platformOs;
+    /**
+     * Android版本
+     */
+    private Integer androidOsv;
+    /**
+     * iOS版本
+     */
+    private Integer iosOsv;
+    /**
+     * 网络环境
+     */
+    private Integer network;
+    /**
+     * 设备品牌
+     */
+    private String deviceBrand;
+    /**
+     * 设备价格
+     */
+    private String devicePrice;
+    /**
+     * 商业兴趣类型
+     */
+    private Integer businessInterestType;
+    /**
+     * 商业兴趣
+     */
+    private String businessInterest;
+    /**
+     * 网红粉丝
+     */
+    private String fansStar;
+    /**
+     * 兴趣视频用户
+     */
+    private String interestVideo;
+    /**
+     * APP行为-按分类
+     */
+    private String appInterest;
+    /**
+     * APP行为-按APP名称
+     */
+    private String appIds;
+    /**
+     * 过滤已转化人群纬度
+     */
+    private Integer filterConvertedLevel;
+    /**
+     * 人群包定向
+     */
+    private String population;
+    /**
+     * 人群包排除
+     */
+    private String excludePopulation;
+    /**
+     * 付费人群包id
+     */
+    private String paidAudience;
+    /**
+     * 开启智能扩量
+     */
+    private Integer isOpen;
+    /**
+     * 不可突破年龄
+     */
+    private Integer noAgeBreak;
+    /**
+     * 不可突破性别
+     */
+    private Integer noGenderBreak;
+    /**
+     * 不可突破地域
+     */
+    private Integer noAreaBreak;
+    /**
+     * 行为兴趣定向
+     */
+    private String behaviorInterest;
+    /**
+     * 操作类型 1-新增 2-修改
+     */
+    private Integer operationType;
+    /**
+     * 组创建时间
+     */
+    private Date groupCreateTime;
+    /**
+     * 组更新时间
+     */
+    private Date groupUpdateTime;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 状态
+     */
+    private Integer status;
+    /**
+     * 状态详情
+     */
+    private String message;
+    /**
+     * 程序化创意2.0-是否开启智能抽帧
+     */
+    private Integer smartCover;
+    /**
+     * 程序化创意2.0-是否开启素材挖掘
+     */
+    private Integer assetMining;
+    /**
+     * 深度转化目标出价
+     */
+    private Integer deepConversionBid;
 }

+ 79 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/KuaiShouAppMultipleBids.java

@@ -0,0 +1,79 @@
+package cn.com.ctop.kuaishou.modules.ai.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+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 org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 多应用分别出价
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-05-18
+ */
+@Data
+@TableName("ctop_ai_kuaishou_app_multiple_bids")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_ai_kuaishou_app_multiple_bids对象", description = "多应用分别出价")
+public class KuaiShouAppMultipleBids {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 账户id
+     */
+    @Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
+    private Long accountId;
+    /**
+     * app_id
+     */
+    @Excel(name = "app_id", width = 15)
+    @ApiModelProperty(value = "app_id")
+    private Long appId;
+    /**
+     * 出价
+     */
+    @Excel(name = "出价", width = 15)
+    @ApiModelProperty(value = "出价")
+    private Long cpaBid;
+    private Long deepConversionBid;
+    /**
+     * 监测链接
+     */
+    @Excel(name = "监测链接", width = 15)
+    @ApiModelProperty(value = "监测链接")
+    private String trackUrl;
+    private String channelCode;
+    /**
+     * 创建时间
+     */
+    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+}

+ 21 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaiShouAppMultipleBidsMapper.java

@@ -0,0 +1,21 @@
+package cn.com.ctop.kuaishou.modules.ai.mapper;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaiShouAppMultipleBids;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 多应用分别出价
+ *
+ * @author jeecg-boot
+ * 2021-05-18
+ * @version V1.0
+ */
+public interface KuaiShouAppMultipleBidsMapper extends BaseMapper<KuaiShouAppMultipleBids> {
+
+    List<JSONObject> getAppInfoList(@Param("accountId") Long accountId, @Param("appIds") JSONArray jsonArray);
+}

+ 36 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaiShouAppMultipleBidsMapper.xml

@@ -0,0 +1,36 @@
+<?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.kuaishou.modules.ai.mapper.KuaiShouAppMultipleBidsMapper">
+
+    <select id="getAppInfoList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.*, t2.app_name,t2.app_version,t2.platform
+        FROM
+        (
+        SELECT
+        *
+        FROM
+        ctop_ai_kuaishou_app_multiple_bids
+        WHERE
+        account_id = #{accountId}
+        <if test="appIds != null and appIds != '' ">
+            and app_id in
+            <foreach collection="appIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        ) t1
+        LEFT JOIN (
+        SELECT
+        app_id,
+        app_name,
+        app_version,
+        platform
+        FROM
+        ctop_kuaishou_app_list
+        WHERE
+        account_id =#{accountId}
+        ) t2 ON t1.app_id = t2.app_id
+    </select>
+</mapper>

+ 4 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouDirectionalPackageMapper.xml

@@ -34,9 +34,10 @@
         ) t4 ON t4.dir_id = t1.id
         LEFT JOIN (
         SELECT dir_id,COUNT(1) 'count' FROM
-        ctop_kuaishou_directional_package_rel
-        WHERE rel_type = 'unit'
-        AND data_status=1
+        ctop_kuaishou_directional_package_rel t
+        INNER JOIN ctop_kuaishou_group tt ON t.rel_id = tt.unit_id
+        WHERE t.rel_type = 'unit'
+        AND t.data_status=1
         GROUP BY dir_id
         ) t5 ON t5.dir_id = t1.id
         where t1.data_status = 1

+ 2 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouDirectionalPckageRelMapper.xml

@@ -16,9 +16,7 @@
         exclude_population ,
         paid_audience ,
         population ,
-        message ,
-        create_time ,
-        update_time
+        message
         )
         values
             (
@@ -33,9 +31,7 @@
         #{excludePopulation} ,
         #{paidAudience} ,
         #{population} ,
-        #{message} ,
-        #{createTime} ,
-        #{updateTime}
+        #{message}
         )
 
     </insert>

+ 5 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouCreateCreativeService.java

@@ -7,9 +7,12 @@ import java.text.ParseException;
 public interface IAiKuaishouCreateCreativeService {
     Long autoCreateCreative(AiKuaishouAdvertiserStrategy strategy, Integer createType, Long videoCnt);
 
-    void autoCreateProgramCreative(AiKuaishouAdvertiserStrategy strategy,Integer createType,Long videoCnt);
+    void autoCreateProgramCreative(AiKuaishouAdvertiserStrategy strategy, Integer createType, Long videoCnt);
 
-    void customCreativeSupplement(AiKuaishouAdvertiserStrategy strategy,Integer hour) throws ParseException;
+    void customCreativeSupplement(AiKuaishouAdvertiserStrategy strategy, Integer hour) throws ParseException;
 
     void customCreativeLimit(AiKuaishouAdvertiserStrategy strategy);
+
+    // 组创建是否超限
+    Boolean getUnitOverrun(Long accountId);
 }

+ 21 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaiShouAppMultipleBidsService.java

@@ -0,0 +1,21 @@
+package cn.com.ctop.kuaishou.modules.ai.service;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaiShouAppMultipleBids;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 多应用分别出价
+ *
+ * @author jeecg-boot
+ * 2021-05-18
+ * @version V1.0
+ */
+public interface IKuaiShouAppMultipleBidsService extends IService<KuaiShouAppMultipleBids> {
+
+    List<JSONObject> getAppInfiList(Long accountId, String appIdArray);
+
+    KuaiShouAppMultipleBids getInfoByAccountAndAppId(Long accountId, Long appId);
+}

+ 0 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaishouAccountCreativeOverrunInfoService.java

@@ -13,7 +13,6 @@ public interface IKuaishouAccountCreativeOverrunInfoService extends IService<Kua
 
     void stopCreativeBySignature(Long accountId,String signature);
 
-
     void updateOverrunInfo(Long advertiserId);
 
     KuaishouAccountCreativeOverrunInfo getByParams(Long accountId, String date);

+ 446 - 164
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java

@@ -12,6 +12,7 @@ import cn.com.ctop.kuaishou.modules.ai.entity.*;
 import cn.com.ctop.kuaishou.modules.ai.enums.KuaishouCreativeAdsenceTypeEnum;
 import cn.com.ctop.kuaishou.modules.ai.enums.KuaishouCreativeMatTypeEnum;
 import cn.com.ctop.kuaishou.modules.ai.service.*;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
 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.*;
@@ -26,6 +27,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.text.ParseException;
 import java.util.*;
 
@@ -58,6 +60,10 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     private IAiKuaishouUnitLevelOperationRecordService unitLevelOperationRecordService;
     @Autowired
     private IAiKuaishouCreativeLevelOperationRecordService creativeLevelOperationRecordService;
+    @Autowired
+    private IKuaishouLandpagePackageService landpagePackageService;
+    @Autowired
+    private IKuaiShouAppMultipleBidsService kuaiShouAppMultipleBidsService;
 
 
     /**
@@ -89,51 +95,141 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         Integer singleAppid = strategy.getSingleAppid();
         if (null != singleAppid && singleAppid == 0) {
             //多应用
-            String appidString = strategy.getAppIdArray();
-            JSONArray appIdArray = JSONArray.parseArray(appidString);
-            if (null != appIdArray && !appIdArray.isEmpty()) {
-                for (int i = 0; i < appIdArray.size(); i++) {
-                    String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
-                    AiKuaiShouAppInfo appInfo = appInfoService.getByParams(strategy.getAccountId(), appIdArray.getLong(i));
-                    if (null == appInfo) {
-                        log.info("账户:{},appid({}) 数据不存在", accountId, appIdArray.getLong(i));
-                        continue;
-                    }
+            JSONArray appIdArray = JSONArray.parseArray(strategy.getAppIdArray());
+            if (strategy.getMultipleBids() == 0) { // 非多应用多出价
+                if (null != appIdArray && !appIdArray.isEmpty()) {
+                    for (int i = 0; i < appIdArray.size(); i++) {
+                        String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
+
+                        AiKuaiShouAppInfo appInfo = appInfoService.getByParams(strategy.getAccountId(), appIdArray.getLong(i));
+                        if (null == appInfo) {
+                            log.info("账户:{},appid({}) 数据不存在", accountId, appIdArray.getLong(i));
+                            continue;
+                        }
+                        if (null != strategy.getGeneralTrack() && strategy.getGeneralTrack() == 0) {
+                            strategy.setClickTrackUrl(appInfo.getTrackUrl());
+                            strategy.setImpressionUrl(appInfo.getTrackUrl());
+                        }
+                        replaceString = appInfo.getAppVersion() + "-" + replaceString;
+                        //1:查询素材
+                        List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, appInfo, createType, videoCnt);
+                        if (null == allVideos || allVideos.isEmpty()) {
+                            log.info("账户:{},{} 到 {} 未获取到相应素材({})", accountId, startTime, endTime, replaceString);
+                            continue;
+                        }
+                        Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN", createType, appInfo.getAppId(), strategyUuid);
+                        for (KuaiShouVideoGet videoItem : allVideos) {
+                            Boolean unitOverrun = getUnitOverrun(accountId);
+                            if (unitOverrun) {
+                                log.error("组创建超限,accountId:{}", accountId);
+                                return 0L;
+                            }
 
-                    if (null != strategy.getGeneralTrack() && strategy.getGeneralTrack() == 0) {
-                        strategy.setClickTrackUrl(appInfo.getTrackUrl());
-                        strategy.setImpressionUrl(appInfo.getTrackUrl());
+                            KuaishouAccountCreativeOverrunInfo overrunInfo = overrunInfoService.getByParams(accountId, DateUtils.formatDate(new Date()));
+                            if (null != overrunInfo) {
+                                log.info("该账户创意创建已超限=>accountId:{}", accountId);
+                                return 0L;
+                            }
+                            // 获取视频封面数据
+                            List<MaterialCutFrame> cutFrameList = materialCutFrameService.getListByVideoSignature(videoItem.getSignature());
+                            if ((null == cutFrameList || cutFrameList.isEmpty())) {
+                                log.info("未获取到视频封面=>videoSignature:{}", videoItem.getSignature());
+                                continue;
+                            }
+                            //开始创建组+创意
+                            String unitName = getName(strategy.getGroupName(), strategy, createType, videoItem.getPhotoName(), "unit", newCampaignId, appInfo.getAppId());
+                            JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
+                            log.info("创建广告组入参:{}", unitParams);
+                            Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
+                            Integer unitCode = (Integer) unitCreateResult.get("code");
+                            String unitMessage = (String) unitCreateResult.get("message");
+                            AiKuaishouUnitLevelOperationRecord unitLevelOperationRecord = new AiKuaishouUnitLevelOperationRecord();
+                            BeanUtils.copyProperties(strategy, unitLevelOperationRecord);
+                            unitLevelOperationRecord.setGroupName(unitName);
+                            unitLevelOperationRecord.setCreateTime(new Date());
+                            unitLevelOperationRecord.setStatus(unitCode);
+                            unitLevelOperationRecord.setCampaignId(newCampaignId);
+                            unitLevelOperationRecord.setCpaBid(unitParams.getInteger("cpa_bid"));
+                            unitLevelOperationRecord.setBid(unitParams.getInteger("bid"));
+                            unitLevelOperationRecord.setDeepConversionBid(unitParams.getInteger("deep_conversion_bid"));
+                            unitLevelOperationRecord.setMessage(unitMessage);
+                            unitLevelOperationRecord.setCampaignId(newCampaignId);
+                            unitLevelOperationRecord.setAiStrategyUuid(strategyUuid);
+                            if (unitCode != 0) {
+                                log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
+                                unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
+                                continue;
+                            }
+                            Long unitId = (Long) unitCreateResult.get("unitId");
+                            unitLevelOperationRecord.setUnitId(unitId);
+                            unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
+                            videoCnt--;
+                            JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy);
+                            createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, appInfo.getAppVersion());
+                            if (videoCnt <= 0) {
+                                return videoCnt;
+                            }
+                        }
                     }
-                    replaceString = appInfo.getAppVersion() + "-" + replaceString;
-                    //1:查询素材
-                    List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, appInfo, createType, videoCnt);
-                    if (null == allVideos || allVideos.isEmpty()) {
-                        log.info("账户:{},{} 到 {} 未获取到相应素材({})", accountId, startTime, endTime, replaceString);
+                }
+            } else if (strategy.getMultipleBids() == 1) { //  多应用多出价
+                String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
+                List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, null, createType, videoCnt);
+                if (Check.isNull(allVideos)) {
+                    return videoCnt;
+                }
+                for (KuaiShouVideoGet videoItem : allVideos) {
+                    // 获取视频封面数据
+                    List<MaterialCutFrame> cutFrameList = materialCutFrameService.getListByVideoSignature(videoItem.getSignature());
+                    if ((null == cutFrameList || cutFrameList.isEmpty())) {
+                        log.info("未获取到视频封面=>videoSignature:{}", videoItem.getSignature());
                         continue;
                     }
-                    Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN", createType, appInfo, strategyUuid);
-                    int unitCnt = 0;
-                    for (KuaiShouVideoGet videoItem : allVideos) {
+                    for (int i = 0; i < appIdArray.size(); i++) {
+
+                        Boolean unitOverrun = getUnitOverrun(accountId);
+                        if (unitOverrun) {
+                            log.error("组创建超限,accountId:{}", accountId);
+                            return 0L;
+                        }
+
+                        Long appId = appIdArray.getLong(i);
+                        if (Check.isNull(appId)) {
+                            continue;
+                        }
+                        KuaiShouAppMultipleBids multipleBids = kuaiShouAppMultipleBidsService.getInfoByAccountAndAppId(accountId, appId);
+                        if (Check.isNull(multipleBids)) {
+                            continue;
+                        }
+                        if (!Check.isNull(multipleBids.getTrackUrl())) {
+                            strategy.setClickTrackUrl(multipleBids.getTrackUrl());
+                        }
                         KuaishouAccountCreativeOverrunInfo overrunInfo = overrunInfoService.getByParams(accountId, DateUtils.formatDate(new Date()));
                         if (null != overrunInfo) {
                             log.info("该账户创意创建已超限=>accountId:{}", accountId);
                             return 0L;
                         }
-                        // 获取视频封面数据
-                        List<MaterialCutFrame> cutFrameList = materialCutFrameService.getListByVideoSignature(videoItem.getSignature());
-                        if ((null == cutFrameList || cutFrameList.isEmpty())) {
-                            log.info("未获取到视频封面=>videoSignature:{}", videoItem.getSignature());
-                            continue;
-                        }
-                        unitCnt++;
+                        Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid);
                         //开始创建组+创意
-                        String unitName = getName(strategy.getGroupName(), strategy, createType, appInfo, videoItem.getPhotoName(), "unit", newCampaignId);
-                        JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
+                        String unitName = getName(strategy.getGroupName(), strategy, createType, videoItem.getPhotoName(), "unit", newCampaignId, appId);
+                        JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
+                        unitParams.remove("cpa_bid");
+                        unitParams.put("cpa_bid", multipleBids.getCpaBid());
+                        if (!Check.isNull(multipleBids.getDeepConversionBid())) {
+                            unitParams.remove("deep_conversion_bid");
+                            unitParams.put("deep_conversion_bid", multipleBids.getDeepConversionBid());
+                        }
+                        strategy.setCpaBid(multipleBids.getCpaBid() + "");
+                        log.info("创建广告组入参:{}", unitParams);
                         Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                         Integer unitCode = (Integer) unitCreateResult.get("code");
                         String unitMessage = (String) unitCreateResult.get("message");
                         AiKuaishouUnitLevelOperationRecord unitLevelOperationRecord = new AiKuaishouUnitLevelOperationRecord();
                         BeanUtils.copyProperties(strategy, unitLevelOperationRecord);
+                        unitLevelOperationRecord.setCampaignId(newCampaignId);
+                        unitLevelOperationRecord.setCpaBid(unitParams.getInteger("cpa_bid"));
+                        unitLevelOperationRecord.setDeepConversionBid(unitParams.getInteger("deep_conversion_bid"));
+                        unitLevelOperationRecord.setBid(unitParams.getInteger("bid"));
                         unitLevelOperationRecord.setGroupName(unitName);
                         unitLevelOperationRecord.setCreateTime(new Date());
                         unitLevelOperationRecord.setStatus(unitCode);
@@ -150,7 +246,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
                         videoCnt--;
                         JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy);
-                        createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, appInfo.getAppVersion());
+                        createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, null);
                         if (videoCnt <= 0) {
                             return videoCnt;
                         }
@@ -165,14 +261,26 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 log.info("账户:{},{} 到 {} 未获取到相应素材({})", accountId, startTime, endTime, replaceString);
                 return videoCnt;
             }
-            Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, null, strategyUuid);
+            Long appId = null;
+            if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
+                appId = JSONArray.parseArray(strategy.getAppIdArray()).getLong(0);
+                if (Check.isNull(appId)) {
+                    return videoCnt;
+                }
+            }
+            Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid);
             if (null == newCampaignId) {
                 return videoCnt;
             }
-
             //3、在“上新”计划中新增广告组,一个素材搭配n张封面,组成一个广告组
-            int unitCnt = 0;
             for (KuaiShouVideoGet videoItem : newVideos) {
+
+                Boolean unitOverrun = getUnitOverrun(accountId);
+                if (unitOverrun) {
+                    log.error("组创建超限,accountId:{}", accountId);
+                    return 0L;
+                }
+
                 KuaishouAccountCreativeOverrunInfo overrunInfo = overrunInfoService.getByParams(accountId, DateUtils.formatDate(new Date()));
                 if (null != overrunInfo) {
                     return 0L;
@@ -183,27 +291,19 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                     log.info("未获取到视频封面=>videoSignature:{}", videoItem.getSignature());
                     continue;
                 }
-                unitCnt++;
-                String unitName = getName(strategy.getGroupName(), strategy, createType, null, videoItem.getPhotoName(), "unit", newCampaignId);
-
-                Long appId = null;
-                if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
-                    appId = JSONArray.parseArray(strategy.getAppIdArray()).getLong(0);
-                }
-
+                String unitName = getName(strategy.getGroupName(), strategy, createType, videoItem.getPhotoName(), "unit", newCampaignId, appId);
                 JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
+                log.info("创建广告组入参:{}", unitParams);
                 Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                 Integer unitCode = (Integer) unitCreateResult.get("code");
                 String unitMessage = (String) unitCreateResult.get("message");
                 AiKuaishouUnitLevelOperationRecord unitLevelOperationRecord = new AiKuaishouUnitLevelOperationRecord();
                 BeanUtils.copyProperties(strategy, unitLevelOperationRecord);
                 unitLevelOperationRecord.setGroupName(unitName);
-                if (!Check.isNull(strategy.getCpaBid())) {
-                    unitLevelOperationRecord.setCpaBid(Integer.valueOf(strategy.getCpaBid() + ""));
-                }
-                if (!Check.isNull(strategy.getBid())) {
-                    unitLevelOperationRecord.setBid(Integer.valueOf(strategy.getBid() + ""));
-                }
+                unitLevelOperationRecord.setCampaignId(newCampaignId);
+                unitLevelOperationRecord.setCpaBid(unitParams.getInteger("cpa_bid"));
+                unitLevelOperationRecord.setBid(unitParams.getInteger("bid"));
+                unitLevelOperationRecord.setDeepConversionBid(unitParams.getInteger("deep_conversion_bid"));
                 unitLevelOperationRecord.setCreateTime(new Date());
                 unitLevelOperationRecord.setStatus(unitCode);
                 unitLevelOperationRecord.setMessage(unitMessage);
@@ -228,7 +328,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         return videoCnt;
     }
 
-
     /**
      * 创建程序化创意
      *
@@ -249,92 +348,187 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         //2:判定账户是否单一应用
         Long timeStart = null;
         Long timeEnd = null;
-
         Integer singleAppid = strategy.getSingleAppid();
         if (null != singleAppid && singleAppid == 0) {
             timeStart = -7 * 60 * 24L;
             timeEnd = -5L;
         } else {
-            timeStart = KuaishouCreativeMatTypeEnum.getStartTimeByType(strategy.getUnitType().toString() + createType.toString());
-            timeEnd = KuaishouCreativeMatTypeEnum.getEndTimeByType(strategy.getUnitType().toString() + createType.toString());
+            if (strategy.getMultipleBids() == 0) {
+                timeStart = KuaishouCreativeMatTypeEnum.getStartTimeByType(strategy.getUnitType().toString() + createType.toString());
+                timeEnd = KuaishouCreativeMatTypeEnum.getEndTimeByType(strategy.getUnitType().toString() + createType.toString());
+            } else if (strategy.getMultipleBids() == 1) {
+                if (createType == 1) {
+                    timeStart = -1 * 60 * 24L;
+                    timeEnd = -5L;
+                } else {
+                    timeStart = KuaishouCreativeMatTypeEnum.getStartTimeByType(strategy.getUnitType().toString() + createType.toString());
+                    timeEnd = KuaishouCreativeMatTypeEnum.getEndTimeByType(strategy.getUnitType().toString() + createType.toString());
+                }
+            }
         }
-
         Long now = System.currentTimeMillis();
         String startTime = DateUtils.formatDateTime(now + timeStart * 60 * 1000L);
         String endTime = DateUtils.formatDateTime(now + timeEnd * 60 * 1000L);
-
         String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
         String key = token.getAccountId() + "_ProgramCreative" + "_" + nowDate;
+        JSONArray appIdArray = JSON.parseArray(strategy.getAppIdArray());
+        if (null != singleAppid && singleAppid == 0) {
+            if (strategy.getMultipleBids() == 0) { //  非多应用多出价
+                //多应用
+                if (null != appIdArray && !appIdArray.isEmpty()) {
+                    for (int i = 0; i < appIdArray.size(); i++) {
+                        AiKuaiShouAppInfo appInfo = appInfoService.getByParams(strategy.getAccountId(), appIdArray.getLong(i));
+                        if (null == appInfo) {
+                            log.info("账户:{},appid({}) 数据不存在", accountId, appIdArray.getLong(i));
+                            continue;
+                        }
+                        String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
 
+                        //判定是否通用监测链接
+                        if (null != strategy.getGeneralTrack() && strategy.getGeneralTrack() == 0) {
+                            strategy.setClickTrackUrl(appInfo.getTrackUrl());
+                            strategy.setImpressionUrl(appInfo.getTrackUrl());
+                        }
+                        replaceString = appInfo.getAppVersion() + "-" + replaceString;
+                        //1:查询可用素材
+                        List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, appInfo, createType, videoCnt);
+                        if (null == allVideos || allVideos.isEmpty()) {
+                            return;
+                        }
+                        Boolean unitOverrun = getUnitOverrun(accountId);
+                        if (unitOverrun) {
+                            log.error("组创建超限,accountId:{}", accountId);
+                            return;
+                        }
 
-        if (null != singleAppid && singleAppid == 0) {
-            //多应用
-            String appidString = strategy.getAppIdArray();
-            JSONArray appIdArray = JSON.parseArray(appidString);
-            if (null != appIdArray && !appIdArray.isEmpty()) {
-                for (int i = 0; i < appIdArray.size(); i++) {
-                    AiKuaiShouAppInfo appInfo = appInfoService.getByParams(strategy.getAccountId(), appIdArray.getLong(i));
-                    if (null == appInfo) {
-                        log.info("账户:{},appid({}) 数据不存在", accountId, appIdArray.getLong(i));
-                        continue;
-                    }
-                    //判定是否通用监测链接
-                    if (null != strategy.getGeneralTrack() && strategy.getGeneralTrack() == 0) {
-                        strategy.setClickTrackUrl(appInfo.getTrackUrl());
-                        strategy.setImpressionUrl(appInfo.getTrackUrl());
-                    }
-                    String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
-                    replaceString = appInfo.getAppVersion() + "-" + replaceString;
-                    //1:查询可用素材
-                    List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, appInfo, createType, videoCnt);
-                    if (null == allVideos || allVideos.isEmpty()) {
-                        return;
+                        //判定创意创建是否超限
+                        KuaishouAccountCreativeOverrunInfo overrunInfo = overrunInfoService.getByParams(accountId, DateUtils.formatDate(new Date()));
+                        if (null != overrunInfo) {
+                            log.info("该账户创意创建已超限=>accountId:{}", accountId);
+                            return;
+                        }
+                        Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN", createType, appInfo.getAppId(), strategyUuid);
+                        //创建组+创意
+                        List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
+                        for (int j = 1; j < splitVideos.size() + 1; j++) {
+                            Object redisObj = redisUtil.get(key);
+                            if (!Check.isNull(redisObj)) {
+                                Integer value = (Integer) redisObj;
+                                if (value == 1) {
+                                    log.error("程序化创意创建超限,accountId:{}", strategy.getAccountId());
+                                    return;
+                                }
+                            }
+                            //创建组
+                            String unitName = getName(strategy.getGroupName(), strategy, createType, null, "unit", newCampaignId, appInfo.getAppId());
+                            JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
+                            log.info("创建广告组入参:{}", unitParams);
+                            Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
+                            Integer unitCode = (Integer) unitCreateResult.get("code");
+                            String unitMessage = (String) unitCreateResult.get("message");
+                            AiKuaishouUnitLevelOperationRecord unitLevelOperationRecord = new AiKuaishouUnitLevelOperationRecord();
+                            BeanUtils.copyProperties(strategy, unitLevelOperationRecord);
+                            unitLevelOperationRecord.setGroupName(unitName);
+                            unitLevelOperationRecord.setCampaignId(newCampaignId);
+                            unitLevelOperationRecord.setCpaBid(unitParams.getInteger("cpa_bid"));
+                            unitLevelOperationRecord.setBid(unitParams.getInteger("bid"));
+                            unitLevelOperationRecord.setDeepConversionBid(unitParams.getInteger("deep_conversion_bid"));
+                            unitLevelOperationRecord.setCreateTime(new Date());
+                            unitLevelOperationRecord.setStatus(unitCode);
+                            unitLevelOperationRecord.setMessage(unitMessage);
+                            unitLevelOperationRecord.setCampaignId(newCampaignId);
+                            unitLevelOperationRecord.setAiStrategyUuid(strategyUuid);
+                            if (unitCode != 0) {
+                                log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
+                                unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
+                                continue;
+                            }
+                            Long unitId = (Long) unitCreateResult.get("unitId");
+                            unitLevelOperationRecord.setUnitId(unitId);
+                            unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
+                            JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j, appInfo.getAppVersion());
+                            createProgramCreative(token, creativeParams, strategy);
+                        }
                     }
-                    //判定创意创建是否超限
-                    KuaishouAccountCreativeOverrunInfo overrunInfo = overrunInfoService.getByParams(accountId, DateUtils.formatDate(new Date()));
-                    if (null != overrunInfo) {
-                        log.info("该账户创意创建已超限=>accountId:{}", accountId);
-                        return;
+                }
+            } else if (strategy.getMultipleBids() == 1) { // 多应用多出价
+                List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, null, createType, videoCnt);
+                if (Check.isNull(allVideos)) {
+                    return;
+                }
+                String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
+                List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 1);
+                for (int j = 1; j < splitVideos.size() + 1; j++) {
+                    List<KuaiShouVideoGet> kuaiShouVideoGets = splitVideos.get(j);
+                    if (Check.isNull(kuaiShouVideoGets)) {
+                        continue;
                     }
-                    Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN", createType, appInfo, strategyUuid);
-
-                    //创建组+创意
-                    List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
-                    for (int j = 1; j < splitVideos.size() + 1; j++) {
-
-                        Object redisObj = redisUtil.get(key);
-                        if (!Check.isNull(redisObj)) {
-                            Integer value = (Integer) redisObj;
-                            if (value == 1) {
-                                log.error("程序化创意创建超限,accountId:{}", strategy.getAccountId());
+                    for (KuaiShouVideoGet videoGet : kuaiShouVideoGets) {
+                        for (int i = 0; i < appIdArray.size(); i++) {
+                            Boolean unitOverrun = getUnitOverrun(accountId);
+                            if (unitOverrun) {
+                                log.error("组创建超限,accountId:{}", accountId);
                                 return;
                             }
-                        }
 
-                        //创建组
-                        String unitName = getName(strategy.getGroupName(), strategy, createType, appInfo, null, "unit", newCampaignId);
-                        JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
-                        Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
-                        Integer unitCode = (Integer) unitCreateResult.get("code");
-                        String unitMessage = (String) unitCreateResult.get("message");
-                        AiKuaishouUnitLevelOperationRecord unitLevelOperationRecord = new AiKuaishouUnitLevelOperationRecord();
-                        BeanUtils.copyProperties(strategy, unitLevelOperationRecord);
-                        unitLevelOperationRecord.setGroupName(unitName);
-                        unitLevelOperationRecord.setCreateTime(new Date());
-                        unitLevelOperationRecord.setStatus(unitCode);
-                        unitLevelOperationRecord.setMessage(unitMessage);
-                        unitLevelOperationRecord.setCampaignId(newCampaignId);
-                        unitLevelOperationRecord.setAiStrategyUuid(strategyUuid);
-                        if (unitCode != 0) {
-                            log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
+                            Object redisObj = redisUtil.get(key);
+                            if (!Check.isNull(redisObj)) {
+                                Integer value = (Integer) redisObj;
+                                if (value == 1) {
+                                    log.error("程序化创意创建超限,accountId:{}", strategy.getAccountId());
+                                    return;
+                                }
+                            }
+                            Long appId = appIdArray.getLong(i);
+                            if (Check.isNull(appId)) {
+                                continue;
+                            }
+                            KuaiShouAppMultipleBids multipleBids = kuaiShouAppMultipleBidsService.getInfoByAccountAndAppId(accountId, appId);
+                            if (Check.isNull(multipleBids)) {
+                                continue;
+                            }
+                            if (!Check.isNull(multipleBids.getTrackUrl())) {
+                                strategy.setClickTrackUrl(multipleBids.getTrackUrl());
+                            }
+                            Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid);
+                            //创建组
+                            String unitName = getName(strategy.getGroupName(), strategy, createType, videoGet.getPhotoName(), "unit", newCampaignId, appId);
+                            JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
+                            unitParams.remove("cpa_bid");
+                            unitParams.put("cpa_bid", multipleBids.getCpaBid());
+                            if (!Check.isNull(multipleBids.getDeepConversionBid())) {
+                                unitParams.remove("deep_conversion_bid");
+                                unitParams.put("deep_conversion_bid", multipleBids.getDeepConversionBid());
+                            }
+                            log.info("创建广告组入参:{}", unitParams);
+                            Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
+                            Integer unitCode = (Integer) unitCreateResult.get("code");
+                            String unitMessage = (String) unitCreateResult.get("message");
+                            AiKuaishouUnitLevelOperationRecord unitLevelOperationRecord = new AiKuaishouUnitLevelOperationRecord();
+                            BeanUtils.copyProperties(strategy, unitLevelOperationRecord);
+                            unitLevelOperationRecord.setGroupName(unitName);
+                            unitLevelOperationRecord.setCampaignId(newCampaignId);
+                            unitLevelOperationRecord.setCpaBid(unitParams.getInteger("cpa_bid"));
+                            unitLevelOperationRecord.setBid(unitParams.getInteger("bid"));
+                            unitLevelOperationRecord.setDeepConversionBid(unitParams.getInteger("deep_conversion_bid"));
+                            unitLevelOperationRecord.setCreateTime(new Date());
+                            unitLevelOperationRecord.setStatus(unitCode);
+                            unitLevelOperationRecord.setMessage(unitMessage);
+                            unitLevelOperationRecord.setCampaignId(newCampaignId);
+                            unitLevelOperationRecord.setDeepConversionBid(unitParams.getInteger("deep_conversion_bid"));
+
+                            unitLevelOperationRecord.setAiStrategyUuid(strategyUuid);
+                            if (unitCode != 0) {
+                                log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
+                                unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
+                                continue;
+                            }
+                            Long unitId = (Long) unitCreateResult.get("unitId");
+                            unitLevelOperationRecord.setUnitId(unitId);
                             unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
-                            continue;
+                            JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j, null);
+                            createProgramCreative(token, creativeParams, strategy);
                         }
-                        Long unitId = (Long) unitCreateResult.get("unitId");
-                        unitLevelOperationRecord.setUnitId(unitId);
-                        unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
-                        JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j, appInfo.getAppVersion());
-                        createProgramCreative(token, creativeParams, strategy);
                     }
                 }
             }
@@ -345,14 +539,29 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             if (null == allVideos) {
                 return;
             }
-
-            Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, null, strategyUuid);
+            Long appId = null;
+            String appIdString = strategy.getAppIdArray();
+            if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
+                if (!Check.isNull(appIdString) && !Check.isNull(JSON.parseArray(appIdString))) {
+                    appId = JSON.parseArray(appIdString).getLong(0);
+                    if (Check.isNull(appId)) {
+                        return;
+                    }
+                }
+            }
+            Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid);
             if (null == newCampaignId) {
                 return;
             }
             //创意
             List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
             for (int j = 1; j < splitVideos.size() + 1; j++) {
+                Boolean unitOverrun = getUnitOverrun(accountId);
+                if (unitOverrun) {
+                    log.error("组创建超限,accountId:{}", accountId);
+                    return;
+                }
+
                 Object redisObj = redisUtil.get(key);
                 if (!Check.isNull(redisObj)) {
                     Integer value = (Integer) redisObj;
@@ -362,21 +571,19 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                     }
                 }
                 //创建组
-                String unitName = getName(strategy.getGroupName(), strategy, createType, null, null, "unit", newCampaignId);
-                String appIdString = strategy.getAppIdArray();
-                Long appId = null;
-                if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
-                    if (!Check.isNull(appIdString) && !Check.isNull(JSON.parseArray(appIdString))) {
-                        appId = JSON.parseArray(appIdString).getLong(0);
-                    }
-                }
+                String unitName = getName(strategy.getGroupName(), strategy, createType, null, "unit", newCampaignId, appId);
                 JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
+                log.info("创建广告组入参:{}", unitParams);
                 Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                 Integer unitCode = (Integer) unitCreateResult.get("code");
                 String unitMessage = (String) unitCreateResult.get("message");
                 AiKuaishouUnitLevelOperationRecord unitLevelOperationRecord = new AiKuaishouUnitLevelOperationRecord();
                 BeanUtils.copyProperties(strategy, unitLevelOperationRecord);
                 unitLevelOperationRecord.setGroupName(unitName);
+                unitLevelOperationRecord.setCampaignId(newCampaignId);
+                unitLevelOperationRecord.setCpaBid(unitParams.getInteger("cpa_bid"));
+                unitLevelOperationRecord.setBid(unitParams.getInteger("bid"));
+                unitLevelOperationRecord.setDeepConversionBid(unitParams.getInteger("deep_conversion_bid"));
                 unitLevelOperationRecord.setCreateTime(new Date());
                 unitLevelOperationRecord.setStatus(unitCode);
                 unitLevelOperationRecord.setMessage(unitMessage);
@@ -394,6 +601,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 createProgramCreative(token, creativeParams, strategy);
             }
         }
+
     }
 
     @Override
@@ -469,14 +677,11 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             return;
         }
         Integer code = resultJson.getInteger("code");
-
-
         String message = resultJson.getString("message");
-
         Long unitId = creativeParams.getLong("unit_id");
         if (code == 0) {
+            createLandPageAndUnit(creativeParams, resultJson.getJSONObject("data"));
             log.info("创建程序化创意成功,accountId:{},unit:{}", token.getAccountId(), unitId);
-
         } else {
             log.error("快手创建程序化创意失败,accountId:{},unitId:{},返回信息:{}", token.getAccountId(), unitId, message);
             if (code == 400001 && "/rest/openapi/v2/creative/advanced/program/create调用已超日限,次日可恢复调用".equals(message)) {
@@ -485,10 +690,20 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 redisUtil.set(key, 1, 100000L);
                 updateService.updateUnitStatus(token.getAccessToken(), token.getAccountId(), unitId, 3, "e9ca23d68d884d4ebb19d07889727dae");
             }
-
-
         }
+    }
 
+    //绑定落地页与广告组、创意的关系
+    private void createLandPageAndUnit(JSONObject programJson, JSONObject data) {
+        if (!Check.isNull(data) && !Check.isNull(programJson.getLong("site_id"))) {
+            Thread thread = new Thread() {
+                @Override
+                public void run() {
+                    landpagePackageService.createLandPageAndUnit(programJson.getLong("site_id"), data.getLong("creative_id"), programJson.getLong("unit_id"), programJson.getLong("advertiser_id"));
+                }
+            };
+            thread.start();
+        }
     }
 
     private JSONObject programCreativeParams(CtopOauthToken token, Long unitId, List<KuaiShouVideoGet> list, AiKuaishouAdvertiserStrategy strategy, Integer creativeCnt, String appVersion) {
@@ -548,8 +763,8 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         if (!Check.isNull(strategy.getActionbarClickUrl())) {
             programJson.put("actionbar_click_url", strategy.getActionbarClickUrl());
         }
-        JSONArray captions = new JSONArray();
-        captions.add(strategy.getDescription());
+
+        JSONArray captions = getCaptions(strategy.getDescription());
         programJson.put("captions", captions);
         if (!Check.isNull(strategy.getCreativeCategory())) {
             programJson.put("creative_category", strategy.getCreativeCategory());
@@ -558,6 +773,22 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         return programJson;
     }
 
+    private JSONArray getCaptions(String description) {
+        JSONArray jsonArray = JSONArray.parseArray(description);
+        if (jsonArray.size() <= 3) {
+            return jsonArray;
+        }
+        Collections.shuffle(jsonArray);
+        JSONArray captions = new JSONArray();
+        for (int i = 0; i < jsonArray.size(); i++) {
+            captions.add(jsonArray.getString(i));
+            if (captions.size() == 3) {
+                break;
+            }
+        }
+        return captions;
+    }
+
     private List<KuaiShouVideoGet> getNewVideoListByParams(AiKuaishouAdvertiserStrategy strategy, String startTime, String endTime, AiKuaiShouAppInfo appInfo) {
         if (null == appInfo) {
             if (Check.isNull(strategy.getMaterialKeyword())) { // 素材名称为空 不需要标注特殊素材
@@ -652,7 +883,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     }
 
 
-    private Long getCampaignId(AiKuaishouAdvertiserStrategy strategy, CtopOauthToken token, String replaceString, String checkType, Integer createType, AiKuaiShouAppInfo appInfo, String uuid) {
+    private Long getCampaignId(AiKuaishouAdvertiserStrategy strategy, CtopOauthToken token, String replaceString, String checkType, Integer createType, Long appId, String uuid) {
         Long campaignId = null;
         if ("ALL_CAMPAIGN".equals(checkType)) {
             campaignId = campaignService.getCampaignIdByAccountAndName(strategy.getAccountId(), replaceString);
@@ -667,7 +898,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         // 不存在“上新”计划,则创建一个计划
         JSONObject campaignParams = new JSONObject();
         campaignParams.put("advertiser_id", token.getAccountId());
-        String campaignName = getName(strategy.getCampaignName(), strategy, createType, appInfo, null, "plan", null);
+        String campaignName = getName(strategy.getCampaignName(), strategy, createType, null, "plan", null, appId);
         campaignParams.put("campaign_name", campaignName);
         campaignParams.put("type", strategy.getCampaignType());
         if (null != strategy.getCampaignDayBudget() && strategy.getCampaignDayBudget() != 0) {
@@ -716,8 +947,9 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         if (null != strategy.getBid() && strategy.getBid() != 0) {
             unitParams.put("bid", strategy.getBid());
         }
-        if (null != strategy.getCpaBid() && strategy.getCpaBid() != 0) {
-            unitParams.put("cpa_bid", strategy.getCpaBid());
+        if (!Check.isNull(strategy.getCpaBid()) && !"0".equals((strategy.getCpaBid()))) {
+            Long cpdBid = getBidByString(strategy.getCpaBid());
+            unitParams.put("cpa_bid", cpdBid);
         }
         //优先低成本
         if (null != strategy.getSmartBid() && strategy.getSmartBid() != 0) {
@@ -898,14 +1130,16 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             }
         }
 
-        JSONArray appInterest = JSONArray.parseArray(strategy.getAppInterest());
-        if (!Check.isNull(appInterest)) {
-            targetJsonObject.put("app_interest", appInterest);
-        }
         // APP行为-按APP名称
-        JSONArray appIds = JSONArray.parseArray(strategy.getAppIds());
-        if (!Check.isNull(appIds)) {
-            targetJsonObject.put("app_ids", appIds);
+        if (sceneId != 5) {
+            JSONArray appIds = JSONArray.parseArray(strategy.getAppIds());
+            if (!Check.isNull(appIds)) {
+                targetJsonObject.put("app_ids", appIds);
+            }
+            JSONArray appInterest = JSONArray.parseArray(strategy.getAppInterest());
+            if (!Check.isNull(appInterest)) {
+                targetJsonObject.put("app_interest", appInterest);
+            }
         }
         // 人群包定向
         JSONArray populationString = JSONArray.parseArray(strategy.getPopulation());
@@ -941,10 +1175,33 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             }
         }
         unitParams.put("target", targetJsonObject);
-        log.info("广告组创建参数:{}", unitParams.toJSONString());
         return unitParams;
     }
 
+    private Long getBidByString(String cpaBid) {
+        if (Check.isNull(cpaBid)) {
+            return null;
+        }
+        String bidString = null;
+        if (cpaBid.contains("/")) { // 阶梯出价
+            String[] split = cpaBid.split("/");
+            int random = new Random().nextInt(split.length);
+            bidString = split[random];
+
+        } else if (cpaBid.contains("-")) { // 随机出价
+            String[] split = cpaBid.split("-");
+            Double min = Double.valueOf(split[0]) / 1000;
+            Double max = Double.valueOf(split[1]) / 1000;
+            Double randomNumber = new BigDecimal(min + Math.random() * (max - min)).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
+            bidString = String.valueOf(new Double(randomNumber * 1000).longValue());
+
+        } else {
+            bidString = cpaBid;
+        }
+
+        return Long.valueOf(bidString);
+    }
+
     private JSONArray cleanPramgramErrorScence(JSONArray scenceArray) {
         JSONArray result = new JSONArray();
         if (null == scenceArray || scenceArray.isEmpty()) {
@@ -1141,7 +1398,10 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         creativeParams.put("photo_id", videoItem.getPhotoId());
         creativeParams.put("creative_material_type", videoItem.getMaterialType());
         creativeParams.put("action_bar_text", strategy.getActionBarText());
-        creativeParams.put("description", strategy.getDescription());
+        JSONArray descArr = JSONArray.parseArray(strategy.getDescription());
+        int index = new Random().nextInt(descArr.size());
+        String description = descArr.getString(index);
+        creativeParams.put("description", description);
         // 封面广告语标题
         if (!Check.isNull(strategy.getStickerTitle())) {
             creativeParams.put("sticker_title", strategy.getStickerTitle());
@@ -1202,12 +1462,16 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             updateService.updateUnitStatus(token.getAccessToken(), token.getAccountId(), unitId, 3, "e9ca23d68d884d4ebb19d07889727dae");
         } else if (creativeCode == -1 && creativeMessage.contains("超过可关联的有效创意的上限")) {
             updateService.updateUnitStatus(token.getAccessToken(), token.getAccountId(), unitId, 3, "e9ca23d68d884d4ebb19d07889727dae");
+        } else if (creativeCode == -1 && creativeMessage.contains("视频不存在")) {
+            updateService.updateUnitStatus(token.getAccessToken(), token.getAccountId(), unitId, 3, "e9ca23d68d884d4ebb19d07889727dae");
         }
 
         AiKuaishouCreativeLevelOperationRecord record = new AiKuaishouCreativeLevelOperationRecord();
         BeanUtils.copyProperties(strategy, record);
         record.setCreativeName(creativeName);
         record.setStatus(creativeCode);
+        record.setDescription(creativeParams.getString("description"));
+        record.setPhotoId(creativeParams.getString("photo_id"));
         record.setMessage(creativeMessage);
         record.setUnitId(unitId);
         record.setAiStrategyUuid(uuid);
@@ -1229,14 +1493,20 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
      */
     @Autowired
     private RedisUtil redisUtil;
+    @Autowired
+    private IKuaiShouAppListService appListService;
 
-    private String getName(String wildcard, AiKuaishouAdvertiserStrategy strategy, Integer createType, AiKuaiShouAppInfo appInfo, String materialName, String type, Long campaignId) {
-        if (wildcard.contains("{{应用包名}}")) {
-            String appName = "";
-            if (null != appInfo) {
-                appName = appInfo.getAppName();
+
+    private String getName(String wildcard, AiKuaishouAdvertiserStrategy strategy, Integer createType, String materialName, String type, Long campaignId, Long appId) {
+        if (wildcard.contains("{{应用名称}}") || wildcard.contains("{{应用标记}}")) {
+            KuaiShouAppList getAppInfo = appListService.getAppInfo(strategy.getAccountId(), appId);
+            if (!Check.isNull(getAppInfo)) {
+                wildcard = wildcard.replace("{{应用名称}}", getAppInfo.getAppName());
+                wildcard = wildcard.replace("{{应用标记}}", getAppInfo.getAppVersion());
+            } else {
+                wildcard = wildcard.replace("{{应用名称}}", "");
+                wildcard = wildcard.replace("{{应用标记}}", "");
             }
-            wildcard = wildcard.replace("{{应用包名}}", appName);
         }
         if (wildcard.contains("{{创意制作方式}}")) {
             if (strategy.getUnitType() == 4) {
@@ -1257,6 +1527,14 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 wildcard = wildcard.replace("{{素材名称}}", materialName);
             }
         }
+        if (wildcard.contains("{{渠道号}}")) {
+            KuaiShouAppMultipleBids multipleBids = kuaiShouAppMultipleBidsService.getInfoByAccountAndAppId(strategy.getAccountId(), appId);
+            if (!Check.isNull(multipleBids)) {
+                wildcard = wildcard.replace("{{渠道号}}", multipleBids.getChannelCode());
+            } else {
+                wildcard = wildcard.replace("{{渠道号}}", "");
+            }
+        }
         if (!wildcard.contains("{{自定义}}")) {
             wildcard = wildcard + "{{自定义}}";
         }
@@ -1271,16 +1549,11 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         } else if ("unit".equals(type)) {
             wildcard = wildcard.replace("{{日期}}", nowDate);
         }
-
         String targetName = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
-        if (null != appInfo) {
-            targetName = appInfo.getAppVersion() + "-" + targetName;
-        }
         wildcard = wildcard.replace("{{自定义}}", targetName);
-
         if (!Check.isNull(campaignId)) {
             Integer count = null;
-            if (null != strategy.getSingleAppid() && strategy.getSingleAppid() == 0) {
+            if (null != strategy.getSingleAppid() && strategy.getSingleAppid() == 0 && strategy.getMultipleBids() == 0) {
                 String redisKey = strategy.getAccountId() + "_" + campaignId;
                 Object redisValue = redisUtil.get(redisKey);
                 if (Check.isNull(redisValue)) {
@@ -1329,12 +1602,21 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     }
 
 
-    public static void main(String[] args) {
-        Date date = new Date();
-        String s = DateUtils.formatDate(date, "yy-MMdd");
-        String timestamp = DateUtils.formatDate(new Date(), "HHmmss");
-        System.err.println(timestamp);
-    }
+    @Override
+    public Boolean getUnitOverrun(Long accountId) {
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String key = accountId + "_" + nowDate + "unit_create_overrun";
+        Object redisObj = redisUtil.get(key);
+        if (Check.isNull(redisObj)) {
+            return false;
+        }
+        Integer value = (Integer) redisObj;
+        if (value == 1) {
+            return true;
+        } else {
+            return false;
+        }
 
+    }
 
 }

+ 48 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaiShouAppMultipleBidsServiceImpl.java

@@ -0,0 +1,48 @@
+package cn.com.ctop.kuaishou.modules.ai.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaiShouAppMultipleBids;
+import cn.com.ctop.kuaishou.modules.ai.mapper.KuaiShouAppMultipleBidsMapper;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaiShouAppMultipleBidsService;
+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 org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 多应用分别出价
+ *
+ * @author jeecg-boot
+ * 2021-05-18
+ * @version V1.0
+ */
+@Service
+public class KuaiShouAppMultipleBidsServiceImpl extends ServiceImpl<KuaiShouAppMultipleBidsMapper, KuaiShouAppMultipleBids> implements IKuaiShouAppMultipleBidsService {
+    @Autowired
+    private KuaiShouAppMultipleBidsMapper appMultipleBidsMapper;
+
+    @Override
+    public List<JSONObject> getAppInfiList(Long accountId, String appIdArray) {
+        if (!Check.isNull(appIdArray)) {
+            JSONArray jsonArray = JSONArray.parseArray(appIdArray);
+            List<JSONObject> appInfoList = appMultipleBidsMapper.getAppInfoList(accountId, jsonArray);
+            return appInfoList;
+
+        }
+        return null;
+    }
+
+    @Override
+    public KuaiShouAppMultipleBids getInfoByAccountAndAppId(Long accountId, Long appId) {
+        QueryWrapper<KuaiShouAppMultipleBids> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId);
+        queryWrapper.eq("app_id", appId);
+        queryWrapper.orderByDesc("create_time");
+        queryWrapper.last("limit 1");
+        return this.getOne(queryWrapper);
+    }
+}

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

@@ -11,4 +11,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IKuaiShouAppListService extends IService<KuaiShouAppList> {
 
+    KuaiShouAppList getAppInfo(Long accountId, Long appId);
 }

+ 6 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/CrossAccountBatchServiceImpl.java

@@ -640,9 +640,12 @@ public class CrossAccountBatchServiceImpl implements ICrossAccountBatchService {
         JSONArray creatives = programJson.getJSONArray("creatives");
         if (creatives != null && !creatives.isEmpty()) {
             JSONObject jsonObject = creatives.getJSONObject(0);
-            if (!Check.isNull(jsonObject)) {
-                for (Object creativeId : add_creative_ids) {
-                    landpagePackageService.createLandPageAndUnit(jsonObject.getLong("site_id"), Long.valueOf(String.valueOf(creativeId)), jsonObject.getLong("unit_id"), jsonObject.getLong("advertiser_id"));
+            Long siteId = jsonObject.getLong("site_id");
+            if (!Check.isNull(siteId)) {
+                if (!Check.isNull(jsonObject)) {
+                    for (Object creativeId : add_creative_ids) {
+                        landpagePackageService.createLandPageAndUnit(siteId, Long.valueOf(String.valueOf(creativeId)), jsonObject.getLong("unit_id"), jsonObject.getLong("advertiser_id"));
+                    }
                 }
             }
         }

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

@@ -3,6 +3,7 @@ package cn.com.ctop.kuaishou.modules.batch.service.impl;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAppListMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAppListService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
@@ -15,4 +16,13 @@ import org.springframework.stereotype.Service;
 @Service
 public class KuaiShouAppListServiceImpl extends ServiceImpl<KuaiShouAppListMapper, KuaiShouAppList> implements IKuaiShouAppListService {
 
+    @Override
+    public KuaiShouAppList getAppInfo(Long accountId, Long appId) {
+        QueryWrapper<KuaiShouAppList> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId);
+        queryWrapper.eq("app_id", appId);
+        queryWrapper.orderByDesc("create_time");
+        queryWrapper.last("limit 1");
+        return this.getOne(queryWrapper);
+    }
 }

+ 4 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java

@@ -503,10 +503,10 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
             target.put("paid_audience", JSONArray.parseArray(templateTarget.getPaidAudience()));
         }
         //-------------兴趣行为定向
-        JSONObject behaviorInterest = new JSONObject();
+    /*    JSONObject behaviorInterest = new JSONObject();
         JSONObject behavior = new JSONObject();
-        JSONObject interest = new JSONObject();
-        if (!Check.isNull(templateTarget.getKeyword())) {
+        JSONObject interest = new JSONObject();*/
+ /*       if (!Check.isNull(templateTarget.getKeyword())) {
             behavior.put("keyword", JSONArray.parseArray(templateTarget.getKeyword()));
         }
         if (!Check.isNull(templateTarget.getLabel())) {
@@ -532,7 +532,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
         }
         if (!Check.isNull(behaviorInterest)) {
             target.put("behavior_interest", behaviorInterest);
-        }
+        }*/
         returnJson.put("target", target);
         returnJson.put("code", 0);
         return returnJson;

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

@@ -7,67 +7,18 @@ import cn.com.ctop.common.module.enums.MaterialEnum;
 import cn.com.ctop.common.module.service.IMaterialCutFrameService;
 import cn.com.ctop.common.module.service.IOauthConfigService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.common.module.utils.HttpUtils;
-import cn.com.ctop.common.module.utils.JsonUtil;
-import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
-import cn.com.ctop.common.module.utils.PropertiesUtils;
-import cn.com.ctop.kuaishou.modules.ai.service.IAiCreativeLimitService;
-import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAccountCreativeOverrunInfoService;
-import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAppPackageService;
-import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouDirectionalPackageService;
-import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouLandpagePackageService;
-import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouPopulationGroupService;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAdvertiserBaseInfo;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouDailyFlows;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouRegionListChildren;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouRegionListParent;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouTargetingTags;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouPopulation;
+import cn.com.ctop.common.module.utils.*;
+import cn.com.ctop.kuaishou.modules.ai.service.*;
+import cn.com.ctop.kuaishou.modules.batch.entity.*;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.ConvertVo;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAdvertiserBaseInfoMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAppListMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouRegionListChildrenMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouRegionListParentMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouTargetingTagsMapper;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCreativeService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyFlowsService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouOverRunSendMessageService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouPopulationService;
-import cn.com.ctop.kuaishou.modules.batch.service.IWarningOperationService;
+import cn.com.ctop.kuaishou.modules.batch.mapper.*;
+import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResult;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCampaign;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreative;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreativeStatistic;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyAccount;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCampaign;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCreative;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCreativeStatistic;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyGroup;
+import cn.com.ctop.kuaishou.modules.report.entity.*;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCampaignMapper;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCampaignService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCreativeService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyAccountService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyCampaignService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyCreativeService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyGroupService;
+import cn.com.ctop.kuaishou.modules.report.service.*;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -84,6 +35,7 @@ import lombok.var;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.http.ParseException;
 import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.RedisUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.io.FileSystemResource;
 import org.springframework.http.HttpEntity;
@@ -101,11 +53,7 @@ import java.io.IOException;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -939,6 +887,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
      */
 
 
+    @Autowired
+    private RedisUtil redisUtil;
+
     @Override
     public Map<String, Object> adUnitCreate(String accessToken, Long advertiserId, JSONObject requestJson, Integer count) {
         Map<String, Object> returnMap = new HashMap<>();
@@ -1004,7 +955,12 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     }
 
                 } else {
+                    if (code == 400001 && resultJson.getString("message").equals("/rest/openapi/v2/ad_unit/create调用已超日限,次日可恢复调用")) {
+                        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+                        String key = advertiserId + "_" + nowDate + "unit_create_overrun";
+                        redisUtil.set(key, 1, 60 * 60 * 24);
 
+                    }
                     if (code == 500000 && count <= 4) {
                         adUnitCreate(accessToken, advertiserId, requestJson, count + 1);
                     }
@@ -1019,7 +975,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     log.info("创建组失败,重试,入参:{}", requestJson);
                     adUnitCreate(accessToken, advertiserId, requestJson, count + 1);
                 }
-                log.error("快手创建广告计划返回内容为空,advertiser_id:{},入参:{}", advertiserId, requestJson);
+                log.error("快手创建广告回内容为空,advertiser_id:{},入参:{}", advertiserId, requestJson);
                 returnMap.put("code", -1);
                 returnMap.put("message", "创建广告组异常");
                 returnMap.put("desc", "result is null");
@@ -2039,7 +1995,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     if (code == 401000 && resultJson.getString("message").contains("超过可关联的有效创意的上限")) {
                         creativeLimitService.replaceSava(advertiserId, requestJson.getLong("photo_id"));
                     }
-
+                    if (code == 401000 && resultJson.getString("message").contains("视频不存在")) {
+                        creativeLimitService.replaceSava(advertiserId, requestJson.getLong("photo_id"));
+                    }
                     log.error("创建广告创意失败,advertiser_id:{},返回信息:{},入参:{}", advertiserId, resultJson, requestJson, count + 1);
                     returnMap.put("code", -1);
                     returnMap.put("message", resultJson.getString("message"));
@@ -2155,9 +2113,12 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         JSONArray creatives = programJson.getJSONArray("creatives");
         if (creatives != null && !creatives.isEmpty()) {
             JSONObject jsonObject = creatives.getJSONObject(0);
-            if (!Check.isNull(jsonObject)) {
-                for (Object creativeId : add_creative_ids) {
-                    landpagePackageService.createLandPageAndUnit(jsonObject.getLong("site_id"), Long.valueOf(String.valueOf(creativeId)), programJson.getLong("unit_id"), programJson.getLong("advertiser_id"));
+            Long siteId = jsonObject.getLong("site_id");
+            if (!Check.isNull(siteId)) {
+                if (!Check.isNull(jsonObject)) {
+                    for (Object creativeId : add_creative_ids) {
+                        landpagePackageService.createLandPageAndUnit(siteId, Long.valueOf(String.valueOf(creativeId)), programJson.getLong("unit_id"), programJson.getLong("advertiser_id"));
+                    }
                 }
             }
         }

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

@@ -571,6 +571,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
     @Value("${jeecg.path.chrome-driver}")
     private String chromeDriver;
 
+
     @Override
     public void adkuaishouWebLogin(String phone, String password) throws IOException {
         ChromeDriverService service = new ChromeDriverService.Builder().usingDriverExecutable(new File(chromeDriver)).usingAnyFreePort().build();

+ 18 - 18
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsNewGroupReportCtrl.java

@@ -25,7 +25,7 @@ import java.util.List;
 import java.util.Map;
 
 /**
- *  Created by JQ.bi on 2020.11.6
+ * Created by JQ.bi on 2020.11.6
  */
 @Slf4j
 @RestController
@@ -46,30 +46,30 @@ public class KsNewGroupReportCtrl {
         Result<Map<String, Object>> resultBody = new Result<>();
         Map<String, Object> result = new HashMap<>();
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
-        String userId= requestBody.getString("userId");
+        String userId = requestBody.getString("userId");
         //TODO 没有维护快手事业部负责人角色,增加判断
-        if(userId.equals("6b4c821adc414dc8b7718ab63ccbfcaf")){
-            accountIds= newPlanReportService.getAccountIdsByMedia();
-        }else{
-            if(!userId.isEmpty()){
-                accountIds= newPlanReportService.getAccountIdsByUserId(userId);
+        if (userId.equals("b73c6a1cafb4469a8c0081acd50f703b") || userId.equals("228c45f913924639bf20c79ce5dadb16")) {
+            accountIds = newPlanReportService.getAccountIdsByMedia();
+        } else {
+            if (!userId.isEmpty()) {
+                accountIds = newPlanReportService.getAccountIdsByUserId(userId);
             }
-            if(accountIds.isEmpty()){
+            if (accountIds.isEmpty()) {
                 return resultBody;
             }
         }
 
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
-        String target= requestBody.getString("target");
-        String order= requestBody.getString("order");
+        String target = requestBody.getString("target");
+        String order = requestBody.getString("order");
         try {
             JSONObject sumData = newGroupReportService.getSumNewGroupBy(accountIds, startDate, endDate);
             List<JSONObject> chartData = newGroupReportService.getKsNewGroupGroupByStatDate(accountIds, startDate, endDate);
-            List<JSONObject> listData = newGroupReportService.getKsNewGroupGroupByAccount(accountIds, startDate, endDate,target,order);
-            result.put("sumData",sumData);
-            result.put("chartData",chartData);
-            result.put("listData",listData);
+            List<JSONObject> listData = newGroupReportService.getKsNewGroupGroupByAccount(accountIds, startDate, endDate, target, order);
+            result.put("sumData", sumData);
+            result.put("chartData", chartData);
+            result.put("listData", listData);
             resultBody.setResult(result);
             resultBody.setSuccess(true);
         } catch (Exception e) {
@@ -84,15 +84,15 @@ public class KsNewGroupReportCtrl {
         Result<List<JSONObject>> result = new Result<>();
 
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
-        if(accountIds.isEmpty()){
+        if (accountIds.isEmpty()) {
             return result;
         }
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
-        String target= requestBody.getString("target");
-        String order= requestBody.getString("order");
+        String target = requestBody.getString("target");
+        String order = requestBody.getString("order");
         try {
-            List<JSONObject> listData = newGroupReportService.getKsNewGroupGroupByAccount(accountIds, startDate, endDate,target,order);
+            List<JSONObject> listData = newGroupReportService.getKsNewGroupGroupByAccount(accountIds, startDate, endDate, target, order);
             result.setResult(listData);
             result.setSuccess(true);
         } catch (Exception e) {

+ 6 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAccount.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.report.entity;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonProperty;
@@ -176,6 +177,11 @@ public class KuaishouReportDailyAccount implements Serializable {
 
     @JsonProperty("play_3s_ratio")
     private Double play3sRatio;
+    @JsonProperty("play_5s_ratio")
+    @TableField("play_5s_ratio")
+    private Double play5sRatio;
+    @JsonProperty("play_end_ratio")
+    private Double playEndRatio;
     @JsonProperty("event_app_invoked")
     private Long eventAppInvoked;
 

+ 6 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportHourlyAccount.java

@@ -108,6 +108,12 @@ public class KuaishouReportHourlyAccount implements Serializable {
     @TableField("play_3s_ratio")
     private BigDecimal play3sRatio;
 
+    @JsonProperty("play_5s_ratio")
+    @TableField("play_5s_ratio")
+    private Double play5sRatio;
+     @JsonProperty("play_end_ratio")
+    private Double playEndRatio;
+
     @JsonProperty
     private Long share;
     @JsonProperty

+ 30 - 28
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouAccountMaterialReportDailyMapper.xml

@@ -108,36 +108,38 @@
         play_3s_count)
         values
         <foreach collection="records" item="record" separator=",">
-            (#{record.companyId} ,
-            #{record.companyName} ,
-            #{record.projectId} ,
-            #{record.projectName} ,
-            #{record.accountId} ,
-            #{record.signature} ,
-            #{record.charge} ,
-            #{record.photoShow} ,
-            #{record.aclick} ,
-            #{record.bclick} ,
+            (
+            #{record.companyId},
+            #{record.companyName},
+            #{record.projectId},
+            #{record.projectName},
+            #{record.accountId},
+            #{record.signature},
+            #{record.charge},
+            #{record.photoShow},
+            #{record.aclick},
+            #{record.bclick},
             #{record.downloadStarted} ,
             #{record.downloadCompleted} ,
-            #{record.activation} ,
-            #{record.submit} ,
-            #{record.statDate} ,
-            #{record.photoClick} ,
-            #{record.eventPayFirstDay} ,
-            #{record.eventPayPurchaseAmountFirstDay} ,
-            #{record.eventPay} ,
-            #{record.eventPayPurchaseAmount} ,
-            #{record.eventRegister} ,
-            #{record.eventJinJianApp} ,
-            #{record.eventCreditGrantApp} ,
-            #{record.eventOrderPaid} ,
-            #{record.eventOrderPaidPurchaseAmount} ,
-            #{record.eventJinJianLandingPage} ,
+            #{record.activation},
+            #{record.submit},
+            #{record.statDate},
+            #{record.photoClick},
+            #{record.eventPayFirstDay},
+            #{record.eventPayPurchaseAmountFirstDay},
+            #{record.eventPay},
+            #{record.eventPayPurchaseAmount},
+            #{record.eventRegister},
+            #{record.eventJinJianApp},
+            #{record.eventCreditGrantApp},
+            #{record.eventOrderPaid},
+            #{record.eventOrderPaidPurchaseAmount},
+            #{record.eventJinJianLandingPage},
             #{record.eventCreditGrantLandingPage} ,
-            #{record.eventNextDayStay} ,
-            #{record.formCount} ,
-            #{record.play3sCount})
+            #{record.eventNextDayStay},
+            #{record.formCount},
+            #{record.play3sCount}
+            )
         </foreach>
     </insert>
     <select id="etlKuaishouAccountMaterialReportDailyList"
@@ -157,7 +159,7 @@
     sum(m.download_completed)as download_completed,
     sum(m.activation)as activation ,
     sum(m.submit)as submit,
-    stat_date,
+    date_format(m.stat_date,'%Y-%m-%d')as stat_date,
     sum(m.photo_click)as photo_click,
     sum(m.event_pay_first_day)as event_pay_first_day,
     sum(m.event_pay_purchase_amount_first_day)as event_pay_purchase_amount_first_day,

+ 8 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml

@@ -139,6 +139,8 @@
         form_cost,
         form_count,
         play_3s_ratio,
+        play_5s_ratio,
+        play_end_ratio,
         event_app_invoked,
         event_new_user_pay,
         event_new_user_pay_cost,
@@ -201,6 +203,8 @@
             #{add.formCost},
             #{add.formCount},
             #{add.play3sRatio},
+            #{add.play5sRatio},
+            #{add.playEndRatio},
             #{add.eventAppInvoked},
             #{add.eventNewUserPay},
             #{add.eventNewUserPayCost},
@@ -267,6 +271,8 @@
         form_cost,
         form_count,
         play_3s_ratio,
+        play_5s_ratio,
+        play_end_ratio,
         event_app_invoked,
         event_new_user_pay,
         event_new_user_pay_cost,
@@ -330,6 +336,8 @@
             #{add.formCost},
             #{add.formCount},
             #{add.play3sRatio},
+            #{add.play5sRatio},
+            #{add.playEndRatio},
             #{add.eventAppInvoked},
             #{add.eventNewUserPay},
             #{add.eventNewUserPayCost},

+ 4 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportHourlyAccountMapper.xml

@@ -54,6 +54,8 @@
         form_cost,
         form_count,
         play_3s_ratio,
+        play_5s_ratio,
+        play_end_ratio,
         event_app_invoked,
         event_new_user_pay,
         event_new_user_pay_cost,
@@ -113,6 +115,8 @@
             #{add.formCost},
             #{add.formCount},
             #{add.play3sRatio},
+            #{add.play5sRatio},
+            #{add.playEndRatio},
             #{add.eventAppInvoked},
             #{add.eventNewUserPay},
             #{add.eventNewUserPayCost},

+ 3 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/constant/QYWxConstant.java

@@ -19,6 +19,9 @@ public class QYWxConstant {
     public static final String QYWX_CHECKIN_DATA = "https://qyapi.weixin.qq.com/cgi-bin/checkin/getcheckindata";  //获取部门下员工简单信息
     public static final String APP_ROVAL_INFO = "https://qyapi.weixin.qq.com/cgi-bin/oa/getapprovalinfo";  //批量获取审批单号
     public static final String APP_ROVAL_DETAIL = "https://qyapi.weixin.qq.com/cgi-bin/oa/getapprovaldetail";  //获取审批申请详情
+    public static final String APPCHAT_CREATE = "https://qyapi.weixin.qq.com/cgi-bin/appchat/create";  //创建群聊
+    public static final String APPCHAT_GET = "https://qyapi.weixin.qq.com/cgi-bin/appchat/get";  //创建群聊
+    public static final String APPCHAT_SEND = "https://qyapi.weixin.qq.com/cgi-bin/appchat/send"; // 发送消息
 
     /**
      * 天津优容智汇 企业微信信息

+ 9 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/service/IAppchatCreateService.java

@@ -0,0 +1,9 @@
+package cn.com.ctop.oa.modules.service;
+
+import com.alibaba.fastjson.JSONArray;
+
+public interface IAppchatCreateService {
+    void createAppChat(String name, String owner, JSONArray userlist);
+
+    void getChatInfo(String chatid);
+}

+ 2 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/service/IWechatUserListService.java

@@ -17,5 +17,7 @@ public interface IWechatUserListService extends IService<WechatUserList> {
     void getYRUserList();
 
     List<WechatUserList> queryList(int dataType);
+
+    WechatUserList getInfoByUserId(String userId);
 }
 

+ 108 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/AppchatCreateServiceImpl.java

@@ -0,0 +1,108 @@
+package cn.com.ctop.oa.modules.service.impl;
+
+import cn.com.ctop.common.module.entity.CtopCorpWexinUser;
+import cn.com.ctop.common.module.service.ICtopCorpWexinUserService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.oa.modules.constant.QYWxConstant;
+import cn.com.ctop.oa.modules.service.IAppchatCreateService;
+import cn.com.ctop.oa.modules.service.IWechatTokenService;
+import cn.com.ctop.oa.modules.service.IWechatUserListService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import static org.jeecg.common.constant.GeneralConstant.ACCESS_TOKEN;
+import static org.jeecg.common.constant.GeneralConstant.CODE;
+
+@Service
+@Slf4j
+public class AppchatCreateServiceImpl implements IAppchatCreateService {
+    @Autowired
+    private IWechatTokenService tokenService;
+    @Autowired
+    private IWechatUserListService userListService;
+    @Autowired
+    private ICtopCorpWexinUserService ctopCorpWexinUserService;
+
+    @Override
+    public void createAppChat(String name, String owner, JSONArray userlist) {
+        try {
+            Map<String, Object> qywxAccessToken = tokenService.getQYWXAccessToken();
+            if ((Integer) qywxAccessToken.get(CODE) != 0) {
+                throw new Exception("获取token失败");
+            }
+            System.err.println(qywxAccessToken);
+            JSONObject params = new JSONObject();
+            params.put("name", "易车时报发送");
+            params.put("owner", "qy01338f036d3ce902287758b529");
+            JSONArray userList = new JSONArray();
+            userList.add("qy01338f036d3ce902287758b529");
+            userList.add("qy01ae8f626d56e90128175730d2");
+            userList.add("YuMeng");
+            params.put("userlist", userList);
+            String resultStr = HttpUtils.httpPostRequestTest(QYWxConstant.APPCHAT_CREATE + "?access_token=" + qywxAccessToken.get(ACCESS_TOKEN), params.toJSONString(), null);
+            System.err.println(resultStr);
+        } catch (Exception e) {
+            log.error("员工考勤入库异常,", e);
+        }
+    }
+
+    @Override
+    public void getChatInfo(String chatid) {
+        Map<String, Object> qywxAccessToken = tokenService.getQYWXAccessToken();
+        TreeMap params = new TreeMap();
+        params.put("chatid", chatid);
+        params.put("access_token", qywxAccessToken.get(ACCESS_TOKEN));
+        String resultStr = HttpUtils.httpGetRequest(QYWxConstant.APPCHAT_GET, null, params);
+        JSONObject jsonObject = JSONObject.parseObject(resultStr);
+        if (Check.isNull(jsonObject)) {
+            return;
+        }
+        Integer errcode = jsonObject.getInteger("errcode");
+        if (errcode != 0) {
+            log.error("获取群聊信息返回code失败");
+            return;
+        }
+        JSONObject chat_info = jsonObject.getJSONObject("chat_info");
+        if (Check.isNull(chat_info)) {
+            return;
+        }
+        JSONArray userlist = chat_info.getJSONArray("userlist");
+        if (Check.isNull(userlist)) {
+            return;
+        }
+        StringBuilder text = new StringBuilder();
+        text.append("请及时发送该时段易车时报!");
+        text.append("\n");
+        text.append("17点和22点必须提前10分钟准时发出!");
+        text.append("\n");
+        text.append("\n");
+        for (int i = 0; i < userlist.size(); i++) {
+            String userId = userlist.getString(i);
+            CtopCorpWexinUser userInfo = ctopCorpWexinUserService.getInfoByUserId(userId);
+            if (Check.isNull(userInfo)) {
+                continue;
+            }
+            if (userInfo.getWexinName().equals("于蒙蒙") || userInfo.getWexinName().equals("吴永前")) {
+                continue;
+            }
+            text.append("@" + userInfo.getWexinName() + "");
+        }
+        JSONObject postJson = new JSONObject();
+        postJson.put("chatid", chatid);
+        postJson.put("msgtype", "text");
+        JSONObject content = new JSONObject();
+        content.put("content", text);
+        postJson.put("text", content);
+        postJson.put("safe", 0);
+        String postStr = HttpUtils.httpPostRequestTest(QYWxConstant.APPCHAT_SEND + "?access_token=" + qywxAccessToken.get(ACCESS_TOKEN), postJson.toJSONString(), null);
+        log.info("定时发送消息返回结果:{}", postStr);
+
+    }
+}

+ 10 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatUserListServiceImpl.java

@@ -11,6 +11,7 @@ import cn.com.ctop.oa.modules.service.IWechatTokenService;
 import cn.com.ctop.oa.modules.service.IWechatUserListService;
 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 com.xxl.job.core.enums.NoEn;
 import lombok.extern.slf4j.Slf4j;
@@ -138,4 +139,13 @@ public class WechatUserListServiceImpl extends ServiceImpl<WechatUserListMapper,
     public List<WechatUserList> queryList(int dataType) {
         return wechatUserListMapper.queryList(dataType);
     }
+
+    @Override
+    public WechatUserList getInfoByUserId(String userId) {
+        QueryWrapper<WechatUserList> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("user_id", userId);
+        queryWrapper.orderByDesc("create_time");
+        queryWrapper.last("limit 1");
+        return this.getOne(queryWrapper);
+    }
 }

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

@@ -0,0 +1,247 @@
+package cn.com.ctop.toutiao.modules.material.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 cn.com.ctop.toutiao.modules.material.entity.ByteDanceCreativeWordPackage;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeWordPackageService;
+import org.jeecg.common.api.vo.Result;
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+
+
+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
+ * @version V1.0
+ * @date 2021-05-19
+ */
+@Slf4j
+@Api(tags = "创意动态词包信息")
+@RestController
+@RequestMapping("/ctop/ByteDanceCreativeWordPackage")
+public class ByteDanceCreativeWordPackageController {
+    @Autowired
+    private IByteDanceCreativeWordPackageService ByteDanceCreativeWordPackageService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param ByteDanceCreativeWordPackage
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "创意动态词包信息-分页列表查询", notes = "创意动态词包信息-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<ByteDanceCreativeWordPackage>> queryPageList(ByteDanceCreativeWordPackage ByteDanceCreativeWordPackage,
+                                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                     @RequestParam(name = "pageSize", defaultValue = "100") Integer pageSize,
+                                                                     HttpServletRequest req) {
+        Result<IPage<ByteDanceCreativeWordPackage>> result = new Result<>();
+        QueryWrapper<ByteDanceCreativeWordPackage> queryWrapper = QueryGenerator.initQueryWrapper(ByteDanceCreativeWordPackage, req.getParameterMap());
+        Page<ByteDanceCreativeWordPackage> page = new Page<ByteDanceCreativeWordPackage>(pageNo, pageSize);
+        IPage<ByteDanceCreativeWordPackage> pageList = ByteDanceCreativeWordPackageService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param ByteDanceCreativeWordPackage
+     * @return
+     */
+    @ApiOperation(value = "创意动态词包信息-添加", notes = "创意动态词包信息-添加")
+    @PostMapping(value = "/add")
+    public Result<ByteDanceCreativeWordPackage> add(@RequestBody ByteDanceCreativeWordPackage ByteDanceCreativeWordPackage) {
+        Result<ByteDanceCreativeWordPackage> result = new Result<>();
+        try {
+            ByteDanceCreativeWordPackageService.save(ByteDanceCreativeWordPackage);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param ByteDanceCreativeWordPackage
+     * @return
+     */
+    @ApiOperation(value = "创意动态词包信息-编辑", notes = "创意动态词包信息-编辑")
+    @PutMapping(value = "/edit")
+    public Result<ByteDanceCreativeWordPackage> edit(@RequestBody ByteDanceCreativeWordPackage ByteDanceCreativeWordPackage) {
+        Result<ByteDanceCreativeWordPackage> result = new Result<ByteDanceCreativeWordPackage>();
+        ByteDanceCreativeWordPackage ByteDanceCreativeWordPackageEntity = ByteDanceCreativeWordPackageService.getById(ByteDanceCreativeWordPackage.getId());
+        if (ByteDanceCreativeWordPackageEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = ByteDanceCreativeWordPackageService.updateById(ByteDanceCreativeWordPackage);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "创意动态词包信息-通过id删除", notes = "创意动态词包信息-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id") String id) {
+        try {
+            ByteDanceCreativeWordPackageService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @ApiOperation(value = "创意动态词包信息-批量删除", notes = "创意动态词包信息-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<ByteDanceCreativeWordPackage> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<ByteDanceCreativeWordPackage> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.ByteDanceCreativeWordPackageService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "创意动态词包信息-通过id查询", notes = "创意动态词包信息-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<ByteDanceCreativeWordPackage> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<ByteDanceCreativeWordPackage> result = new Result<>();
+        ByteDanceCreativeWordPackage ByteDanceCreativeWordPackage = ByteDanceCreativeWordPackageService.getById(id);
+        if (ByteDanceCreativeWordPackage == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(ByteDanceCreativeWordPackage);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<ByteDanceCreativeWordPackage> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                ByteDanceCreativeWordPackage ByteDanceCreativeWordPackage = JSON.parseObject(deString, ByteDanceCreativeWordPackage.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(ByteDanceCreativeWordPackage, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<ByteDanceCreativeWordPackage> pageList = ByteDanceCreativeWordPackageService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "创意动态词包信息列表");
+        mv.addObject(NormalExcelConstants.CLASS, ByteDanceCreativeWordPackage.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<ByteDanceCreativeWordPackage> listByteDanceCreativeWordPackages = ExcelImportUtil.importExcel(file.getInputStream(), ByteDanceCreativeWordPackage.class, params);
+                ByteDanceCreativeWordPackageService.saveBatch(listByteDanceCreativeWordPackages);
+                return Result.ok("文件导入成功!数据行数:" + listByteDanceCreativeWordPackages.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("文件导入失败!");
+    }
+
+}
+

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

@@ -0,0 +1,202 @@
+package cn.com.ctop.toutiao.modules.material.controller;
+
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import cn.com.ctop.toutiao.modules.material.entity.BytedanceAccountCommonSlogen;
+import cn.com.ctop.toutiao.modules.material.service.IBytedanceAccountCommonSlogenService;
+import com.alibaba.fastjson.JSON;
+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.jeecg.common.api.vo.Result;
+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
+ * @date   2021-05-24
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="头条账户通用文案数据")
+@RestController
+@RequestMapping("/ctop/bytedanceAccountCommonSlogen")
+public class BytedanceAccountCommonSlogenController {
+	@Autowired
+	private IBytedanceAccountCommonSlogenService bytedanceAccountCommonSlogenService;
+
+	/**
+	  * 分页列表查询
+	 * @param bytedanceAccountCommonSlogen
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@ApiOperation(value="头条账户通用文案数据-分页列表查询", notes="头条账户通用文案数据-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<BytedanceAccountCommonSlogen>> queryPageList(BytedanceAccountCommonSlogen bytedanceAccountCommonSlogen,
+																	 @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+																	 @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+																	 HttpServletRequest req) {
+		Result<IPage<BytedanceAccountCommonSlogen>> result = new Result<>();
+		QueryWrapper<BytedanceAccountCommonSlogen> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceAccountCommonSlogen, req.getParameterMap());
+		Page<BytedanceAccountCommonSlogen> page = new Page<>(pageNo, pageSize);
+		IPage<BytedanceAccountCommonSlogen> pageList = bytedanceAccountCommonSlogenService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param bytedanceAccountCommonSlogen
+	 * @return
+	 */
+	@ApiOperation(value="头条账户通用文案数据-添加", notes="头条账户通用文案数据-添加")
+	@PostMapping(value = "/add")
+	public Result<BytedanceAccountCommonSlogen> add(@RequestBody BytedanceAccountCommonSlogen bytedanceAccountCommonSlogen) {
+		Result<BytedanceAccountCommonSlogen> result = new Result<>();
+		try {
+			bytedanceAccountCommonSlogenService.save(bytedanceAccountCommonSlogen);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param bytedanceAccountCommonSlogen
+	 * @return
+	 */
+	@ApiOperation(value="头条账户通用文案数据-编辑", notes="头条账户通用文案数据-编辑")
+	@PutMapping(value = "/edit")
+	public Result<BytedanceAccountCommonSlogen> edit(@RequestBody BytedanceAccountCommonSlogen bytedanceAccountCommonSlogen) {
+		Result<BytedanceAccountCommonSlogen> result = new Result<>();
+		BytedanceAccountCommonSlogen bytedanceAccountCommonSlogenEntity = bytedanceAccountCommonSlogenService.getById(bytedanceAccountCommonSlogen.getId());
+		if(bytedanceAccountCommonSlogenEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = bytedanceAccountCommonSlogenService.updateById(bytedanceAccountCommonSlogen);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="头条账户通用文案数据-通过id删除", notes="头条账户通用文案数据-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id") String id) {
+		try {
+			bytedanceAccountCommonSlogenService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+
+	/**
+	 *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@ApiOperation(value="头条账户通用文案数据-批量删除", notes="头条账户通用文案数据-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<BytedanceAccountCommonSlogen> deleteBatch(@RequestParam(name="ids") String ids) {
+		Result<BytedanceAccountCommonSlogen> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.bytedanceAccountCommonSlogenService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="头条账户通用文案数据-通过id查询", notes="头条账户通用文案数据-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<BytedanceAccountCommonSlogen> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<BytedanceAccountCommonSlogen> result = new Result<>();
+		BytedanceAccountCommonSlogen bytedanceAccountCommonSlogen = bytedanceAccountCommonSlogenService.getById(id);
+		if(bytedanceAccountCommonSlogen==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(bytedanceAccountCommonSlogen);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+   * 通过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<BytedanceAccountCommonSlogen> listBytedanceAccountCommonSlogens = ExcelImportUtil.importExcel(file.getInputStream(), BytedanceAccountCommonSlogen.class, params);
+              bytedanceAccountCommonSlogenService.saveBatch(listBytedanceAccountCommonSlogens);
+              return Result.ok("文件导入成功!数据行数:" + listBytedanceAccountCommonSlogens.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("文件导入失败!");
+  }
+
+}

+ 108 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceCreativeWordPackage.java

@@ -0,0 +1,108 @@
+package cn.com.ctop.toutiao.modules.material.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.alibaba.fastjson.JSONObject;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+@Data
+@TableName("ctop_bytedance_creative_word_package")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_bytedance_creative_word_package对象", description = "今日头条创意词包")
+public class ByteDanceCreativeWordPackage {
+
+
+    /**id*/
+    @TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+    private java.lang.Integer id;
+    /**creativeWordId*/
+    @Excel(name = "creativeWordId", width = 15)
+    @ApiModelProperty(value = "creativeWordId")
+    private java.lang.Integer creativeWordId;
+    /**name*/
+    @Excel(name = "name", width = 15)
+    @ApiModelProperty(value = "name")
+    private java.lang.String name;
+    /**defaultWord*/
+    @Excel(name = "defaultWord", width = 15)
+    @ApiModelProperty(value = "defaultWord")
+    private java.lang.String defaultWord;
+    /**words*/
+    @Excel(name = "words", width = 15)
+    @ApiModelProperty(value = "words")
+    private java.lang.Object words;
+    /**contentType*/
+    @Excel(name = "contentType", width = 15)
+    @ApiModelProperty(value = "contentType")
+    private java.lang.String contentType;
+    /**maxWordLen*/
+    @Excel(name = "maxWordLen", width = 15)
+    @ApiModelProperty(value = "maxWordLen")
+    private java.lang.Integer maxWordLen;
+    /**status*/
+    @Excel(name = "status", width = 15)
+    @ApiModelProperty(value = "status")
+    private java.lang.String status;
+    /**userRate*/
+    @Excel(name = "userRate", width = 15)
+    @ApiModelProperty(value = "userRate")
+    private Float userRate;
+    /**createTime*/
+    @ApiModelProperty(value = "createTime")
+    private java.util.Date createTime;
+    /**updateTime*/
+    @ApiModelProperty(value = "updateTime")
+    private java.util.Date updateTime;
+
+
+
+    public ByteDanceCreativeWordPackage(){}
+
+    public ByteDanceCreativeWordPackage(JSONObject jsonObject){
+        int creativeWordId = jsonObject.getInteger("creative_word_id");
+        this.creativeWordId = creativeWordId;
+
+        int maxWordLen = jsonObject.getInteger("max_word_len");
+        this.maxWordLen = maxWordLen;
+
+        String name = jsonObject.getString("name");
+        if (null != name && !"".equals(name.trim())) {
+            this.name = name;
+        }
+
+        String defaultWord = jsonObject.getString("default_word");
+        if (null != defaultWord && !"".equals(defaultWord.trim())) {
+            this.defaultWord = defaultWord;
+        }
+
+        String words = jsonObject.getString("words");
+        if (null != words && !"".equals(words.trim())) {
+            this.words = words;
+        }
+
+        String contentType = jsonObject.getString("content_type");
+        if (null != contentType && !"".equals(contentType.trim())) {
+            this.contentType = contentType;
+        }
+
+        String status = jsonObject.getString("status");
+        if (null != status && !"".equals(status.trim())) {
+            this.status = status;
+        }
+
+        Float userRate = jsonObject.getFloat("user_rate");
+        this.userRate = userRate;
+    }
+
+
+}

+ 53 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/BytedanceAccountCommonSlogen.java

@@ -0,0 +1,53 @@
+package cn.com.ctop.toutiao.modules.material.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   2021-05-24
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_bytedance_account_common_slogen")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_bytedance_account_common_slogen对象", description="头条账户通用文案数据")
+public class BytedanceAccountCommonSlogen {
+    
+	/**id*/
+	@TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+	private Integer id;
+	/**slogen*/
+	@Excel(name = "slogen", width = 15)
+    @ApiModelProperty(value = "slogen")
+	private String slogen;
+	/**accountId*/
+	@Excel(name = "accountId", width = 15)
+    @ApiModelProperty(value = "accountId")
+	private Integer accountId;
+	/**createTime*/
+    @ApiModelProperty(value = "createTime")
+	private Date createTime;
+	/**updateTime*/
+    @ApiModelProperty(value = "updateTime")
+	private Date updateTime;
+	/**status*/
+	@Excel(name = "status", width = 15)
+    @ApiModelProperty(value = "status")
+	private Integer status;
+}

+ 4 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/BytedanceVideoSlogenInfo.java

@@ -35,7 +35,9 @@ public class BytedanceVideoSlogenInfo {
 	/**status*/
 	private Integer status;
 
-	public BytedanceVideoSlogenInfo(String videoCode, String slogan, String userId) {
+	private String creativeWordIds;
+
+	public BytedanceVideoSlogenInfo(String videoCode, String slogan, String userId, String creativeWordIds) {
 		this.videoCode = videoCode;
 		this.slogan = slogan;
 		this.createBy = userId;
@@ -43,6 +45,7 @@ public class BytedanceVideoSlogenInfo {
 		this.createTime = new Date();
 		this.updateTime = new Date();
 		this.status = 1;
+		this.creativeWordIds = creativeWordIds;
 	}
 
 	public BytedanceVideoSlogenInfo() {

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

@@ -0,0 +1,18 @@
+package cn.com.ctop.toutiao.modules.material.mapper;
+
+import cn.com.ctop.toutiao.modules.material.entity.ByteDanceCreative;
+import cn.com.ctop.toutiao.modules.material.entity.ByteDanceCreativeWordPackage;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @Description: 今日头条创意信息
+ * @Author: jeecg-boot
+ * @Date: 2019-07-22
+ * @Version: V1.0
+ */
+public interface ByteDanceCreativeWordPackageMapper extends BaseMapper<ByteDanceCreativeWordPackage> {
+    void replaceBatch(@Param(value = "creativeWordPackages") List<ByteDanceCreativeWordPackage> creativeWordPackages);
+}

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

@@ -0,0 +1,17 @@
+package cn.com.ctop.toutiao.modules.material.mapper;
+
+import java.util.List;
+
+import cn.com.ctop.toutiao.modules.material.entity.BytedanceAccountCommonSlogen;
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 头条账户通用文案数据
+ * @author jeecg-boot
+ * 2021-05-24
+ * @version V1.0
+ */
+public interface BytedanceAccountCommonSlogenMapper extends BaseMapper<BytedanceAccountCommonSlogen> {
+
+}

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

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.toutiao.modules.material.mapper.ByteDanceCreativeWordPackageMapper">
+
+    <insert id="replaceBatch">
+        replace into ctop_bytedance_creative_word_package(
+        creative_word_id,
+        name,
+        default_word,
+        words,
+        content_type,
+        max_word_len,
+        status,
+        user_rate)
+        values
+        <foreach collection="creativeWordPackages" item="report" separator=",">
+            (
+            #{report.creativeWordId},
+            #{report.name},
+            #{report.defaultWord},
+            #{report.words},
+            #{report.contentType},
+            #{report.maxWordLen},
+            #{report.status},
+            #{report.userRate}
+            )
+        </foreach>
+    </insert>
+</mapper>

+ 5 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/BytedanceAccountCommonSlogenMapper.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.toutiao.modules.material.mapper.BytedanceAccountCommonSlogenMapper">
+
+</mapper>

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

@@ -0,0 +1,21 @@
+package cn.com.ctop.toutiao.modules.material.service;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.toutiao.modules.material.entity.ByteDanceCreative;
+import cn.com.ctop.toutiao.modules.material.entity.ByteDanceCreativeWordPackage;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 今日头条创意词包
+ * @Author: jeecg-boot
+ * @Date: 2021-05-18
+ * @Version: test
+ */
+public interface IByteDanceCreativeWordPackageService extends IService<ByteDanceCreativeWordPackage> {
+    Map<String, Object> getCreativeWordPackage();
+
+}

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

@@ -0,0 +1,14 @@
+package cn.com.ctop.toutiao.modules.material.service;
+
+import cn.com.ctop.toutiao.modules.material.entity.BytedanceAccountCommonSlogen;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 头条账户通用文案数据
+ * @author jeecg-boot
+ * 2021-05-24
+ * @version V1.0
+ */
+public interface IBytedanceAccountCommonSlogenService extends IService<BytedanceAccountCommonSlogen> {
+
+}

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

@@ -1,8 +1,11 @@
 package cn.com.ctop.toutiao.modules.material.service;
 
+import cn.com.ctop.toutiao.modules.link.entity.ETLReportBytedanceVideo;
 import cn.com.ctop.toutiao.modules.material.entity.EtlBytedanceVideoInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * @Description: 头条视频报表信息
  * @Author: jeecg-boot
@@ -10,5 +13,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @Version: V1.0
  */
 public interface IEtlBytedanceVideoInfoService extends IService<EtlBytedanceVideoInfo> {
+    List<ETLReportBytedanceVideo> selectAllETLReportBytedanceVideo();
 
+    void updateETLReportNameIsNull(ETLReportBytedanceVideo etlReportBytedanceVideo);
 }

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

@@ -0,0 +1,66 @@
+package cn.com.ctop.toutiao.modules.material.service.impl;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.toutiao.modules.material.entity.ByteDanceCreativeWordPackage;
+import cn.com.ctop.toutiao.modules.material.mapper.ByteDanceCreativeWordPackageMapper;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeWordPackageService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+@Slf4j
+@Service
+public class ByteDanceCreativeWordPackageServiceImpl extends ServiceImpl<ByteDanceCreativeWordPackageMapper, ByteDanceCreativeWordPackage> implements IByteDanceCreativeWordPackageService {
+
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Resource
+    private ByteDanceCreativeWordPackageMapper byteDanceCreativeWordPackageMapper;
+
+    @Override
+    public Map<String, Object> getCreativeWordPackage(){
+        String accountId = "1649600126891015";
+        JSONObject data = new JSONObject();
+
+        //1:获取token
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", token.getAccessToken());
+
+        data.put("advertiser_id", token.getAccountId());
+//        data.put("creative_word_ids","");  不填,默认返回所有创意词包
+        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_word_select");
+        String result = HttpUtils.httpGetRequest(url,headers,data);
+        JSONObject jsonObject = JSONObject.parseObject(result);
+        saveCreativeWordPackageToDb(jsonObject);
+        return null;
+    }
+
+    public void saveCreativeWordPackageToDb(JSONObject result){
+        List<ByteDanceCreativeWordPackage> resultList = new ArrayList<ByteDanceCreativeWordPackage>();
+        Integer code = result.getInteger("code");
+        if(code != null && 0 == code){
+            JSONObject data = result.getJSONObject("data");
+            JSONArray dataJSONArray = data.getJSONArray("creative_word");
+            for (int i = 0 ; i < dataJSONArray.size() ; i++) {
+                JSONObject creativeWord = (JSONObject)dataJSONArray.get(i);
+                ByteDanceCreativeWordPackage byteDanceCreativeWordPackage = new ByteDanceCreativeWordPackage(creativeWord);
+                resultList.add(byteDanceCreativeWordPackage);
+            }
+            byteDanceCreativeWordPackageMapper.replaceBatch(resultList);
+        }
+    }
+
+}

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

@@ -0,0 +1,18 @@
+package cn.com.ctop.toutiao.modules.material.service.impl;
+
+import cn.com.ctop.toutiao.modules.material.entity.BytedanceAccountCommonSlogen;
+import cn.com.ctop.toutiao.modules.material.mapper.BytedanceAccountCommonSlogenMapper;
+import cn.com.ctop.toutiao.modules.material.service.IBytedanceAccountCommonSlogenService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 头条账户通用文案数据
+ * @author jeecg-boot
+ * 2021-05-24
+ * @version V1.0
+ */
+@Service
+public class BytedanceAccountCommonSlogenServiceImpl extends ServiceImpl<BytedanceAccountCommonSlogenMapper, BytedanceAccountCommonSlogen> implements IBytedanceAccountCommonSlogenService {
+
+}

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

@@ -5,6 +5,7 @@ import cn.com.ctop.toutiao.modules.material.entity.BytedanceVideoSlogenInfo;
 import cn.com.ctop.toutiao.modules.material.mapper.BytedanceVideoSlogenInfoMapper;
 import cn.com.ctop.toutiao.modules.material.service.IBytedanceVideoSlogenInfoService;
 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 org.springframework.stereotype.Service;
@@ -25,8 +26,10 @@ public class BytedanceVideoSlogenInfoServiceImpl extends ServiceImpl<BytedanceVi
             return;
         }
         for(int i=0;i<slogans.size();i++){
-            String slogan = slogans.getString(i);
-            BytedanceVideoSlogenInfo slogenInfo = new BytedanceVideoSlogenInfo(videoCode,slogan,userId);
+            JSONObject sloganObject = slogans.getJSONObject(i);
+            String title = sloganObject.getString("title");
+            String creativeWordIds = Check.isNull(sloganObject.getJSONArray("creative_word_ids")) ? "" : sloganObject.getJSONArray("creative_word_ids").toJSONString();
+            BytedanceVideoSlogenInfo slogenInfo = new BytedanceVideoSlogenInfo(videoCode,title,userId,creativeWordIds);
             this.save(slogenInfo);
         }
     }

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

@@ -1,11 +1,16 @@
 package cn.com.ctop.toutiao.modules.material.service.impl;
 
+import cn.com.ctop.toutiao.modules.link.entity.ETLReportBytedanceVideo;
 import cn.com.ctop.toutiao.modules.material.entity.EtlBytedanceVideoInfo;
 import cn.com.ctop.toutiao.modules.material.mapper.EtlBytedanceVideoInfoMapper;
 import cn.com.ctop.toutiao.modules.material.service.IEtlBytedanceVideoInfoService;
+import cn.com.ctop.toutiao.modules.report.mapper.EtlBytedanceReportVideoDailyMapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * 头条视频报表信息
  * @author jeecg-boot
@@ -15,4 +20,16 @@ import org.springframework.stereotype.Service;
 @Service
 public class EtlBytedanceVideoInfoServiceImpl extends ServiceImpl<EtlBytedanceVideoInfoMapper, EtlBytedanceVideoInfo> implements IEtlBytedanceVideoInfoService {
 
+    @Autowired
+    EtlBytedanceReportVideoDailyMapper etlBytedanceReportVideoDailyMapper;
+
+    @Override
+    public List<ETLReportBytedanceVideo> selectAllETLReportBytedanceVideo(){
+        List<ETLReportBytedanceVideo> etlReportBytedanceVideoList = etlBytedanceReportVideoDailyMapper.getCtopMaterialAscriptionInfo();
+        return etlReportBytedanceVideoList;
+    }
+    @Override
+    public void updateETLReportNameIsNull(ETLReportBytedanceVideo etlReportBytedanceVideo){
+        etlBytedanceReportVideoDailyMapper.updateOneBytedanceVideoInfo(etlReportBytedanceVideo);
+    }
 }

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

@@ -25,4 +25,8 @@ public interface EtlBytedanceReportVideoDailyMapper extends BaseMapper<EtlByteda
     List<ETLReportBytedanceVideo> etlBytedanceVideoInfo(@Param(value = "date") String date);
 
     void replaceEtlVideoInfo(@Param(value = "videoInfo") ETLReportBytedanceVideo videoInfo);
+
+    List<ETLReportBytedanceVideo> getCtopMaterialAscriptionInfo();
+
+    void updateOneBytedanceVideoInfo(@Param(value = "etlReportBytedanceVideo") ETLReportBytedanceVideo etlReportBytedanceVideo);
 }

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

@@ -2,6 +2,40 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.toutiao.modules.report.mapper.EtlBytedanceReportVideoDailyMapper">
 
+    <select id="getCtopMaterialAscriptionInfo" resultType="cn.com.ctop.toutiao.modules.link.entity.ETLReportBytedanceVideo">
+        SELECT DISTINCT
+            md5,
+            cma.clip_id,
+            cma.clip_name,
+            cma.shot_id,
+            cma.shot_name,
+            cma.plan_id,
+            cma.plan_name
+        FROM
+            etl_report_bytedance_video video
+        LEFT JOIN ctop_material_ascription cma ON cma. CODE = video.md5
+        where
+		cma.clip_id is not null or
+		cma.clip_name is not null or
+		cma.shot_id is not null or
+		cma.shot_name is not null or
+		cma.plan_id is not null or
+		cma.plan_name is not null;
+    </select>
+
+    <update id="updateOneBytedanceVideoInfo"  parameterType="cn.com.ctop.toutiao.modules.link.entity.ETLReportBytedanceVideo">
+        UPDATE etl_report_bytedance_video
+        <trim prefix="set" suffixOverrides=",">
+            <if test="etlReportBytedanceVideo.clipId!=null">clip_id=#{etlReportBytedanceVideo.clipId},</if>
+            <if test="etlReportBytedanceVideo.clipName!=null">clip_name=#{etlReportBytedanceVideo.clipName},</if>
+            <if test="etlReportBytedanceVideo.shotId!=null">shot_id=#{etlReportBytedanceVideo.shotId},</if>
+            <if test="etlReportBytedanceVideo.shotName!=null">shot_name=#{etlReportBytedanceVideo.shotName},</if>
+            <if test="etlReportBytedanceVideo.planId!=null">plan_id=#{etlReportBytedanceVideo.planId},</if>
+            <if test="etlReportBytedanceVideo.planName!=null">plan_name=#{etlReportBytedanceVideo.planName},</if>
+        </trim>
+        WHERE md5=#{etlReportBytedanceVideo.md5}
+    </update>
+
 
     <select id="getBytedanceVideoInfo" resultType="java.util.Map">
         SELECT

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

@@ -414,6 +414,7 @@ public class ReportServiceImpl implements IReportService {
             log.error("素材报表请求数据null=>accountId:{};startDate:{};endDate:{}", token.getAccountId(), startDate, endDate);
             return;
         }
+
         Integer code = getObject.getInteger("code");
         String message = getObject.getString("message");
         if (null == code || code != 0) {

+ 0 - 0
module-toutiao/src/main/resources/bytedance_config.properties


Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini