Browse Source

Merge branch 'master' into test

# Conflicts:
#	jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
#	module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java
#	module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
#	module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
huangxuechao 4 năm trước cách đây
mục cha
commit
470678edc6
80 tập tin đã thay đổi với 2678 bổ sung401 xóa
  1. 70 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialAscriptionController.java
  2. 54 19
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  3. 15 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java
  4. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  5. 12 2
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  6. 1 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/AlarmRuleRecordMapper.java
  7. 6 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmRuleRecordMapper.xml
  8. 8 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmRuleRecordServiceImpl.java
  9. 1 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/IAlarmRuleRecordService.java
  10. 76 35
      module-common/src/main/java/cn/com/ctop/common/module/entity/RuleDateUnitKuaishou.java
  11. 2 4
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java
  12. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/ProjectMapper.java
  13. 3 3
      module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java
  14. 16 1
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml
  15. 28 27
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ProductMapper.xml
  16. 6 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ProjectMapper.xml
  17. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialAscriptionService.java
  18. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  19. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/IMessageTemplate.java
  20. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IProjectService.java
  21. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java
  22. 11 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialAscriptionServiceImpl.java
  23. 20 17
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  24. 3 2
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MessageTemplateImpl.java
  25. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/ProjectServiceImpl.java
  26. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java
  27. 4 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java
  28. 21 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAlarmRuleRecordJob.java
  29. 1 1
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouMaterialSyncMd5Job.java
  30. 40 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouProjectVideoGetJob.java
  31. 50 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouSupplierVideoGetJob.java
  32. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaiShouCreativeRefusalController.java
  33. 82 35
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaishouAppPackageController.java
  34. 0 25
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaishouDirectionalPackageController.java
  35. 248 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaishouVideoDirectionalPackageController.java
  36. 8 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/KuaishouAppPackage.java
  37. 75 53
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/KuaishouAppPackageRel.java
  38. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/KuaishouDirectionalPackage.java
  39. 233 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/KuaishouVideoDirectionalPackage.java
  40. 4 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouAppPackageMapper.java
  41. 4 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouDirectionalPckageRelMapper.java
  42. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouLandpagePackageMapper.java
  43. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouPopulationPackageMapper.java
  44. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouVideoDirectionalPackageMapper.java
  45. 24 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouAppPackageMapper.xml
  46. 17 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouDirectionalPackageMapper.xml
  47. 27 19
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouDirectionalPckageRelMapper.xml
  48. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouLandpagePackageMapper.xml
  49. 20 8
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouPopulationPackageMapper.xml
  50. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouVideoDirectionalPackageMapper.xml
  51. 4 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaishouAppPackageService.java
  52. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaishouVideoDirectionalPackageService.java
  53. 0 17
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/KuaishouAppPackageRelMapper.java
  54. 6 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java
  55. 96 14
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouAppPackageServiceImpl.java
  56. 20 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouDirectionalPackageServiceImpl.java
  57. 18 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouLandpagePackageServiceImpl.java
  58. 18 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouPopulationPackageServiceImpl.java
  59. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouVideoDirectionalPackageServiceImpl.java
  60. 99 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  61. 318 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouProjectVideoGetController.java
  62. 7 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouVideoGet.java
  63. 132 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouProjectVideoGet.java
  64. 7 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouVideoGetMapper.java
  65. 36 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouProjectVideoGetMapper.java
  66. 58 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouVideoGetMapper.xml
  67. 211 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouProjectVideoGetMapper.xml
  68. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouMaterialUploadService.java
  69. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouVideoGetService.java
  70. 28 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouProjectVideoGetService.java
  71. 28 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouMaterialUploadServiceImpl.java
  72. 73 10
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouVideoGetServiceImpl.java
  73. 95 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouProjectVideoGetServiceImpl.java
  74. 1 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouTemplateServiceImpl.java
  75. 16 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouGroupExploreController.java
  76. 20 18
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouReportAccountDailyMapper.xml
  77. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouGroupExploreService.java
  78. 49 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouGroupExploreServiceImpl.java
  79. 56 41
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/RuleKuaiShouPlanServiceImpl.java
  80. 2 3
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceNewPlanReportMapper.xml

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

@@ -2,9 +2,15 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
 import cn.com.ctop.common.module.entity.MaterialAscription;
+import cn.com.ctop.common.module.entity.SysUser;
 import cn.com.ctop.common.module.service.IMaterialAscriptionService;
+import cn.com.ctop.common.module.service.ISysUserService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.QueryGenerator;
+import cn.com.ctop.kuaishou.modules.material.entity.EtlKuaishouVideoInfo;
+import cn.com.ctop.kuaishou.modules.material.service.IEtlKuaishouVideoInfoService;
+import cn.com.ctop.toutiao.modules.link.entity.ETLReportBytedanceVideo;
+import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -114,13 +120,77 @@ public class MaterialAscriptionController {
         return result;
     }
 
