فهرست منبع

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

huangxuechao 4 سال پیش
والد
کامیت
5d73427644
70فایلهای تغییر یافته به همراه1566 افزوده شده و 504 حذف شده
  1. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  2. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  3. 32 66
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  4. 25 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProductController.java
  5. 72 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  6. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ProjectMember.java
  7. 6 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/ProjectMemberMapper.java
  8. 15 15
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MaterialReportOverViewMapper.xml
  9. 50 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ProjectMemberMapper.xml
  10. 7 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IProjectMemberService.java
  11. 37 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java
  12. 63 58
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java
  13. 2 2
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  14. 2 2
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  15. 6 6
      jeecg-boot-module-system/src/main/resources/application-test.yml
  16. 11 11
      jeecg-boot-module-system/src/main/resources/application-wps.yml
  17. 1 0
      jeecg-boot-module-system/src/main/resources/application.yml
  18. 21 15
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  19. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java
  20. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/Product.java
  21. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/entity/SysUserDepart.java
  22. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java
  23. 4 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/ProductMapper.java
  24. 4 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java
  25. 4 4
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml
  26. 34 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ProductMapper.xml
  27. 27 1
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml
  28. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/ICtopCorpWexinUserService.java
  29. 3 3
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  30. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IProductService.java
  31. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java
  32. 11 2
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopCorpWexinUserServiceImpl.java
  33. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java
  34. 77 59
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  35. 7 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/ProductServiceImpl.java
  36. 2 2
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/SysDepartServiceImpl.java
  37. 10 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java
  38. 95 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/ChaojiyingUtils.java
  39. 4 0
      module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java
  40. 20 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/SendHourlyMessageJob.java
  41. 11 0
      module-job-bytedance/src/main/resources/application.yml
  42. 2 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCreateUnitJob.java
  43. 1 1
      module-job-kuaishou/src/main/resources/application-prod.yml
  44. 12 1
      module-job-kuaishou/src/main/resources/application.yml
  45. 21 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouCreateCreativeController.java
  46. 135 68
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouCreativeLevelOperationRecord.java
  47. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/KuaiShouAppMultipleBids.java
  48. 5 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouCreateCreativeService.java
  49. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaishouAccountCreativeOverrunInfoService.java
  50. 183 91
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java
  51. 4 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java
  52. 21 63
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  53. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java
  54. 18 18
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsNewGroupReportCtrl.java
  55. 6 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAccount.java
  56. 6 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportHourlyAccount.java
  57. 8 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml
  58. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportHourlyAccountMapper.xml
  59. 3 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/constant/QYWxConstant.java
  60. 9 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/IAppchatCreateService.java
  61. 2 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/IWechatUserListService.java
  62. 108 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/AppchatCreateServiceImpl.java
  63. 10 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatUserListServiceImpl.java
  64. 202 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/BytedanceAccountCommonSlogenController.java
  65. 53 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/BytedanceAccountCommonSlogen.java
  66. 17 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/BytedanceAccountCommonSlogenMapper.java
  67. 5 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/BytedanceAccountCommonSlogenMapper.xml
  68. 14 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IBytedanceAccountCommonSlogenService.java
  69. 18 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceAccountCommonSlogenServiceImpl.java
  70. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -92,6 +92,8 @@ public class MaterialInfo implements Serializable {
 
     private Long projectId;
 
+    private Long productId;
+
     /**
      * 素材名称
      */

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

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

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

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

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

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

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

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

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

@@ -25,6 +25,8 @@ 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> getAccountIdsByUserId(@Param("userId") String userId);
@@ -46,4 +48,6 @@ public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
     List<JSONObject> getAccountListByProjectList(@Param("list") List list);
 
     List<Long> getValidProjectIds(@Param("mediaId")  Integer mediaId);
+
+    List<UserAllocation> getAccountListByUserIdAndProductId(@Param("userId")String userId,@Param("projectId")Long projectId,@Param("productId")Long productId);
 }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -19,6 +19,8 @@ import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.mime.HttpMultipartMode;
 import org.apache.http.entity.mime.MultipartEntityBuilder;
 import org.apache.http.entity.mime.content.FileBody;
 import org.apache.http.impl.client.CloseableHttpClient;
@@ -33,6 +35,7 @@ import java.io.*;
 import java.net.HttpURLConnection;
 import java.net.URI;
 import java.net.URL;