+    @Autowired
+    private ISysUserService sysUserService;
+    @Autowired
+    private IEtlKuaishouVideoInfoService etlKuaishouVideoInfoService;
+    @Autowired
+    private IETLReportBytedanceVideoService reportBytedanceVideoService;
+
     @PutMapping(value = "/update")
     public Result<MaterialAscription> update(@RequestBody MaterialAscription materialAscription) {
         Result<MaterialAscription> result = new Result<>();
+        String shotName = "";
+        String shotId = materialAscription.getShotId();
+        if (!Check.isNull(shotId)) {
+            SysUser plan = sysUserService.getById(shotId);
+            if (!Check.isNull(plan)) {
+                shotName = plan.getRealname();
+                materialAscription.setShotName(shotName);
+            }
+        }
+        String planName = "";
+        String planId = materialAscription.getPlanId();
+        if (!Check.isNull(planId)) {
+            SysUser plan = sysUserService.getById(planId);
+            if (!Check.isNull(plan)) {
+                planName = plan.getRealname();
+                materialAscription.setPlanName(planName);
+            }
+        }
+        String clipName = "";
+        String clipId = materialAscription.getClipId();
+        if (!Check.isNull(clipId)) {
+            SysUser clip = sysUserService.getById(clipId);
+            if (!Check.isNull(clip)) {
+                clipName = clip.getRealname();
+                materialAscription.setClipName(clipName);
+            }
+        }
         QueryWrapper<MaterialAscription> ascriptionQueryWrapper = new QueryWrapper<>();
         ascriptionQueryWrapper.eq("material_id", materialAscription.getMaterialId());
         ascriptionQueryWrapper.last("limit 1");
         MaterialAscription one = materialAscriptionService.getOne(ascriptionQueryWrapper);
+        if (!Check.isNull(shotId) || !Check.isNull(planId) || !Check.isNull(clipId)) {
+            EtlKuaishouVideoInfo updateVideoInfo = new EtlKuaishouVideoInfo();
+            ETLReportBytedanceVideo updateByteDanceVideoInfo = new ETLReportBytedanceVideo();
+            if (!Check.isNull(clipId)) {
+                updateVideoInfo.setClipId(clipId);
+                updateVideoInfo.setClipName(clipName);
+                updateByteDanceVideoInfo.setClipId(clipId);
+                updateByteDanceVideoInfo.setClipName(clipName);
+            }
+            if (!Check.isNull(shotId)) {
+                updateVideoInfo.setShotId(shotId);
+                updateVideoInfo.setShotName(shotName);
+                updateByteDanceVideoInfo.setShotId(shotId);
+                updateByteDanceVideoInfo.setShotName(shotName);
+            }
+            if (!Check.isNull(planId)) {
+                updateVideoInfo.setPlanId(planId);
+                updateVideoInfo.setPlanName(planName);
+                updateByteDanceVideoInfo.setPlanId(planId);
+                updateByteDanceVideoInfo.setPlanName(planName);
+            }
+            QueryWrapper<EtlKuaishouVideoInfo> updateKuaiShouQueryWrapper = new QueryWrapper<>();
+            updateKuaiShouQueryWrapper.eq("video_code", materialAscription.getMaterialId());
+            etlKuaishouVideoInfoService.update(updateVideoInfo, updateKuaiShouQueryWrapper);
+            QueryWrapper<ETLReportBytedanceVideo> updateByteDanceQueryWrapper = new QueryWrapper<>();
+            updateByteDanceQueryWrapper.eq("md5", materialAscription.getMaterialId());
+            reportBytedanceVideoService.update(updateByteDanceVideoInfo, updateByteDanceQueryWrapper);
+        }
+
+
         boolean ok;
         if (Check.isNull(one)) {
             ok = materialAscriptionService.save(materialAscription);

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

@@ -6,10 +6,8 @@ import cn.com.ctop.common.module.entity.*;
 import cn.com.ctop.common.module.enums.MaterialSupplierEnum;
 import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.*;
-
 import cn.com.ctop.toutiao.modules.material.entity.BytedanceVideoSlogenInfo;
 import cn.com.ctop.toutiao.modules.material.service.IBytedanceVideoSlogenInfoService;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -74,6 +72,8 @@ public class MaterialInfoController {
     private IBytedanceVideoSlogenInfoService slogenInfoService;
     @Autowired
     private IProductService productService;
+    @Autowired
+    private IProjectService projectService;
 
 
     @GetMapping("/supplierWatermark")
@@ -150,7 +150,7 @@ public class MaterialInfoController {
     public Result<Object> watermarkVideo(@RequestParam(name = "id") String id, @RequestParam(name = "watermarkTemplateId") Long watermarkTemplateId) {
         Result<Object> result = new Result<>();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        Thread thread = new Thread(()-> materialInfoService.watermarkVideo(id, watermarkTemplateId, sysUser.getId()));
+        Thread thread = new Thread(() -> materialInfoService.watermarkVideo(id, watermarkTemplateId, sysUser.getId()));
         thread.start();
         result.setCode(200);
         result.setSuccess(true);
@@ -288,8 +288,7 @@ public class MaterialInfoController {
     @GetMapping(value = "/listV2")
     public Map<String, Object> queryPageList(String type, Integer status, Long productId, String materialName, String code,
                                              String startDate, String endDate, String tagCode,
-                                             @RequestParam(name = "projectId", required = false) Long projectId,
-                                             @RequestParam(name = "offlineFlag", required = false) Integer offlineFlag,
+                                             Long projectId, String clipId, String shotId, String planId,
                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
@@ -305,7 +304,7 @@ public class MaterialInfoController {
                 productIds = new ArrayList<>();
                 productIds.add(productId);
             }
-            return materialInfoService.getListByParams(projectId, tagCode, type, status, productIds, materialName, code, startDate, endDate, null, offlineFlag, pageNo, pageSize);
+            return materialInfoService.getListByParams(tagCode, type, status, productIds, materialName, code, startDate, endDate, null, projectId, clipId, shotId, planId, pageNo, pageSize);
         } else if ("designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode) || "plane".equals(roleCode) || "plan".equals(roleCode) || "shot".equals(roleCode)) {
             //查询自己所在项目下的数据
             if (null == productId || productId == 0) {
@@ -315,14 +314,14 @@ public class MaterialInfoController {
                 productIds = new ArrayList<>();
                 productIds.add(productId);
             }
-            return materialInfoService.getListByParams(projectId, tagCode, type, status, productIds, materialName, code, startDate, endDate, null, offlineFlag, pageNo, pageSize);
+            return materialInfoService.getListByParams(tagCode, type, status, productIds, materialName, code, startDate, endDate, null, projectId, clipId, shotId, planId, pageNo, pageSize);
         } else {
             //查询自己上传的视频
             if (null != productId && productId != 0) {
                 productIds = new ArrayList<>();
                 productIds.add(productId);
             }
-            return materialInfoService.getListByParams(projectId, tagCode, type, status, productIds, materialName, code, startDate, endDate, userId, offlineFlag, pageNo, pageSize);
+            return materialInfoService.getListByParams(tagCode, type, status, productIds, materialName, code, startDate, endDate, userId, projectId, clipId, shotId, planId, pageNo, pageSize);
         }
     }
 
@@ -447,6 +446,7 @@ public class MaterialInfoController {
 
     /**
      * 头条素材信息编辑
+     *
      * @param materialInfo
      * @return
      */
@@ -509,11 +509,11 @@ public class MaterialInfoController {
             }
         }
         //添加视频文案信息
-        if(!Check.isNull(materialInfo.getSlogans())){
+        if (!Check.isNull(materialInfo.getSlogans())) {
             JSONArray slogans = materialInfo.getSlogans();
-            if(null!=slogans&&!slogans.isEmpty()){
+            if (null != slogans && !slogans.isEmpty()) {
                 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-                slogenInfoService.insertSlogans(materialInfoEntity.getProjectId(),materialInfoEntity.getCode(),slogans,user.getId());
+                slogenInfoService.insertSlogans(materialInfoEntity.getCode(), slogans, user.getId());
             }
         }
         boolean ok = materialInfoService.updateById(materialInfo);
@@ -525,8 +525,24 @@ public class MaterialInfoController {
         // 如果状态为2 审核拒绝 给上传人发送消息
         if (status == 2) {
             Product product = productService.getById(materialInfoEntity.getProductId());
-            String text = messageTemplate.getMaterialRejectTemplate(product.getProductName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
-            sendMessageService.sendMessage(materialInfoEntity.getUserId(), text);
+            Project project = projectService.getById(materialInfoEntity.getProjectId());
+            String text = messageTemplate.getMaterialRejectTemplate(product.getProductName(), project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
+            MaterialAscription ascription = materialAscriptionService.getInfoByCode(materialInfoEntity.getCode());
+            List<String> userList = new ArrayList<>();
+            if (!Check.isNull(ascription)) {
+                if (!Check.isNull(ascription.getClipId())) {
+                    userList.add(ascription.getClipId());
+                }
+                if (!Check.isNull(ascription.getPlanId())) {
+                    userList.add(ascription.getPlanId());
+                }
+            } else {
+                userList.add(materialInfoEntity.getUserId());
+            }
+            for (int i = 0; i < userList.size(); i++) {
+                String userId = userList.get(i);
+                sendMessageService.sendMessage(userId, text);
+            }
         }
         return result;
 
@@ -534,6 +550,7 @@ public class MaterialInfoController {
 
     /**
      * 头条素材信息编辑 -- 批量通过审核
+     *
      * @param materialInfo
      * @return
      */
@@ -545,9 +562,11 @@ public class MaterialInfoController {
         for (String id : ids) {
             materialInfo.setId(id);
             Result<MaterialInfo> materialInfoResult = bytedanceEdit(materialInfo);
-            if(materialInfoResult.getCode().equals(CommonConstant.SC_OK_200)){ successNum++;}
+            if (materialInfoResult.getCode().equals(CommonConstant.SC_OK_200)) {
+                successNum++;
+            }
         }
-        return result.success("批量修改成功"+successNum+"个");
+        return result.success("批量修改成功" + successNum + "个");
 
     }
 
@@ -617,9 +636,9 @@ public class MaterialInfoController {
             result.error500("未找到对应实体");
         } else {
             //查询素材下关联的头条文案信息
-            List<BytedanceVideoSlogenInfo>slogenInfos = slogenInfoService.listByParams(materialInfo.getCode(),1);
+            List<BytedanceVideoSlogenInfo> slogenInfos = slogenInfoService.listByParams(materialInfo.getCode(), 1);
             JSONArray slogenArray = new JSONArray();
-            if(null!=slogenInfos&&!slogenInfos.isEmpty()){
+            if (null != slogenInfos && !slogenInfos.isEmpty()) {
                 slogenArray.addAll(slogenInfos);
             }
             materialInfo.setSlogans(slogenArray);
@@ -744,8 +763,24 @@ public class MaterialInfoController {
         // 如果状态为2 审核拒绝 给上传人发送消息
         if (status == 2) {
             Product product = productService.getById(materialInfoEntity.getProductId());
-            String text = messageTemplate.getMaterialRejectTemplate(product.getProductName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
-            sendMessageService.sendMessage(materialInfoEntity.getUserId(), text);
+            Project project = projectService.getById(materialInfoEntity.getProjectId());
+            String text = messageTemplate.getMaterialRejectTemplate(product.getProductName(), project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
+            List<String> userList = new ArrayList<>();
+            MaterialAscription ascription = materialAscriptionService.getInfoByCode(materialInfoEntity.getCode());
+            if (!Check.isNull(ascription)) {
+                if (!Check.isNull(ascription.getClipId())) {
+                    userList.add(ascription.getClipId());
+                }
+                if (!Check.isNull(ascription.getPlanId())) {
+                    userList.add(ascription.getPlanId());
+                }
+            } else {
+                userList.add(materialInfoEntity.getUserId());
+            }
+            for (int i = 0; i < userList.size(); i++) {
+                String userId = userList.get(i);
+                sendMessageService.sendMessage(userId, text);
+            }
         }
         return result;
     }

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

@@ -129,7 +129,9 @@ public class ProjectMemberController {
                             projectMember.setProductName(product.getProductName());
                         }
                         Advertiser advertiser = advertiserService.getById(project.getAdvertiserId());
-                        projectMember.setAdvertiserName(advertiser.getName());
+                        if (!Check.isNull(advertiser)) {
+                            projectMember.setAdvertiserName(advertiser.getName());
+                        }
                         projectMember.setAdvertiserId(project.getAdvertiserId());
                         projectMember.setMediaId(project.getMediaId());
                         projectMember.setMaxBid(project.getMaxBid());
@@ -151,6 +153,7 @@ public class ProjectMemberController {
 
     /**
      * 获取项目以及账户信息
+     *
      * @param requestJson
      * @return
      */
@@ -245,10 +248,11 @@ public class ProjectMemberController {
             return result;
         }
         String projectName = projectMember.getProjectName();
+        Long productId = projectMember.getProductId();
         projectMember.setUserId(null);
         projectMember.setProjectName(null);
+        projectMember.setProductId(null);
         QueryWrapper<ProjectMember> queryWrapper = QueryGenerator.initQueryWrapper(projectMember, req.getParameterMap());
-
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
         if (!"admin".equals(roleCode) && !roleCode.contains("sale") && !"meidaManager".equals(roleCode)) {
             queryWrapper.eq("user_id", userId);
@@ -256,6 +260,15 @@ public class ProjectMemberController {
         if (!Check.isNull(projectName)) {
             queryWrapper.like("project_name", projectName);
         }
+        if (!Check.isNull(productId)) {
+            List<Long> projectIds = projectService.getProjectIdsByProductId(productId);
+            if (Check.isNull(projectIds)) {
+                result.setSuccess(false);
+                result.setMessage("该产品下暂无关联项目");
+                return result;
+            }
+            queryWrapper.in("project_id", projectIds);
+        }
         queryWrapper.groupBy("project_id");
         queryWrapper.orderByDesc("create_time");
         Page<ProjectMember> page = new Page<>(pageNo, pageSize);
@@ -269,8 +282,6 @@ public class ProjectMemberController {
     }
 
 
-
-
     /**
      * 分页列表查询
      *

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

@@ -358,7 +358,7 @@ public class UserAllocationController {
 
 
     @GetMapping(value = "/getAccountIdListByUserId")
-    public Result<List<JSONObject>> getAccountIdListByUserId(Long userId) {
+    public Result<List<JSONObject>> getAccountIdListByUserId(String userId) {
         Result<List<JSONObject>> result = new Result<>();
         try {
             if (Check.isNull(userId)) {

+ 12 - 2
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -58,10 +58,20 @@ public class SampleTest {
 
     @Test
     public void loadKuaishouCookie() throws ParseException {
-        wechatUserInfoService.getUserList();
+
+        CtopOauthToken tokenByAccountId = tokenService.getTokenByAccountId(1700996735138951L);
+        advertiserDataService.getMaterialList(tokenByAccountId);
+
+
+
+        CtopOauthToken tokenByAccountId1 = tokenService.getTokenByAccountId(1700996735589383L);
+        advertiserDataService.getMaterialList(tokenByAccountId1);
+
+/*
+        wechatUserInfoService.getUserList();*/
 
         // appchatCreateService.createAppChat(null, null, null);
-        appchatCreateService.getChatInfo(null);
+   //     appchatCreateService.getChatInfo(null);
        /* redisUtil.set("11sdfhgjksdhfjksdhfjksdhfkjsjkfhkjsddhfjksdhfkjhsjkfhjkshfjksdhfjksdhfjkshdjkfhsjkdfhkjsd1","hahahaha",5);
         Object o = redisUtil.get("11sdfhgjksdhfjksdhfjksdhfkjsjkfhkjsddhfjksdhfkjhsjkfhjkshfjksdhfjksdhfjkshdjkfhsjkdfhkjsd1");
         System.err.println(o);*/

+ 1 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/AlarmRuleRecordMapper.java

@@ -12,4 +12,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface AlarmRuleRecordMapper extends BaseMapper<AlarmRuleRecord> {
 
+    void deleteByTime();
 }

+ 6 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmRuleRecordMapper.xml

@@ -2,4 +2,10 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.alarm.modules.mapper.AlarmRuleRecordMapper">
 
+    <delete id="deleteByTime">
+        delete
+        from ctop_alarm_rule_record
+        where create_time &lt;= DATE_SUB(NOW(), INTERVAL 10 DAY)
+    </delete>
+
 </mapper>

+ 8 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmRuleRecordServiceImpl.java

@@ -4,6 +4,7 @@ import cn.com.ctop.alarm.modules.entity.AlarmRuleRecord;
 import cn.com.ctop.alarm.modules.mapper.AlarmRuleRecordMapper;
 import cn.com.ctop.alarm.modules.service.IAlarmRuleRecordService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
@@ -16,4 +17,11 @@ import org.springframework.stereotype.Service;
 @Service
 public class AlarmRuleRecordServiceImpl extends ServiceImpl<AlarmRuleRecordMapper, AlarmRuleRecord> implements IAlarmRuleRecordService {
 
+    @Autowired
+    private AlarmRuleRecordMapper alarmRuleRecordMapper;
+
+    @Override
+    public void deleteByTime() {
+        alarmRuleRecordMapper.deleteByTime();
+    }
 }

+ 1 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/IAlarmRuleRecordService.java

@@ -11,4 +11,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IAlarmRuleRecordService extends IService<AlarmRuleRecord> {
 
+    void deleteByTime();
 }

+ 76 - 35
module-common/src/main/java/cn/com/ctop/common/module/entity/RuleDateUnitKuaishou.java

@@ -1,51 +1,92 @@
 package cn.com.ctop.common.module.entity;
 
-import java.math.BigDecimal;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
+import java.math.BigDecimal;
+
 /**
  * 快手预警组数据
  */
 @Data
 @TableName("ctop_rule_data_unit_kuaishou")
 public class RuleDateUnitKuaishou {
-    
-	/**id*/
-	private Long id;
-	/**accountId*/
-	private Long accountId;
-    /**planId*/
+
+    /**
+     * id
+     */
+    private Long id;
+    /**
+     * accountId
+     */
+    private Long accountId;
+    /**
+     * planId
+     */
     private Long planId;
-	/**unitId*/
-	private Long unitId;
-	/**unitName*/
-	private String unitName;
-	/**消耗*/
-	private BigDecimal charge;
-
-	private Long convertNum;
-
-	private BigDecimal convertCost;
-
-	/**activation*/
-	private Long activation;
-	/**激活单价*/
-	private BigDecimal activationCost;
-	/**注册数*/
-	private Long eventRegister;
-	/**表单*/
-	private BigDecimal registerCost;
-	/**表单*/
-	private Long formCount;
-	/**表单提交单价*/
-	private BigDecimal formCost;
-	/**付费*/
-	private Long eventPay;
-	/**付费单价*/
-	private BigDecimal payCost;
+    /**
+     * unitId
+     */
+    private Long unitId;
+    /**
+     * unitName
+     */
+    private String unitName;
+    /**
+     * 消耗
+     */
+    private BigDecimal charge;
+
+    private Long convertNum;
+
+    private BigDecimal convertCost;
+
+    /**
+     * activation
+     */
+    private Long activation;
+    /**
+     * 激活单价
+     */
+    private BigDecimal activationCost;
+    /**
+     * 注册数
+     */
+    private Long eventRegister;
+    /**
+     * 表单
+     */
+    private BigDecimal registerCost;
+    /**
+     * 表单
+     */
+    private Long formCount;
+    /**
+     * 表单提交单价
+     */
+    private BigDecimal formCost;
+    /**
+     * 付费
+     */
+    private Long eventPay;
+    /**
+     * 深度转化目标出价
+     */
+    private Long deepConversionBid;
+    /**
+     * 深度转化目标 3: 付费,7: 次日留存,10: 完件, 11: 授信 ,0:无
+     */
+    private Integer deepConversionType;
+    /**
+     * 安卓版本  3:不限, 4: 4.x+, 5: 5.x+, 6: 6.x+, 7: 7.x+;
+     */
+    private Integer androidOsv;
+    /**
+     * 付费单价
+     */
+    private BigDecimal payCost;
 
     private Integer status;
 
-	private java.util.Date createTime;
+    private java.util.Date createTime;
 }

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2 - 4
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java


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

@@ -27,4 +27,6 @@ public interface ProjectMapper extends BaseMapper<Project> {
     List<JSONObject> getProjectListByIds(@Param("ids") JSONArray projectIdArray);
 
     List<JSONObject> getListByMap(@Param("ids") Map<Long, Long> projectIdMap);
+
+    List<Long> getProjectIdsByProductId(@Param("productId") Long productId);
 }

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

@@ -25,9 +25,7 @@ public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
 
     List<JSONObject> getUserIdListByProjectId(@Param("projectId") Long projectId);
 
-    List<JSONObject> getUserIdListByProductId(@Param("productId") Long productId);
-
-    List<JSONObject> getAccountIdListByUserId(@Param("userId") Long userId);
+    List<JSONObject> getAccountIdListByUserId(@Param("userId") String userId);
 
     List<JSONObject> getAccountIdsByUserId(@Param("userId") String userId);
 
@@ -50,4 +48,6 @@ public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
     List<Long> getValidProjectIds(@Param("mediaId")  Integer mediaId);
 
     List<UserAllocation> getAccountListByUserIdAndProductId(@Param("userId")String userId,@Param("projectId")Long projectId,@Param("productId")Long productId);
+
+    List<JSONObject> getUserIdListByProductId(@Param("productId") Long productId);
 }

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

@@ -52,7 +52,6 @@
     </select>
 
 
-
     <select id="getEffiSignature" resultType="string">
         select
         efficient_video_signature
@@ -96,10 +95,26 @@
         <if test="tagCode!=null">
             left join ctop_material_tag_info tagInfo on tagInfo.code = matInfo.code
         </if>
+        <if test="ascription != null and ascription != ''">
+            left join ctop_material_ascription ascription on matInfo.code = ascription.material_id
+        </if>
         where 1=1
         <if test="tagCode!=null">
             and tagInfo.tag_code like concat(#{tagCode},'%')
         </if>
+        <if test="clipId !=null and clipId != ''">
+            and ascription.clip_id = #{clipId}
+        </if>
+        <if test="shotId !=null and shotId != ''">
+            and ascription.shot_id = #{shotId}
+        </if>
+        <if test="planId !=null and planId != ''">
+            and ascription.plan_id = #{planId}
+        </if>
+        <if test="projectId !=null and projectId != ''">
+            and matInfo.project_id = #{projectId}
+        </if>
+
         <if test="status!=null">
             and matInfo.status = #{status}
         </if>

+ 28 - 27
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ProductMapper.xml

@@ -19,36 +19,37 @@
 
     <select id="getUserProductList" resultType="cn.com.ctop.common.module.entity.Product">
         select
-            cp.id,
-            cp.product_name as 'productName',
-            ca.name as 'advertiserName'
+        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
+        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>
-                      ) )
+        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>
+        <if test="productName != null and productName != ''">
+            and cp.product_name like concat('%',#{productName},'%')
+        </if>
+        order by cp.create_time desc
     </select>
 
 </mapper>

+ 6 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ProjectMapper.xml

@@ -54,5 +54,11 @@
         </foreach>
 
     </select>
+    <select id="getProjectIdsByProductId" resultType="java.lang.Long">
+        SELECT
+        id
+        from ctop_project
+        where product_id = #{productId}
+    </select>
 
 </mapper>

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

@@ -14,4 +14,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
 public interface IMaterialAscriptionService extends IService<MaterialAscription> {
     JSONObject getDetailByCode(String code);
 
+    MaterialAscription getInfoByCode(String code);
+
 }

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

@@ -78,7 +78,7 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
 
     List<MaterialInfo> getListByDate(String startDate, String endDate);
 
-    Map<String, Object> getListByParams(Long projectId, String tagCode, String type, Integer status, List<Long> projectIds, String materialName, String code, String startDate, String endDate, String userId, Integer offlineFlag, Integer pageNo, Integer pageSize);
+    Map<String, Object> getListByParams(String tagCode, String type, Integer status, List<Long> projectIds, String materialName, String code, String startDate, String endDate, String userId, Long projectId, String clipId, String shotId, String planId, Integer pageNo, Integer pageSize);
 
     JSONArray getIdListByProject(Long projectId);
 }

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

@@ -19,7 +19,7 @@ public interface IMessageTemplate {
     String getMaterialSyncSucessTemplate(String projectName, String accountId, String accountName, String materialName, String reason);
 
 
-    String getMaterialRejectTemplate(String projectName, String materialName, String refuseReason);
+    String getMaterialRejectTemplate(String productName, String projectName, String materialName, String refuseReason);
 
     String getFeishuMaterialSyncTemplate(String projectName, Long accountId, String accountName, String materialName, String reason);
 

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

@@ -27,4 +27,6 @@ public interface IProjectService extends IService<Project> {
 
 
     Map<Long, String> getProjectMap(Map<Long, Long> projectIdMap);
+
+    List<Long> getProjectIdsByProductId(Long productId);
 }

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

@@ -34,7 +34,7 @@ public interface IUserAllocationService extends IService<UserAllocation> {
 
     List<JSONObject> getUserIdListByProjectId(Long projectId);
 
-    List<JSONObject> getAccountIdListByUserId(Long userId);
+    List<JSONObject> getAccountIdListByUserId(String userId);
 
     List<JSONObject> getAccountIdsByUserId(String userId);
 

+ 11 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialAscriptionServiceImpl.java

@@ -4,6 +4,7 @@ import cn.com.ctop.common.module.entity.MaterialAscription;
 import cn.com.ctop.common.module.mapper.MaterialAscriptionMapper;
 import cn.com.ctop.common.module.service.IMaterialAscriptionService;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
@@ -27,4 +28,14 @@ public class MaterialAscriptionServiceImpl extends ServiceImpl<MaterialAscriptio
     public JSONObject getDetailByCode(String code) {
         return ascriptionMapper.selectByMaterialId(code);
     }
+
+    @Override
+    public MaterialAscription getInfoByCode(String code) {
+        QueryWrapper<MaterialAscription> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("material_id", code);
+        queryWrapper.orderByDesc("create_time");
+        queryWrapper.last("limit 1");
+        return this.getOne(queryWrapper);
+
+    }
 }

+ 20 - 17
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -315,7 +315,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             }
         }
 
-         getFile(info);
+        getFile(info);
 
     }
 
@@ -531,12 +531,12 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             info.setUpdateTime(new Date());
             info.setType(type);
             //TODO 此处逻辑待调整
-//            Project project = projectService.getById(projectId);
-//            if (!Check.isNull(project)) {
-//                if (!Check.isNull(project.getSupplierCode())) {
-//                    info.setSupplierCode(project.getSupplierCode());
-//                }
-//            }
+            //      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/", "");
@@ -773,10 +773,16 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
 
     @Override
-    public Map<String, Object> getListByParams(Long projectId, String tagCode, String type, Integer status, List<Long> productId, String materialName, String code, String startDate, String endDate, String userId, Integer offlineFlag, 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, Long projectId, String clipId, String shotId, String planId, Integer pageNo, Integer pageSize) {
         Map<String, Object> result = new HashMap<>();
         PageHelper.startPage(pageNo, pageSize);
-        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(projectId, tagCode, type, status, productId, materialName, code, startDate, endDate, userId ,offlineFlag);
+
+        String ascription = null;
+        if (!Check.isNull(clipId) || !Check.isNull(shotId) || !Check.isNull(planId)) {
+            ascription = "true";
+        }
+
+        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, productId, materialName, code, startDate, endDate, userId, projectId, ascription, clipId, shotId, planId);
         List<MaterialInfo> setList = new ArrayList<>();
         PageInfo<MaterialInfo> pageInfo = new PageInfo<>(dailyList);
         if (null != dailyList && !dailyList.isEmpty()) {
@@ -810,14 +816,11 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 } else {
                     materialInfo.setBytedanceCost(new BigDecimal(0));
                 }
-
-                //TODO 待删除
-//                Project project = projectService.getById(info.getProjectId());
-//                if (!Check.isNull(project)) {
-//                    materialInfo.setMediaId(project.getMediaId());
-//                    materialInfo.setProjectName(project.getProjectName());
-//                }
-
+                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());
                 imageInfoQueryWrapper.eq("status", 0);

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

@@ -68,10 +68,11 @@ public class MessageTemplateImpl implements IMessageTemplate {
      * @return
      */
     @Override
-    public String getMaterialRejectTemplate(String projectName, String materialName, String refuseReason) {
+    public String getMaterialRejectTemplate(String productName, String projectName, String materialName, String refuseReason) {
         StringBuilder text = new StringBuilder();
         text.append("素材驳回通知").append("<br/>")
-                .append("您的项目:").append(projectName + ",").append("<br/>")
+                .append("您的产品:").append(productName + ",").append("<br/>")
+                .append("下的项目:").append(projectName + ",").append("<br/>")
                 .append("素材名称为:").append(materialName).append("<br/>")
                 .append("已被驳回。").append("<br/>");
         if (!Check.isNull(refuseReason)) {

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

@@ -65,4 +65,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         }
         return projectMap;
     }
+
+    @Override
+    public List<Long> getProjectIdsByProductId(Long productId) {
+        return projectMapper.getProjectIdsByProductId(productId);
+    }
 }

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

@@ -121,7 +121,7 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
     }
 
     @Override
-    public List<JSONObject> getAccountIdListByUserId(Long userId) {
+    public List<JSONObject> getAccountIdListByUserId(String userId) {
         return userAllocationMapper.getAccountIdListByUserId(userId);
     }
 

+ 4 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java

@@ -358,5 +358,9 @@ public class KuaishouInterfaceConstant {
      * 查询广告组的加速探索报表接口
      */
     public static final String QUERY_SPEED_EXPLORE_REPORT = "/rest/openapi/v1/report/speed_explore";
+  /**
+     * 辅助探索
+     */
+    public static final String AD_UNIT_EXPLORE_SUPPORT = "/rest/openapi/v1/ad_unit/explore/support";
 
 }

+ 21 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAlarmRuleRecordJob.java

@@ -0,0 +1,21 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.alarm.modules.service.IAlarmRuleRecordService;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class KuaishouAlarmRuleRecordJob {
+    @Autowired
+    private IAlarmRuleRecordService alarmRuleRecordService;
+
+    /**
+     * 预警规则记录表 定期删除,只保留10天数据
+     */
+    @XxlJob("cleanAlarmRuleRecordJob")
+    public void execute() throws Exception {
+        alarmRuleRecordService.deleteByTime();
+    }
+}

+ 1 - 1
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouMaterialSyncMd5Job.java

@@ -21,7 +21,7 @@ public class KuaishouMaterialSyncMd5Job {
     @XxlJob("kuaishouMaterialSyncMd5Job")
     public void execute() throws Exception {
         String nowDate = DateUtils.getDate("yyyy-MM-dd");
-        String statDate = getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        String statDate = getAnotherDay("yyyy-MM-dd", nowDate, -2);
         historyReportTaskService.getMd5V2(statDate);
     }
 }

+ 40 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouProjectVideoGetJob.java

@@ -0,0 +1,40 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouProjectVideoGetService;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 清洗项目素材
+ *
+ * @param
+ * @author ZHAOXA
+ * @return
+ * @throws
+ */
+@Component
+public class KuaishouProjectVideoGetJob {
+    @Autowired
+    private IKuaishouProjectVideoGetService projectVideoGetService;
+    @Autowired
+    private IProjectService projectService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+
+    @XxlJob("kuaishouProjectVideoGetJob")
+    public void kuaishouProjectVideoGetJob() {
+        //2快手,1开启的项目
+        List<Project> projects = projectService.listByMediaType(2, 1);
+        projects.forEach(project -> executorService.submit(() -> {
+            projectVideoGetService.clearProjectVideo(project.getId());
+        }));
+        XxlJobHelper.log("清洗项目素材完成");
+    }
+}

+ 50 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouSupplierVideoGetJob.java

@@ -0,0 +1,50 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
+import com.alibaba.fastjson.JSONObject;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 同步素造素材供应商
+ *
+ * @param
+ * @author ZHAOXA
+ * @return
+ * @throws
+ */
+@Component
+public class KuaishouSupplierVideoGetJob {
+    @Autowired
+    private IKuaiShouVideoGetService videoGetService;
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+
+    @XxlJob("kuaishouSupplierVideoGetJob")
+    public void KuaishouSupplierVideoGetJob() {
+        List<JSONObject> datas = videoGetService.getAccountIds();
+        for (JSONObject data : datas) {
+            CtopOauthToken token = tokenService.getTokenByAccountId(data.getLong("accountId"));
+            if (Check.isNull(token)) {
+                continue;
+            }
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    videoGetService.getSuZaoList(token.getAccessToken(), data.getLong("accountId"), 1, data.getString("startDate"));
+                }
+            });
+        }
+        XxlJobHelper.log("同步素造素材供应商完成");
+    }
+}

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaiShouCreativeRefusalController.java

@@ -42,7 +42,7 @@ public class KuaiShouCreativeRefusalController {
     private IKuaiShouImageGetService imageGetService;
     @Autowired
     private IKuaiShouMaterialUploadService uploadService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(80);
+    static ExecutorService executorService = Executors.newFixedThreadPool(50);
 
     /**
      * 创意拒审重提

+ 82 - 35
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaishouAppPackageController.java

@@ -1,9 +1,11 @@
 package cn.com.ctop.kuaishou.modules.ai.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.service.IProjectService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.ExportExcelUtils;
-import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.LoadFileUtil;
 import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouAppPackage;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAppPackageService;
 import com.alibaba.fastjson.JSONArray;
@@ -25,15 +27,13 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
-import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 /**
  * 项目绑定的应用
@@ -49,6 +49,8 @@ import java.util.Map;
 public class KuaishouAppPackageController {
     @Autowired
     private IKuaishouAppPackageService kuaishouAppPackageService;
+    @Autowired
+    private IProjectService projectService;
 
     /**
      * 分页列表查询
@@ -114,6 +116,7 @@ public class KuaishouAppPackageController {
         return Result.error("查询失败");
 
     }
+
     /**
      * 查询项目下有效账户
      *
@@ -141,6 +144,7 @@ public class KuaishouAppPackageController {
         }
         return Result.error("查询失败");
     }
+
     /**
      * 推送应用
      *
@@ -234,26 +238,49 @@ public class KuaishouAppPackageController {
     @PostMapping(value = "/fillInLink")
     public Result<Object> fillInLink(@RequestBody KuaishouAppPackage kuaishouAppPackage) {
         try {
-            if (Check.isNull(kuaishouAppPackage.getProjectId())) {
-                return Result.error("请选择项目");
-            } else if (Check.isNull(kuaishouAppPackage.getAppVersion())) {
-                return Result.error("请填写应用标记");
-            } else if (Check.isNull(kuaishouAppPackage.getAppName())) {
-                return Result.error("请填写应用名称");
-            } else if (Check.isNull(kuaishouAppPackage.getPlatform())) {
+            Integer platform = kuaishouAppPackage.getPlatform();
+            if (Check.isNull(platform)) {
                 return Result.error("请选择应用类型");
-            } else {
-                Integer platform = kuaishouAppPackage.getPlatform();
-                if ((platform == 1 || platform == 3) && Check.isNull(kuaishouAppPackage.getImageToken())) {
-                    return Result.error("请上传图标");
-                }
-                if ((platform == 1 || platform == 2) && Check.isNull(kuaishouAppPackage.getAppPrivacyUrl())) {
+            }
+            if (platform == 1 || platform == 2) {
+                if (Check.isNull(kuaishouAppPackage.getProjectId())) {
+                    return Result.error("请选择项目");
+                } else if (Check.isNull(kuaishouAppPackage.getAppVersion())) {
+                    return Result.error("请填写应用标记");
+                } else if (Check.isNull(kuaishouAppPackage.getAppName())) {
+                    return Result.error("请填写应用名称");
+                } else if (Check.isNull(kuaishouAppPackage.getAppPrivacyUrl())) {
                     return Result.error("安卓类应用隐私政策url不为空");
+                } else {
+                    if (platform == 1 && Check.isNull(kuaishouAppPackage.getAppIconUrl())) {
+                        return Result.error("请上传图标");
+                    }
+                    if (platform == 1 && Check.isNull(kuaishouAppPackage.getPackageName())) {
+                        return Result.error("请填写应用包名");
+                    }
                 }
-                if (platform == 1 && Check.isNull(kuaishouAppPackage.getPackageName())) {
-                    return Result.error("请填写应用包名");
+            } else {
+                if (Check.isNull(kuaishouAppPackage.getAppName())) {
+                    return Result.error("请填写应用名称");
+                } else if (Check.isNull(kuaishouAppPackage.getAppVersion())) {
+                    return Result.error("请填写应用标记");
+                } else if (Check.isNull(kuaishouAppPackage.getUrl())) {
+                    return Result.error("请填写链接");
+                } else if (Check.isNull(kuaishouAppPackage.getProjectId())) {
+                    return Result.error("请选择项目");
+                } else if (platform == 3 && Check.isNull(kuaishouAppPackage.getAppIconUrl())) {
+                    return Result.error("请上传图标");
                 }
             }
+            if (!kuaishouAppPackage.getAppIconUrl().contains("http")) {
+                kuaishouAppPackage.setAppIconUrl("https:".concat(kuaishouAppPackage.getAppIconUrl()));
+            }
+
+            String newFileUrl = kuaishouAppPackageService.getDownloadPath(kuaishouAppPackage.getAppIconUrl());
+            if (Check.isNull(newFileUrl)) {
+                return Result.error("本地下载文件失败,路径:" + kuaishouAppPackage.getAppIconUrl());
+            }
+            kuaishouAppPackage.setImageMd5(LoadFileUtil.getMD5(newFileUrl));
             kuaishouAppPackage.setDataStatus(1);//有效
             kuaishouAppPackageService.saveOrUpdate(kuaishouAppPackage);
             return Result.ok("操作成功!");
@@ -275,7 +302,7 @@ public class KuaishouAppPackageController {
             if (Check.isNull(projectId) || Check.isNull(appVersion)) {
                 return Result.error("缺失参数");
             }
-            List<Long> list = kuaishouAppPackageService.queryByAppVersion(projectId, appVersion);
+            List<Long> list = kuaishouAppPackageService.queryByAppVersion(projectId, appVersion,null);
             if (Check.isNull(list)) {
                 return Result.ok("success");
             } else {
@@ -367,29 +394,45 @@ public class KuaishouAppPackageController {
         if (kuaishouAppPackage == null) {
             result.error500("未找到对应实体");
         } else {
+            Project project = projectService.getById(kuaishouAppPackage.getProjectId());
+            if (!Check.isNull(project)) {
+                kuaishouAppPackage.setProjectName(project.getProjectName());
+            }
             result.setResult(kuaishouAppPackage);
             result.setSuccess(true);
         }
         return result;
     }
 
+    //发送响应流方法
+    public void setResponseHeader(HttpServletResponse response, String fileName) {
+        try {
+            try {
+                fileName = new String(fileName.getBytes(), "ISO8859-1");
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+            }
+//            response.setContentType("multipart/form-data;charset=ISO8859-1");
+            response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
+            response.addHeader("Pargam", "no-cache");
+            response.addHeader("Cache-Control", "no-cache");
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
     /**
      * 导出应用模板
-     *
-     * @param request
-     * @param response
      */
-    @RequestMapping(value = "/exportAppTemplate")
-    public void exportXls(HttpServletRequest request, HttpServletResponse response) {
-        Map<String, Object> paramsMap = new HashMap<>();
+    @GetMapping("/exportAppTemplate")
+    public void getExcel(HttpServletResponse response) {
         try {
-            List<List<Object>> excelList = new ArrayList<>();
             OutputStream os = response.getOutputStream();
             ExportExcelUtils eeu = new ExportExcelUtils();
             XSSFWorkbook workbook = new XSSFWorkbook();
-            String[] titles = {"应用名称", "应用包名", "应用标记", "隐私政策链接", "下载链接", "监测链接", "广告监测SDK"};
-            eeu.exportExcelForAttendance(workbook, 0, "Sheet1", titles, excelList);
-            HttpUtils.setResponseHeader(response, "AppTemplate.xlsx");
+            String[] titles = {"应用名称", "应用包名", "应用标记", "隐私政策链接", "下载链接", "监测链接", "是否接入广告监测sdk(0否 1 是)"};
+            eeu.exportExcelForAttendance(workbook, 0, "Sheet1", titles, new ArrayList<>());
+            this.setResponseHeader(response, "应用模板.xlsx");
             workbook.write(os);
             os.flush();
             os.close();
@@ -398,6 +441,7 @@ public class KuaishouAppPackageController {
         }
     }
 
+
     /**
      * 导入应用程序excel
      *
@@ -412,20 +456,23 @@ public class KuaishouAppPackageController {
                                       @RequestParam("file") MultipartFile file,
                                       @RequestParam("projectId") Long projectId,
                                       @RequestParam("platform") Integer platform,
-                                      @RequestParam("imageToken") String imageToken,
                                       @RequestParam("imageUrl") String imageUrl) {
         response.setHeader("Access-Control-Allow-Origin", "*");
         try {
+            if (Check.isNull(platform)) {
+                return Result.error("请选择应用类型");
+            }
             if (Check.isNull(file)) {
                 return Result.error("执行失败,请上传应用Excel文件");
             } else if (Check.isNull(projectId)) {
                 return Result.error("请选择项目");
-            } else if (Check.isNull(imageToken) || Check.isNull(imageUrl)) {
+            } else if ((platform == 1 || platform == 3) && Check.isNull(imageUrl)) {
                 return Result.error("请上传图标");
-            } else if (Check.isNull(platform)) {
-                return Result.error("请选择应用类型");
             }
-            return kuaishouAppPackageService.importExcel(file, projectId, platform, imageToken, imageUrl);
+            if (!imageUrl.contains("http")) {
+                imageUrl = "https:".concat(imageUrl);
+            }
+            return kuaishouAppPackageService.importExcel(file, projectId, platform, imageUrl);
         } catch (Exception e) {
             e.printStackTrace();
             log.error("解析应用Excel文档异常", e);

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

@@ -65,31 +65,6 @@ public class KuaishouDirectionalPackageController {
     private ICtopOauthTokenService oauthTokenService;
 
     /**
-     * 分页列表查询
-     *
-     * @param kuaishouDirectionalPackage
-     * @param pageNo
-     * @param pageSize
-     * @param req
-     * @return
-     */
-    @AutoLog(value = "自动投放-定向包详情-分页列表查询")
-    @ApiOperation(value = "自动投放-定向包详情-分页列表查询", notes = "自动投放-定向包详情-分页列表查询")
-    @GetMapping(value = "/list")
-    public Result<IPage<KuaishouDirectionalPackage>> queryPageList(KuaishouDirectionalPackage kuaishouDirectionalPackage,
-                                                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-                                                                   HttpServletRequest req) {
-        Result<IPage<KuaishouDirectionalPackage>> result = new Result<>();
-        QueryWrapper<KuaishouDirectionalPackage> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouDirectionalPackage, req.getParameterMap());
-        Page<KuaishouDirectionalPackage> page = new Page<KuaishouDirectionalPackage>(pageNo, pageSize);
-        IPage<KuaishouDirectionalPackage> pageList = kuaishouDirectionalPackageService.page(page, queryWrapper);
-        result.setSuccess(true);
-        result.setResult(pageList);
-        return result;
-    }
-
-    /**
      * 查询定向包列表
      *
      * @param

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

@@ -0,0 +1,248 @@
+package cn.com.ctop.kuaishou.modules.ai.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.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouVideoDirectionalPackage;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouVideoDirectionalPackageService;
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.common.api.vo.Result;
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+
+import java.util.Date;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 素材绑定的定向包模板
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-05-25
+ */
+@Slf4j
+@Api(tags = "素材绑定的定向包模板")
+@RestController
+@RequestMapping("/kuais/kuaishouVideoDirectionalPackage")
+public class KuaishouVideoDirectionalPackageController {
+    @Autowired
+    private IKuaishouVideoDirectionalPackageService kuaishouVideoDirectionalPackageService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaishouVideoDirectionalPackage
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "素材绑定的定向包模板-分页列表查询", notes = "素材绑定的定向包模板-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaishouVideoDirectionalPackage>> queryPageList(KuaishouVideoDirectionalPackage kuaishouVideoDirectionalPackage,
+                                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                        HttpServletRequest req) {
+        Result<IPage<KuaishouVideoDirectionalPackage>> result = new Result<>();
+        QueryWrapper<KuaishouVideoDirectionalPackage> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouVideoDirectionalPackage, req.getParameterMap());
+        Page<KuaishouVideoDirectionalPackage> page = new Page<KuaishouVideoDirectionalPackage>(pageNo, pageSize);
+        IPage<KuaishouVideoDirectionalPackage> pageList = kuaishouVideoDirectionalPackageService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+	/**
+	 * 创建定向包
+	 *
+	 * @param
+	 * @return
+	 */
+	@PostMapping(value = "/createDirectionalPackage")
+	public Result<Object> createDirectionalPackage(@RequestBody JSONObject requestJson) {
+		Result<JSONObject> result = new Result<>();
+		try {
+			Long accountId = requestJson.getLong("projectId");
+			if (Check.isNull(accountId)) {
+				return Result.error("请选择账户id");
+			}
+//			return kuaishouVideoDirectionalPackageService.saveOrUpdate(null);
+		} catch (Exception e) {
+			log.error("创建定向包失败", e);
+			return Result.error("创建失败" + e.getMessage());
+		}
+		return null;
+	}
+    /**
+     * 编辑
+     *
+     * @param kuaishouVideoDirectionalPackage
+     * @return
+     */
+    @ApiOperation(value = "素材绑定的定向包模板-编辑", notes = "素材绑定的定向包模板-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaishouVideoDirectionalPackage> edit(@RequestBody KuaishouVideoDirectionalPackage kuaishouVideoDirectionalPackage) {
+        Result<KuaishouVideoDirectionalPackage> result = new Result<KuaishouVideoDirectionalPackage>();
+        KuaishouVideoDirectionalPackage kuaishouVideoDirectionalPackageEntity = kuaishouVideoDirectionalPackageService.getById(kuaishouVideoDirectionalPackage.getId());
+        if (kuaishouVideoDirectionalPackageEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaishouVideoDirectionalPackageService.updateById(kuaishouVideoDirectionalPackage);
+            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 {
+            kuaishouVideoDirectionalPackageService.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<KuaishouVideoDirectionalPackage> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<KuaishouVideoDirectionalPackage> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaishouVideoDirectionalPackageService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "素材绑定的定向包模板-通过id查询", notes = "素材绑定的定向包模板-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaishouVideoDirectionalPackage> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaishouVideoDirectionalPackage> result = new Result<>();
+        KuaishouVideoDirectionalPackage kuaishouVideoDirectionalPackage = kuaishouVideoDirectionalPackageService.getById(id);
+        if (kuaishouVideoDirectionalPackage == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaishouVideoDirectionalPackage);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaishouVideoDirectionalPackage> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaishouVideoDirectionalPackage kuaishouVideoDirectionalPackage = JSON.parseObject(deString, KuaishouVideoDirectionalPackage.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaishouVideoDirectionalPackage, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaishouVideoDirectionalPackage> pageList = kuaishouVideoDirectionalPackageService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "素材绑定的定向包模板列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaishouVideoDirectionalPackage.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<KuaishouVideoDirectionalPackage> listKuaishouVideoDirectionalPackages = ExcelImportUtil.importExcel(file.getInputStream(), KuaishouVideoDirectionalPackage.class, params);
+                kuaishouVideoDirectionalPackageService.saveBatch(listKuaishouVideoDirectionalPackages);
+                return Result.ok("文件导入成功!数据行数:" + listKuaishouVideoDirectionalPackages.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("文件导入失败!");
+    }
+
+}

+ 8 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/KuaishouAppPackage.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.ai.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -40,6 +41,9 @@ public class KuaishouAppPackage {
     @Excel(name = "项目ID", width = 15)
     @ApiModelProperty(value = "项目ID")
     private Long projectId;
+
+    @TableField(exist = false)
+    private String projectName;
     /**
      * 应用唯一标识
      */
@@ -75,11 +79,11 @@ public class KuaishouAppPackage {
      */
     private String appPrivacyUrl;
     /**
-     * 图片token
+     * 图片MD5标识
      */
-    @Excel(name = "图片token", width = 15)
-    @ApiModelProperty(value = "图片token")
-    private String imageToken;
+    @Excel(name = "图片MD5标识", width = 15)
+    @ApiModelProperty(value = "图片MD5标识")
+    private String imageMd5;
     /**
      * 应用包名
      */

+ 75 - 53
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/KuaishouAppPackageRel.java

@@ -1,79 +1,101 @@
 package cn.com.ctop.kuaishou.modules.ai.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 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 com.fasterxml.jackson.annotation.JsonFormat;
-import org.springframework.format.annotation.DateTimeFormat;
 import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
 
 /**
  * 应用和账户关联表
+ *
  * @author jeecg-boot
- * @date   2021-05-13
  * @version V1.0
+ * @date 2021-05-13
  */
 @Data
 @TableName("ctop_kuaishou_app_package_rel")
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
-@ApiModel(value="ctop_kuaishou_app_package_rel对象", description="应用和账户关联表")
+@ApiModel(value = "ctop_kuaishou_app_package_rel对象", description = "应用和账户关联表")
 public class KuaishouAppPackageRel {
 
-	/**id*/
-	@TableId(type = IdType.AUTO)
-	@ApiModelProperty(value = "id")
-	private Long id;
-	/**应用模板ID*/
-	@Excel(name = "应用模板ID", width = 15)
-	@ApiModelProperty(value = "应用模板ID")
-	private Long apptemId;
-	/**项目ID*/
-	@Excel(name = "项目ID", width = 15)
-	@ApiModelProperty(value = "项目ID")
-	private Long projectId;
-	/**账户ID*/
-	@Excel(name = "账户ID", width = 15)
-	@ApiModelProperty(value = "账户ID")
-	private Long accountId;
-	/**账户ID*/
-	@Excel(name = "账户ID", width = 15)
-	@ApiModelProperty(value = "账户ID")
-	private Long appId;
-	/**快手方-应用地址*/
-	@Excel(name = "快手方-应用地址", width = 15)
-	@ApiModelProperty(value = "快手方-应用地址")
-	private String returnUrl;
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 应用模板ID
+     */
+    @Excel(name = "应用模板ID", width = 15)
+    @ApiModelProperty(value = "应用模板ID")
+    private Long apptemId;
+    /**
+     * 项目ID
+     */
+    @Excel(name = "项目ID", width = 15)
+    @ApiModelProperty(value = "项目ID")
+    private Long projectId;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long appId;
+    /**
+     * 快手方-应用地址
+     */
+    @Excel(name = "快手方-应用地址", width = 15)
+    @ApiModelProperty(value = "快手方-应用地址")
+    private String returnUrl;
+
+    private Integer dataStatus;
 
-	private Integer dataStatus;
+    private String appVersion;
 
-	private String appVersion;
-	/**返回信息*/
-	@Excel(name = "返回信息", width = 15)
-	@ApiModelProperty(value = "返回信息")
-	private String message;
-	/**更新时间*/
-	@Excel(name = "更新时间", width = 15)
-	@ApiModelProperty(value = "更新时间")
-	private String returnUpdateTime;
-	/**创建时间*/
-	@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;
+    private String imageToken;
+    /**
+     * 返回信息
+     */
+    @Excel(name = "返回信息", width = 15)
+    @ApiModelProperty(value = "返回信息")
+    private String message;
+    /**
+     * 更新时间
+     */
+    @Excel(name = "更新时间", width = 15)
+    @ApiModelProperty(value = "更新时间")
+    private String returnUpdateTime;
+    /**
+     * 创建时间
+     */
+    @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;
 }

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

@@ -229,4 +229,8 @@ public class KuaishouDirectionalPackage {
      */
     @ApiModelProperty(value = "定向模板修改时间")
     private Date updateTime;
+
+    @TableField(exist = false)
+    private String userId;
+
 }

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

@@ -0,0 +1,233 @@
+package cn.com.ctop.kuaishou.modules.ai.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 素材绑定的定向包模板
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-05-25
+ */
+@Data
+@TableName("ctop_kuaishou_video_directional_package")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_video_directional_package对象", description = "素材绑定的定向包模板")
+public class KuaishouVideoDirectionalPackage {
+
+    /**
+     * id
+     */
+    private String id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private String videoGetId;
+    /**
+     * 0无效,1有效
+     */
+    @Excel(name = "0无效,1有效", width = 15)
+    @ApiModelProperty(value = "0无效,1有效")
+    private Integer dataStatus;
+    /**
+     * 地域
+     */
+    @Excel(name = "地域", width = 15)
+    @ApiModelProperty(value = "地域")
+    private String region;
+    /**
+     * 商圈定向
+     */
+    @Excel(name = "商圈定向", width = 15)
+    @ApiModelProperty(value = "商圈定向")
+    private String districtIds;
+    /**
+     * 用户类型 0:实时1:常驻 2:不限
+     */
+    @Excel(name = "用户类型 0:实时1:常驻 2:不限 ", width = 15)
+    @ApiModelProperty(value = "用户类型 0:实时1:常驻 2:不限 ")
+    private Integer userType;
+    /**
+     * 可选年龄段 18:18-23岁 24:24-30岁 31:31-40岁 41:41-49岁 50:50-100岁
+     */
+    @Excel(name = "可选年龄段 18:18-23岁 24:24-30岁 31:31-40岁 41:41-49岁 50:50-100岁 ", width = 15)
+    @ApiModelProperty(value = "可选年龄段 18:18-23岁 24:24-30岁 31:31-40岁 41:41-49岁 50:50-100岁 ")
+    private String agesRange;
+    /**
+     * 年龄最小值
+     */
+    @Excel(name = "年龄最小值", width = 15)
+    @ApiModelProperty(value = "年龄最小值")
+    private Integer min;
+    /**
+     * 年龄最大值
+     */
+    @Excel(name = "年龄最大值", width = 15)
+    @ApiModelProperty(value = "年龄最大值")
+    private Integer max;
+    /**
+     * 性别 1:女性, 2:男性,0 表示不限
+     */
+    @Excel(name = "性别 1:女性, 2:男性,0 表示不限", width = 15)
+    @ApiModelProperty(value = "性别 1:女性, 2:男性,0 表示不限")
+    private Integer gender;
+    /**
+     * 定向的 os 版本 应用安装类计划以app_id中的platform_os为准 1:Android,2:iOS,0 表示不限
+     */
+    @Excel(name = "定向的 os 版本 应用安装类计划以app_id中的platform_os为准 1:Android,2:iOS,0 表示不限", width = 15)
+    @ApiModelProperty(value = "定向的 os 版本 应用安装类计划以app_id中的platform_os为准 1:Android,2:iOS,0 表示不限")
+    private Integer platformOs;
+    /**
+     * Android 版本 3:不限,4:4.x+,5:5.x+,6:6.x+,7:7.x+
+     */
+    @Excel(name = "Android 版本 3:不限,4:4.x+,5:5.x+,6:6.x+,7:7.x+", width = 15)
+    @ApiModelProperty(value = "Android 版本 3:不限,4:4.x+,5:5.x+,6:6.x+,7:7.x+")
+    private Integer androidOsv;
+    /**
+     * iOS 版本 6:不限, 7:7.x+, 8:8.x+, 9:9.x+, 10:10.x+
+     */
+    @Excel(name = "iOS 版本 6:不限, 7:7.x+, 8:8.x+, 9:9.x+, 10:10.x+", width = 15)
+    @ApiModelProperty(value = "iOS 版本 6:不限, 7:7.x+, 8:8.x+, 9:9.x+, 10:10.x+")
+    private Integer iosOsv;
+    /**
+     * 网络环境 1:WI-FI,2:移动网络,0:表示不限
+     */
+    @Excel(name = "网络环境 1:WI-FI,2:移动网络,0:表示不限", width = 15)
+    @ApiModelProperty(value = "网络环境 1:WI-FI,2:移动网络,0:表示不限")
+    private Integer network;
+    /**
+     * 过滤已转化人群纬度 0:不限 1:广告组 2:广告计划 3:本账户 4:公司主体 5:APP
+     */
+    @Excel(name = "过滤已转化人群纬度 0:不限 1:广告组 2:广告计划 3:本账户 4:公司主体 5:APP", width = 15)
+    @ApiModelProperty(value = "过滤已转化人群纬度 0:不限 1:广告组 2:广告计划 3:本账户 4:公司主体 5:APP")
+    private Integer filterConvertedLevel;
+    /**
+     * 设备品牌  1:OPPO,2:VIVO, 3:华为,4:小米,5:荣耀,6:三星,7:金立,8:魅族,9:乐视,10:其他,11:苹果(只有 platform_os 为不限时支持此选项);传值为 [] 表示不限;当 platform_os 表示 iOS 的时候,没有设备品牌定向
+     */
+    @Excel(name = "设备品牌  1:OPPO,2:VIVO, 3:华为,4:小米,5:荣耀,6:三星,7:金立,8:魅族,9:乐视,10:其他,11:苹果(只有 platform_os 为不限时支持此选项);传值为 [] 表示不限;当 platform_os 表示 iOS 的时候,没有设备品牌定向", width = 15)
+    @ApiModelProperty(value = "设备品牌  1:OPPO,2:VIVO, 3:华为,4:小米,5:荣耀,6:三星,7:金立,8:魅族,9:乐视,10:其他,11:苹果(只有 platform_os 为不限时支持此选项);传值为 [] 表示不限;当 platform_os 表示 iOS 的时候,没有设备品牌定向")
+    private String deviceBrand;
+    /**
+     * 设备价格 1:1,500元以下,2:1,501~2,000,3:2,001~2,500,4:2,501~3,000,5、3,001~3,500,6:3,501~4,000,7:4,001~4,500,8:4,501~5,000,9:5,001~5,500,10:5,500元以上,传值为 [] 表示不限
+     */
+    @Excel(name = "设备价格 1:1,500元以下,2:1,501~2,000,3:2,001~2,500,4:2,501~3,000,5、3,001~3,500,6:3,501~4,000,7:4,001~4,500,8:4,501~5,000,9:5,001~5,500,10:5,500元以上,传值为 [] 表示不限", width = 15)
+    @ApiModelProperty(value = "设备价格 1:1,500元以下,2:1,501~2,000,3:2,001~2,500,4:2,501~3,000,5、3,001~3,500,6:3,501~4,000,7:4,001~4,500,8:4,501~5,000,9:5,001~5,500,10:5,500元以上,传值为 [] 表示不限")
+    private String devicePrice;
+    /**
+     * 商业兴趣类型 0:默认值 1:智能投放 2:兴趣标签
+     */
+    @Excel(name = "商业兴趣类型 0:默认值 1:智能投放 2:兴趣标签", width = 15)
+    @ApiModelProperty(value = "商业兴趣类型 0:默认值 1:智能投放 2:兴趣标签")
+    private Integer businessInterestType;
+    /**
+     * 商业兴趣
+     */
+    @Excel(name = "商业兴趣", width = 15)
+    @ApiModelProperty(value = "商业兴趣")
+    private String businessInterest;
+    /**
+     * 网红类别
+     */
+    @Excel(name = "网红类别", width = 15)
+    @ApiModelProperty(value = "网红类别")
+    private String fansStar;
+    /**
+     * 兴趣视频
+     */
+    @Excel(name = "兴趣视频", width = 15)
+    @ApiModelProperty(value = "兴趣视频")
+    private String interestVideo;
+    /**
+     * APP行为-按分类
+     */
+    @Excel(name = "APP行为-按分类", width = 15)
+    @ApiModelProperty(value = "APP行为-按分类")
+    private String appInterest;
+    /**
+     * APP行为-按APP名称
+     */
+    @Excel(name = "APP行为-按APP名称", width = 15)
+    @ApiModelProperty(value = "APP行为-按APP名称")
+    private String appIds;
+    /**
+     * 开启智能扩量 默认为0,为1时打开智能扩量,其他数值报错;关闭智能扩量时,以下三个字段必须为0
+     */
+    @Excel(name = "开启智能扩量 默认为0,为1时打开智能扩量,其他数值报错;关闭智能扩量时,以下三个字段必须为0", width = 15)
+    @ApiModelProperty(value = "开启智能扩量 默认为0,为1时打开智能扩量,其他数值报错;关闭智能扩量时,以下三个字段必须为0")
+    private Integer isOpen;
+    /**
+     * 不可突破年龄 默认为0(可突破/无需控制),定向age数据不为空时,可设为1(不可突破)
+     */
+    @Excel(name = "不可突破年龄 默认为0(可突破/无需控制),定向age数据不为空时,可设为1(不可突破)", width = 15)
+    @ApiModelProperty(value = "不可突破年龄 默认为0(可突破/无需控制),定向age数据不为空时,可设为1(不可突破)")
+    private Integer noAgeBreak;
+    /**
+     * 不可突破性别 默认为0(可突破/无需控制),定向gender数据不为空时,可设为1(不可突破
+     */
+    @Excel(name = "不可突破性别 默认为0(可突破/无需控制),定向gender数据不为空时,可设为1(不可突破", width = 15)
+    @ApiModelProperty(value = "不可突破性别 默认为0(可突破/无需控制),定向gender数据不为空时,可设为1(不可突破")
+    private Integer noGenderBreak;
+    /**
+     * 不可突破地域 默认为0(可突破/无需控制),定向region数据不为空时,可设为1(不可突破)
+     */
+    @Excel(name = "不可突破地域 默认为0(可突破/无需控制),定向region数据不为空时,可设为1(不可突破)", width = 15)
+    @ApiModelProperty(value = "不可突破地域 默认为0(可突破/无需控制),定向region数据不为空时,可设为1(不可突破)")
+    private Integer noAreaBreak;
+    /**
+     * 行为定向关键词
+     */
+    @Excel(name = "行为定向关键词", width = 15)
+    @ApiModelProperty(value = "行为定向关键词")
+    private String keyword;
+    /**
+     * 行为定向 类目词
+     */
+    @Excel(name = "行为定向 类目词", width = 15)
+    @ApiModelProperty(value = "行为定向 类目词")
+    private String label;
+    /**
+     * 兴趣定向类目词
+     */
+    @Excel(name = "兴趣定向类目词", width = 15)
+    @ApiModelProperty(value = "兴趣定向类目词")
+    private String interestLabel;
+    /**
+     * 在多少天内发生行为的用户 0:7天 1:15天 2:30天 3:90天 4:180天
+     */
+    @Excel(name = "在多少天内发生行为的用户 0:7天 1:15天 2:30天 3:90天 4:180天", width = 15)
+    @ApiModelProperty(value = "在多少天内发生行为的用户 0:7天 1:15天 2:30天 3:90天 4:180天")
+    private Integer timeType;
+    /**
+     * 行为强度	0:不限 1:高强度
+     */
+    @Excel(name = "行为强度	0:不限 1:高强度", width = 15)
+    @ApiModelProperty(value = "行为强度	0:不限 1:高强度")
+    private Integer strengthType;
+    /**
+     * 行为场景	1:社区 2:APP 4:推广
+     */
+    @Excel(name = "行为场景	1:社区 2:APP 4:推广", width = 15)
+    @ApiModelProperty(value = "行为场景	1:社区 2:APP 4:推广")
+    private String sceneType;
+    /**
+     * 定向模板创建时间
+     */
+    @ApiModelProperty(value = "定向模板创建时间")
+    private Date createTime;
+    /**
+     * 定向模板修改时间
+     */
+    @ApiModelProperty(value = "定向模板修改时间")
+    private Date updateTime;
+}

+ 4 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouAppPackageMapper.java

@@ -20,11 +20,13 @@ public interface KuaishouAppPackageMapper extends BaseMapper<KuaishouAppPackage>
 
     List<String> queryAppVersions(@Param("projectId") Long projectId);
 
-    List<Long> queryByAppVersion(@Param("projectId") Long projectId,@Param("appVersion") String appVersion);
+    List<Long> queryByAppVersion(@Param("projectId") Long projectId, @Param("appVersion") String appVersion, @Param("dataStatus") Integer dataStatus);
 
-    List<JSONObject> queryPageList(@Param("appVersion") String appVersion, @Param("projectId") Long projectId, @Param("platform") Integer platform);
+    List<JSONObject> queryPageList(@Param("userId") String userId, @Param("appName") String appName, @Param("appVersion") String appVersion, @Param("projectId") Long projectId, @Param("platform") Integer platform);
 
     Long queryUnitCount(@Param("id") Long id);
 
     List<JSONObject> getRelatedGroups(@Param("id") Long id, @Param("accountId") Long accountId);
+
+    String getUrlByMd5(@Param("md5") String md5);
 }

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

@@ -19,11 +19,13 @@ public interface KuaishouDirectionalPckageRelMapper extends BaseMapper<KuaishouD
 
     void replace(KuaishouDirectionalaPckageRel rel);
 
-    List<JSONObject> queryPushResults(@Param("id") String id, @Param("accountIds") JSONArray accountIds,@Param("status") String status);
+    List<JSONObject> queryPushResults(@Param("id") String id, @Param("accountIds") JSONArray accountIds, @Param("status") String status);
 
     List<JSONObject> getAccountByProjectId(@Param("projectId") Long projectId, @Param("id") String id);
 
     List<JSONObject> queryRelId(@Param("projectId") Long projectId, @Param("id") String id, @Param("type") String type);
 
-    List<JSONObject> queryUnitIdByAccountId(@Param("id") String id,@Param("accountId")  Long accountId);
+    List<JSONObject> queryUnitIdByAccountId(@Param("id") String id, @Param("accountId") Long accountId);
+
+    void updateTemName(@Param("id") String id, @Param("templateName") String templateName);
 }

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouLandpagePackageMapper.java

@@ -20,7 +20,7 @@ public interface KuaishouLandpagePackageMapper extends BaseMapper<KuaishouLandpa
 
     void deleteByAccountId(@Param("accountId") Long accountId);
 
-    List<JSONObject> queryPageList(@Param("accountId") Long accountId,@Param("projectId") Long projectId);
+    List<JSONObject> queryPageList(@Param("userId") String userId, @Param("accountId") Long accountId, @Param("projectId") Long projectId);
 
     List<JSONObject> getRelatedAccounts(@Param("siteId") Long siteId);
 

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

@@ -16,9 +16,9 @@ import java.util.List;
  */
 public interface KuaishouPopulationPackageMapper extends BaseMapper<KuaishouPopulationPackage> {
 
-    Long queryPageListTotal(@Param("projectId") Long projectId, @Param("orientationName") String orientationName);
+    Long queryPageListTotal(@Param("userId") String userId, @Param("projectId") Long projectId, @Param("orientationName") String orientationName);
 
-    List<JSONObject> queryPageList(@Param("projectId") Long projectId, @Param("orientationName") String orientationName);
+    List<JSONObject> queryPageList(@Param("userId") String userId, @Param("projectId") Long projectId, @Param("orientationName") String orientationName);
 
     Long queryUnitCount(@Param("id") Long id);
 

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.ai.mapper;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouVideoDirectionalPackage;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 素材绑定的定向包模板
+ *
+ * @author jeecg-boot
+ * 2021-05-25
+ * @version V1.0
+ */
+public interface KuaishouVideoDirectionalPackageMapper extends BaseMapper<KuaishouVideoDirectionalPackage> {
+
+}

+ 24 - 5
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouAppPackageMapper.xml

@@ -11,7 +11,7 @@
         app_version,
         app_name,
         app_icon_url,
-        image_token,
+        image_md5,
         package_name,
         platform,
         app_privacy_url,
@@ -29,7 +29,7 @@
             #{app.appVersion},
             #{app.appName},
             #{app.appIconUrl},
-            #{app.imageToken},
+            #{app.imageMd5},
             #{app.packageName},
             #{app.platform},
             #{app.appPrivacyUrl},
@@ -49,7 +49,12 @@
         SELECT id
         FROM ctop_kuaishou_app_package
         where project_id = #{projectId}
-          and app_version = #{appVersion}
+        <if test="appVersion!=null">
+            and app_version = #{appVersion}
+        </if>
+        <if test="dataStatus!=null">
+            and data_status = #{dataStatus}
+        </if>
     </select>
 
     <select id="queryPageList" resultType="com.alibaba.fastjson.JSONObject">
@@ -70,17 +75,25 @@
         t2.project_name 'projectName',
         (SELECT COUNT(1) FROM ctop_kuaishou_app_package_rel WHERE apptem_id = t1.id AND data_status = 1)'accountCount'
         FROM ctop_kuaishou_app_package t1
-        LEFT JOIN ctop_project = t2 on t1.project_id =t2.id
-        WHERE t1.data_status =1
+        LEFT JOIN ctop_project t2 on t1.project_id =t2.id
+        LEFT JOIN ctop_project_member t3 ON t1.project_id = t3.project_id
+        WHERE t1.data_status = 1
+        <if test="userId!=null">
+             AND t3.user_id = #{userId}
+        </if>
         <if test="appVersion!=null">
             AND t1.app_version Like concat('%',#{appVersion},'%')
         </if>
+        <if test="appName!=null">
+            AND t1.app_name Like concat(concat('%',#{appName}),'%')
+        </if>
         <if test="projectId!=null">
             AND t1.project_id=#{projectId}
         </if>
         <if test="platform!=null">
             AND t1.platform=#{platform}
         </if>
+        GROUP BY t1.id
         order by t1.create_time desc
     </select>
 
@@ -114,4 +127,10 @@
         order by t1.create_time desc
     </select>
 
+    <select id="getUrlByMd5" resultType="java.lang.String">
+        SELECT app_icon_url
+        FROM ctop_kuaishou_app_package
+        WHERE image_md5 = #{md5} limit 1
+    </select>
+
 </mapper>

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

@@ -40,7 +40,11 @@
         AND t.data_status=1
         GROUP BY dir_id
         ) t5 ON t5.dir_id = t1.id
+        LEFT JOIN ctop_project_member t6 ON t1.project_id = t6.project_id
         where t1.data_status = 1
+        <if test="userId !=null">
+            AND t6.user_id =#{userId}
+        </if>
         <if test="templateName !=null">
             AND t1.template_name like concat('%',#{templateName},'%')
         </if>
@@ -50,13 +54,21 @@
         <if test="projectId !=null">
             AND t1.project_id = #{projectId}
         </if>
+        GROUP BY t1.id
         order by t1.update_time desc
     </select>
+
     <select id="queryListTotal" resultType="java.lang.Long">
+        SELECT IFNULL(count(1),0)
+        FROM (
         SELECT
-        IFNULL(count(1),0)
+        t1.id
         FROM ctop_kuaishou_directional_package t1
+        LEFT JOIN ctop_project_member t2 ON t1.project_id = t2.project_id
         where t1.data_status = 1
+        <if test="userId !=null">
+            AND t2.user_id =#{userId}
+        </if>
         <if test="templateName !=null">
             AND t1.template_name like concat('%',#{templateName},'%')
         </if>
@@ -66,6 +78,9 @@
         <if test="projectId !=null">
             AND t1.project_id = #{projectId}
         </if>
+        GROUP BY t1.id
+        ) t
+
     </select>
 
 
@@ -88,7 +103,7 @@
         INNER JOIN ( SELECT account_id,unit_id,unit_name FROM ctop_kuaishou_group
         where 1=1
         <if test="accountId!=null">
-           and account_id = #{accountId}
+            and account_id = #{accountId}
         </if>
         ) t1 ON t1.unit_id = t2.rel_id
         LEFT JOIN ctop_user_allocation t3 ON t1.account_id = t3.account_id

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

@@ -49,7 +49,7 @@
         where dir_id = #{id}
         AND rel_type = 'account'
         <if test=" status!=null">
-        AND  t1.data_status = #{status}
+            AND t1.data_status = #{status}
         </if>
         <if test="accountIds!=null">
             AND rel_id IN
@@ -61,34 +61,42 @@
     </select>
 
     <select id="getAccountByProjectId" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
-            t1.account_id as 'accountId',
-            CONCAT(t1.auth_name,'(',t1.account_id,')') as 'authName',
-            IFNULL(t2.data_status,0) as 'state'
-            FROM ctop_user_allocation t1
-                LEFT JOIN (
-                SELECT rel_id,data_status FROM ctop_kuaishou_directional_package_rel
-                WHERE  project_id = #{projectId}
-                  AND rel_type = 'account'
-                  AND dir_id = #{id}
-            ) t2 ON t1.account_id = t2.rel_id
+        SELECT t1.account_id as 'accountId', CONCAT(t1.auth_name, '(', t1.account_id, ')') as 'authName', IFNULL(t2.data_status, 0) as 'state'
+        FROM ctop_user_allocation t1
+                 LEFT JOIN (
+            SELECT rel_id, data_status
+            FROM ctop_kuaishou_directional_package_rel
+            WHERE project_id = #{projectId}
+              AND rel_type = 'account'
+              AND dir_id = #{id}
+        ) t2 ON t1.account_id = t2.rel_id
         where t1.account_status = 0
           AND t1.project_id = #{projectId}
     </select>
 
     <select id="queryRelId" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT rel_id,template_id FROM ctop_kuaishou_directional_package_rel
-        WHERE  project_id = #{projectId}
+        SELECT rel_id, template_id
+        FROM ctop_kuaishou_directional_package_rel
+        WHERE project_id = #{projectId}
           AND rel_type = #{type}
           AND dir_id = #{id}
     </select>
 
     <select id="queryUnitIdByAccountId" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT rel_id,template_id FROM(
-       SELECT DISTINCT unit_id FROM ctop_kuaishou_group
-       where account_id = #{accountId} ) t1
-       INNER JOIN ctop_kuaishou_directional_package_rel t2 ON t1.unit_id = t2.rel_id
-        WHERE t2.rel_type = 'unit' AND t2.dir_id = #{id}
+        SELECT rel_id, template_id
+        FROM (
+                 SELECT DISTINCT unit_id
+                 FROM ctop_kuaishou_group
+                 where account_id = #{accountId}) t1
+                 INNER JOIN ctop_kuaishou_directional_package_rel t2 ON t1.unit_id = t2.rel_id
+        WHERE t2.rel_type = 'unit'
+          AND t2.dir_id = #{id}
     </select>
 
+    <update id="updateTemName">
+        update
+            ctop_kuaishou_directional_package_rel
+        set template_name = #{templateName}
+        where dir_id = #{id}
+    </update>
 </mapper>

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

@@ -55,13 +55,18 @@
         FROM ctop_kuaishou_landpage_package t1
         LEFT JOIN ctop_project t2 ON t1.project_id = t2.id
         LEFT JOIN ctop_user_allocation t3 ON t1.account_id = t3.account_id
+        LEFT JOIN ctop_project_member t4 ON t1.project_id = t4.project_id
         WHERE 1=1
+        <if test="userId!=null">
+            AND t4.user_id =#{userId}
+        </if>
         <if test="projectId!=null">
             AND t1.project_id =#{projectId}
         </if>
         <if test="accountId!=null">
             AND t1.account_id =#{accountId}
         </if>
+        GROUP BY t1.id
         ORDER BY t1.landpage_update_time desc
     </select>
 

+ 20 - 8
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouPopulationPackageMapper.xml

@@ -4,14 +4,21 @@
 
     <select id="queryPageListTotal" resultType="java.lang.Long">
         SELECT IFNULL(COUNT(1), 0)
-        FROM ctop_kuaishou_population_package t1
-        WHERE data_status = 1
+        FROM
+        (SELECT t1.id FROM ctop_kuaishou_population_package t1
+        LEFT JOIN ctop_project_member t3 ON t1.project_id = t3.project_id
+        WHERE t1.data_status =1
+        <if test="userId !=null">
+            AND t3.user_id =#{userId}
+        </if>
         <if test="orientationName !=null">
             AND orientation_name LIKE CONCAT('%', #{orientationName}, '%')
         </if>
         <if test="projectId !=null">
             AND t1.project_id =#{projectId}
         </if>
+        GROUP BY t1.id
+        ) t
     </select>
 
     <select id="queryPageList" resultType="com.alibaba.fastjson.JSONObject">
@@ -38,20 +45,25 @@
         FROM
         ctop_kuaishou_population_package t1
         LEFT JOIN ctop_project t2 ON t1.project_id = t2.id
-        WHERE data_status = 1
+        LEFT JOIN ctop_project_member t3 ON t1.project_id = t3.project_id
+        WHERE t1.data_status = 1
+        <if test="userId !=null">
+            AND t3.user_id =#{userId}
+        </if>
         <if test="orientationName !=null">
             AND orientation_name LIKE CONCAT(CONCAT('%', #{orientationName}), '%')
         </if>
         <if test="projectId !=null">
             AND t1.project_id =#{projectId}
         </if>
+        GROUP BY t1.id
         order by t1.create_time desc
     </select>
 
     <select id="queryUnitCount" resultType="java.lang.Long">
         SELECT IFNULL(COUNT(1), 0)
         FROM ctop_kuaishou_population_group t1
-        INNER JOIN ctop_kuaishou_group t3 ON t1.unit_id = t3.unit_id
+                 INNER JOIN ctop_kuaishou_group t3 ON t1.unit_id = t3.unit_id
         where orientation_id IN
               (SELECT orientation_id
                FROM ctop_kuaishou_population_package_rel
@@ -61,9 +73,9 @@
     </select>
 
     <select id="queryListByStatus" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT account_id,project_id
+        SELECT account_id, project_id
         FROM ctop_kuaishou_population_package_rel
-        WHERE data_status =1
+        WHERE data_status = 1
         GROUP BY account_id
     </select>
 
@@ -90,7 +102,7 @@
         select orientation_name
         from ctop_kuaishou_population_package
         where signature = #{signature}
-        AND data_status = 1
-</select>
+          AND data_status = 1
+    </select>
 
 </mapper>

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

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

@@ -17,13 +17,13 @@ import java.util.List;
  */
 public interface IKuaishouAppPackageService extends IService<KuaishouAppPackage> {
 
-    Result<Object> importExcel(MultipartFile file, Long projectId, Integer platform, String imageToken, String imageUrl) throws Exception;
+    Result<Object> importExcel(MultipartFile file, Long projectId, Integer platform, String imageUrl) throws Exception;
 
     Result<Object> pushAppPackage(Long id, JSONArray accountIds);
 
     Result<Object> queryPushResults(String id, JSONArray accountIds, String status);
 
-    List<Long> queryByAppVersion(Long projectId,String appVersion);
+    List<Long> queryByAppVersion(Long projectId,String appVersion,Integer dataStatus);
 
     void createAppAndGroupRel(JSONObject request);
 
@@ -34,4 +34,6 @@ public interface IKuaishouAppPackageService extends IService<KuaishouAppPackage>
     Result<Object> getRelatedGroups(Long id, Long accountId);
 
     Result<Object> getAccountByProjectId(Long projectId, String id);
+
+    String getDownloadPath(String url);
 }

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.ai.service;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouVideoDirectionalPackage;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 素材绑定的定向包模板
+ *
+ * @author jeecg-boot
+ * 2021-05-25
+ * @version V1.0
+ */
+public interface IKuaishouVideoDirectionalPackageService extends IService<KuaishouVideoDirectionalPackage> {
+
+}

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

@@ -1,17 +0,0 @@
-package cn.com.ctop.kuaishou.modules.ai.service;
-
-import java.util.List;
-
-import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouAppPackageRel;
-import org.apache.ibatis.annotations.Param;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- * 应用和账户关联表
- * @author: jeecg-boot
- * @date:   2021-05-13
- * @cersion: V1.0
- */
-public interface KuaishouAppPackageRelMapper extends BaseMapper<KuaishouAppPackageRel> {
-
-}

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

@@ -1073,7 +1073,12 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             }
             //程序化创意2.0素材挖掘
             if (!Check.isNull(strategy.getAssetMining())) {
-                unitParams.put("asset_mining", strategy.getAssetMining());
+                if (strategy.getAssetMining() == 1) {
+                    unitParams.put("asset_mining", true);
+                } else if (strategy.getAssetMining() == 0) {
+                    unitParams.put("asset_mining", false);
+                }
+
             }
         }
         if (!Check.isNull(strategy.getTemplateId())) {

+ 96 - 14
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouAppPackageServiceImpl.java

@@ -2,8 +2,10 @@ package cn.com.ctop.kuaishou.modules.ai.service.impl;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.ISysRoleExtService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.LoadFileUtil;
 import cn.com.ctop.common.module.utils.PropertiesUtils;
 import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouAppPackage;
 import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouAppPackageRel;
@@ -11,9 +13,12 @@ import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouAppGroupMapper;
 import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouAppPackageMapper;
 import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouAppPackageRelMapper;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAppPackageService;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouMaterialUploadService;
 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.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -25,12 +30,17 @@ import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.MD5Util;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.IOException;
 import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -38,6 +48,7 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.UUID;
 
 /**
  * 项目绑定的应用
@@ -51,7 +62,8 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
 
     @Autowired
     private KuaishouAppPackageMapper appPackageMapper;
-
+    @Autowired
+    private ISysRoleExtService sysRoleService;
     @Autowired
     private KuaishouAppPackageRelMapper relMapper;
 
@@ -62,9 +74,15 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaiShouMaterialUploadService materialUploadService;
+    @Autowired
+    private IKuaiShouImageGetService imageGetService;
+    @Autowired
+    private IKuaiShouMaterialUploadService uploadService;
+    @Value("${zip.local.download-path}")
+    private String downloadPath;
 
     @Override
-    public Result<Object> importExcel(MultipartFile file, Long projectId, Integer platform, String imageToken, String imageUrl) throws Exception {
+    public Result<Object> importExcel(MultipartFile file, Long projectId, Integer platform, String imageUrl) throws Exception {
         JSONObject returnJson = new JSONObject();
         Workbook workbook = null;
         String fileName = file.getOriginalFilename();
@@ -84,6 +102,16 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
         if (rows == 0) {
             throw new Exception("请填写数据");
         }
+        String newFileUrl = getDownloadPath(imageUrl);
+        if (Check.isNull(newFileUrl)) {
+            return Result.error("本地下载文件失败,路径:" + imageUrl);
+        }
+        String md5 = null;
+        try {
+            md5 = LoadFileUtil.getMD5(newFileUrl);
+        } catch (IOException e) {
+            log.error("获取MD5签名失败", e);
+        }
         //查询项目下的应用标记(同一账户下应用标记不能重复),在此视为同一项目不可重复
         List<String> appVersions = appPackageMapper.queryAppVersions(projectId);
         StringBuffer errAppVersions = new StringBuffer();
@@ -109,8 +137,6 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
                     return Result.error("解析失败,文档中应用名称列缺失数据");
                 } else if (Check.isNull(url)) {
                     return Result.error("解析失败,文档中下载链接列缺失数据");
-                } else if (Check.isNull(trackUrl)) {
-                    return Result.error("解析失败,文档中监测链接列缺失数据");
                 }
                 if (appVersions.contains(appVersion)) {
                     errAppVersions.append(appVersion).append("、");
@@ -121,14 +147,14 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
                 appPackage.setAppIconUrl(imageUrl);
                 appPackage.setPackageName(packageName);
                 appPackage.setPlatform(platform);
-                appPackage.setImageToken(imageToken);
+                appPackage.setImageMd5(md5);
                 appPackage.setTrackUrl(trackUrl);
                 appPackage.setAppPrivacyUrl(appPrivacyUrl);
                 appPackage.setDataStatus(1);//有效
                 appPackage.setUrl(url);
-                String md5 = MD5Util.getMd5(url);
-                if (!Check.isNull(md5)) {
-                    appPackage.setAppMd5(md5);
+                String appmd5 = MD5Util.getMd5(url);
+                if (!Check.isNull(appmd5)) {
+                    appPackage.setAppMd5(appmd5);
                 }
                 if (!Check.isNull(useSdk)) {
                     appPackage.setUseSdk(Integer.valueOf(useSdk));
@@ -136,6 +162,7 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
                 appList.add(appPackage);
             }
         }
+        LoadFileUtil.delFile(newFileUrl);
         String errVersion = errAppVersions.toString();
         if (!Check.isNull(errVersion)) {
             return Result.error("数据异常,重复的应用标记:" + errVersion.substring(0, errVersion.length() - 1));
@@ -144,6 +171,15 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
         return Result.ok("文件导入成功");
     }
 
+    public String getDownloadPath(String url) {
+        StringBuffer path = new StringBuffer();
+        path.append(downloadPath).append(DateUtils.getNowDate(DateUtils.WEB_FORMAT)).append("/").append(UUID.randomUUID().toString()).append("/");
+        if (!url.contains("http")) {
+            url = "https:".concat(url);
+        }
+        return LoadFileUtil.downLoadFromUrl(url, path.toString());
+    }
+
     private String getCellValue(Cell cell) {
         String value = "";
         if (cell != null) {
@@ -189,7 +225,7 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
     public Result<Object> pushAppPackage(Long id, JSONArray accountIds) {
         KuaishouAppPackage appPackage = appPackageMapper.selectById(id);
         if (Check.isNull(appPackage)) {
-            return Result.error("获取到应用信息");
+            return Result.error("获取到应用信息");
         }
         KuaishouAppPackageRel rel = new KuaishouAppPackageRel();
         rel.setApptemId(appPackage.getId());
@@ -199,16 +235,25 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
         for (Object account : accountIds) {
             try {
                 Long accountId = Long.valueOf(String.valueOf(account));
+                rel.setAccountId(accountId);
                 KuaishouAppPackageRel entity = relMapper.queryEntityByAccountId(accountId, appPackage.getAppVersion());
                 if (!Check.isNull(entity)) {
                     continue;
                 }
                 CtopOauthToken oauthToken = tokenService.getTokenByAccountId(accountId);
+                JSONObject dataJson = getImageToken(appPackage.getImageMd5(), accountId, oauthToken);
+                String imageToken = dataJson.getString("image_token");
+                if (Check.isNull(imageToken)) {
+                    rel.setMessage(dataJson.getString("message"));
+                    rel.setDataStatus(0);
+                    list.add(rel);
+                    continue;
+                }
                 JSONObject requestJson = new JSONObject();
                 requestJson.put("advertiser_id", accountId);
                 requestJson.put("app_version", appPackage.getAppVersion());
                 requestJson.put("app_name", appPackage.getAppName());
-                requestJson.put("image_token", appPackage.getImageToken());
+                requestJson.put("image_token", imageToken);
                 requestJson.put("package_name", appPackage.getPackageName());
                 requestJson.put("platform", appPackage.getPlatform());
                 requestJson.put("url", appPackage.getUrl());
@@ -220,7 +265,7 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
                 headerMap.put("Access-Token", oauthToken.getAccessToken());
                 String result = materialUploadService.exceptInfoForRestTemplate(url, requestJson, headerMap);
                 JSONObject resultJson = JSONObject.parseObject(result);
-                rel.setAccountId(accountId);
+
                 if (!Check.isNull(resultJson)) {
                     Integer code = resultJson.getInteger("code");
                     if (code == 0) {
@@ -249,6 +294,33 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
         }
         return Result.ok("推送完成");
     }
+
+    /**
+     * 获取图片token
+     */
+    private JSONObject getImageToken(String md5, Long accountId, CtopOauthToken oauthToken) {
+        JSONObject request = new JSONObject();
+        if (!Check.isNull(md5)) {
+            QueryWrapper<KuaiShouImageGet> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("account_id", accountId);
+            queryWrapper.eq("signature", md5);
+            queryWrapper.last("limit 1");
+            KuaiShouImageGet imageGet = imageGetService.getOne(queryWrapper);
+            if (!Check.isNull(imageGet)) {
+                request.put("image_token", imageGet.getImageToken());
+                return request;
+            } else {
+                String url = appPackageMapper.getUrlByMd5(md5);
+                JSONObject resultJson = uploadService.kuauiShouImageUploadOnly(url, md5, accountId, oauthToken.getAccessToken());
+                if (resultJson.getInteger("code") == 0) {
+                    return resultJson.getJSONObject("data");
+                }
+                return resultJson;
+            }
+        }
+        return request;
+    }
+
     @Override
     public Result<Object> queryPushResults(String id, JSONArray accountIds, String status) {
         List<JSONObject> lsit = relMapper.queryPushResults(id, accountIds, status);
@@ -256,8 +328,8 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
     }
 
     @Override
-    public List<Long> queryByAppVersion(Long projectId,String appVersion) {
-        return appPackageMapper.queryByAppVersion(projectId,appVersion);
+    public List<Long> queryByAppVersion(Long projectId, String appVersion, Integer dataStatus) {
+        return appPackageMapper.queryByAppVersion(projectId, appVersion, dataStatus);
     }
 
     @Override
@@ -272,8 +344,18 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
 
     @Override
     public Result<Object> queryPageList(KuaishouAppPackage kuaishouAppPackage, Integer pageNo, Integer pageSize) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = null;
+        if (!Check.isNull(user)) {
+            userId = user.getId();
+            String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+            //角色为管理员、销售、媒介可以查看所有项目信息
+            if ("admin".equals(roleCode) || roleCode.contains("sale") || "meidaManager".equals(roleCode)) {
+                userId = null;
+            }
+        }
         PageHelper.startPage(pageNo, pageSize);
-        List<JSONObject> list = appPackageMapper.queryPageList(kuaishouAppPackage.getAppVersion(), kuaishouAppPackage.getProjectId(), kuaishouAppPackage.getPlatform());
+        List<JSONObject> list = appPackageMapper.queryPageList(userId, kuaishouAppPackage.getAppName(), kuaishouAppPackage.getAppVersion(), kuaishouAppPackage.getProjectId(), kuaishouAppPackage.getPlatform());
         for (JSONObject object : list) {
             object.put("unitCount", appPackageMapper.queryUnitCount(object.getLong("id")));
         }

+ 20 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouDirectionalPackageServiceImpl.java

@@ -2,6 +2,7 @@ package cn.com.ctop.kuaishou.modules.ai.service.impl;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.ISysRoleExtService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
@@ -27,7 +28,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.vo.LoginUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -66,7 +69,8 @@ public class KuaishouDirectionalPackageServiceImpl extends ServiceImpl<KuaishouD
     private KuaiShouGroupMapper groupMapper;
     @Autowired
     private KuaishouTemplateTargetMapper templateTargetMapper;
-
+    @Autowired
+    private ISysRoleExtService sysRoleService;
     @Autowired
     private IKuaiShouGroupTemplateService groupTemplateService;
     static ExecutorService executorService = null;
@@ -133,6 +137,9 @@ public class KuaishouDirectionalPackageServiceImpl extends ServiceImpl<KuaishouD
             };
             thread.start();
         }
+        if (!entity.getTemplateName().equals(kuaishouDirectionalPackage.getTemplateName())) {
+            relMapper.updateTemName(entity.getId(), kuaishouDirectionalPackage.getTemplateName());
+        }
         return Result.ok("该项目下定向包已做同步修改");
     }
 
@@ -334,6 +341,17 @@ public class KuaishouDirectionalPackageServiceImpl extends ServiceImpl<KuaishouD
 
     @Override
     public Result<Object> queryList(KuaishouDirectionalPackage directionalPackage, Integer pageNo, Integer pageSize) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = null;
+        if (!Check.isNull(user)) {
+            userId = user.getId();
+            String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+            //角色为管理员、销售、媒介可以查看所有项目信息
+            if ("admin".equals(roleCode) || roleCode.contains("sale") || "meidaManager".equals(roleCode)) {
+                userId = null;
+            }
+        }
+        directionalPackage.setUserId(userId);
         Long total = packageMapper.queryListTotal(directionalPackage);
         PageHelper.startPage(pageNo, pageSize, false);
         List<JSONObject> list = packageMapper.queryList(directionalPackage);
@@ -639,7 +657,7 @@ public class KuaishouDirectionalPackageServiceImpl extends ServiceImpl<KuaishouD
     public Result<Object> queryPopulationById(Long templateId, Long accountId) {
         KuaishouTemplateTarget target = templateTargetMapper.queryTemplateTarget(templateId, accountId);
         if (Check.isNull(target)) {
-            return Result.error("查询到人群包");
+            return Result.error("查询到人群包");
         }
         JSONObject data = new JSONObject();
         String excludePopulation = target.getExcludePopulation();

+ 18 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouLandpagePackageServiceImpl.java

@@ -4,6 +4,7 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.ISysRoleExtService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
@@ -19,7 +20,9 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.vo.LoginUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -49,11 +52,23 @@ public class KuaishouLandpagePackageServiceImpl extends ServiceImpl<KuaishouLand
     private UserAllocationMapper userAllocationMapper;
     @Autowired
     private ICtopOauthTokenService oauthTokenService;
+    @Autowired
+    private ISysRoleExtService sysRoleService;
 
     @Override
     public Result<Object> queryPageList(KuaishouLandpagePackage kuaishouLandpagePackage, Integer pageNo, Integer pageSize) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = null;
+        if (!Check.isNull(user)) {
+            userId = user.getId();
+            String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+            //角色为管理员、销售、媒介可以查看所有项目信息
+            if ("admin".equals(roleCode) || roleCode.contains("sale") || "meidaManager".equals(roleCode)) {
+                userId = null;
+            }
+        }
         PageHelper.startPage(pageNo, pageSize);
-        List<JSONObject> list = landpagePackageMapper.queryPageList(kuaishouLandpagePackage.getAccountId(), kuaishouLandpagePackage.getProjectId());
+        List<JSONObject> list = landpagePackageMapper.queryPageList(userId, kuaishouLandpagePackage.getAccountId(), kuaishouLandpagePackage.getProjectId());
         return Result.ok(new PageInfo<JSONObject>(list));
     }
 
@@ -92,7 +107,7 @@ public class KuaishouLandpagePackageServiceImpl extends ServiceImpl<KuaishouLand
 
                         }
                     } else {
-                        log.error(resultJson.getString("message")+",accountId:"+accountId);
+                        log.error(resultJson.getString("message") + ",accountId:" + accountId);
                     }
                 }
             }
@@ -136,7 +151,7 @@ public class KuaishouLandpagePackageServiceImpl extends ServiceImpl<KuaishouLand
 
     @Override
     public Result<Object> getRelatedGroups(Long siteId, Long accountId) {
-        List<JSONObject> list = landpagePackageMapper.getRelatedGroups(siteId,accountId);
+        List<JSONObject> list = landpagePackageMapper.getRelatedGroups(siteId, accountId);
         return Result.ok(new PageInfo<JSONObject>(list));
     }
 

+ 18 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouPopulationPackageServiceImpl.java

@@ -2,6 +2,7 @@ package cn.com.ctop.kuaishou.modules.ai.service.impl;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.ISysRoleExtService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.LoadFileUtil;
 import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouCrowdPack;
@@ -19,7 +20,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -56,6 +59,9 @@ public class KuaishouPopulationPackageServiceImpl extends ServiceImpl<KuaishouPo
     private IKuaishouPopulationService iKuaishouPopulationService;
     @Autowired
     private IKuaishouPopulationGroupService populationGroupService;
+    @Autowired
+    private ISysRoleExtService sysRoleService;
+
     @Value("${zip.local.download-path}")
     private String downloadPath;
 
@@ -238,9 +244,19 @@ public class KuaishouPopulationPackageServiceImpl extends ServiceImpl<KuaishouPo
 
     @Override
     public Result<Object> queryPageList(KuaishouPopulationPackage kuaishouPopulationPackage, Integer pageNo, Integer pageSize) {
-        Long total = kuaishouPopulationPackageMapper.queryPageListTotal(kuaishouPopulationPackage.getProjectId(), kuaishouPopulationPackage.getOrientationName());
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = null;
+        if (!Check.isNull(user)) {
+            userId = user.getId();
+            String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+            //角色为管理员、销售、媒介可以查看所有项目信息
+            if ("admin".equals(roleCode) || roleCode.contains("sale") || "meidaManager".equals(roleCode)) {
+                userId = null;
+            }
+        }
+        Long total = kuaishouPopulationPackageMapper.queryPageListTotal(userId, kuaishouPopulationPackage.getProjectId(), kuaishouPopulationPackage.getOrientationName());
         PageHelper.startPage(pageNo, pageSize, false);
-        List<JSONObject> list = kuaishouPopulationPackageMapper.queryPageList(kuaishouPopulationPackage.getProjectId(), kuaishouPopulationPackage.getOrientationName());
+        List<JSONObject> list = kuaishouPopulationPackageMapper.queryPageList(userId, kuaishouPopulationPackage.getProjectId(), kuaishouPopulationPackage.getOrientationName());
         if (!Check.isNull(list)) {
             for (JSONObject object : list) {
                 object.put("unitCount", kuaishouPopulationPackageMapper.queryUnitCount(object.getLong("id")));

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.ai.service.impl;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouVideoDirectionalPackage;
+import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouVideoDirectionalPackageMapper;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouVideoDirectionalPackageService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 素材绑定的定向包模板
+ *
+ * @author jeecg-boot
+ * 2021-05-25
+ * @version V1.0
+ */
+@Service
+public class KuaishouVideoDirectionalPackageServiceImpl extends ServiceImpl<KuaishouVideoDirectionalPackageMapper, KuaishouVideoDirectionalPackage> implements IKuaishouVideoDirectionalPackageService {
+
+}

+ 99 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -5,17 +5,47 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.MaterialInfo;
 import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.BigDecimalUtil;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.QueryGenerator;
 import cn.com.ctop.common.module.utils.RandomUtil;
-import cn.com.ctop.kuaishou.modules.batch.entity.*;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouActionBarText;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAdvertiserBaseInfo;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppInfo;
+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.KuaiShouDirectionalTemplate;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTarget;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
+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.kuaishou.modules.batch.entity.vo.ConvertVo;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.SpendVo;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCampaignMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouTargetingTagsMapper;
-import cn.com.ctop.kuaishou.modules.batch.service.*;
+import cn.com.ctop.kuaishou.modules.batch.service.IBatchService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouActionBarTextService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAdvertiserBaseInfoService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAppInfoService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAppListService;
+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.IKuaiShouDirectionalTemplateService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTargetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouRegionListParentService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
+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.ISyncPullMaterialService;
 import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaiShouGroupDailyReportService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -27,7 +57,14 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
@@ -89,7 +126,8 @@ public class BatchController {
     private ISyncPullMaterialService syncPullMaterialService;
     @Autowired
     private IKuaiShouAdvertiserBaseInfoService KuaiShouAdvertiserBaseInfoService;
-
+    @Autowired
+    private IUserAllocationService userAllocationService;
 
     /**
      * 获取花费信息
@@ -2291,6 +2329,63 @@ public class BatchController {
         return result;
     }
 
+    /**
+     * 同步人员应用
+     *
+     * @param accountId
+     * @return
+     */
+    @GetMapping(value = "/syncUserAppList")
+    public Result<Object> syncUserAppList(String userId, Integer type) {
+        if (Check.isNull(type) || Check.isNull(userId)) {
+            return Result.error("缺失参数");
+        }
+        //0管理员更新所有账户
+        if (0 == type) {
+            List<CtopOauthToken> ctopOauthTokens = oauthTokenService.selectKuaiShouToken();
+            for (CtopOauthToken oauthToken : ctopOauthTokens) {
+                iKuaishouInterfaceService.getAppList(oauthToken.getAccountId(), oauthToken.getAccessToken());
+            }
+        } else {
+            List<JSONObject> list = userAllocationService.getAccountIdListByUserId(userId);
+            for (JSONObject obj : list) {
+                CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(obj.getLong("accountId"));
+                if (!Check.isNull(oauthToken)) {
+                    iKuaishouInterfaceService.getAppList(obj.getLong("accountId"), oauthToken.getAccessToken());
+                }
+            }
+        }
+        return Result.ok("success");
+    }
+
+    /**
+     * 同步人员的人群包列表
+     *
+     * @param accountId
+     * @return
+     */
+    @GetMapping(value = "/syncUserPopulationList")
+    public Result<Object> syncUserPopulationList(String userId, Integer type) {
+        if (Check.isNull(type) || Check.isNull(userId)) {
+            return Result.error("缺失参数");
+        }
+        //0管理员更新所有账户
+        if (0 == type) {
+            List<CtopOauthToken> ctopOauthTokens = oauthTokenService.selectKuaiShouToken();
+            for (CtopOauthToken oauthToken : ctopOauthTokens) {
+                iKuaishouInterfaceService.getPopulationList(oauthToken.getAccountId(), oauthToken.getAccessToken(), 1);
+            }
+        } else {
+            List<JSONObject> list = userAllocationService.getAccountIdListByUserId(userId);
+            for (JSONObject obj : list) {
+                CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(obj.getLong("accountId"));
+                if (!Check.isNull(oauthToken)) {
+                    iKuaishouInterfaceService.getPopulationList(obj.getLong("accountId"), oauthToken.getAccessToken(), 1);
+                }
+            }
+        }
+        return Result.ok("success");
+    }
 
     /**
      * 同步应用

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

@@ -0,0 +1,318 @@
+package cn.com.ctop.kuaishou.modules.batch.controller;
+
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouProjectVideoGet;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouProjectVideoGetService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+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.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+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-21
+ */
+@Slf4j
+@Api(tags = "快手-项目下视频信息")
+@RestController
+@RequestMapping("/kuaishouProjectVideoGet")
+public class KuaishouProjectVideoGetController {
+    @Autowired
+    private IKuaishouProjectVideoGetService kuaishouProjectVideoGetService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaishouProjectVideoGet
+     * @param pageNo
+     * @param pageSize
+     * @return
+     */
+    @GetMapping(value = "/list")
+    public Result<Object> queryPageList(KuaishouProjectVideoGet kuaishouProjectVideoGet,
+                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        try {
+            return kuaishouProjectVideoGetService.queryPageList(kuaishouProjectVideoGet, pageNo, pageSize);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+    /**
+     * 素材数量统计
+     *
+     * @return
+     */
+    @GetMapping(value = "/getVideoTotalNumber")
+    public Result<Object> getVideoTotalNumber(Long projectId) {
+        try {
+            if (Check.isNull(projectId)) {
+                return Result.error("请选择项目");
+            }
+            return kuaishouProjectVideoGetService.getVideoTotalNumber(projectId);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+    /**
+     * 素材详情数据
+     * put_start_time
+     *
+     * @return
+     */
+    @GetMapping(value = "/getVideoDetails")
+    public Result<Object> getVideoDetails(String signature) {
+        try {
+            if (Check.isNull(signature)) {
+                return Result.error("请选择素材");
+            }
+            return kuaishouProjectVideoGetService.getVideoDetails(signature);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+    /**
+     * 素材已关联账户数据
+     * put_start_time
+     *
+     * @return
+     */
+    @GetMapping(value = "/getAccountVideos")
+    public Result<Object> getAccountVideos(String signature, Long projectId, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        try {
+            if (Check.isNull(signature)) {
+                return Result.error("请选择素材");
+            }
+            if (Check.isNull(projectId)) {
+                return Result.error("请选择项目");
+            }
+            return kuaishouProjectVideoGetService.getAccountVideos(signature, projectId, pageNo, pageSize);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaishouProjectVideoGet
+     * @return
+     */
+    @AutoLog(value = "快手-项目下视频信息-添加")
+    @ApiOperation(value = "快手-项目下视频信息-添加", notes = "快手-项目下视频信息-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaishouProjectVideoGet> add(@RequestBody KuaishouProjectVideoGet kuaishouProjectVideoGet) {
+        Result<KuaishouProjectVideoGet> result = new Result<>();
+        try {
+            kuaishouProjectVideoGetService.save(kuaishouProjectVideoGet);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    @GetMapping(value = "/clearProjectVideo")
+    public Result<Object> clearProjectVideo(Long projectId) {
+        try {
+            kuaishouProjectVideoGetService.clearProjectVideo(projectId);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        }
+        return Result.ok("执行完成");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaishouProjectVideoGet
+     * @return
+     */
+    @AutoLog(value = "快手-项目下视频信息-编辑")
+    @ApiOperation(value = "快手-项目下视频信息-编辑", notes = "快手-项目下视频信息-编辑")
+    @PostMapping(value = "/edit")
+    public Result<KuaishouProjectVideoGet> edit(@RequestBody KuaishouProjectVideoGet kuaishouProjectVideoGet) {
+        Result<KuaishouProjectVideoGet> result = new Result<KuaishouProjectVideoGet>();
+        KuaishouProjectVideoGet kuaishouProjectVideoGetEntity = kuaishouProjectVideoGetService.getById(kuaishouProjectVideoGet.getId());
+        if (kuaishouProjectVideoGetEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaishouProjectVideoGetService.updateById(kuaishouProjectVideoGet);
+            if (ok) {
+                result.success("操作成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "快手-项目下视频信息-通过id删除")
+    @ApiOperation(value = "快手-项目下视频信息-通过id删除", notes = "快手-项目下视频信息-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            kuaishouProjectVideoGetService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "快手-项目下视频信息-批量删除")
+    @ApiOperation(value = "快手-项目下视频信息-批量删除", notes = "快手-项目下视频信息-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<KuaishouProjectVideoGet> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<KuaishouProjectVideoGet> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaishouProjectVideoGetService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "快手-项目下视频信息-通过id查询")
+    @ApiOperation(value = "快手-项目下视频信息-通过id查询", notes = "快手-项目下视频信息-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaishouProjectVideoGet> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaishouProjectVideoGet> result = new Result<>();
+        KuaishouProjectVideoGet kuaishouProjectVideoGet = kuaishouProjectVideoGetService.getById(id);
+        if (kuaishouProjectVideoGet == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaishouProjectVideoGet);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaishouProjectVideoGet> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaishouProjectVideoGet kuaishouProjectVideoGet = JSON.parseObject(deString, KuaishouProjectVideoGet.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaishouProjectVideoGet, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaishouProjectVideoGet> pageList = kuaishouProjectVideoGetService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "快手-项目下视频信息列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaishouProjectVideoGet.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<KuaishouProjectVideoGet> listKuaishouProjectVideoGets = ExcelImportUtil.importExcel(file.getInputStream(), KuaishouProjectVideoGet.class, params);
+                kuaishouProjectVideoGetService.saveBatch(listKuaishouProjectVideoGets);
+                return Result.ok("文件导入成功!数据行数:" + listKuaishouProjectVideoGets.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 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouVideoGet.java

@@ -44,6 +44,13 @@ public class KuaiShouVideoGet {
     private Integer materialType;
     private Integer channelType;
     private Integer status;
+    /**素造素材标签*/
+    private String materialTag;
+    /**素造供应商id*/
+    private Long supplierAccountId;
+    /**供应商名称*/
+    private String supplierAccountName;
+
     /**
      * 创建时间
      */

+ 132 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouProjectVideoGet.java

@@ -0,0 +1,132 @@
+package cn.com.ctop.kuaishou.modules.batch.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-21
+ */
+@Data
+@TableName("ctop_kuaishou_project_video_get")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_project_video_get对象", description = "快手-项目下视频信息")
+public class KuaishouProjectVideoGet {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long projectId;
+    /**
+     * 0 可用 1 删除
+     */
+    @Excel(name = "0 可用 1 删除", width = 15)
+    @ApiModelProperty(value = "0 可用 1 删除")
+    private Integer status;
+    /**
+     * 视频id
+     */
+    @Excel(name = "视频id", width = 15)
+    @ApiModelProperty(value = "视频id")
+    private String photoId;
+    /**
+     * 宽
+     */
+    @Excel(name = "宽", width = 15)
+    @ApiModelProperty(value = "宽")
+    private Integer width;
+    /**
+     * 高
+     */
+    @Excel(name = "高", width = 15)
+    @ApiModelProperty(value = "高")
+    private Integer height;
+    /**
+     * 视频预览链接
+     */
+    @Excel(name = "视频预览链接", width = 15)
+    @ApiModelProperty(value = "视频预览链接")
+    private String url;
+    /**
+     * 视频首帧图片链接
+     */
+    @Excel(name = "视频首帧图片链接", width = 15)
+    @ApiModelProperty(value = "视频首帧图片链接")
+    private String coverUrl;
+    /**
+     * 1 竖版视频 2 横版视频
+     */
+    @Excel(name = "1 竖版视频 2 横版视频", width = 15)
+    @ApiModelProperty(value = "1 竖版视频 2 横版视频")
+    private Integer materialType;
+    /**
+     * 0:自产 1:素造
+     */
+    @Excel(name = "0:自产 1:素造", width = 15)
+    @ApiModelProperty(value = "0:自产 1:素造")
+    private Integer channelType;
+    /**
+     * statDate
+     */
+    @ApiModelProperty(value = "statDate")
+    private Date statDate;
+    /**
+     * MD5值
+     */
+    @Excel(name = "MD5值", width = 15)
+    @ApiModelProperty(value = "MD5值")
+    private String signature;
+    /**
+     * 素材名称
+     */
+    @Excel(name = "素材名称", width = 15)
+    @ApiModelProperty(value = "素材名称")
+    private String photoName;
+    /**
+     * 允许投放起始时间
+     */
+    private String putStartTime;
+    /**
+     * 允许投放结束时间
+     */
+    private String putEndTime;
+    /**
+     * 创建时间
+     */
+    @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;
+}

+ 7 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouVideoGetMapper.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.mapper;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouProjectVideoGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.KuaiShouVideoGetVo;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -44,4 +45,10 @@ public interface KuaiShouVideoGetMapper extends BaseMapper<KuaiShouVideoGet> {
     List<KuaiShouVideoGet> getZeroVideoByParams(@Param("accountId")Long accountId, @Param("startTime")String startTime, @Param("endTime")String endTime, @Param("videoCnt")Long videoCnt,@Param("appVersion")String appVersion,@Param("channelType")Integer channelType,@Param("relativeCnt")Integer relativeCnt);
 
     List<KuaiShouVideoGet> getHistoryTopVideoByParams(@Param("accountId")Long accountId, @Param("startTime")String startTime, @Param("endTime")String endTime, @Param("videoCnt")Long videoCnt,@Param("appVersion")String appVersion,@Param("channelType")Integer channelType);
+
+    List<KuaishouProjectVideoGet> selectProjectVideo(@Param("projectId") Long projectId,@Param("updateTime") String updateTime);
+
+    void updateBatch(@Param(value = "videoGetList")  List<KuaiShouVideoGet> videoGetList);
+
+    List<JSONObject> getAccountIds();
 }

+ 36 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouProjectVideoGetMapper.java

@@ -0,0 +1,36 @@
+package cn.com.ctop.kuaishou.modules.batch.mapper;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouProjectVideoGet;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 快手-项目下视频信息
+ *
+ * @author: jeecg-boot
+ * @date: 2021-05-21
+ * @cersion: V1.0
+ */
+public interface KuaishouProjectVideoGetMapper extends BaseMapper<KuaishouProjectVideoGet> {
+
+    void replaceBatch(@Param("list") List<KuaishouProjectVideoGet> list);
+
+    String queryLatestUpdateTime(@Param("projectId") Long projectId);
+
+    Long queryPageListTotal(KuaishouProjectVideoGet kuaishouProjectVideoGet);
+
+    List<KuaishouProjectVideoGet> queryPageList(KuaishouProjectVideoGet kuaishouProjectVideoGet);
+
+    JSONObject getVideoTotalNumber(Map<String, Object> paramsMap);
+
+    JSONObject getVideoDetails(@Param("signature") String signature);
+
+    Long getAccountVideosTotal(@Param("signature") String signature, @Param("projectId") Long projectId);
+
+    List<JSONObject> getAccountVideos(@Param("signature") String signature, @Param("projectId") Long projectId);
+
+}

+ 58 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouVideoGetMapper.xml

@@ -298,4 +298,62 @@
             limit #{videoCnt}
         </if>
     </select>
+
+    <select id="selectProjectVideo" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaishouProjectVideoGet">
+        SELECT
+            t1.id,
+            t2.project_id,
+            t1.status,
+            t1.photo_id,
+            t1.width,
+            t1.height,
+            t1.url,
+            t1.cover_url,
+            t1.material_type,
+            t1.channel_type,
+            t1.stat_date,
+            t1.signature,
+            t1.photo_name,
+            t1.update_time
+        FROM ctop_kuaishou_video_get t1
+                 INNER JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
+        WHERE t1.`status` =0
+          AND t2.project_id=#{projectId}
+        <if test="updateTime!=null">
+          AND t1.update_time >=#{updateTime}
+        </if>
+
+    </select>
+
+    <select id="getAccountIds" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            account_id 'accountId',DATE_FORMAT(MAX(create_time),'%Y-%m-%d %H:%i:%s') 'startDate'
+        FROM ctop_kuaishou_video_get
+        where channel_type = 1
+          and  status = 0
+        GROUP BY account_id
+    </select>
+
+    <update id="updateBatch">
+        UPDATE ctop_kuaishou_video_get SET
+        material_tag = CASE id
+        <foreach item="videoGet" index="index" collection="videoGetList">
+            WHEN #{videoGet.id} THEN #{videoGet.materialTag}
+        </foreach>
+        END,
+        supplier_account_id = CASE id
+        <foreach item="videoGet" index="index" collection="videoGetList">
+            WHEN #{videoGet.id} THEN #{videoGet.supplierAccountId}
+        </foreach>
+        END,
+        supplier_account_name = CASE id
+        <foreach item="videoGet" index="index" collection="videoGetList">
+            WHEN #{videoGet.id} THEN #{videoGet.supplierAccountName}
+        </foreach>
+        END
+        WHERE id IN
+        <foreach item="videoGet" index="index" collection="videoGetList" open="(" separator="," close=")">
+             #{videoGet.id}
+        </foreach>
+    </update>
 </mapper>

+ 211 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouProjectVideoGetMapper.xml

@@ -0,0 +1,211 @@
+<?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.batch.mapper.KuaishouProjectVideoGetMapper">
+
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_project_video_get(
+        id,
+        project_id,
+        status,
+        photo_id,
+        width,
+        height,
+        url,
+        cover_url,
+        material_type,
+        channel_type,
+        stat_date,
+        signature,
+        photo_name,
+        update_time,
+        material_tag,
+        supplier_account_id,
+        supplier_account_name
+        )
+        values
+        <foreach collection="list" item="video" separator=",">
+            (
+            #{video.id},
+            #{video.projectId},
+            #{video.status},
+            #{video.photoId},
+            #{video.width},
+            #{video.height},
+            #{video.url},
+            #{video.coverUrl},
+            #{video.materialType},
+            #{video.channelType},
+            #{video.statDate},
+            #{video.signature},
+            #{video.photoName},
+            #{video.updateTime}
+            #{video.materialTag},
+            #{video.supplierAccountId},
+            #{video.supplierAccountName}
+            )
+        </foreach>
+    </insert>
+
+    <select id="queryLatestUpdateTime" resultType="java.lang.String">
+        SELECT update_time
+        FROM ctop_kuaishou_project_video_get
+        WHERE project_id = #{projectId}
+        ORDER BY update_time DESC LIMIT 1
+    </select>
+
+    <select id="queryPageListTotal" resultType="java.lang.Long">
+        SELECT IFNULL(COUNT(1),0)
+        FROM ctop_kuaishou_project_video_get
+        <where>
+            <if test="projectId != null">
+                and project_id = #{projectId}
+            </if>
+            <if test="signature != null">
+                and signature = #{signature}
+            </if>
+            <if test="status != null">
+                and `status` = #{status}
+            </if>
+            <if test="channelType != null">
+                and channel_type = #{channelType}
+            </if>
+        </where>
+    </select>
+    <select id="queryPageList" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaishouProjectVideoGet">
+        SELECT
+        project_id,
+        status,
+        photo_id,
+        width,
+        height,
+        url,
+        cover_url,
+        material_type,
+        channel_type,
+        stat_date,
+        signature,
+        photo_name
+        FROM ctop_kuaishou_project_video_get
+        <where>
+            <if test="projectId != null">
+                and project_id = #{projectId}
+            </if>
+            <if test="signature != null">
+                and signature = #{signature}
+            </if>
+            <if test="status != null">
+                and `status` = #{status}
+            </if>
+            <if test="channelType != null">
+                and channel_type = #{channelType}
+            </if>
+        </where>
+        ORDER BY stat_date desc
+    </select>
+
+     <select id="getVideoTotalNumber" resultType="com.alibaba.fastjson.JSONObject">
+         SELECT
+            IFNULL(t1.total,0) 'total',
+            IFNULL(t2.validCount,0) 'validCount',
+            IFNULL(t3.todayUpCount,0) 'todayUpCount',
+            IFNULL(t4.yesterdayUpCount,0) 'yesterdayUpCount',
+            IFNULL(t5.thisWeekCount,0) 'thisWeekCount',
+            IFNULL(t6.lastWeekCount,0) 'lastWeekCount'
+         FROM
+         (
+         SELECT COUNT(1) total FROM ctop_kuaishou_project_video_get where project_id = #{projectId}
+         ) t1
+         LEFT JOIN
+         (
+         SELECT COUNT(1) validCount FROM ctop_kuaishou_report_daily_material t1
+         INNER JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
+         WHERE t2.project_id = #{projectId}
+         AND t1.stat_date = #{today}
+         AND t1.charge>0
+         ) t2 ON 1=1
+         LEFT JOIN
+         (
+         SELECT COUNT(1) todayUpCount FROM ctop_kuaishou_project_video_get where project_id = #{projectId}
+         AND stat_date LIKE CONCAT(#{today},'%')
+         ) t3 ON 1=1
+         LEFT JOIN
+         (
+         SELECT COUNT(1) yesterdayUpCount FROM ctop_kuaishou_project_video_get where project_id = #{projectId}
+         AND stat_date LIKE CONCAT(DATE_SUB(#{today},INTERVAL 1 day),'%')
+         ) t4 ON 1=1
+         LEFT JOIN
+         (
+         SELECT COUNT(1) thisWeekCount FROM ctop_kuaishou_project_video_get where project_id = #{projectId}
+         AND stat_date >= #{monday}
+         AND stat_date &lt;= now()
+         ) t5 ON 1=1
+         LEFT JOIN
+         (
+         SELECT COUNT(1) lastWeekCount FROM ctop_kuaishou_project_video_get where project_id = #{projectId}
+         AND stat_date >= #{lastStartDate}
+         AND stat_date &lt;= CONCAT(#{lastEndDate},' 23:59:59')
+         ) t6 ON 1=1
+    </select>
+
+    <select id="getVideoDetails" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            IFNULL(t1.id,'') 'id',
+            IFNULL(t1.photo_name,'') 'photoName',
+            IFNULL(t1.signature,'') 'signature',
+            IFNULL(t1.`status`,'') 'status',
+            IFNULL(t1.channel_type,'') 'channelType',
+            IFNULL(t1.stat_date,'') 'statDate',
+            IFNULL(t1.create_time,'') 'createTime',
+            IFNULL(t1.put_start_time,'') 'putStartTime',
+            IFNULL(t1.put_end_time,'') 'putEndTime',
+            IFNULL(t2.plan_name,'') 'planName',
+            IFNULL(t2.shot_name,'') 'shotName',
+            IFNULL(t2.clip_name,'') 'clipName',
+            IFNULL(t1.supplier_account_name,'无') 'supplierAccountName'
+        FROM ctop_kuaishou_project_video_get t1
+                 LEFT JOIN ctop_material_ascription t2 ON t1.signature = t2.material_id
+        WHERE t1.signature = #{signature}
+    </select>
+
+    <select id="getAccountVideosTotal" resultType="java.lang.Long">
+        SELECT
+            IFNULL(COUNT(1),0)
+        FROM (
+                 select t1.account_id
+                 FROM ctop_kuaishou_report_daily_material t1
+                          LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
+                 WHERE t2.project_id = #{projectId}
+                   AND t1.signature =#{signature}
+                 GROUP BY t1.account_id
+             ) t
+    </select>
+
+    <select id="getAccountVideos" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            t2.auth_name 'authName',
+            t2.account_id 'accountId',
+            t1.stat_date 'statDate',
+            t3.rejectCount,
+            (SELECT COUNT(0) FROM ctop_kuaishou_creative WHERE account_id = t1.account_id) 'creativeCount',
+            IFNULL(SUM(t1.charge),0) 'charge',
+            IFNULL(SUM(t1.photo_show),0) 'photoShow',
+            IFNULL(SUM(t1.photo_click),0) 'photoClick',
+            IFNULL(SUM(t1.aclick),0) 'aclick',
+            IFNULL(SUM(t1.bclick),0) 'bclick',
+            CONCAT(IFNULL(CAST(ROUND(SUM(t1.photo_click)/SUM(t1.photo_show)*100,2) AS CHAR),0),'%') 'photoClickRatio',
+            CONCAT(IFNULL(CAST(ROUND(SUM(t1.bclick)/SUM(t1.aclick)*100,2) AS CHAR),0),'%') 'actionRatio',
+            IFNULL(ROUND(SUM(t1.charge)/SUM(t1.aclick)*1000,2),0) 'impression1kCost',
+            IFNULL(ROUND(SUM(t1.charge)/SUM(t1.photo_click),2),0) 'photoClickCost',
+            IFNULL(ROUND(SUM(t1.charge)/SUM(t1.bclick),2),0) 'actionCost'
+        FROM ctop_kuaishou_report_daily_material t1
+         LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
+         LEFT JOIN (
+            SELECT COUNT(1) 'rejectCount',account_id FROM ctop_kuaishou_creative WHERE `status` =42 GROUP BY account_id
+        ) t3 ON t1.account_id = t3.account_id
+        WHERE t2.project_id = #{projectId}
+          AND t1.signature =#{signature}
+        GROUP BY t1.account_id
+
+    </select>
+
+</mapper>

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

@@ -9,6 +9,7 @@ public interface IKuaiShouMaterialUploadService {
 
     String kuauiShouImageUpload(String url, String signature, Long accountId, String token);
 
+    JSONObject kuauiShouImageUploadOnly(String url, String signature, Long accountId, String token);
 
     String exceptInfoForRestTemplate(String url, Map<String, Object> paramMap, Map<String, String> headerMap);
 }

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

@@ -52,4 +52,8 @@ public interface IKuaiShouVideoGetService extends IService<KuaiShouVideoGet> {
     List<KuaiShouVideoGet> getZeroVideoByParams(Long accountId, String startTime, String endTime, Long videoCnt,String appVersion,Integer channelType,Integer relativeCnt);
 
     List<KuaiShouVideoGet> getHistoryTopVideoByParams(Long accountId, String startTime, String endTime, Long videoCnt, String appVersion, Integer channelType);
+
+    void getSuZaoList(String token, Long accountId, int page,String startDate);
+
+    List<JSONObject> getAccountIds();
 }

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

@@ -0,0 +1,28 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouProjectVideoGet;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
+
+/**
+ * @Description: 快手-项目下视频信息
+ * @Author: jeecg-boot
+ * @Date: 2021-05-21
+ * @Version: V1.0
+ */
+public interface IKuaishouProjectVideoGetService extends IService<KuaishouProjectVideoGet> {
+
+    /**
+     * 清洗项目数据
+     */
+    void clearProjectVideo(Long projectId);
+
+    Result<Object> queryPageList(KuaishouProjectVideoGet kuaishouProjectVideoGet,Integer pageNo,Integer pageSize);
+
+    Result<Object> getVideoTotalNumber(Long projectId);
+
+    Result<Object> getVideoDetails(String signature);
+
+    Result<Object> getAccountVideos(String signature,Long projectId,Integer pageNo,Integer pageSize);
+
+}

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

@@ -18,6 +18,7 @@ import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpMethod;
 import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
 import org.springframework.stereotype.Service;
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.MultiValueMap;
@@ -168,6 +169,29 @@ public class KuaiShouMaterialUploadServiceImpl implements IKuaiShouMaterialUploa
         return null;
     }
 
+    @Override
+    public JSONObject kuauiShouImageUploadOnly(String url, String signature, Long accountId, String token) {
+        try {
+            Map<String, String> headerMap = new HashMap<>();
+            headerMap.put("Content-Type", "multipart/form-data");
+            JSONObject requestJson = new JSONObject();
+            requestJson.put("signature", signature);
+            requestJson.put("url", url);
+            requestJson.put("type", 1);
+            requestJson.put("advertiser_id", accountId);
+            headerMap.put("Access-Token", token);
+            String requestUrl = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.IMAGE_UPLOAD;
+            requestJson.put("upload_type", "2");
+            String result = exceptInfoForRestTemplate(requestUrl, requestJson, headerMap);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(resultJson)) {
+                return resultJson;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
 
     public String uploadFile(MultipartFile multipartFile, String dirPath) throws IOException {
         String fileName = multipartFile.getOriginalFilename();
@@ -200,6 +224,10 @@ public class KuaiShouMaterialUploadServiceImpl implements IKuaiShouMaterialUploa
                         headers.add(key, headerMap.get(key));
                     }
                 }
+                SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
+                requestFactory.setConnectTimeout(1000 * 500);// 设置超时
+                requestFactory.setReadTimeout(1000 * 500);
+                RestTemplate rest = new RestTemplate(requestFactory);
                 HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(param, headers);
                 ResponseEntity<String> responseEntity = rest.exchange(url, HttpMethod.POST, httpEntity, String.class);
                 return responseEntity.getBody();

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

@@ -15,6 +15,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -22,9 +23,12 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 /**
  * @Description: 快手-获取视频接口
@@ -151,7 +155,7 @@ public class KuaiShouVideoGetServiceImpl extends ServiceImpl<KuaiShouVideoGetMap
 
 
     @Override
-    public List<KuaiShouVideoGet> getNewVideoBetweenTime(Long accountId, String startTime, String endTime,Integer channelType,String appVersion,Integer videoCnt) {
+    public List<KuaiShouVideoGet> getNewVideoBetweenTime(Long accountId, String startTime, String endTime, Integer channelType, String appVersion, Integer videoCnt) {
         QueryWrapper<KuaiShouVideoGet> queryWrapper = new QueryWrapper<>();
         queryWrapper.isNotNull("signature");
         if (null != accountId && accountId != 0) {
@@ -161,15 +165,15 @@ public class KuaiShouVideoGetServiceImpl extends ServiceImpl<KuaiShouVideoGetMap
             queryWrapper.le("stat_date", endTime);
             queryWrapper.gt("stat_date", startTime);
         }
-        if(null!=channelType&&channelType!=2){
-            queryWrapper.eq("channel_type",channelType);
+        if (null != channelType && channelType != 2) {
+            queryWrapper.eq("channel_type", channelType);
         }
 
-        if(null!=appVersion&&!appVersion.trim().equals("")){
-            queryWrapper.likeRight("photo_name",appVersion);
+        if (null != appVersion && !appVersion.trim().equals("")) {
+            queryWrapper.likeRight("photo_name", appVersion);
         }
-        if(null!=videoCnt&&videoCnt!=0){
-            queryWrapper.last("limit "+videoCnt);
+        if (null != videoCnt && videoCnt != 0) {
+            queryWrapper.last("limit " + videoCnt);
         }
         return this.list(queryWrapper);
     }
@@ -277,12 +281,71 @@ public class KuaiShouVideoGetServiceImpl extends ServiceImpl<KuaiShouVideoGetMap
     }
 
     @Override
-    public List<KuaiShouVideoGet> getZeroVideoByParams(Long accountId, String startTime, String endTime, Long videoCnt,String appVersion,Integer channelType,Integer relativeCnt) {
-        return videoGetMapper.getZeroVideoByParams(accountId,startTime,endTime,videoCnt,appVersion,channelType,relativeCnt);
+    public List<KuaiShouVideoGet> getZeroVideoByParams(Long accountId, String startTime, String endTime, Long videoCnt, String appVersion, Integer channelType, Integer relativeCnt) {
+        return videoGetMapper.getZeroVideoByParams(accountId, startTime, endTime, videoCnt, appVersion, channelType, relativeCnt);
     }
 
     @Override
     public List<KuaiShouVideoGet> getHistoryTopVideoByParams(Long accountId, String startTime, String endTime, Long videoCnt, String appVersion, Integer channelType) {
-        return videoGetMapper.getHistoryTopVideoByParams(accountId,startTime,endTime,videoCnt,appVersion,channelType);
+        return videoGetMapper.getHistoryTopVideoByParams(accountId, startTime, endTime, videoCnt, appVersion, channelType);
+    }
+
+    /**
+     * 素造接口,获取同步供应商素材标签数据
+     */
+    @Override
+    public void getSuZaoList(String token, Long accountId, int page,String startDate) {
+        String url = "https://ad.e.kuaishou.com/rest/openapi/v1/ad_creator/video/list";
+        Map<String, String> headers = new HashMap<String, String>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", token);
+        Map<String, Object> param = new HashMap<String, Object>();
+        param.put("advertiser_id", accountId);
+        param.put("page", page);
+        param.put("page_size", 200);
+        param.put("start_date", startDate);
+        param.put("end_date", DateUtils.formatDate(new Date(),DateUtils.NEW_FORMAT));
+        String result = HttpUtils.httpPostRequest(url, param, headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        System.out.println(result);
+        if (Check.isNull(resultJson)) {
+            return;
+        }
+        Integer code = resultJson.getInteger("code");
+        String message = resultJson.getString("message");
+        if (null == code || code != 0) {
+            log.error("获取快手素造列表数据异常:{},accountId:{}", message, accountId);
+            return;
+        }
+        JSONObject dataJson = resultJson.getJSONObject("data");
+        if (Check.isNull(dataJson)) {
+            return;
+        }
+        JSONArray details = dataJson.getJSONArray("details");
+        if (Check.isNull(details)) {
+            return;
+        }
+        List<KuaiShouVideoGet> videoGetList = new ArrayList<>();
+        for (int i = 0; i < details.size(); i++) {
+            JSONObject detailJson = details.getJSONObject(i);
+            if (Check.isNull(detailJson)) {
+                continue;
+            }
+            KuaiShouVideoGet videoGet = new KuaiShouVideoGet();
+            videoGet.setMaterialTag(detailJson.getString("material_tag"));
+            videoGet.setSupplierAccountId(detailJson.getLong("supplier_account_id"));
+            videoGet.setSupplierAccountName(detailJson.getString("supplier_account_name"));
+            videoGet.setId(accountId + detailJson.getString("photo_id"));
+            videoGetList.add(videoGet);
+        }
+        if (!Check.isNull(videoGetList)) {
+            videoGetMapper.updateBatch(videoGetList);
+        }
+        getSuZaoList(token, accountId, page + 1,startDate);
+    }
+
+    @Override
+    public List<JSONObject> getAccountIds() {
+        return videoGetMapper.getAccountIds();
     }
 }

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

@@ -0,0 +1,95 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouProjectVideoGet;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouVideoGetMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouProjectVideoGetMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouMaterialUploadService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouProjectVideoGetService;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 快手-项目下视频信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-05-21
+ */
+@Service
+public class KuaishouProjectVideoGetServiceImpl extends ServiceImpl<KuaishouProjectVideoGetMapper, KuaishouProjectVideoGet> implements IKuaishouProjectVideoGetService {
+
+    @Autowired
+    private KuaishouProjectVideoGetMapper projectVideoGetMapper;
+    @Autowired
+    private KuaiShouVideoGetMapper videoGetMapper;
+    @Autowired
+    private IKuaiShouImageGetService imageGetService;
+    @Autowired
+    private IKuaiShouMaterialUploadService uploadService;
+
+    @Override
+    public void clearProjectVideo(Long projectId) {
+        String updateTime = projectVideoGetMapper.queryLatestUpdateTime(projectId);
+        System.out.println(updateTime);
+        List<KuaishouProjectVideoGet> list = videoGetMapper.selectProjectVideo(projectId, updateTime);
+        if (!Check.isNull(list)) {
+            projectVideoGetMapper.replaceBatch(list);
+        }
+    }
+
+    @Override
+    public Result<Object> queryPageList(KuaishouProjectVideoGet kuaishouProjectVideoGet, Integer pageNo, Integer pageSize) {
+        Long total = projectVideoGetMapper.queryPageListTotal(kuaishouProjectVideoGet);
+        PageHelper.startPage(pageNo, pageSize, false);
+        PageInfo pageInfo = new PageInfo(projectVideoGetMapper.queryPageList(kuaishouProjectVideoGet));
+        pageInfo.setTotal(total);
+        return Result.ok(pageInfo);
+    }
+
+    @Override
+    public Result<Object> getVideoTotalNumber(Long projectId) {
+        //本周一
+        String monday = DateUtils.getdateFromWeek(1);
+        //当天日期
+        String today = DateUtils.formatDate(new Date());
+        //上周一日期
+        String lastStartDate = DateUtils.getLastDay(monday, 7);
+        //上周当天日期
+        String lastEndDate = DateUtils.getLastDay(today, 7);
+        Map<String, Object> paramsMap = new HashMap<>();
+        paramsMap.put("lastStartDate", lastStartDate);
+        paramsMap.put("lastEndDate", lastEndDate);
+        paramsMap.put("monday", monday);
+        paramsMap.put("today", today);
+        paramsMap.put("projectId", projectId);
+        return Result.ok(projectVideoGetMapper.getVideoTotalNumber(paramsMap));
+    }
+
+    @Override
+    public Result<Object> getVideoDetails(String signature) {
+        return Result.ok(projectVideoGetMapper.getVideoDetails(signature));
+    }
+
+    @Override
+    public Result<Object> getAccountVideos(String signature, Long projectId, Integer pageNo, Integer pageSize) {
+        Long total = projectVideoGetMapper.getAccountVideosTotal(signature, projectId);
+        PageHelper.startPage(pageNo, pageSize, false);
+        PageInfo<JSONObject> list = new PageInfo<>(projectVideoGetMapper.getAccountVideos(signature, projectId));
+        list.setTotal(total);
+        return Result.ok(list);
+    }
+
+}

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

@@ -359,7 +359,6 @@ public class KuaishouTemplateServiceImpl extends ServiceImpl<KuaishouTemplateMap
             String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.TEMPLATE_CREATE;
 
             String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
-
             JSONObject resultJson = JSONObject.parseObject(result);
             if (!Check.isNull(resultJson)) {
                 Integer code = resultJson.getInteger("code");
@@ -371,7 +370,7 @@ public class KuaishouTemplateServiceImpl extends ServiceImpl<KuaishouTemplateMap
 
                 } else {
                     returnJson.put("code", -1);
-                    returnJson.put("message", returnJson.getString("message"));
+                    returnJson.put("message", resultJson.getString("message"));
                 }
             } else {
                 returnJson.put("code", -1);

+ 16 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouGroupExploreController.java

@@ -118,6 +118,22 @@ public class KuaishouGroupExploreController {
         }
     }
 
+    /**
+     * 辅助探索
+     *
+     * @param data
+     * @return
+     */
+    @PostMapping(value = "/adUnitExploreSupport")
+    public Result<Object> adUnitExploreSupport(@RequestBody JSONObject data) {
+        try {
+            return kuaishouGroupExploreService.adUnitExploreSupport(data);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            return Result.error("操作失败");
+        }
+    }
+
 
     /**
      * 添加

+ 20 - 18
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouReportAccountDailyMapper.xml

@@ -285,13 +285,13 @@
                      AND media_id =2
                      GROUP BY user_id) t) as 'totle'
                  FROM (
-                     SELECT sum(charge) as 'charge', t2.user_id 'userId' FROM ctop_etl_kuaishou_report_account_daily t1
+                     SELECT sum (charge) as 'charge', t2.user_id 'userId' FROM ctop_etl_kuaishou_report_account_daily t1
                      LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
                      WHERE t1.stat_date &gt;= #{mStartDate}
                      AND t1.stat_date &lt;= #{today}
                      AND media_id =2
                      GROUP BY user_id
-                     ORDER BY SUM(charge) DESC
+                     ORDER BY SUM (charge) DESC
                      ) t, (select @rownum := 0) a
              ) tt
         WHERE tt.userId = #{userId}
@@ -520,22 +520,22 @@
     </select>
 
     <select id="projectPageListTotal" resultType="java.lang.Integer">
-        SELECT IFNULL(SUM(1),0) from
-            (
-                SELECT
-                    t3.id
-                FROM ctop_etl_kuaishou_report_account_daily t1
-                         LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
-                         INNER JOIN ctop_project t3 ON t2.project_id = t3.id
-                where t1.stat_date &gt;= #{startTime}
-                  AND t1.stat_date &lt;= #{endTime}
-                GROUP BY t3.id
-                HAVING SUM(charge)>0
-            ) t
+        SELECT IFNULL(SUM(1), 0)
+        from (
+                 SELECT t3.id
+                 FROM ctop_etl_kuaishou_report_account_daily t1
+                          LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
+                          INNER JOIN ctop_project t3 ON t2.project_id = t3.id
+                 where t1.stat_date &gt;= #{startTime}
+                   AND t1.stat_date &lt;= #{endTime}
+                 GROUP BY t3.id
+                 HAVING SUM(charge) > 0
+             ) t
     </select>
 
     <select id="selectList" resultType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountHourly">
-        SELECT * from ctop_etl_kuaishou_report_account_daily
+        SELECT *
+        from ctop_etl_kuaishou_report_account_daily
         WHERE stat_date &gt;= #{startDate}
           and stat_date &lt;= #{endDate}
     </select>
@@ -572,8 +572,9 @@
         ctop_etl_kuaishou_report_account_daily t1
         LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
         LEFT JOIN(
-        SELECT user_id,COUNT(1) 'accountCount' FROM ctop_user_allocation i1
-        INNER JOIN ctop_etl_kuaishou_report_account_daily  i2 ON i1.account_id = i2.account_id
+        SELECT user_id,COUNT(1) 'accountCount' FROM (
+        SELECT user_id,i1.account_id FROM ctop_user_allocation i1
+        INNER JOIN ctop_etl_kuaishou_report_account_daily i2 ON i1.account_id = i2.account_id
         AND i2.stat_date &gt;= #{startTime}
         and i2.stat_date &lt;= #{endTime}
         WHERE user_id IN
@@ -581,7 +582,8 @@
                  open="(" separator="," close=")">
             #{id}
         </foreach>
-        GROUP BY user_id
+        GROUP BY user_id,i1.account_id
+        )t GROUP BY user_id
         ) t3 ON t2.user_id = t3.user_id
         LEFT JOIN (
         SELECT

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouGroupExploreService.java

@@ -27,4 +27,6 @@ public interface IKuaishouGroupExploreService extends IService<KuaishouGroupExpl
     void unitOpenSpeedExplore(Long accountId, Long unitId, BigDecimal groupAccount,Long accountExploreId);
 
     void getReportByAccount(CtopOauthToken token);
+
+    Result<Object> adUnitExploreSupport(JSONObject data);
 }

+ 49 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouGroupExploreServiceImpl.java

@@ -2,12 +2,17 @@ package cn.com.ctop.kuaishou.modules.report.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.*;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
 import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouGroupSpeedExploreLog;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouGroupSpeedExploreLogService;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouGroupExplore;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouGroupExploreMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouGroupExploreService;
+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;
@@ -226,7 +231,7 @@ public class KuaishouGroupExploreServiceImpl extends ServiceImpl<KuaishouGroupEx
     }
 
     @Override
-    public void unitOpenSpeedExplore(Long accountId, Long unitId, BigDecimal groupAccount,Long accountExploreId) {
+    public void unitOpenSpeedExplore(Long accountId, Long unitId, BigDecimal groupAccount, Long accountExploreId) {
         KuaishouGroupSpeedExploreLog groupSpeedExploreLog = new KuaishouGroupSpeedExploreLog();
         groupSpeedExploreLog.setAccountExploreId(accountExploreId);
         groupSpeedExploreLog.setAccountId(accountId);
@@ -247,7 +252,7 @@ public class KuaishouGroupExploreServiceImpl extends ServiceImpl<KuaishouGroupEx
                 String message = resultJson.getString("message");
                 groupSpeedExploreLog.setStatus(code);
                 groupSpeedExploreLog.setMessage(message);
-            }else{
+            } else {
                 groupSpeedExploreLog.setStatus(StatusCode.KUAISHOU_SPEED_EXPLORE_FAIL.getCode());
                 groupSpeedExploreLog.setMessage(StatusCode.KUAISHOU_SPEED_EXPLORE_FAIL.getDesc());
             }
@@ -264,5 +269,46 @@ public class KuaishouGroupExploreServiceImpl extends ServiceImpl<KuaishouGroupEx
         //1:查询此账户下设置了加速探索的组
     }
 
+    @Override
+    public Result<Object> adUnitExploreSupport(JSONObject data) {
+        try {
+            Long accountId = data.getLong("accountId");
+            if (Check.isNull(accountId)) {
+                return Result.error("请选择广告主");
+            }
+            JSONArray supportUnitIds = data.getJSONArray("supportUnitIds");
+            if (Check.isNull(supportUnitIds)) {
+                return Result.error("请填写辅助探索广告组集");
+            }
+            Long unitId = data.getLong("unitId");
+            if (Check.isNull(unitId)) {
+                return Result.error("请填写要设置辅助探索的广告组");
+            }
+            CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.AD_UNIT_EXPLORE_SUPPORT;
+            Map<String, String> header = new HashMap<>();
+            header.put("Access-Token", token.getAccessToken());
+            header.put("Content-Type", "application/json");
+            JSONObject params = new JSONObject();
+            params.put("advertiser_id", accountId);
+            params.put("support_unit_ids", supportUnitIds);
+            params.put("unit_id", unitId);
+            String result = HttpUtils.httpPostRequest(url, params, header);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(resultJson)) {
+                Integer code = resultJson.getInteger("code");
+                if (code == 0) {
+                    return Result.ok(resultJson.getJSONObject("data"));
+                } else {
+                    log.info("辅助探索失败,accountId:{},返回信息:{}", accountId, resultJson);
+                    return Result.error("辅助探索失败," + resultJson.getString("message"));
+                }
+            }
+        } catch (Exception e) {
+            log.error("辅助探索失败", e);
+        }
+        return Result.error("辅助探索失败");
+    }
+
 
 }

+ 56 - 41
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/RuleKuaiShouPlanServiceImpl.java

@@ -11,7 +11,9 @@ import cn.com.ctop.common.module.service.IRuleDatePlanKuaishouService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTarget;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTargetService;
 import cn.com.ctop.kuaishou.modules.report.service.IRuleKuaiShouPlanService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -29,7 +31,7 @@ import java.util.List;
 import java.util.Map;
 
 @Service
-public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaishouMapper, RuleDatePlanKuaishou>  implements IRuleKuaiShouPlanService {
+public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaishouMapper, RuleDatePlanKuaishou> implements IRuleKuaiShouPlanService {
 
     @Autowired
     ICtopOauthTokenService oauthTokenService;
@@ -46,6 +48,9 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
     @Autowired
     IKuaiShouGroupService kuaiShouGroupService;
 
+    @Autowired
+    private IKuaiShouGroupTargetService kuaiShouGroupTargetService;
+
     @Override
     public void cleanRuleDataPlan(Long accountId, int page) {
         JSONObject param = new JSONObject();
@@ -82,8 +87,8 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
         param.put("advertiser_id", accountId);
         param.put("page_size", 500);
         param.put("page", page);
-        param.put("start_date",startDate);
-        param.put("end_date",endDate);
+        param.put("start_date", startDate);
+        param.put("end_date", endDate);
 
         Map<String, String> headers = new HashMap<>();
         headers.put("Access-Token", oauthTokenService.getTokenByAccountId(accountId).getAccessToken());
@@ -152,7 +157,7 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
                 batch.add(plan);
             }
         });
-        if(!batch.isEmpty()) {
+        if (!batch.isEmpty()) {
             planKuaishouService.saveOrUpdateBatch(batch);
         }
     }
@@ -162,23 +167,32 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
         details.forEach(detail -> {
             JSONObject unitDetail = (JSONObject) detail;
             RuleDateUnitKuaishou unit = new RuleDateUnitKuaishou();
-            QueryWrapper<KuaiShouGroup> wrapper=new QueryWrapper<>();
-            wrapper.eq("unit_id",unitDetail.getLong("unit_id"));
+            QueryWrapper<KuaiShouGroup> wrapper = new QueryWrapper<>();
+            wrapper.eq("unit_id", unitDetail.getLong("unit_id"));
             KuaiShouGroup group = kuaiShouGroupService.getOne(wrapper);
-            if(group!=null){
+            if (group != null) {
                 Integer status = group.getStatus();
                 Integer putStatus = group.getPutStatus();
-                if((status == 20 || status == 19) && putStatus == 1){
+                if ((status == 20 || status == 19) && putStatus == 1) {
+                    QueryWrapper<KuaiShouGroupTarget> targetWrapper = new QueryWrapper<>();
+                    targetWrapper.eq("unit_id", unitDetail.getLong("unit_id"));
+                    KuaiShouGroupTarget groupTarget = kuaiShouGroupTargetService.getOne(targetWrapper);
+                    if (!Check.isNull(groupTarget)) {
+                        unit.setAndroidOsv(groupTarget.getAndroidOsv());
+                    }
                     unit.setId(unitDetail.getLong("unit_id"));
                     unit.setAccountId(accountId);
                     unit.setPlanId(unitDetail.getLong("campaign_id"));
                     unit.setUnitId(unitDetail.getLong("unit_id"));
                     unit.setUnitName(unitDetail.getString("unit_name"));
                     unit.setCharge(unitDetail.getBigDecimal("charge"));
+                    unit.setDeepConversionBid(group.getDeepConversionBid());
+                    unit.setDeepConversionType(group.getDeepConversionType());
+
                     //未知优化目标数据存空
-                    if(group.getOcpxActionType()!=0){
-                        unit.setConvertNum(handleConvertNum(group.getOcpxActionType(),unitDetail));
-                        if(null!=unit.getConvertNum()&&unit.getConvertNum()!=0){
+                    if (group.getOcpxActionType() != 0) {
+                        unit.setConvertNum(handleConvertNum(group.getOcpxActionType(), unitDetail));
+                        if (null != unit.getConvertNum() && unit.getConvertNum() != 0) {
                             unit.setConvertCost(unitDetail.getBigDecimal("charge").divide(BigDecimal.valueOf(unit.getConvertNum()), 2, RoundingMode.HALF_UP));
                         }
                     }
@@ -187,7 +201,7 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
             }
 
         });
-        if(!batch.isEmpty()){
+        if (!batch.isEmpty()) {
             unitKuaishouService.saveOrUpdateBatch(batch);
         }
     }
@@ -204,49 +218,49 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
                 target.setAccountId(accountId);
                 target.setPlanId(unitDetail.getLong("campaign_id"));
                 target.setUnitId(unitDetail.getLong("unit_id"));
-                target.setSceneId(unitDetail.getJSONArray("scene_id")==null?"":unitDetail.getJSONArray("scene_id").toString());
+                target.setSceneId(unitDetail.getJSONArray("scene_id") == null ? "" : unitDetail.getJSONArray("scene_id").toString());
                 //获取组定向信息
                 JSONObject unitTarget = unitDetail.getJSONObject("target");
                 //地域
                 JSONArray region = unitTarget.getJSONArray("region");
-                target.setRegion(region==null?"":region.toJSONString());
+                target.setRegion(region == null ? "" : region.toJSONString());
                 //性别
                 Integer gender = unitDetail.getJSONObject("target").getInteger("gender");
-                target.setGender(gender==null?0:gender);
+                target.setGender(gender == null ? 0 : gender);
                 //年龄
                 JSONArray agesRange = unitTarget.getJSONArray("ages_range");
-                target.setAgesRange(agesRange==null?"":agesRange.toJSONString());
+                target.setAgesRange(agesRange == null ? "" : agesRange.toJSONString());
                 //操作系统
                 Integer platformOs = unitTarget.getInteger("platform_os");
-                target.setPlatformOs(platformOs==null?0:platformOs);
+                target.setPlatformOs(platformOs == null ? 0 : platformOs);
                 //设类类型
                 JSONArray deviceBrand = unitTarget.getJSONArray("device_brand");
-                target.setDeviceBrand(deviceBrand==null?"":deviceBrand.toJSONString());
+                target.setDeviceBrand(deviceBrand == null ? "" : deviceBrand.toJSONString());
                 //设备价格
                 JSONArray devicePrice = unitTarget.getJSONArray("device_price");
-                target.setDevicePrice(devicePrice==null?"":devicePrice.toJSONString());
+                target.setDevicePrice(devicePrice == null ? "" : devicePrice.toJSONString());
                 //过滤已转化人群
                 Integer filterConvertedLevel = unitTarget.getInteger("filter_converted_level");
                 target.setFilterConvertedLevel(filterConvertedLevel);
                 //人群包定向
                 JSONArray population = unitTarget.getJSONArray("population");
-                target.setPopulation(population==null?"":population.toJSONString());
+                target.setPopulation(population == null ? "" : population.toJSONString());
                 //人群包排除
                 JSONArray excludePopulation = unitTarget.getJSONArray("exclude_population");
-                target.setExcludePopulation(excludePopulation==null?"":excludePopulation.toJSONString());
+                target.setExcludePopulation(excludePopulation == null ? "" : excludePopulation.toJSONString());
                 //应用商店
                 JSONArray appStore = unitDetail.getJSONArray("app_store");
-                target.setAppStore(appStore==null?"":appStore.toJSONString());
+                target.setAppStore(appStore == null ? "" : appStore.toJSONString());
                 //商业兴趣
                 JSONArray businessInterest = unitTarget.getJSONArray("business_interest");
-                target.setBusinessInterest(businessInterest==null?"":businessInterest.toJSONString());
+                target.setBusinessInterest(businessInterest == null ? "" : businessInterest.toJSONString());
                 //网络环境
                 Integer network = unitTarget.getInteger("network");
-                target.setNetwork(network==null?0:network);
+                target.setNetwork(network == null ? 0 : network);
 
                 Integer isOpen = unitDetail.getJSONObject("target").getJSONObject("intelli_extend").getInteger("is_open");
-                target.setIsOpen(isOpen==null?0:isOpen);
-                target.setScheduleTime(unitDetail.getString("schedule_time")==null?"":unitDetail.getString("schedule_time"));
+                target.setIsOpen(isOpen == null ? 0 : isOpen);
+                target.setScheduleTime(unitDetail.getString("schedule_time") == null ? "" : unitDetail.getString("schedule_time"));
 
                 batch.add(target);
             }
@@ -265,48 +279,49 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
      * 383: 授信,event_credit_grant_app
      * 384: 完件 event_jin_jian_app
      * 715:微信复制 event_add_wechat
+     *
      * @param ocpxActionType
      * @param detail
      * @return
      */
-    private Long handleConvertNum(int ocpxActionType,JSONObject detail){
-        Long convertNum=null;
-        switch (ocpxActionType){
+    private Long handleConvertNum(int ocpxActionType, JSONObject detail) {
+        Long convertNum = null;
+        switch (ocpxActionType) {
             case 2:
-                convertNum=detail.getLong("bclick");
+                convertNum = detail.getLong("bclick");
                 break;
             case 10:
-                convertNum=detail.getLong("aclick");
+                convertNum = detail.getLong("aclick");
                 break;
             case 11:
-                convertNum=detail.getLong("photo_click");
+                convertNum = detail.getLong("photo_click");
                 break;
             case 31:
-                convertNum=detail.getLong("download_completed");
+                convertNum = detail.getLong("download_completed");
                 break;
             case 53:
-                convertNum=detail.getLong("form_count");
+                convertNum = detail.getLong("form_count");
                 break;
             case 180:
-                convertNum=detail.getLong("activation");
+                convertNum = detail.getLong("activation");
                 break;
             case 190:
-                convertNum=detail.getLong("event_pay");
+                convertNum = detail.getLong("event_pay");
                 break;
             case 191:
-                convertNum=detail.getDouble("event_pay_first_day_roi").longValue();
+                convertNum = detail.getDouble("event_pay_first_day_roi").longValue();
                 break;
             case 348:
-                convertNum=detail.getLong("event_valid_clues");
+                convertNum = detail.getLong("event_valid_clues");
                 break;
             case 383:
-                convertNum=detail.getLong("event_credit_grant_app");
+                convertNum = detail.getLong("event_credit_grant_app");
                 break;
             case 384:
-                convertNum=detail.getLong("event_jin_jian_app");
+                convertNum = detail.getLong("event_jin_jian_app");
                 break;
             case 715:
-                convertNum=detail.getLong("event_add_wechat");
+                convertNum = detail.getLong("event_add_wechat");
                 break;
         }
         return convertNum;

+ 2 - 3
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceNewPlanReportMapper.xml

@@ -246,7 +246,7 @@
         ) t
     </select>
 
-    <select id="queryAllOperator"  resultType="com.alibaba.fastjson.JSONObject">
+    <select id="queryAllOperator" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
             DISTINCT user_id,user_name
         FROM
@@ -258,7 +258,7 @@
                 FROM
                     ctop_project
                 WHERE
-                    media_id = 1
+                    media_id in(1,3)
             )
           and
                 role_code IN (
@@ -290,5 +290,4 @@
     </select>
 
 
-
 </mapper>