+import java.nio.charset.Charset;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -73,6 +76,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
                 Integer code = jsonObject.getInteger("code");
                 if (code == 0) {
                     log.info("头条上传素材成功,返回信息:{},accountId:{}", jsonObject, accountId);
+                    //TODO 信息返回之后同步入库
                 } else {
                     log.error("头条上传素材失败,返回信息:{},accountId:{}", jsonObject, accountId);
                     UserAllocation allocation = userAllocationService.getByAccountId(Long.valueOf(accountId));
@@ -268,6 +272,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
             // 其他参数
             entityBuilder.addTextBody("advertiser_id", String.valueOf(token.getAccountId()));
             entityBuilder.addTextBody("video_signature", DigestUtils.md5Hex(new FileInputStream(new File(videoPath))));
+            entityBuilder.addTextBody("filename",file.getFilename(), ContentType.create("text/plain", Charset.forName("UTF-8")));
             HttpEntity entity = entityBuilder.build();
             client = HttpClientBuilder.create().build();
             httpPost.setURI(URI.create(url));

+ 77 - 59
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

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

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

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

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

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

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

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

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 95 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/ChaojiyingUtils.java


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -52,12 +52,14 @@ public class KuaiShouAppMultipleBids {
     @Excel(name = "出价", width = 15)
     @ApiModelProperty(value = "出价")
     private Long cpaBid;
+    private Long deepConversionBid;
     /**
      * 监测链接
      */
     @Excel(name = "监测链接", width = 15)
     @ApiModelProperty(value = "监测链接")
     private String trackUrl;
+    private String channelCode;
     /**
      * 创建时间
      */

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

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

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

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

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

@@ -96,10 +96,11 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         if (null != singleAppid && singleAppid == 0) {
             //多应用
             JSONArray appIdArray = JSONArray.parseArray(strategy.getAppIdArray());
-            String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
             if (strategy.getMultipleBids() == 0) { // 非多应用多出价
                 if (null != appIdArray && !appIdArray.isEmpty()) {
                     for (int i = 0; i < appIdArray.size(); i++) {
+                        String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
+
                         AiKuaiShouAppInfo appInfo = appInfoService.getByParams(strategy.getAccountId(), appIdArray.getLong(i));
                         if (null == appInfo) {
                             log.info("账户:{},appid({}) 数据不存在", accountId, appIdArray.getLong(i));
@@ -118,6 +119,12 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         }
                         Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN", createType, appInfo.getAppId(), strategyUuid);
                         for (KuaiShouVideoGet videoItem : allVideos) {
+                            Boolean unitOverrun = getUnitOverrun(accountId);
+                            if (unitOverrun) {
+                                log.error("组创建超限,accountId:{}", accountId);
+                                return 0L;
+                            }
+
                             KuaishouAccountCreativeOverrunInfo overrunInfo = overrunInfoService.getByParams(accountId, DateUtils.formatDate(new Date()));
                             if (null != overrunInfo) {
                                 log.info("该账户创意创建已超限=>accountId:{}", accountId);
@@ -132,6 +139,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                             //开始创建组+创意
                             String unitName = getName(strategy.getGroupName(), strategy, createType, videoItem.getPhotoName(), "unit", newCampaignId, appInfo.getAppId());
                             JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
+                            log.info("创建广告组入参:{}", unitParams);
                             Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                             Integer unitCode = (Integer) unitCreateResult.get("code");
                             String unitMessage = (String) unitCreateResult.get("message");
@@ -143,6 +151,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                             unitLevelOperationRecord.setCampaignId(newCampaignId);
                             unitLevelOperationRecord.setCpaBid(unitParams.getInteger("cpa_bid"));
                             unitLevelOperationRecord.setBid(unitParams.getInteger("bid"));
+                            unitLevelOperationRecord.setDeepConversionBid(unitParams.getInteger("deep_conversion_bid"));
                             unitLevelOperationRecord.setMessage(unitMessage);
                             unitLevelOperationRecord.setCampaignId(newCampaignId);
                             unitLevelOperationRecord.setAiStrategyUuid(strategyUuid);
@@ -164,41 +173,54 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                     }
                 }
             } else if (strategy.getMultipleBids() == 1) { //  多应用多出价
+                String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
                 List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, null, createType, videoCnt);
                 if (Check.isNull(allVideos)) {
                     return videoCnt;
                 }
-                for (int i = 0; i < appIdArray.size(); i++) {
-                    Long appId = appIdArray.getLong(i);
-                    if (Check.isNull(appId)) {
-                        continue;
-                    }
-                    KuaiShouAppMultipleBids multipleBids = kuaiShouAppMultipleBidsService.getInfoByAccountAndAppId(accountId, appId);
-                    if (Check.isNull(multipleBids)) {
+                for (KuaiShouVideoGet videoItem : allVideos) {
+                    // 获取视频封面数据
+                    List<MaterialCutFrame> cutFrameList = materialCutFrameService.getListByVideoSignature(videoItem.getSignature());
+                    if ((null == cutFrameList || cutFrameList.isEmpty())) {
+                        log.info("未获取到视频封面=>videoSignature:{}", videoItem.getSignature());
                         continue;
                     }
-                    if (!Check.isNull(multipleBids.getTrackUrl())) {
-                        strategy.setClickTrackUrl(multipleBids.getTrackUrl());
-                    }
-                    Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid);
-                    for (KuaiShouVideoGet videoItem : allVideos) {
+                    for (int i = 0; i < appIdArray.size(); i++) {
+
+                        Boolean unitOverrun = getUnitOverrun(accountId);
+                        if (unitOverrun) {
+                            log.error("组创建超限,accountId:{}", accountId);
+                            return 0L;
+                        }
+
+                        Long appId = appIdArray.getLong(i);
+                        if (Check.isNull(appId)) {
+                            continue;
+                        }
+                        KuaiShouAppMultipleBids multipleBids = kuaiShouAppMultipleBidsService.getInfoByAccountAndAppId(accountId, appId);
+                        if (Check.isNull(multipleBids)) {
+                            continue;
+                        }
+                        if (!Check.isNull(multipleBids.getTrackUrl())) {
+                            strategy.setClickTrackUrl(multipleBids.getTrackUrl());
+                        }
                         KuaishouAccountCreativeOverrunInfo overrunInfo = overrunInfoService.getByParams(accountId, DateUtils.formatDate(new Date()));
                         if (null != overrunInfo) {
                             log.info("该账户创意创建已超限=>accountId:{}", accountId);
                             return 0L;
                         }
-                        // 获取视频封面数据
-                        List<MaterialCutFrame> cutFrameList = materialCutFrameService.getListByVideoSignature(videoItem.getSignature());
-                        if ((null == cutFrameList || cutFrameList.isEmpty())) {
-                            log.info("未获取到视频封面=>videoSignature:{}", videoItem.getSignature());
-                            continue;
-                        }
+                        Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid);
                         //开始创建组+创意
                         String unitName = getName(strategy.getGroupName(), strategy, createType, videoItem.getPhotoName(), "unit", newCampaignId, appId);
                         JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
                         unitParams.remove("cpa_bid");
                         unitParams.put("cpa_bid", multipleBids.getCpaBid());
+                        if (!Check.isNull(multipleBids.getDeepConversionBid())) {
+                            unitParams.remove("deep_conversion_bid");
+                            unitParams.put("deep_conversion_bid", multipleBids.getDeepConversionBid());
+                        }
                         strategy.setCpaBid(multipleBids.getCpaBid() + "");
+                        log.info("创建广告组入参:{}", unitParams);
                         Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                         Integer unitCode = (Integer) unitCreateResult.get("code");
                         String unitMessage = (String) unitCreateResult.get("message");
@@ -206,6 +228,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         BeanUtils.copyProperties(strategy, unitLevelOperationRecord);
                         unitLevelOperationRecord.setCampaignId(newCampaignId);
                         unitLevelOperationRecord.setCpaBid(unitParams.getInteger("cpa_bid"));
+                        unitLevelOperationRecord.setDeepConversionBid(unitParams.getInteger("deep_conversion_bid"));
                         unitLevelOperationRecord.setBid(unitParams.getInteger("bid"));
                         unitLevelOperationRecord.setGroupName(unitName);
                         unitLevelOperationRecord.setCreateTime(new Date());
@@ -229,9 +252,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         }
                     }
                 }
-
             }
-
         } else {
             //单一应用
             String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
@@ -253,6 +274,13 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             }
             //3、在“上新”计划中新增广告组,一个素材搭配n张封面,组成一个广告组
             for (KuaiShouVideoGet videoItem : newVideos) {
+
+                Boolean unitOverrun = getUnitOverrun(accountId);
+                if (unitOverrun) {
+                    log.error("组创建超限,accountId:{}", accountId);
+                    return 0L;
+                }
+
                 KuaishouAccountCreativeOverrunInfo overrunInfo = overrunInfoService.getByParams(accountId, DateUtils.formatDate(new Date()));
                 if (null != overrunInfo) {
                     return 0L;
@@ -265,6 +293,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 }
                 String unitName = getName(strategy.getGroupName(), strategy, createType, videoItem.getPhotoName(), "unit", newCampaignId, appId);
                 JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
+                log.info("创建广告组入参:{}", unitParams);
                 Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                 Integer unitCode = (Integer) unitCreateResult.get("code");
                 String unitMessage = (String) unitCreateResult.get("message");
@@ -274,6 +303,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 unitLevelOperationRecord.setCampaignId(newCampaignId);
                 unitLevelOperationRecord.setCpaBid(unitParams.getInteger("cpa_bid"));
                 unitLevelOperationRecord.setBid(unitParams.getInteger("bid"));
+                unitLevelOperationRecord.setDeepConversionBid(unitParams.getInteger("deep_conversion_bid"));
                 unitLevelOperationRecord.setCreateTime(new Date());
                 unitLevelOperationRecord.setStatus(unitCode);
                 unitLevelOperationRecord.setMessage(unitMessage);
@@ -298,7 +328,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         return videoCnt;
     }
 
-
     /**
      * 创建程序化创意
      *
@@ -344,7 +373,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         String key = token.getAccountId() + "_ProgramCreative" + "_" + nowDate;
         JSONArray appIdArray = JSON.parseArray(strategy.getAppIdArray());
         if (null != singleAppid && singleAppid == 0) {
-            String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
             if (strategy.getMultipleBids() == 0) { //  非多应用多出价
                 //多应用
                 if (null != appIdArray && !appIdArray.isEmpty()) {
@@ -354,6 +382,8 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                             log.info("账户:{},appid({}) 数据不存在", accountId, appIdArray.getLong(i));
                             continue;
                         }
+                        String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
+
                         //判定是否通用监测链接
                         if (null != strategy.getGeneralTrack() && strategy.getGeneralTrack() == 0) {
                             strategy.setClickTrackUrl(appInfo.getTrackUrl());
@@ -365,6 +395,12 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         if (null == allVideos || allVideos.isEmpty()) {
                             return;
                         }
+                        Boolean unitOverrun = getUnitOverrun(accountId);
+                        if (unitOverrun) {
+                            log.error("组创建超限,accountId:{}", accountId);
+                            return;
+                        }
+
                         //判定创意创建是否超限
                         KuaishouAccountCreativeOverrunInfo overrunInfo = overrunInfoService.getByParams(accountId, DateUtils.formatDate(new Date()));
                         if (null != overrunInfo) {
@@ -372,7 +408,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                             return;
                         }
                         Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN", createType, appInfo.getAppId(), strategyUuid);
-
                         //创建组+创意
                         List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
                         for (int j = 1; j < splitVideos.size() + 1; j++) {
@@ -387,12 +422,17 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                             //创建组
                             String unitName = getName(strategy.getGroupName(), strategy, createType, null, "unit", newCampaignId, appInfo.getAppId());
                             JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
+                            log.info("创建广告组入参:{}", unitParams);
                             Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                             Integer unitCode = (Integer) unitCreateResult.get("code");
                             String unitMessage = (String) unitCreateResult.get("message");
                             AiKuaishouUnitLevelOperationRecord unitLevelOperationRecord = new AiKuaishouUnitLevelOperationRecord();
                             BeanUtils.copyProperties(strategy, unitLevelOperationRecord);
                             unitLevelOperationRecord.setGroupName(unitName);
+                            unitLevelOperationRecord.setCampaignId(newCampaignId);
+                            unitLevelOperationRecord.setCpaBid(unitParams.getInteger("cpa_bid"));
+                            unitLevelOperationRecord.setBid(unitParams.getInteger("bid"));
+                            unitLevelOperationRecord.setDeepConversionBid(unitParams.getInteger("deep_conversion_bid"));
                             unitLevelOperationRecord.setCreateTime(new Date());
                             unitLevelOperationRecord.setStatus(unitCode);
                             unitLevelOperationRecord.setMessage(unitMessage);
@@ -416,54 +456,79 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 if (Check.isNull(allVideos)) {
                     return;
                 }
-                for (int i = 0; i < appIdArray.size(); i++) {
-                    Long appId = appIdArray.getLong(i);
-                    if (Check.isNull(appId)) {
+                String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
+                List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 1);
+                for (int j = 1; j < splitVideos.size() + 1; j++) {
+                    List<KuaiShouVideoGet> kuaiShouVideoGets = splitVideos.get(j);
+                    if (Check.isNull(kuaiShouVideoGets)) {
                         continue;
                     }
-                    KuaiShouAppMultipleBids multipleBids = kuaiShouAppMultipleBidsService.getInfoByAccountAndAppId(accountId, appId);
-                    if (Check.isNull(multipleBids)) {
-                        continue;
-                    }
-                    if (!Check.isNull(multipleBids.getTrackUrl())) {
-                        strategy.setClickTrackUrl(multipleBids.getTrackUrl());
-                    }
-                    Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid);
-                    List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
-                    for (int j = 1; j < splitVideos.size() + 1; j++) {
-                        Object redisObj = redisUtil.get(key);
-                        if (!Check.isNull(redisObj)) {
-                            Integer value = (Integer) redisObj;
-                            if (value == 1) {
-                                log.error("程序化创意创建超限,accountId:{}", strategy.getAccountId());
+                    for (KuaiShouVideoGet videoGet : kuaiShouVideoGets) {
+                        for (int i = 0; i < appIdArray.size(); i++) {
+                            Boolean unitOverrun = getUnitOverrun(accountId);
+                            if (unitOverrun) {
+                                log.error("组创建超限,accountId:{}", accountId);
                                 return;
                             }
-                        }
-                        //创建组
-                        String unitName = getName(strategy.getGroupName(), strategy, createType, null, "unit", newCampaignId, appId);
-                        JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
-                        unitParams.put("cpa_bid", multipleBids.getCpaBid());
-                        Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
-                        Integer unitCode = (Integer) unitCreateResult.get("code");
-                        String unitMessage = (String) unitCreateResult.get("message");
-                        AiKuaishouUnitLevelOperationRecord unitLevelOperationRecord = new AiKuaishouUnitLevelOperationRecord();
-                        BeanUtils.copyProperties(strategy, unitLevelOperationRecord);
-                        unitLevelOperationRecord.setGroupName(unitName);
-                        unitLevelOperationRecord.setCreateTime(new Date());
-                        unitLevelOperationRecord.setStatus(unitCode);
-                        unitLevelOperationRecord.setMessage(unitMessage);
-                        unitLevelOperationRecord.setCampaignId(newCampaignId);
-                        unitLevelOperationRecord.setAiStrategyUuid(strategyUuid);
-                        if (unitCode != 0) {
-                            log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
+
+                            Object redisObj = redisUtil.get(key);
+                            if (!Check.isNull(redisObj)) {
+                                Integer value = (Integer) redisObj;
+                                if (value == 1) {
+                                    log.error("程序化创意创建超限,accountId:{}", strategy.getAccountId());
+                                    return;
+                                }
+                            }
+                            Long appId = appIdArray.getLong(i);
+                            if (Check.isNull(appId)) {
+                                continue;
+                            }
+                            KuaiShouAppMultipleBids multipleBids = kuaiShouAppMultipleBidsService.getInfoByAccountAndAppId(accountId, appId);
+                            if (Check.isNull(multipleBids)) {
+                                continue;
+                            }
+                            if (!Check.isNull(multipleBids.getTrackUrl())) {
+                                strategy.setClickTrackUrl(multipleBids.getTrackUrl());
+                            }
+                            Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid);
+                            //创建组
+                            String unitName = getName(strategy.getGroupName(), strategy, createType, videoGet.getPhotoName(), "unit", newCampaignId, appId);
+                            JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
+                            unitParams.remove("cpa_bid");
+                            unitParams.put("cpa_bid", multipleBids.getCpaBid());
+                            if (!Check.isNull(multipleBids.getDeepConversionBid())) {
+                                unitParams.remove("deep_conversion_bid");
+                                unitParams.put("deep_conversion_bid", multipleBids.getDeepConversionBid());
+                            }
+                            log.info("创建广告组入参:{}", unitParams);
+                            Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
+                            Integer unitCode = (Integer) unitCreateResult.get("code");
+                            String unitMessage = (String) unitCreateResult.get("message");
+                            AiKuaishouUnitLevelOperationRecord unitLevelOperationRecord = new AiKuaishouUnitLevelOperationRecord();
+                            BeanUtils.copyProperties(strategy, unitLevelOperationRecord);
+                            unitLevelOperationRecord.setGroupName(unitName);
+                            unitLevelOperationRecord.setCampaignId(newCampaignId);
+                            unitLevelOperationRecord.setCpaBid(unitParams.getInteger("cpa_bid"));
+                            unitLevelOperationRecord.setBid(unitParams.getInteger("bid"));
+                            unitLevelOperationRecord.setDeepConversionBid(unitParams.getInteger("deep_conversion_bid"));
+                            unitLevelOperationRecord.setCreateTime(new Date());
+                            unitLevelOperationRecord.setStatus(unitCode);
+                            unitLevelOperationRecord.setMessage(unitMessage);
+                            unitLevelOperationRecord.setCampaignId(newCampaignId);
+                            unitLevelOperationRecord.setDeepConversionBid(unitParams.getInteger("deep_conversion_bid"));
+
+                            unitLevelOperationRecord.setAiStrategyUuid(strategyUuid);
+                            if (unitCode != 0) {
+                                log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
+                                unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
+                                continue;
+                            }
+                            Long unitId = (Long) unitCreateResult.get("unitId");
+                            unitLevelOperationRecord.setUnitId(unitId);
                             unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
-                            continue;
+                            JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j, null);
+                            createProgramCreative(token, creativeParams, strategy);
                         }
-                        Long unitId = (Long) unitCreateResult.get("unitId");
-                        unitLevelOperationRecord.setUnitId(unitId);
-                        unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
-                        JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j, null);
-                        createProgramCreative(token, creativeParams, strategy);
                     }
                 }
             }
@@ -474,7 +539,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             if (null == allVideos) {
                 return;
             }
-
             Long appId = null;
             String appIdString = strategy.getAppIdArray();
             if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
@@ -492,6 +556,12 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             //创意
             List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
             for (int j = 1; j < splitVideos.size() + 1; j++) {
+                Boolean unitOverrun = getUnitOverrun(accountId);
+                if (unitOverrun) {
+                    log.error("组创建超限,accountId:{}", accountId);
+                    return;
+                }
+
                 Object redisObj = redisUtil.get(key);
                 if (!Check.isNull(redisObj)) {
                     Integer value = (Integer) redisObj;
@@ -503,12 +573,17 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 //创建组
                 String unitName = getName(strategy.getGroupName(), strategy, createType, null, "unit", newCampaignId, appId);
                 JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
+                log.info("创建广告组入参:{}", unitParams);
                 Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                 Integer unitCode = (Integer) unitCreateResult.get("code");
                 String unitMessage = (String) unitCreateResult.get("message");
                 AiKuaishouUnitLevelOperationRecord unitLevelOperationRecord = new AiKuaishouUnitLevelOperationRecord();
                 BeanUtils.copyProperties(strategy, unitLevelOperationRecord);
                 unitLevelOperationRecord.setGroupName(unitName);
+                unitLevelOperationRecord.setCampaignId(newCampaignId);
+                unitLevelOperationRecord.setCpaBid(unitParams.getInteger("cpa_bid"));
+                unitLevelOperationRecord.setBid(unitParams.getInteger("bid"));
+                unitLevelOperationRecord.setDeepConversionBid(unitParams.getInteger("deep_conversion_bid"));
                 unitLevelOperationRecord.setCreateTime(new Date());
                 unitLevelOperationRecord.setStatus(unitCode);
                 unitLevelOperationRecord.setMessage(unitMessage);
@@ -526,6 +601,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 createProgramCreative(token, creativeParams, strategy);
             }
         }
+
     }
 
     @Override
@@ -601,16 +677,11 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             return;
         }
         Integer code = resultJson.getInteger("code");
-
-
         String message = resultJson.getString("message");
-
         Long unitId = creativeParams.getLong("unit_id");
         if (code == 0) {
             createLandPageAndUnit(creativeParams, resultJson.getJSONObject("data"));
-
             log.info("创建程序化创意成功,accountId:{},unit:{}", token.getAccountId(), unitId);
-
         } else {
             log.error("快手创建程序化创意失败,accountId:{},unitId:{},返回信息:{}", token.getAccountId(), unitId, message);
             if (code == 400001 && "/rest/openapi/v2/creative/advanced/program/create调用已超日限,次日可恢复调用".equals(message)) {
@@ -619,10 +690,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 redisUtil.set(key, 1, 100000L);
                 updateService.updateUnitStatus(token.getAccessToken(), token.getAccountId(), unitId, 3, "e9ca23d68d884d4ebb19d07889727dae");
             }
-
-
         }
-
     }
 
     //绑定落地页与广告组、创意的关系
@@ -1061,14 +1129,17 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 targetJsonObject.put("filter_converted_level", strategy.getFilterConvertedLevel());
             }
         }
-        JSONArray appInterest = JSONArray.parseArray(strategy.getAppInterest());
-        if (!Check.isNull(appInterest)) {
-            targetJsonObject.put("app_interest", appInterest);
-        }
+
         // APP行为-按APP名称
-        JSONArray appIds = JSONArray.parseArray(strategy.getAppIds());
-        if (!Check.isNull(appIds)) {
-            targetJsonObject.put("app_ids", appIds);
+        if (sceneId != 5) {
+            JSONArray appIds = JSONArray.parseArray(strategy.getAppIds());
+            if (!Check.isNull(appIds)) {
+                targetJsonObject.put("app_ids", appIds);
+            }
+            JSONArray appInterest = JSONArray.parseArray(strategy.getAppInterest());
+            if (!Check.isNull(appInterest)) {
+                targetJsonObject.put("app_interest", appInterest);
+            }
         }
         // 人群包定向
         JSONArray populationString = JSONArray.parseArray(strategy.getPopulation());
@@ -1104,7 +1175,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             }
         }
         unitParams.put("target", targetJsonObject);
-        log.info("广告组创建参数:{}", unitParams.toJSONString());
         return unitParams;
     }
 
@@ -1392,12 +1462,16 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             updateService.updateUnitStatus(token.getAccessToken(), token.getAccountId(), unitId, 3, "e9ca23d68d884d4ebb19d07889727dae");
         } else if (creativeCode == -1 && creativeMessage.contains("超过可关联的有效创意的上限")) {
             updateService.updateUnitStatus(token.getAccessToken(), token.getAccountId(), unitId, 3, "e9ca23d68d884d4ebb19d07889727dae");
+        } else if (creativeCode == -1 && creativeMessage.contains("视频不存在")) {
+            updateService.updateUnitStatus(token.getAccessToken(), token.getAccountId(), unitId, 3, "e9ca23d68d884d4ebb19d07889727dae");
         }
 
         AiKuaishouCreativeLevelOperationRecord record = new AiKuaishouCreativeLevelOperationRecord();
         BeanUtils.copyProperties(strategy, record);
         record.setCreativeName(creativeName);
         record.setStatus(creativeCode);
+        record.setDescription(creativeParams.getString("description"));
+        record.setPhotoId(creativeParams.getString("photo_id"));
         record.setMessage(creativeMessage);
         record.setUnitId(unitId);
         record.setAiStrategyUuid(uuid);
@@ -1422,9 +1496,8 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     @Autowired
     private IKuaiShouAppListService appListService;
 
-    private String getName(String wildcard, AiKuaishouAdvertiserStrategy strategy, Integer createType, String materialName, String type, Long campaignId, Long appId) {
-
 
+    private String getName(String wildcard, AiKuaishouAdvertiserStrategy strategy, Integer createType, String materialName, String type, Long campaignId, Long appId) {
         if (wildcard.contains("{{应用名称}}") || wildcard.contains("{{应用标记}}")) {
             KuaiShouAppList getAppInfo = appListService.getAppInfo(strategy.getAccountId(), appId);
             if (!Check.isNull(getAppInfo)) {
@@ -1435,8 +1508,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 wildcard = wildcard.replace("{{应用标记}}", "");
             }
         }
-
-
         if (wildcard.contains("{{创意制作方式}}")) {
             if (strategy.getUnitType() == 4) {
                 wildcard = wildcard.replace("{{创意制作方式}}", "自定义");
@@ -1456,6 +1527,14 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 wildcard = wildcard.replace("{{素材名称}}", materialName);
             }
         }
+        if (wildcard.contains("{{渠道号}}")) {
+            KuaiShouAppMultipleBids multipleBids = kuaiShouAppMultipleBidsService.getInfoByAccountAndAppId(strategy.getAccountId(), appId);
+            if (!Check.isNull(multipleBids)) {
+                wildcard = wildcard.replace("{{渠道号}}", multipleBids.getChannelCode());
+            } else {
+                wildcard = wildcard.replace("{{渠道号}}", "");
+            }
+        }
         if (!wildcard.contains("{{自定义}}")) {
             wildcard = wildcard + "{{自定义}}";
         }
@@ -1470,12 +1549,8 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         } else if ("unit".equals(type)) {
             wildcard = wildcard.replace("{{日期}}", nowDate);
         }
-
-
         String targetName = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
         wildcard = wildcard.replace("{{自定义}}", targetName);
-
-
         if (!Check.isNull(campaignId)) {
             Integer count = null;
             if (null != strategy.getSingleAppid() && strategy.getSingleAppid() == 0 && strategy.getMultipleBids() == 0) {
@@ -1527,4 +1602,21 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     }
 
 
+    @Override
+    public Boolean getUnitOverrun(Long accountId) {
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String key = accountId + "_" + nowDate + "unit_create_overrun";
+        Object redisObj = redisUtil.get(key);
+        if (Check.isNull(redisObj)) {
+            return false;
+        }
+        Integer value = (Integer) redisObj;
+        if (value == 1) {
+            return true;
+        } else {
+            return false;
+        }
+
+    }
+
 }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -0,0 +1,202 @@
+package cn.com.ctop.toutiao.modules.material.controller;
+
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import cn.com.ctop.toutiao.modules.material.entity.BytedanceAccountCommonSlogen;
+import cn.com.ctop.toutiao.modules.material.service.IBytedanceAccountCommonSlogenService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 头条账户通用文案数据
+ * @author jeecg-boot
+ * @date   2021-05-24
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="头条账户通用文案数据")
+@RestController
+@RequestMapping("/ctop/bytedanceAccountCommonSlogen")
+public class BytedanceAccountCommonSlogenController {
+	@Autowired
+	private IBytedanceAccountCommonSlogenService bytedanceAccountCommonSlogenService;
+
+	/**
+	  * 分页列表查询
+	 * @param bytedanceAccountCommonSlogen
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@ApiOperation(value="头条账户通用文案数据-分页列表查询", notes="头条账户通用文案数据-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<BytedanceAccountCommonSlogen>> queryPageList(BytedanceAccountCommonSlogen bytedanceAccountCommonSlogen,
+																	 @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+																	 @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+																	 HttpServletRequest req) {
+		Result<IPage<BytedanceAccountCommonSlogen>> result = new Result<>();
+		QueryWrapper<BytedanceAccountCommonSlogen> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceAccountCommonSlogen, req.getParameterMap());
+		Page<BytedanceAccountCommonSlogen> page = new Page<>(pageNo, pageSize);
+		IPage<BytedanceAccountCommonSlogen> pageList = bytedanceAccountCommonSlogenService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param bytedanceAccountCommonSlogen
+	 * @return
+	 */
+	@ApiOperation(value="头条账户通用文案数据-添加", notes="头条账户通用文案数据-添加")
+	@PostMapping(value = "/add")
+	public Result<BytedanceAccountCommonSlogen> add(@RequestBody BytedanceAccountCommonSlogen bytedanceAccountCommonSlogen) {
+		Result<BytedanceAccountCommonSlogen> result = new Result<>();
+		try {
+			bytedanceAccountCommonSlogenService.save(bytedanceAccountCommonSlogen);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param bytedanceAccountCommonSlogen
+	 * @return
+	 */
+	@ApiOperation(value="头条账户通用文案数据-编辑", notes="头条账户通用文案数据-编辑")
+	@PutMapping(value = "/edit")
+	public Result<BytedanceAccountCommonSlogen> edit(@RequestBody BytedanceAccountCommonSlogen bytedanceAccountCommonSlogen) {
+		Result<BytedanceAccountCommonSlogen> result = new Result<>();
+		BytedanceAccountCommonSlogen bytedanceAccountCommonSlogenEntity = bytedanceAccountCommonSlogenService.getById(bytedanceAccountCommonSlogen.getId());
+		if(bytedanceAccountCommonSlogenEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = bytedanceAccountCommonSlogenService.updateById(bytedanceAccountCommonSlogen);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="头条账户通用文案数据-通过id删除", notes="头条账户通用文案数据-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id") String id) {
+		try {
+			bytedanceAccountCommonSlogenService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+
+	/**
+	 *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@ApiOperation(value="头条账户通用文案数据-批量删除", notes="头条账户通用文案数据-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<BytedanceAccountCommonSlogen> deleteBatch(@RequestParam(name="ids") String ids) {
+		Result<BytedanceAccountCommonSlogen> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.bytedanceAccountCommonSlogenService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="头条账户通用文案数据-通过id查询", notes="头条账户通用文案数据-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<BytedanceAccountCommonSlogen> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<BytedanceAccountCommonSlogen> result = new Result<>();
+		BytedanceAccountCommonSlogen bytedanceAccountCommonSlogen = bytedanceAccountCommonSlogenService.getById(id);
+		if(bytedanceAccountCommonSlogen==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(bytedanceAccountCommonSlogen);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+   * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+          MultipartFile file = entity.getValue();
+          ImportParams params = new ImportParams();
+          params.setTitleRows(2);
+          params.setHeadRows(1);
+          params.setNeedSave(true);
+          try {
+              List<BytedanceAccountCommonSlogen> listBytedanceAccountCommonSlogens = ExcelImportUtil.importExcel(file.getInputStream(), BytedanceAccountCommonSlogen.class, params);
+              bytedanceAccountCommonSlogenService.saveBatch(listBytedanceAccountCommonSlogens);
+              return Result.ok("文件导入成功!数据行数:" + listBytedanceAccountCommonSlogens.size());
+          } catch (Exception e) {
+              log.error(e.getMessage(),e);
+              return Result.error("文件导入失败:"+e.getMessage());
+          } finally {
+              try {
+                  file.getInputStream().close();
+              } catch (IOException e) {
+                  e.printStackTrace();
+              }
+          }
+      }
+      return Result.ok("文件导入失败!");
+  }
+
+}

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

@@ -0,0 +1,53 @@
+package cn.com.ctop.toutiao.modules.material.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 头条账户通用文案数据
+ * @author jeecg-boot
+ * @date   2021-05-24
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_bytedance_account_common_slogen")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_bytedance_account_common_slogen对象", description="头条账户通用文案数据")
+public class BytedanceAccountCommonSlogen {
+    
+	/**id*/
+	@TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+	private Integer id;
+	/**slogen*/
+	@Excel(name = "slogen", width = 15)
+    @ApiModelProperty(value = "slogen")
+	private String slogen;
+	/**accountId*/
+	@Excel(name = "accountId", width = 15)
+    @ApiModelProperty(value = "accountId")
+	private Integer accountId;
+	/**createTime*/
+    @ApiModelProperty(value = "createTime")
+	private Date createTime;
+	/**updateTime*/
+    @ApiModelProperty(value = "updateTime")
+	private Date updateTime;
+	/**status*/
+	@Excel(name = "status", width = 15)
+    @ApiModelProperty(value = "status")
+	private Integer status;
+}

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

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

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

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

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

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

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

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

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

@@ -86,7 +86,6 @@ public class ReportServiceImpl implements IReportService {
         config.propertyNamingStrategy = PropertyNamingStrategy.SnakeCase;
         JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(conditions, config));
         JSONObject getObject = getAdvertiserStat(token, jsonObject);
-        System.out.println(getObject);
         if(null == getObject){
             XxlJobHelper.log("头条广告主数据获取异常");
             return;
@@ -415,6 +414,7 @@ public class ReportServiceImpl implements IReportService {
             log.error("素材报表请求数据null=>accountId:{};startDate:{};endDate:{}", token.getAccountId(), startDate, endDate);
             return;
         }
+
         Integer code = getObject.getInteger("code");
         String message = getObject.getString("message");
         if (null == code || code != 0) {