瀏覽代碼

Merge branch 'master' into V1.1.8

zhaoxian 4 年之前
父節點
當前提交
758dbf5357
共有 100 個文件被更改,包括 1223 次插入781 次删除
  1. 5 0
      jeecg-boot-module-system/pom.xml
  2. 0 6
      jeecg-boot-module-system/src/main/java/org/jeecg/config/WebMvcConfiguration.java
  3. 26 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  4. 105 21
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  5. 7 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java
  6. 53 329
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  7. 4 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  8. 14 12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/ProjectMemberMapper.java
  9. 3 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MaterialReportOverViewMapper.xml
  10. 14 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ProjectMemberMapper.xml
  11. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IProjectMemberService.java
  12. 7 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BidWarningServiceImpl.java
  13. 6 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CpaBidWarningServiceImpl.java
  14. 6 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java
  15. 19 17
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/util/ApprovalNodeNoticeHandler.java
  16. 17 11
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java
  17. 0 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java
  18. 61 8
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java
  19. 1 1
      jeecg-boot-module-system/src/main/resources/application-jiaoyang.yml
  20. 1 1
      jeecg-boot-module-system/src/main/resources/application-preprod.yml
  21. 1 1
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  22. 1 1
      jeecg-boot-module-system/src/main/resources/application-prod2.yml
  23. 1 1
      jeecg-boot-module-system/src/main/resources/application-test.yml
  24. 0 1
      jeecg-boot-module-system/src/main/resources/application.yml
  25. 二進制
      jeecg-boot-module-system/src/main/resources/lib/opencv-4.2.0.jar
  26. 0 1
      jeecg-boot-module-system/src/main/resources/static/demo1.html
  27. 23 32
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  28. 27 23
      module-check/src/main/java/cn/com/ctop/notice/handler/SendWeChatHandle.java
  29. 2 13
      module-common/pom.xml
  30. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/CtopCorpWexinUser.java
  31. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java
  32. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/Project.java
  33. 7 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/UserAllocation.java
  34. 86 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/WexinConfig.java
  35. 4 3
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MailLogMapper.java
  36. 3 1
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java
  37. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/ProjectMapper.java
  38. 9 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/SysUserMapper.java
  39. 15 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/WexinConfigMapper.java
  40. 6 6
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MailLogMapper.xml
  41. 22 14
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml
  42. 15 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ProjectMapper.xml
  43. 12 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/SysUserMapper.xml
  44. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/WexinConfigMapper.xml
  45. 3 2
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  46. 2 1
      module-common/src/main/java/cn/com/ctop/common/module/service/IProjectService.java
  47. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/ISysUserService.java
  48. 16 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IWexinConfigService.java
  49. 7 4
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MailLogServiceImpl.java
  50. 19 9
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  51. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/ProjectServiceImpl.java
  52. 6 2
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/SendMessageServiceImpl.java
  53. 24 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/SysUserServiceImpl.java
  54. 29 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/WexinConfigServiceImpl.java
  55. 45 31
      module-common/src/main/java/cn/com/ctop/common/module/utils/CorpWexinUtils.java
  56. 28 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/StringUtils.java
  57. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/vo/SysUserVo.java
  58. 二進制
      module-common/src/main/resources/lib/jave-1.0.jar
  59. 1 1
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAiCreateJob.java
  60. 10 6
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceCheckAccountReportJob.java
  61. 2 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceMaterialsLoadJob.java
  62. 19 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceRejectReasonJob.java
  63. 1 1
      module-job-bytedance/src/main/resources/application-dev.yml
  64. 1 1
      module-job-bytedance/src/main/resources/application-jiaoyang.yml
  65. 1 1
      module-job-bytedance/src/main/resources/application-prod.yml
  66. 51 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAutoSynchronousProjectMaterialJob.java
  67. 16 6
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCreateCreativeJob.java
  68. 9 3
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyCampaignReportLoadJob.java
  69. 4 3
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyGroupReportLoadJob.java
  70. 11 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouEtlVideoJob.java
  71. 0 46
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouGroupDailyReportJob.java
  72. 1 1
      module-job-kuaishou/src/main/resources/application-jiaoyang.yml
  73. 1 1
      module-job-kuaishou/src/main/resources/application-preprod.yml
  74. 1 1
      module-job-kuaishou/src/main/resources/application-prod.yml
  75. 4 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouCreateCreativeController.java
  76. 30 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java
  77. 4 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouLandpagePackageServiceImpl.java
  78. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroupTemplate.java
  79. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouGroupTemplateMapper.java
  80. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupTemplateMapper.xml
  81. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml
  82. 9 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouVideoGetMapper.xml
  83. 7 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/AccountWarningServiceImpl.java
  84. 23 11
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java
  85. 22 13
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  86. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouProjectVideoGetServiceImpl.java
  87. 6 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/material/service/impl/KuaishouBidWarningServiceImpl.java
  88. 0 10
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java
  89. 29 28
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouAccountReportCtrl.java
  90. 2 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouYiCheReportController.java
  91. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaishouAccountMaterialReportDailyMapper.java
  92. 18 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouAccountMaterialReportDailyMapper.xml
  93. 49 19
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouYiCheReportMapper.xml
  94. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IEtlKuaishouAccountMaterialReportDailyService.java
  95. 10 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouAccountMaterialReportDailyServiceImpl.java
  96. 1 1
      module-kuaishou/src/main/resources/json_template/kuaishou_filed_mapping.json
  97. 69 10
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/BytedanceVideoSlogenInfoController.java
  98. 2 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/ByteDanceCreativeWordPackageMapper.java
  99. 6 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/BytedanceImageInfoMapper.java
  100. 0 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/BytedanceVideoSlogenInfoMapper.java

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

@@ -161,6 +161,8 @@
             <groupId>cn.com.ctop</groupId>
             <artifactId>opencv</artifactId>
             <version>4.2.0</version>
+            <scope>system</scope>
+            <systemPath>${project.basedir}/src/main/resources/lib/opencv-4.2.0.jar</systemPath>
         </dependency>
         <dependency>
             <groupId>com.github.pagehelper</groupId>
@@ -208,6 +210,9 @@
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <includeSystemScope>true</includeSystemScope>
+                </configuration>
             </plugin>
         </plugins>
         <resources>

+ 0 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/config/WebMvcConfiguration.java

@@ -1,8 +1,6 @@
 package org.jeecg.config;
 
-import org.jeecg.config.interceptors.BrowseLogHandelInterceptor;
 import org.jeecg.modules.shiro.authc.interceptor.OnlineInterceptor;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -22,10 +20,6 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
  */
 @Configuration
 public class WebMvcConfiguration implements WebMvcConfigurer {
-
-	@Autowired
-	BrowseLogHandelInterceptor browseLogHandelInterceptor;
-
 	@Value("${jeecg.path.upload}")
 	private String upLoadPath;
 	@Value("${jeecg.path.webapp}")

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

@@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
@@ -58,7 +59,7 @@ public class CallbackController {
     private IKuaishouInterfaceService kuaishouInterfaceService;
     @Autowired
     private IBindAccountAuthService bindAccountAuthService;
-    @Autowired
+    @Resource
     private UserAllocationMapper allocationMapper;
     @Autowired
     private ICtopOauthTokenService ctopOauthTokenService;
@@ -157,10 +158,17 @@ public class CallbackController {
                     //创建人
                     String userId = json.getString("userId");
                     Long projectId = json.getLong("projectId");
+                    String authBeginTime = json.getString("authBeginTime");
                     BigDecimal warningProportion = json.getBigDecimal("WarningProportion");
                     BigDecimal warningAmount = json.getBigDecimal("WarningAmount");
                     String systemType = json.getString("systemType");
 
+                    /* TODO
+                    Integer autoDelivery = json.getInteger("autoDelivery");
+                    String materialTypeStr = json.getString("materialType");
+                    //物料类型,0-不同步,1应用包,(2人群包,3定向包)
+                    JSONArray materialTypeArr = json.getJSONArray("materialType");
+*/
                     CtopOauthToken topOauthToken = new CtopOauthToken();
                     topOauthToken.setId(String.valueOf(accountId));
                     topOauthToken.setAppId(json.getLong("appId"));
@@ -195,6 +203,9 @@ public class CallbackController {
                     userAllocation.setSystemType(systemType);
                     // 获取快手昵称
                     userAllocation.setAuthName((String) advertiseBaseInfoMap.get("userName"));
+                    if(null!=authBeginTime&&!authBeginTime.trim().equals("")){
+                        userAllocation.setAuthBeginTime(authBeginTime);
+                    }
                     userAllocation.setMediaId(mediaId);
                     userAllocation.setAccountId(accountId);
                     userAllocation.setProjectId(projectId);
@@ -203,20 +214,20 @@ public class CallbackController {
                     userAllocation.setCreateTime(new Date());
                     userAllocation.setUpdateTime(new Date());
                     //自动投放,0关闭,1开启
-                    userAllocation.setAutoDelivery(json.getInteger("autoDelivery"));
-                    userAllocation.setMaterialType(json.getString("materialType"));
+                    /* TODO
+                    userAllocation.setAutoDelivery(autoDelivery);
+                    userAllocation.setMaterialType(materialTypeStr);*/
                     allocationMapper.deleteById(userAllocation.getId());
                     Map<String, Object> deleteUserMap = new HashMap<>();
                     deleteUserMap.put("advertiser_id", advertiserId);
                     deleteUserMap.put("account_id", accountId);
                     allocationMapper.deleteByMap(deleteUserMap);
+                    log.info("待创建账户信息:{}", userAllocation.toString());
                     int i = allocationMapper.insert(userAllocation);
                     if (i > 0) {
                         log.info("同步分配用户表完成,task_id:{},accountId:{}", state, accountId);
                     }
-                    //物料类型,0-不同步,1应用包,(2人群包,3定向包)
-                    JSONArray materialTypeArr = json.getJSONArray("materialType");
-                    Integer materialType = materialTypeArr.getInteger(0);
+                   /* TODO Integer materialType = materialTypeArr.getInteger(0);*/
                     //账号绑定
                     bindAccountAuthService.addBindAccount(accountId, KuaishouInterfaceConstant.LOGIN_TYPE_KUAISHOU, advertiserId);
                     Thread t = new Thread() {
@@ -224,9 +235,10 @@ public class CallbackController {
                         public void run() {
                             try {
                                 kuaishouInterfaceService.loadKuaishouDataSingle(topOauthToken);
+                                /* TODO
                                 if (!Check.isNull(materialType) && materialType != 0) {
                                     synchronMaterials(materialType, accountId, projectId);
-                                }
+                                }*/
                             } catch (ParseException e) {
                                 e.printStackTrace();
                             }
@@ -303,6 +315,7 @@ public class CallbackController {
             String userId = json.getString("userId");
             //创建人
             String userName = json.getString("userName");
+            String authBeginTime = json.getString("authBeginTime");
             Long projectId = json.getLong("projectId");
             BigDecimal warningProportion = json.getBigDecimal("WarningProportion");
             BigDecimal warningAmount = json.getBigDecimal("WarningAmount");
@@ -368,6 +381,9 @@ public class CallbackController {
                             userAllocation.setProjectId(projectId);
                             userAllocation.setSystemType(systemType);
                             userAllocation.setAuthName((String) advertiserDataMap.get("name"));
+                            if(null!=authBeginTime&&!authBeginTime.trim().equals("")){
+                                userAllocation.setAuthBeginTime(authBeginTime);
+                            }
                             userAllocation.setAdvertiserId(advertiserId);
                             userAllocation.setWarningProportion(warningProportion);
                             userAllocation.setWarningAmount(warningAmount);
@@ -420,6 +436,9 @@ public class CallbackController {
                     userAllocation.setProjectId(projectId);
                     userAllocation.setSystemType(systemType);
                     userAllocation.setAuthName((String) advertiserDataMap.get("name"));
+                    if(null!=authBeginTime&&!authBeginTime.trim().equals("")){
+                        userAllocation.setAuthBeginTime(authBeginTime);
+                    }
                     userAllocation.setAdvertiserId(advertiserId);
                     userAllocation.setWarningProportion(warningProportion);
                     userAllocation.setWarningAmount(warningAmount);

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

@@ -6,7 +6,9 @@ import cn.com.ctop.common.module.entity.*;
 import cn.com.ctop.common.module.enums.MaterialSupplierEnum;
 import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.*;
+import cn.com.ctop.toutiao.modules.material.entity.ByteDanceCreativeWordPackage;
 import cn.com.ctop.toutiao.modules.material.entity.BytedanceVideoSlogenInfo;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeWordPackageService;
 import cn.com.ctop.toutiao.modules.material.service.IBytedanceVideoSlogenInfoService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -18,7 +20,6 @@ import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
@@ -31,6 +32,8 @@ import javax.servlet.http.HttpServletRequest;
 import java.net.URLDecoder;
 import java.text.ParseException;
 import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * 素材信息
@@ -74,7 +77,11 @@ public class MaterialInfoController {
     private IProductService productService;
     @Autowired
     private IProjectService projectService;
+    @Autowired
+    private IProjectMemberService projectMemberService;
 
+    @Autowired
+    private IByteDanceCreativeWordPackageService byteDanceGeneralCopywriterService;
 
     @GetMapping("/supplierWatermark")
     public Result<String> supplierWatermark(String id) {
@@ -293,36 +300,57 @@ public class MaterialInfoController {
                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        List<Long> productIds = null;
+        List<Long> projectIds = new ArrayList<>();
         String userId = user.getId();
         String roleCode = roleService.getRoleCodeByUserId(userId);
         if (null == tagCode || "".equals(tagCode.trim())) {
             tagCode = null;
         }
-        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 != productId && productId != 0) {
-                productIds = new ArrayList<>();
-                productIds.add(productId);
+        //管理员、销售查询所有素材
+        if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || roleCode.contains("sale")) {
+            if (!Check.isNull(projectId)) {
+                projectIds.add(projectId);
+            } else if (!Check.isNull(productId)) {
+                List<Long> projectIdsByProductId = projectService.getProjectIdsByProductId(productId);
+                projectIds.addAll(projectIdsByProductId);
+            }
+            return materialInfoService.getListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, null, clipId, shotId, planId, offlineFlag, pageNo, pageSize);
+            //运营经理、运营、运营助理
+        } else if ("operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode)) {
+            if (!Check.isNull(projectId)) {
+                projectIds.add(projectId);
+            } else if (!Check.isNull(productId)) {
+                List<Long> partakeProjectIds = projectMemberService.getProjectIdsByProductId(productId, userId);
+                List<Long> productProjectIds = projectService.getProjectIdsByProductIdAndNotIn(productId, partakeProjectIds);
+                projectIds.addAll(partakeProjectIds);
+                projectIds.addAll(productProjectIds);
+            } else {
+                List<Long> partakeProjectIds = projectMemberService.getProjectIdsByProductId(null, userId);
+                List<Long> productProjectIds = projectService.getProjectIdsByProductIdAndNotIn(null, partakeProjectIds);
+                projectIds.addAll(partakeProjectIds);
+                projectIds.addAll(productProjectIds);
             }
-            return materialInfoService.getListByParams(tagCode, type, status, productIds, materialName, code, startDate, endDate, null, projectId, clipId, shotId, planId,offlineFlag, pageNo, pageSize);
+            return materialInfoService.getListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, null, clipId, shotId, planId, offlineFlag, pageNo, pageSize);
+
         } else if ("designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode) || "plane".equals(roleCode) || "plan".equals(roleCode) || "shot".equals(roleCode)) {
             //查询自己所在项目下的数据
-            if (null == productId || productId == 0) {
-                productIds = memberService.selectProductsByUserId(userId);
+            if (!Check.isNull(projectId)) {
+                projectIds.add(projectId);
+            } else if (!Check.isNull(productId)) {
+                projectIds = projectMemberService.getProjectIdsByProductId(productId, userId);
 
             } else {
-                productIds = new ArrayList<>();
-                productIds.add(productId);
+                projectIds = projectMemberService.getProjectIdsByProductId(null, userId);
             }
-            return materialInfoService.getListByParams(tagCode, type, status, productIds, materialName, code, startDate, endDate, null, projectId, clipId, shotId, planId,offlineFlag, pageNo, pageSize);
+            return materialInfoService.getListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, null, clipId, shotId, planId, offlineFlag, pageNo, pageSize);
         } else {
             //查询自己上传的视频
-            if (null != productId && productId != 0) {
-                productIds = new ArrayList<>();
-                productIds.add(productId);
+            if (!Check.isNull(projectId)) {
+                projectIds.add(projectId);
+            } else if (!Check.isNull(productId)) {
+                projectIds = projectMemberService.getProjectIdsByProductId(productId, userId);
             }
-            return materialInfoService.getListByParams(tagCode, type, status, productIds, materialName, code, startDate, endDate, userId, projectId, clipId, shotId, planId,offlineFlag, pageNo, pageSize);
+            return materialInfoService.getListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, userId, clipId, shotId, planId, offlineFlag, pageNo, pageSize);
         }
     }
 
@@ -513,8 +541,60 @@ public class MaterialInfoController {
         if (!Check.isNull(materialInfo.getSlogans())) {
             JSONArray slogans = materialInfo.getSlogans();
             if (null != slogans && !slogans.isEmpty()) {
+
+
+                for (int i = 0; i < slogans.size(); i++) {
+                    JSONObject slogenInfo = slogans.getJSONObject(i);
+                    String title = slogenInfo.getString("title");
+                    title = title.trim().replaceAll("[\\{]{2,}", "{");
+                    title = title.trim().replaceAll("[\\}]{2,}", "}");
+                    slogenInfo.put("title", title);
+                    String reg = "\\{[\\u4e00-\\u9fa5\\-]{2,6}\\}";
+                    Pattern pattern = Pattern.compile(reg);
+                    Matcher matcher = pattern.matcher(title);
+                    JSONArray creativeWordIdsArray = new JSONArray();
+
+                    int len = StringUtils.lengthAsSlogan(title);
+                    int left = title.indexOf("{");
+                    int right = title.indexOf("}");
+                    if (left >= 0 || right >= 0) {
+                        int times = 0;
+                        while (matcher.find()) { //此处find()每次被调用后,会偏移到下一个匹配
+                            times++;
+                            if (times >= 3) {
+                                result.setCode(500);
+                                result.setMessage("动态词包不合法,词包数量超过2个");
+                                return result;
+                            }
+                            String matchStr = matcher.group();//获取当前匹配的值
+                            title = title.replace(matchStr, "");
+                            ByteDanceCreativeWordPackage creativeWordPackage = byteDanceGeneralCopywriterService.selectCreativeWordPackageByName(matchStr.substring(1, matchStr.length() - 1));
+                            if (Check.isNull(creativeWordPackage)) {
+                                result.setCode(500);
+                                result.setMessage("动态词包不合法,词包不存在或者含有单独的非词包大括号");
+                                return result;
+                            }
+                            creativeWordIdsArray.add(creativeWordPackage.getCreativeWordId());
+                            len = len - (right - left) + creativeWordPackage.getMaxWordLen();
+                            left = title.indexOf("{");
+                            right = title.indexOf("}");
+                        }
+                        if (title.contains("{") || title.contains("}")) {
+                            return result.error500("大括号单独出现或大括号中内容不合法");
+                        }
+                        slogenInfo.put("creative_word_ids", creativeWordIdsArray.toJSONString());
+                    }
+                    //校验标题长度,长度小于5和大于30的全部过滤
+                    if (len < 5 || len > 30) {
+                        result.setCode(500);
+                        result.setMessage("文案长度不合法,小于5或大于30");
+                        return result;
+                    }
+                }
+
                 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-                slogenInfoService.insertSlogans(materialInfo.getProjectId(), materialInfoEntity.getCode(), slogans, user.getId());
+                slogenInfoService.deleteAllSlogens(Check.isNull(materialInfo.getProjectId()) ? materialInfoEntity.getProjectId() : materialInfo.getProjectId(), materialInfoEntity.getCode(), user.getId());
+                slogenInfoService.insertSlogans(Check.isNull(materialInfo.getProjectId()) ? materialInfoEntity.getProjectId() : materialInfo.getProjectId(), materialInfoEntity.getCode(), slogans, user.getId());
             }
         }
         boolean ok = materialInfoService.updateById(materialInfo);
@@ -545,6 +625,7 @@ public class MaterialInfoController {
                 sendMessageService.sendMessage(userId, text);
             }
         }
+        result.setCode(0);
         return result;
 
     }
@@ -563,11 +644,14 @@ public class MaterialInfoController {
         for (String id : ids) {
             materialInfo.setId(id);
             Result<MaterialInfo> materialInfoResult = bytedanceEdit(materialInfo);
-            if (materialInfoResult.getCode().equals(CommonConstant.SC_OK_200)) {
-                successNum++;
+            if (!materialInfoResult.getCode().equals(0)) {
+                return materialInfoResult;
             }
+            successNum++;
         }
-        return result.success("批量修改成功" + successNum + "个");
+        result.setCode(0);
+        result.setMessage("批量通过" + successNum + "个视频");
+        return result;
 
     }
 

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

@@ -323,18 +323,21 @@ public class ProjectMemberController {
             if (Check.isNull(projectId)) {
                 throw new Exception("请选择项目");
             }
-            String projectName = jsonObject.getString("projectName");
+            Project project = projectService.getById(projectId);
+            if(Check.isNull(project)){
+                throw new Exception("项目不存在");
+            }
             JSONArray memberArr = jsonObject.getJSONArray("memberArr");
             if (Check.isNull(memberArr)) {
                 throw new Exception("请选择项目成员");
             }
             for (int i = 0; i < memberArr.size(); i++) {
-                String userId = memberArr.get(i).toString();
+                String userId = memberArr.getString(i);
                 if (!Check.isNull(userId)) {
                     QueryWrapper<ProjectMember> queryWrapper = new QueryWrapper<>();
                     queryWrapper.eq("user_id", userId);
                     queryWrapper.eq("project_id", projectId);
-                    ProjectMember selectMember = (ProjectMember) projectMemberService.getOne(queryWrapper);
+                    ProjectMember selectMember = projectMemberService.getOne(queryWrapper);
                     if (!Check.isNull(selectMember)) {
                         continue;
                     }
@@ -344,7 +347,7 @@ public class ProjectMemberController {
                         member.setRoleCode(roleCode);
                     }
                     member.setProjectId(projectId);
-                    member.setProjectName(projectName);
+                    member.setProjectName(project.getProjectName());
                     member.setUserId(userId);
                     SysUser sysUser = sysUserService.getById(userId);
                     if (!Check.isNull(sysUser)) {

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

@@ -2,6 +2,7 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.entity.*;
 import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
+import cn.com.ctop.common.module.mapper.MailLogMapper;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.*;
@@ -34,6 +35,7 @@ import cn.com.ctop.toutiao.modules.report.service.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.xxl.job.core.context.XxlJobHelper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.annotations.Param;
@@ -119,18 +121,19 @@ public class TestController {
     private IUserAllocationService allocationService;
     @Autowired
     private ICtopOauthTokenService tokenService;
-
     @Autowired
     private IKuaiShouProjectDataService kuaiShouProjectDataService;
     @Autowired
-    private IKuaishouReportHourlyGroupService hourlyGroupService;
-    @Autowired
     private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
 
     @Autowired
     private IKuaiShouCreativeService creativeService;
     @Autowired
     private IKuaiShouGroupService groupService;
+    @Autowired
+    private MailLogMapper mailLogMapper;
+    @Autowired
+    private CorpWexinUtils corpWexinUtils;
 
     @Autowired
     private IBatchService batchService;
@@ -141,6 +144,18 @@ public class TestController {
     @Value("${xxl-job.requestUrl}")
     private String jobUrl;
 
+    @GetMapping("/testSend")
+    public void testSend(String userId) {
+
+        JSONObject weChatId = mailLogMapper.getWChatIdByUserId(userId);
+        if (weChatId.isEmpty()) {
+            log.error(String.format("User WeChat not found. userId =%s", userId));
+            //TODO 通知管理员添加邮箱
+        } else {
+            corpWexinUtils.sendMessageByWeChatId(weChatId, "hahahahahahah");
+        }
+    }
+
     @GetMapping("/uploadVideo")
     public String uploadVideo(Long projectId) {
 
@@ -160,207 +175,6 @@ public class TestController {
         return "success";
     }
 
-
-    @GetMapping(value = "/getProgramCreative")
-    public void getProgramCreative() {
-        List<Long> list = new ArrayList();
-        list.add(10045052L);
-        list.add(10045823L);
-        list.add(10045830L);
-        list.add(10045831L);
-
-        for (int i = 0; i < list.size(); i++) {
-            Long accountId = list.get(i);
-            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
-            creativeService.getProgramCreative(oauthToken, 1);
-        }
-
-
-    }
-
-
-    @GetMapping(value = "/campaignList")
-    public void campaignList() {
-        List<Long> list = new ArrayList();
-        list.add(10045052L);
-        list.add(10045823L);
-        list.add(10045830L);
-        list.add(10045831L);
-        for (int i = 0; i < list.size(); i++) {
-            Long accountId = list.get(i);
-            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
-            // kuaishouInterfaceService.getCampaignList(oauthToken, null, null);
-            videoService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        kuaishouInterfaceService.getCampaignList(oauthToken, null, null);
-                        //   kuaishouInterfaceService.getGroupList(oauthToken, null, null);
-                        //     kuaishouInterfaceService.getCreativeList(oauthToken, null, null);
-                        Thread.sleep(1500);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    }
-                }
-            });
-
-        }
-
-    }
-
-
-    @GetMapping(value = "/creativeList")
-    public void creativeList() {
-        List<Long> list = new ArrayList();
-        list.add(10045052L);
-        list.add(10045823L);
-        list.add(10045830L);
-        list.add(10045831L);
-        for (int i = 0; i < list.size(); i++) {
-            Long accountId = list.get(i);
-            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
-            QueryWrapper<KuaiShouCampaign> campaignQueryWrapper = new QueryWrapper<>();
-            campaignQueryWrapper.eq("account_id", accountId);
-
-            List<KuaiShouCampaign> list1 = campaignService.list(campaignQueryWrapper);
-            for (KuaiShouCampaign campaign : list1) {
-                executorService.submit(new Runnable() {
-                    @Override
-                    public void run() {
-                        kuaishouInterfaceService.getCreativeList(oauthToken, null, null);
-                    }
-                });
-                try {
-                    Thread.sleep(400L);
-                } catch (InterruptedException e) {
-                    e.printStackTrace();
-                }
-            }
-
-
-        }
-
-    }
-
-
-    @GetMapping(value = "/updateUnit")
-    public void updateUnit() throws Exception {
-        List<Long> list = new ArrayList();
-        list.add(9556344L);
-        list.add(9743738L);
-        list.add(9743727L);
-        list.add(9812671L);
-        list.add(9838554L);
-        list.add(9743746L);
-        list.add(9767055L);
-        list.add(9556274L);
-        list.add(9767096L);
-        list.add(9792538L);
-        list.add(9766952L);
-        list.add(9677440L);
-        list.add(9677334L);
-        list.add(9556465L);
-        list.add(9677236L);
-        list.add(9556227L);
-        list.add(9556188L);
-        list.add(9556431L);
-        list.add(9677408L);
-        list.add(9677284L);
-
-        for (int i = 0; i < list.size(); i++) {
-            Long accountId = list.get(i);
-            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
-            QueryWrapper<KuaiShouGroup> groupQueryWrapper = new QueryWrapper<>();
-            groupQueryWrapper.eq("account_id", accountId);
-            //      groupQueryWrapper.ne("schedule_time","000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111");
-            //     groupQueryWrapper.eq("use_app_market", 1);
-            //    groupQueryWrapper.gt("cpa_bid", 19000);
-
-
-            List<KuaiShouGroup> list1 = groupService.list(groupQueryWrapper);
-          /*  for (KuaiShouGroup group : list1) {
-
-                JSONObject json = new JSONObject();
-                json.put("unitId", group.getUnitId());
-                json.put("useAppMarket", 0);
-                json.put("appStore", new JSONArray());
-                batchService.updateUnit(json, oauthToken);
-            }*/
-
-            for (KuaiShouGroup group : list1) {
-                executorService.submit(new Runnable() {
-                    @Override
-                    public void run() {
-                        try {
-                            JSONObject json = new JSONObject();
-                            json.put("unitId", group.getUnitId());
-                            json.put("cpaBid", 18 * 1000);
-                            //     json.put("gender", "2");
-                            batchService.updateUnit(json, oauthToken);
-                            Thread.sleep(1500);
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                        }
-                    }
-                });
-
-
-            }
-
-
-        }
-
-
-    }
-
-
-    @GetMapping(value = "/updateCreative")
-    public void updateCreative() {
-        List<Long> list = new ArrayList();
-        list.add(10045052L);
-        list.add(10045823L);
-        list.add(10045830L);
-        list.add(10045831L);
-
-        for (int i = 0; i < list.size(); i++) {
-            Long accountId = list.get(i);
-            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
-
-
-            QueryWrapper<KuaiShouCreative> creativeQueryWrapper = new QueryWrapper<>();
-            creativeQueryWrapper.eq("account_id", accountId);
-
-
-            List<KuaiShouCreative> creativeList = creativeService.list(creativeQueryWrapper);
-            for (KuaiShouCreative creative : creativeList) {
-                executorService.submit(new Runnable() {
-                    @Override
-                    public void run() {
-                        try {
-                            JSONObject json = new JSONObject();
-                            json.put("creativeId", creative.getCreativeId());
-                            String url = "https://click-wailaxin.1sapp.com/vendor/feedback/reportClick?platform=kuaishou&feedback_type=android&account_id=19&plan_id=__DID__&adgroup_id=__AID__&creative_id=__CID__&imei=__IMEI2__&mac=__MAC__&androidid=__ANDROIDID2__&ts=__TS__&ip=__IP__&ua=__UA__&callback=__CALLBACK__&oaid=__OAID__&app=dxqlb";
-
-                            if (creative.getCreativeMaterialType() == 1) {
-                                json.put("clickTrackUrl", url);
-                            } else if (creative.getCreativeMaterialType() == 4) {
-                                json.put("impressionUrl", url);
-                                json.put("clickTrackUrl", url);
-
-                            }
-                            JSONObject jsonObject = batchService.updateCreative(json, oauthToken);
-                            log.info("修改创意返回信息:creative:{},结果:{}", creative.getCreativeId(), jsonObject);
-                            Thread.sleep(1000L);
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                        }
-                    }
-                });
-            }
-        }
-    }
-
-
     @GetMapping("/cleanNewlyData")
     public void cleanNewlyData(String startDate, String endDate) throws ParseException {
 
@@ -406,19 +220,6 @@ public class TestController {
 
     }
 
-    @GetMapping("/getVideoByProjectId")
-    public String getVideoByProjectId(Long projectId) {
-        QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("project_id", projectId);
-        List<UserAllocation> list = allocationService.list(queryWrapper);
-        for (UserAllocation allocation : list) {
-            CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
-            kuaishouInterfaceService.getVideoList(token, null, null);
-        }
-        return "success";
-    }
-
-
     @GetMapping("/testKuaishou")
     public String kuaishouCallback(@RequestParam("auth_code") String authCode, @RequestParam("state") String state) {
         try {
@@ -528,115 +329,6 @@ public class TestController {
         return "授权绑定失败!";
     }
 
-
-    @GetMapping("/getBytedanceMatReport")
-    public Map<String, Object> getData() {
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        executorService = Executors.newFixedThreadPool(10);
-        CountDownLatch countDownLatch = new CountDownLatch(tokens.size());
-        tokens.forEach(record -> executorService.submit(() -> {
-            try {
-                reportService.getAdvertiserReport(record, DateUtils.parseDate("2021-01-01", "yyyy-MM-dd"), DateUtils.parseDate("2021-01-31", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-                log.info("账户数据获取完成:account:{},时间:{}-{}", record.getAccountId(), "2021-01-01", "2020-01-31");
-            } catch (Exception e) {
-
-            } finally {
-                countDownLatch.countDown();
-            }
-        }));
-        try {
-            countDownLatch.await();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-        Map<String, Object> result = new HashMap<>();
-        ResultMapUtils.setResultMap(new HashMap<>(), StatusCode.COMMON_SUCCESS);
-        return result;
-    }
-
-
-    @GetMapping(value = "/updateTemplate")
-    public void updateTemplate(Long projectId, String startDate, String endDate) {
-
-        List<Long> list = new ArrayList();
-        list.add(7022550L);
-        list.add(7409586L);
-        list.add(5473041L);
-        list.add(5852766L);
-        list.add(6962896L);
-        list.add(7409919L);
-        for (int i = 0; i < list.size(); i++) {
-            Long accountId = list.get(i);
-            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
-            templateService.getTemplateByAccountId(oauthToken.getAccountId(), oauthToken.getAccessToken(), 1);
-
-            QueryWrapper<KuaishouTemplate> queryWrapper = new QueryWrapper<>();
-            queryWrapper.eq("account_id", accountId);
-            List<KuaishouTemplate> list1 = templateService.list(queryWrapper);
-            if (!Check.isNull(list1)) {
-                for (KuaishouTemplate template : list1) {
-                    JSONObject param = new JSONObject();
-                    param.put("templateId", template.getTemplateId());
-                    param.put("accountId", template.getAccountId());
-                    param.put("templateName", template.getTemplateName());
-                    param.put("filterConvertedLevel", 5);
-                    templateService.updateTemplate(oauthToken.getAccountId(), oauthToken.getAccessToken(), param);
-
-                }
-
-            }
-
-
-        }
-
-
-    }
-
-
-    @GetMapping(value = "/getCreativeByProjectId")
-    public void gerCreative(Long projectId, String startDate, String endDate) {
-
-        Result<String> result = new Result<>();
-        try {
-            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-            Date start = simpleDateFormat.parse(startDate);
-            Date end = simpleDateFormat.parse(endDate);
-            QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
-            userAllocationQueryWrapper.eq("project_id", projectId);
-            List<UserAllocation> list = userAllocationService.list(userAllocationQueryWrapper);
-            if (!Check.isNull(list)) {
-                for (UserAllocation allocation : list) {
-                    Long accountId = allocation.getAccountId();
-                    QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
-                    tokenQueryWrapper.eq("media_id", 2);
-                    tokenQueryWrapper.eq("account_id", accountId);
-                    CtopOauthToken token = tokenMapper.selectOne(tokenQueryWrapper);
-                    if (!Check.isNull(token)) {
-                        suzhaoService.submit(new Runnable() {
-                            @Override
-                            public void run() {
-                                JSONArray arr = new JSONArray();
-                                kuaishouInterfaceService.getAdvertiserCreativeReportDaily(token, start, end, arr, arr);
-
-                            }
-                        });
-
-
-                    }
-                }
-
-            }
-
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            result.setSuccess(false);
-        }
-
-
-    }
-
-
     @GetMapping(value = "/agentReport")
     public void agentReport(String startDate, String endDate) {
         dailyAgentService.getAgentReportByPage(startDate, endDate);
@@ -1460,6 +1152,7 @@ public class TestController {
     @Autowired
     private IKuaishouStrategyService kuaishouStrategyService;
     static ExecutorService executorServic1e = Executors.newFixedThreadPool(5);
+
     /**
      * 勿动勿删,煜一人群报表数据拉取接口。
      *
@@ -1542,6 +1235,7 @@ public class TestController {
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
+
     @Autowired
     private IBytedanceCheckReportTaskInfoService checkReportTaskInfoService;
 
@@ -1557,13 +1251,43 @@ public class TestController {
     @GetMapping("testCheckCost")
     public Map<String, Object> testCheckCost(String date) throws ParseException {
         Map<String, Object> result = new HashMap<>();
-        List<BytedanceCheckReportTaskInfo>taskInfos = checkReportTaskInfoService.getListByParams(null,"2021-06-01",0);
-        if(null!=taskInfos&&!taskInfos.isEmpty()){
-            for (BytedanceCheckReportTaskInfo taskInfo:taskInfos) {
+        List<BytedanceCheckReportTaskInfo> taskInfos = checkReportTaskInfoService.getListByParams(null, "2021-06-01", 0);
+        if (null != taskInfos && !taskInfos.isEmpty()) {
+            for (BytedanceCheckReportTaskInfo taskInfo : taskInfos) {
                 checkReportTaskInfoService.checkCost(taskInfo);
             }
         }
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
+
+    @GetMapping("checkCostData")
+    public void checkCostData(String date){
+            //1:初始化
+            checkReportTaskInfoService.initTask(date);
+            //2: checkCost
+            List<BytedanceCheckReportTaskInfo>taskInfos = checkReportTaskInfoService.getListByParams(null,date,0);
+            if(null!=taskInfos&&!taskInfos.isEmpty()){
+                for (BytedanceCheckReportTaskInfo task:taskInfos) {
+                    checkReportTaskInfoService.checkCost(task);
+                }
+                log.info("{}:数据获取完成",date);
+            }
+    }
+
+    @GetMapping("refreshReportData")
+    public void refreshReportData()throws Exception{
+        //1:查询异常任务数据
+        List<BytedanceCheckReportTaskInfo>taskInfos = checkReportTaskInfoService.getListByParams(null,null,50001);
+        if(null!=taskInfos&&!taskInfos.isEmpty()){
+            taskInfos.forEach(taskInfo -> {
+                try {
+                    checkReportTaskInfoService.reloadData(taskInfo);
+                    checkReportTaskInfoService.checkCost(taskInfo);
+                }catch (Exception e) {
+                }
+            });
+            log.info("数据更新完成");
+        }
+    }
 }

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

@@ -499,10 +499,10 @@ public class UserAllocationController {
             ProjectMember member = memberMapper.selectOne(memberQueryWrapper);
             if (Check.isNull(member)) {
                 ProjectMember addMember = new ProjectMember();
-                addMember.setProjectId(userAllocation.getProjectId());
-                addMember.setUserId(userAllocation.getUserId());
-                addMember.setUserName(userAllocation.getUserName());
-                String roleCode = sysRoleService.getRoleCodeByUserId(userAllocation.getUserId());
+                addMember.setProjectId(userAllocationEntity.getProjectId());
+                addMember.setUserId(userAllocationEntity.getUserId());
+                addMember.setUserName(userAllocationEntity.getUserName());
+                String roleCode = sysRoleService.getRoleCodeByUserId(userAllocationEntity.getUserId());
                 if (!Check.isNull(roleCode)) {
                     addMember.setRoleCode(roleCode);
                 }

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

@@ -22,32 +22,34 @@ public interface ProjectMemberMapper extends BaseMapper<ProjectMember> {
 
     List<Long> selectProductsByUserId(@Param("userId") String userId);
 
-    List<ProjectMember> adminProjects(@Param("mediaIds")List<Integer> mediaIds);
+    List<ProjectMember> adminProjects(@Param("mediaIds") List<Integer> mediaIds);
 
-    List<ProjectMember> designLeaderProjects(@Param("companyId")String companyId ,@Param("mediaIds")List<Integer> mediaIds);
+    List<ProjectMember> designLeaderProjects(@Param("companyId") String companyId, @Param("mediaIds") List<Integer> mediaIds);
 
-    List<ProjectMember> designProjects(@Param("userId")String userId, @Param("mediaIds")List<Integer> mediaIds);
+    List<ProjectMember> designProjects(@Param("userId") String userId, @Param("mediaIds") List<Integer> mediaIds);
 
-    List<ProjectMember> operationProjects(@Param("userId")String userId, @Param("mediaIds")List<Integer> mediaIds);
+    List<ProjectMember> operationProjects(@Param("userId") String userId, @Param("mediaIds") List<Integer> mediaIds);
 
-    String getRoleCodeByUserId(@Param("userId")String userId);
+    String getRoleCodeByUserId(@Param("userId") String userId);
 
-    String getCompanyIdByUserId(@Param("userId")String userId);
+    String getCompanyIdByUserId(@Param("userId") String userId);
 
-    List<ProjectMember> queryProjectMemberByUserId(@Param("userId")String userId, @Param("mediaIds")List<Integer> mediaIds);
+    List<ProjectMember> queryProjectMemberByUserId(@Param("userId") String userId, @Param("mediaIds") List<Integer> mediaIds);
 
 
-    List<ProjectMember> getSaleProjects(@Param("userId")String userId, @Param("mediaIds")List<Integer> mediaIds);
+    List<ProjectMember> getSaleProjects(@Param("userId") String userId, @Param("mediaIds") List<Integer> mediaIds);
 
     List<Long> getProjectByMap(@Param("userId") String userId);
 
-    List<Project> getProjectByUserId(@Param("userId")String userId);
+    List<Project> getProjectByUserId(@Param("userId") String userId);
 
-    List<Long> getProjectByAccountIds(@Param("accountIds")JSONArray accountIds);
+    List<Long> getProjectByAccountIds(@Param("accountIds") JSONArray accountIds);
 
-    List<Long> getProductByAccountIds(@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);
+    List<ProjectMember> getProductIds(@Param("userId") String userId, @Param("mediaList") List<Integer> mediaList, @Param("productId") Long productId);
+
+    List<Long> getProjectIdsByProductId(@Param("productId") Long productId, @Param("userId") String userId);
 }

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

@@ -99,7 +99,7 @@
         ctop_etl_kuaishou_account_material_report_daily
         WHERE
         1=1
-        <if test="projects !=null">
+        <if test="projects !=null and projects.size() > 0">
             AND project_id IN
             <foreach collection="projects" item="item" separator=","
                      open="(" close=")">
@@ -227,7 +227,8 @@
     <select id="queryBytedanceTopMaterial" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         t1.*,
-        IFNULL((SELECT GROUP_CONCAT(tag_name) from ctop_material_tag_info where code=signature and status=1),"塑造") as  tag
+        IFNULL((SELECT GROUP_CONCAT(tag_name) from ctop_material_tag_info where code=signature and status=1),"塑造") as
+        tag
         FROM
         (SELECT md5 signature,
         IFNULL(toutiao_url, '') AS url,

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

@@ -262,6 +262,20 @@
         group by t2.id
         order by t2.create_time desc
     </select>
+    <select id="getProjectIdsByProductId" resultType="java.lang.Long">
+        SELECT
+        t1.id
+        FROM
+        ctop_project t1
+        LEFT JOIN ctop_project_member t2 ON t1.id = t2.project_id
+        WHERE
+        t2.user_id = #{userId}
+        <if test="productId != null and productId != ''">
+            AND t1.product_id = #{productId}
+        </if>
+        GROUP BY
+        t1.id
+    </select>
 
 
 </mapper>

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

@@ -50,4 +50,6 @@ public interface IProjectMemberService extends IService<ProjectMember> {
     List<ProjectMember> getMapsByProjectList(List<ProjectMember> projectMembers);
 
     List<ProjectMember> getOwnProducts(List<Integer> mediaList, Long productId);
+
+    List<Long> getProjectIdsByProductId(Long productId, String userId);
 }

+ 7 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BidWarningServiceImpl.java

@@ -13,6 +13,7 @@ import cn.com.ctop.common.module.utils.SendMailUtil;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertisePlanService;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
@@ -42,6 +43,8 @@ public class BidWarningServiceImpl implements IBidWarningService {
     private MailLogMapper mailLogMapper;
     @Autowired
     private IByteDanceAdvertisePlanService byteDanceAdvertisePlanService;
+    @Autowired
+    private CorpWexinUtils corpWexinUtils;
 
 
     /**
@@ -62,7 +65,7 @@ public class BidWarningServiceImpl implements IBidWarningService {
                     }
                     Long maxBid = project.getMaxBid();
                     Long projectId = project.getId();
-                    List<UserAllocation> userAllocations = userAllocationService.getByParams(projectId,null,null);
+                    List<UserAllocation> userAllocations = userAllocationService.getByParams(projectId, null, null);
                     if (!Check.isNull(userAllocations)) {
                         for (UserAllocation userAllocation : userAllocations) {
                             if (userAllocation.getAccountStatus() == 1) {
@@ -91,6 +94,7 @@ public class BidWarningServiceImpl implements IBidWarningService {
             e.printStackTrace();
         }
     }
+
     private void sendMessage(String mediaId, Long accountId, Long projectId, String projectName, String authName, List<String> unitWarning, Long maxBid) {
         String createTime = DateUtils.getNowDate("yyyy-MM-dd");
         Integer count = mailLogMapper.selectCountByAccountIdAndDate(accountId, createTime, 1);
@@ -125,8 +129,8 @@ public class BidWarningServiceImpl implements IBidWarningService {
             }
         }
 
-        List<String> wexinIds = mailLogMapper.selectWeiXinIdList(projectId);
-        CorpWexinUtils.sendMessage(wexinIds, text.toString());
+        List<JSONObject> wexinIds = mailLogMapper.selectWeiXinIdList(projectId);
+        corpWexinUtils.sendMessage(wexinIds, text.toString());
     }
 
 

+ 6 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CpaBidWarningServiceImpl.java

@@ -12,6 +12,7 @@ import cn.com.ctop.common.module.utils.SendMailUtil;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertisePlanService;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.ctop.service.ICpaBidWarningService;
@@ -37,6 +38,8 @@ public class CpaBidWarningServiceImpl implements ICpaBidWarningService {
     private MailLogMapper mailLogMapper;
     @Autowired
     private IByteDanceAdvertisePlanService byteDanceAdvertisePlanService;
+    @Autowired
+    private CorpWexinUtils corpWexinUtils;
 
     /**
      * 预警
@@ -45,7 +48,7 @@ public class CpaBidWarningServiceImpl implements ICpaBidWarningService {
     public void cpaBidWarning(Project project) {
         try {
             BigDecimal maxDeepCpaBid = project.getMaxDeepCpaBid();
-            List<UserAllocation> userAllocations = userAllocationService.getByParams(project.getId(),null,null);
+            List<UserAllocation> userAllocations = userAllocationService.getByParams(project.getId(), null, null);
             if (!Check.isNull(userAllocations)) {
                 for (UserAllocation userAllocation : userAllocations) {
                     if (userAllocation.getAccountStatus() == 1) {
@@ -109,8 +112,8 @@ public class CpaBidWarningServiceImpl implements ICpaBidWarningService {
             }
         }
 
-        List<String> wexinIds = mailLogMapper.selectWeiXinIdList(projectId);
-        CorpWexinUtils.sendMessage(wexinIds, text.toString());
+        List<JSONObject> wexinIds = mailLogMapper.selectWeiXinIdList(projectId);
+        corpWexinUtils.sendMessage(wexinIds, text.toString());
     }
 
 

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

@@ -439,7 +439,7 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
         }
         //如果以上角色都不是的话直接查询此角色所属项目
         //   projectMemberList = memberMapper.designProjects(userId, mediaList);
-        List<ProjectMember> projectMemberList  = memberMapper.getProductIds(userId, mediaList,productId);
+        List<ProjectMember> projectMemberList = memberMapper.getProductIds(userId, mediaList, productId);
 
 
         if (null == projectMemberList) {
@@ -449,6 +449,11 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
         return projectMemberList;
     }
 
+    @Override
+    public List<Long> getProjectIdsByProductId(Long productId, String userId) {
+        return memberMapper.getProjectIdsByProductId(productId, userId);
+    }
+
 }
 
 

+ 19 - 17
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/util/ApprovalNodeNoticeHandler.java

@@ -21,18 +21,20 @@ public class ApprovalNodeNoticeHandler {
 
     @Autowired
     IPlatformMaterialService platformMaterialService;
+    @Autowired
+    private CorpWexinUtils corpWexinUtils;
 
     /**
-     *  企业微信通知
+     * 企业微信通知
      */
-    public void NOTICE_WE_CHAT_ORDER(String operate, String orderCode){
-        Map<String, JSONObject> relatePerson=relatePerson(orderCode,null);
-        message(operate,null, relatePerson.get("orderRelatePerson"));
+    public void NOTICE_WE_CHAT_ORDER(String operate, String orderCode) {
+        Map<String, JSONObject> relatePerson = relatePerson(orderCode, null);
+        message(operate, null, relatePerson.get("orderRelatePerson"));
     }
 
-    public void NOTICE_WE_CHAT_MATERIAL(String operate, String materialCode){
-        Map<String, JSONObject> relatePerson=relatePerson(null,materialCode);
-        message(operate,relatePerson.get("materialRelatePerson"),null);
+    public void NOTICE_WE_CHAT_MATERIAL(String operate, String materialCode) {
+        Map<String, JSONObject> relatePerson = relatePerson(null, materialCode);
+        message(operate, relatePerson.get("materialRelatePerson"), null);
     }
 
     /**
@@ -40,7 +42,7 @@ public class ApprovalNodeNoticeHandler {
      */
     private Map<String, JSONObject> relatePerson(String orderCode, String materialCode) {
         Map<String, JSONObject> result = new HashMap<>();
-        if (null==materialCode) {
+        if (null == materialCode) {
             result.put("orderRelatePerson", platformMaterialService.getOrderRelatePersonByMaterialCode(orderCode));
         } else {
             result.put("materialRelatePerson", platformMaterialService.getMaterialRelatePersonByMaterialCode(materialCode));
@@ -166,12 +168,12 @@ public class ApprovalNodeNoticeHandler {
      */
     private void sendWeChat(Set<String> users, String message) {
         users.forEach(userId -> {
-            String weChatId = mailLogMapper.getWChatIdByUserId(userId);
+            JSONObject weChatId = mailLogMapper.getWChatIdByUserId(userId);
             if (weChatId.isEmpty()) {
                 log.error(String.format("User WeChat not found. userId =%s", userId));
                 //TODO 通知管理员添加邮箱
             } else {
-                CorpWexinUtils.sendMessageByWeChatId(weChatId, message);
+                corpWexinUtils.sendMessageByWeChatId(weChatId, message);
             }
         });
     }
@@ -180,12 +182,12 @@ public class ApprovalNodeNoticeHandler {
      * 发送通知消息到多人企业微信
      */
     private void sendWeChat(String userId, String message) {
-            String weChatId = mailLogMapper.getWChatIdByUserId(userId);
-            if (weChatId.isEmpty()) {
-                log.error(String.format("User WeChat not found. userId =%s", userId));
-                //TODO 通知管理员添加邮箱
-            } else {
-                CorpWexinUtils.sendMessageByWeChatId(weChatId, message);
-            }
+        JSONObject weChatId = mailLogMapper.getWChatIdByUserId(userId);
+        if (weChatId.isEmpty()) {
+            log.error(String.format("User WeChat not found. userId =%s", userId));
+            //TODO 通知管理员添加邮箱
+        } else {
+            corpWexinUtils.sendMessageByWeChatId(weChatId, message);
+        }
     }
 }

+ 17 - 11
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java

@@ -1,11 +1,9 @@
 package org.jeecg.modules.system.controller;
 
-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.entity.*;
 import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.AesEncryptUtil;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
 import cn.com.feishu.provider.AuthProvider;
@@ -69,6 +67,8 @@ public class LoginController {
     private ICorpFeishuUserService corpFeishuUserService;
     @Autowired
     private ICtopCorpWexinUserService ctopCorpWexinUserService;
+    @Autowired
+    private IWexinConfigService wexinConfigService;
     private static final String BASE_CHECK_CODES = "qwertyuiplkjhgfdsazxcvbnmQWERTYUPLKJHGFDSAZXCVBNM1234567890";
 
     @GetMapping("feishu/url")
@@ -152,18 +152,23 @@ public class LoginController {
         }
     }
 
+
     @RequestMapping(value = "/wxlogin", method = RequestMethod.POST)
     @ApiOperation("企业微信登录接口")
-    public Result<JSONObject> wxlogin(@RequestParam(name = "code") String code) throws Exception {
+    public Result<JSONObject> wxlogin(@RequestParam(name = "code") String code, @RequestParam(name = "corpId") String corpId) throws Exception {
         Result<JSONObject> result = new Result<>();
+        WexinConfig wexinConfig = wexinConfigService.getInfoByCorpId(corpId);
+        if (Check.isNull(wexinConfig)) {
+            result.error500("未找到用户配置,请联系管理员");
+            return result;
+        }
         val configStorage = new WxCpDefaultConfigImpl();
-        configStorage.setCorpId("ww24b8a47826f5875f");
-        configStorage.setAgentId(1000002);
-        configStorage.setCorpSecret("MJIlySADGPlgvADnkFQPUpfZD4yV-4WN6066OgNnb0s");
-        configStorage.setToken("hcst2019");
-        configStorage.setAesKey("hcst2019");
+        configStorage.setCorpId(wexinConfig.getCorpId());
+        configStorage.setAgentId(wexinConfig.getAgentId());
+        configStorage.setCorpSecret(wexinConfig.getCorpSecret());
+        configStorage.setToken(wexinConfig.getToken());
+        configStorage.setAesKey(wexinConfig.getAesKey());
         val service = new WxCpServiceImpl();
-
         service.setWxCpConfigStorage(configStorage);
         WxCpOAuth2Service wxCpOAuth2Service = service.getOauth2Service();
         try {
@@ -193,6 +198,7 @@ public class LoginController {
                 CtopCorpWexinUser ctopCorpWexinUser = ctopCorpWexinUserService.getById(sysUser.getId());
                 if (ctopCorpWexinUser == null) {
                     ctopCorpWexinUser = new CtopCorpWexinUser();
+                    ctopCorpWexinUser.setCorpId(corpId);
                     ctopCorpWexinUser.setUserId(sysUser.getId());
                     ctopCorpWexinUser.setWexinEmail(user.getEmail());
                     ctopCorpWexinUser.setWexinGender(user.getGender().getGenderName());

+ 0 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java

@@ -64,10 +64,6 @@ public class SysDepartController {
     private ISysBaseApi sysBaseAPI;
     @Autowired
     private ISysDepartService sysDepartService;
-    @Autowired
-    private ISysUserService sysUserService;
-    @Autowired
-    private ISysUserDepartService sysUserDepartService;
     public RedisTemplate<String, Object> redisTemplate;
 
     /**

+ 61 - 8
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java

@@ -15,6 +15,9 @@ import cn.com.ctop.common.module.utils.StatusCode;
 import cn.com.ctop.common.module.vo.SysDepartUsersVO;
 import cn.com.ctop.common.module.vo.SysUserRoleVO;
 import cn.com.ctop.common.module.vo.SysUserVo;
+import cn.com.ctop.toutiao.modules.operation.entity.BytedanceOperationLog;
+import cn.com.ctop.toutiao.modules.operation.service.IBytedanceOperationLogService;
+import cn.com.ctop.toutiao.modules.operation.util.GetChangeDateUtil;
 import cn.hutool.core.util.RandomUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -27,6 +30,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
+import me.chanjar.weixin.common.annotation.Required;
 import org.apache.commons.lang.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
@@ -102,10 +106,12 @@ public class SysUserController {
     private IUserCompanyService userCompanyService;
     @Autowired
     private ISysRoleService roleService;
-
     @Resource
     private UserCompanyMapper userCompanyMapper;
     @Autowired
+    IBytedanceOperationLogService bytedanceOperationLogService;
+
+    @Autowired
     private RedisUtil redisUtil;
     @Value("${jeecg.path.upload}")
     private String upLoadPath;
@@ -126,9 +132,14 @@ public class SysUserController {
     }
 
     @RequestMapping(value = "/getAllUser", method = RequestMethod.GET)
-    public Result<Object> getAllUser(String status) {
+    public Result<Object> getAllUser(@RequestParam("status")String status,@RequestParam(name="userId",required = false )String userId) {
         try {
             List<SysUserVo> allUser = sysUserService.getAllUser(null, status);
+            if(!Check.isNull(userId)){
+                List<SysUserVo> mulUserList = treeCategoryData(allUser, userId);    //获取自己的下属id
+                allUser.removeAll(mulUserList);
+            }
+
             return Result.ok(allUser);
         } catch (Exception e) {
             e.printStackTrace();
@@ -136,6 +147,18 @@ public class SysUserController {
         return Result.error("查询失败");
     }
 
+    public List<SysUserVo> treeCategoryData(List<SysUserVo> allList, String leaderId) {
+        List<SysUserVo> mapList = new ArrayList<>();
+        for (SysUserVo vo : allList) {
+            if (leaderId.equals(vo.getLeaderId())){
+                mapList.add(vo);
+                mapList.addAll(treeCategoryData(allList,vo.getUserId()));
+            }
+        }
+        return mapList;
+
+    }
+
 
     /**
      * 获取用户列表数据
@@ -143,7 +166,7 @@ public class SysUserController {
      * @param user
      * @param pageNo
      * @param pageSize
-     * @param req
+     * @param
      * @return
      */
     @PermissionData(pageComponent = "system/UserList")
@@ -233,7 +256,7 @@ public class SysUserController {
             List<SysUserVo> userList;
 
             PageHelper.startPage(pageNo, pageSize);
-            if ("4b10089775c040119e139087517aed88".equals(companyId) || "6608ed13c0dd42de93c790dbdf124234".equals(companyId) || "d57fecdcf7a94d009736d9c850731582".equals(companyId)) {
+            if ("1648c7ceb4d449a9a13fbed7a8d9976c".equals(companyId) || "4b10089775c040119e139087517aed88".equals(companyId) || "6608ed13c0dd42de93c790dbdf124234".equals(companyId) || "d57fecdcf7a94d009736d9c850731582".equals(companyId)) {
                 userList = sysUserService.getAllUser(userName, null);
             } else {
                 userList = sysUserService.getUserListByCompany(companyId, userName);
@@ -329,9 +352,16 @@ public class SysUserController {
                     user.setOrgCode(depart.getOrgCode());
                 }
             }
+
+            if (Check.isNull(selectedRoles)){
+
+            }
+
             sysUserService.addUserWithRole(user, selectedRoles);
             sysUserService.addUserWithDepart(user, selectedDeparts);
             userCompanyService.addOrUpdateUserWithCompany(user);
+            //用户 分配角色 为 设计组长  用户设计组长姓名 为自己真实姓名
+            sysUserService.updUserDesignLeaderById(user.getId(),user.getRealname(),selectedRoles);
             result.success("添加成功!");
             sysBaseAPI.addLog("添加用户,id: " + user.getId(), CommonConstant.LOG_TYPE_2, 1);
         } catch (Exception e) {
@@ -347,8 +377,6 @@ public class SysUserController {
     private ISysDepartService departService;
 
     @RequestMapping(value = "/edit", method = RequestMethod.PUT)
-    //@RequiresRoles({"admin"})
-    //@RequiresPermissions("user:edit")
     public Result<SysUser> edit(@RequestBody JSONObject jsonObject) {
         Result<SysUser> result = new Result<SysUser>();
         try {
@@ -358,10 +386,33 @@ public class SysUserController {
             if (sysUser == null) {
                 result.error500("未找到对应实体");
             } else {
+                sysUser = sysUserService.queryPageList(sysUser).get(0);
                 SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class);
+
+                //汇报上级选择合法性校验:校验被修改人的汇报上级的汇报上级是不是本人
+                String leaderId = user.getLeaderId();
+                if(!Check.isNull(leaderId) && !sysUser.getLeaderId().equals(leaderId)){    //判断此次修改是否修改了leadId
+                    String leaderIdOfLeaderUser = sysUserService.getById(leaderId).getLeaderId();
+                    if(!Check.isNull(leaderIdOfLeaderUser) && leaderIdOfLeaderUser.equals(user.getId())){   //汇报上级的上级领导不为空,且恰好是自己构成了管理循环
+                        result.error500("要修改的汇报上级是自己的下属,请重新选择!");
+                        return result;
+                    }
+                }
+
+                //添加修改记录的日志
+                BytedanceOperationLog bytedanceOperationLog = new BytedanceOperationLog();
+                bytedanceOperationLog.setOldData(sysUser.toString());
+                bytedanceOperationLog.setNewData(user.toString());
+                String operationContent = user.getRealname() + ":" +GetChangeDateUtil.makeOperationContent(sysUser,user,new String[]{"leaderName", "departName","roleName"});
+                bytedanceOperationLog.setOperationContent(operationContent);
+                bytedanceOperationLog.setOperationType("用户管理-修改");
+                LoginUser createBy = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+                bytedanceOperationLog.setCreateById(createBy.getId());
+                bytedanceOperationLogService.save(bytedanceOperationLog);
+
                 user.setLeaderName(user.getLeaderName().trim());
                 user.setUpdateTime(new Date());
-                user.setLeaderName(user.getLeaderName().trim());
+//                user.setLeaderName(user.getLeaderName().trim());
                 //String passwordEncode = PasswordUtil.encrypt(user.getUsername(), user.getPassword(), sysUser.getSalt());
                 user.setPassword(sysUser.getPassword());
                 String roles = jsonObject.getString("selectedroles");//用户角色
@@ -388,12 +439,14 @@ public class SysUserController {
                                 ProjectMember updateMember = new ProjectMember();
                                 updateMember.setRoleCode(sysRole.getRoleCode());
                                 memberService.update(updateMember, memberQueryWrapper);//更新项目人员角色信息
+
                             }
                         }
                     };
                     thread.start();
                 }
-
+                //用户 分配角色 为 设计组长  用户设计组长姓名 为自己真实姓名
+                sysUserService.updUserDesignLeaderById(user.getId(),user.getRealname(),roles);
                 result.success("修改成功!");
             }
         } catch (Exception e) {

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

@@ -127,7 +127,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: foobared
+    password: hcst@2021..
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

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

@@ -127,7 +127,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: foobared
+    password: hcst@2021..
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

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

@@ -127,7 +127,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: foobared
+    password: hcst@2021..
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

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

@@ -119,7 +119,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: foobared
+    password: hcst@2021..
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

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

@@ -118,7 +118,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password:
+    password: hcst@2020
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

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

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

二進制
jeecg-boot-module-system/src/main/resources/lib/opencv-4.2.0.jar


+ 0 - 1
jeecg-boot-module-system/src/main/resources/static/demo1.html

@@ -1 +0,0 @@
-demo1

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

@@ -192,53 +192,35 @@ public class SampleTest {
     }
 
     @Test
-    public void checkCostData(){
-        String date = "2021-06-01";
-        for (int i=0;i<14;i++){
-            String getDate = DateUtils.addDay(date,i);
+    public void checkCostData() {
+        String date = "2021-06-11";
+        for (int i = 0; i < 7; i++) {
+            String getDate = DateUtils.addDay(date, i);
             //1:初始化
             checkReportTaskInfoService.initTask(getDate);
             //2: checkCost
-            List<BytedanceCheckReportTaskInfo>taskInfos = checkReportTaskInfoService.getListByParams(null,getDate,0);
-            if(null!=taskInfos&&!taskInfos.isEmpty()){
-                for (BytedanceCheckReportTaskInfo task:taskInfos) {
+            List<BytedanceCheckReportTaskInfo> taskInfos = checkReportTaskInfoService.getListByParams(null, getDate, 0);
+            if (null != taskInfos && !taskInfos.isEmpty()) {
+                for (BytedanceCheckReportTaskInfo task : taskInfos) {
                     checkReportTaskInfoService.checkCost(task);
                 }
-                log.info("{}:数据获取完成",getDate);
+                log.info("{}:数据获取完成", getDate);
             }
         }
     }
 
     @Test
-    public void reloadKuaishouData(){
-        String formatDate = "2021-06-01";
-        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        tokens.forEach(token -> {
-            try {
-                List<EtlKuaishouAccountMaterialReportDaily> getList = etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouAccountMaterialReportDailyList(formatDate,token.getAccountId());
-                if(null!=getList&&!getList.isEmpty()){
-                    getList.forEach(report->etlKuaishouAccountMaterialReportDailyMapper.replace(report));
-                }
-            }catch (Exception e){
-                e.printStackTrace();
-            }
-        });
-
-        log.info("{}数据获取完成",formatDate);
-    }
-
-    @Test
-    public void refreshReportData()throws Exception{
+    public void refreshReportData() throws Exception {
         //1:查询异常任务数据
-        List<BytedanceCheckReportTaskInfo>taskInfos = checkReportTaskInfoService.getListByParams(null,null,50001);
-        if(null!=taskInfos&&!taskInfos.isEmpty()){
+        List<BytedanceCheckReportTaskInfo> taskInfos = checkReportTaskInfoService.getListByParams(null, null, 50001);
+        if (null != taskInfos && !taskInfos.isEmpty()) {
             countDownLatch = new CountDownLatch(taskInfos.size());
             taskInfos.forEach(taskInfo -> {
                 try {
                     checkReportTaskInfoService.reloadData(taskInfo);
                     checkReportTaskInfoService.checkCost(taskInfo);
-                }catch (Exception e){
-                }finally {
+                } catch (Exception e) {
+                } finally {
                     countDownLatch.countDown();
                 }
             });
@@ -248,9 +230,18 @@ public class SampleTest {
     }
 
     @Test
-    public void testfreshBytedanceUrl(){
+    public void testfreshBytedanceUrl() {
         etlReportBytedanceVideoService.etlBytedanceVideoClipIdJob();
         etlReportBytedanceVideoService.etlBytedanceVideoPlanInfoJob();
         etlReportBytedanceVideoService.etlBytedanceVideoShotInfoJob();
     }
+
+    @Test
+    public void loadEffecfData(){
+        String startDate = "2021-05-01";
+        for(int i=0;i<=70;i++){
+            String getDate = DateUtils.addDay(startDate,i);
+            bytedanceVideoEtlInfoService.etlBytedanceVideoInfo(DateUtils.parseDate(getDate,"yyyy-MM-dd"));
+        }
+    }
 }

+ 27 - 23
module-check/src/main/java/cn/com/ctop/notice/handler/SendWeChatHandle.java

@@ -2,6 +2,7 @@ package cn.com.ctop.notice.handler;
 
 import cn.com.ctop.common.module.mapper.MailLogMapper;
 import cn.com.ctop.common.module.utils.CorpWexinUtils;
+import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -16,43 +17,46 @@ public class SendWeChatHandle {
 
     @Autowired
     MailLogMapper mailLogMapper;
+    @Autowired
+    private CorpWexinUtils corpWexinUtils;
 
-    public void sendWeChatByMail(String mail,String message){
-        String weChatId=mailLogMapper.getWeChatByMail(mail);
-        if(weChatId.isEmpty()){
-        log.error(String.format("mail's WeChat not found. mail =%s", mail));
-        //TODO 通知管理员添加邮箱
-    }else{
-        List<String> messageList= splitMessage(message);
-        messageList.forEach(it->CorpWexinUtils.sendMessageByWeChatId(weChatId,it));
+    public void sendWeChatByMail(String mail, String message) {
+        JSONObject weChatId = mailLogMapper.getWeChatByMail(mail);
+        if (weChatId.isEmpty()) {
+            log.error(String.format("mail's WeChat not found. mail =%s", mail));
+            //TODO 通知管理员添加邮箱
+        } else {
+            List<String> messageList = splitMessage(message);
+            messageList.forEach(it -> corpWexinUtils.sendMessageByWeChatId(weChatId, it));
+        }
     }
-}
 
     /**
      * 发送多人,邮箱逗号隔开
+     *
      * @param mails
      * @param message
      */
-    public void sendWeChatByMails(String mails,String message){
-        List<String> mail= Arrays.asList(mails.split(","));
-        mail.forEach(m-> this.sendWeChatByMail(m,message));
+    public void sendWeChatByMails(String mails, String message) {
+        List<String> mail = Arrays.asList(mails.split(","));
+        mail.forEach(m -> this.sendWeChatByMail(m, message));
     }
 
     /**
-     *  消息切割
+     * 消息切割
      */
-    private List<String> splitMessage(String message){
-        List<String> messageList=new ArrayList<>();
-        if(message.length()>1006){
-            int number=message.length()/1006;
-            for(int i=0;i<number;i++){
-                if(i!=number-1){
-                    messageList.add(message.substring(i*1006,(i+1)*1006-1));
-                }else {
-                    messageList.add(message.substring((i+1)*1006));
+    private List<String> splitMessage(String message) {
+        List<String> messageList = new ArrayList<>();
+        if (message.length() > 1006) {
+            int number = message.length() / 1006;
+            for (int i = 0; i < number; i++) {
+                if (i != number - 1) {
+                    messageList.add(message.substring(i * 1006, (i + 1) * 1006 - 1));
+                } else {
+                    messageList.add(message.substring((i + 1) * 1006));
                 }
             }
-        }else {
+        } else {
             messageList.add(message);
         }
         return messageList;

+ 2 - 13
module-common/pom.xml

@@ -29,6 +29,8 @@
             <groupId>thirtpart</groupId>
             <artifactId>jave</artifactId>
             <version>1.0</version>
+            <scope>system</scope>
+            <systemPath>${project.basedir}/src/main/resources/lib/jave-1.0.jar</systemPath>
         </dependency>
         <dependency>
             <groupId>junit</groupId>
@@ -106,19 +108,6 @@
 
     <build>
         <resources>
-            <resource>
-                <directory>lib</directory>
-                <targetPath>BOOT-INF/lib/</targetPath>
-                <includes>
-                    <include>**/*.jar</include>
-                </includes>
-            </resource>
-            <resource>
-                <directory>src/main/resources</directory>
-                <targetPath>BOOT-INF/classes/</targetPath>
-            </resource>
-
-
             <!-- 解决MyBatis配置文件引入问题 -->
             <resource>
                 <directory>src/main/java</directory>

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

@@ -37,6 +37,7 @@ public class CtopCorpWexinUser {
     @Excel(name = "userId", width = 15)
     @ApiModelProperty(value = "userId")
     private String userId;
+
     /**
      * wexinId
      */
@@ -67,6 +68,7 @@ public class CtopCorpWexinUser {
     @Excel(name = "wexinGender", width = 15)
     @ApiModelProperty(value = "wexinGender")
     private String wexinGender;
+    private String corpId;
     /**
      * createTime
      */

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

@@ -192,4 +192,9 @@ public class MaterialInfo implements Serializable {
     //视频关联广告语信息--头条
     @TableField(exist = false)
     private JSONArray slogans;
+
+    @TableField(exist = false)
+    private Integer slogansCount;
+
+    private Integer offlineFlag;
 }

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

@@ -97,6 +97,7 @@ public class Project {
      */
     private BigDecimal maxDeepCpaBid;
     private Integer checkLink;
+    private Integer materialShare;
     /**
      * 创建时间
      */

+ 7 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/UserAllocation.java

@@ -104,6 +104,13 @@ public class UserAllocation implements Serializable {
     @ApiModelProperty(value = "授权名称")
     private String authName;
 
+    /**
+     * 授权开始时间
+     */
+    @Excel(name = "授权开始时间", width = 15)
+    @ApiModelProperty(value = "授权开始时间")
+    private String authBeginTime;
+
 
     /**
      * 0 启动

+ 86 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/WexinConfig.java

@@ -0,0 +1,86 @@
+package cn.com.ctop.common.module.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import me.chanjar.weixin.cp.api.WxCpService;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 企业微信配置信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-06-17
+ */
+@Data
+@TableName("ctop_wexin_config")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_wexin_config对象", description = "企业微信配置信息")
+public class WexinConfig {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+    private Integer id;
+    /**
+     * corpId
+     */
+    @Excel(name = "corpId", width = 15)
+    @ApiModelProperty(value = "corpId")
+    private String corpId;
+    /**
+     * agentId
+     */
+    @Excel(name = "agentId", width = 15)
+    @ApiModelProperty(value = "agentId")
+    private Integer agentId;
+    /**
+     * corpSecret
+     */
+    @Excel(name = "corpSecret", width = 15)
+    @ApiModelProperty(value = "corpSecret")
+    private String corpSecret;
+    /**
+     * aesKey
+     */
+    @Excel(name = "aesKey", width = 15)
+    @ApiModelProperty(value = "aesKey")
+    private String aesKey;
+    /**
+     * token
+     */
+    @Excel(name = "token", width = 15)
+    @ApiModelProperty(value = "token")
+    private String token;
+    /**
+     * remarks
+     */
+    @Excel(name = "remarks", width = 15)
+    @ApiModelProperty(value = "remarks")
+    private String remarks;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+
+    @TableField(exist = false)
+    private WxCpService wxCpService;
+}

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

@@ -1,6 +1,7 @@
 package cn.com.ctop.common.module.mapper;
 
 import cn.com.ctop.common.module.entity.MailLog;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -19,11 +20,11 @@ public interface MailLogMapper extends BaseMapper<MailLog> {
 
     List<String> selectMailList(@Param("projectId") Long projectId);
 
-    List<String> selectWeiXinIdList(@Param("projectId") Long projectId);
+    List<JSONObject> selectWeiXinIdList(@Param("projectId") Long projectId);
 
-    String getWChatIdByUserId(@Param("userId") String responsibleId);
+    JSONObject getWChatIdByUserId(@Param("userId") String responsibleId);
 
     String getUserNameByUserId(@Param("userId") String transferor);
 
-    String getWeChatByMail(@Param("mail") String mail);
+    JSONObject getWeChatByMail(@Param("mail") String mail);
 }

文件差異過大導致無法顯示
+ 3 - 1
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java


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

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

+ 9 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/SysUserMapper.java

@@ -152,6 +152,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
      */
     int updateNullByEmptyString(@Param("fieldName") String fieldName);
 
+
     /**
      * 根据部门Ids,查询部门下用户信息
      *
@@ -177,4 +178,12 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
     List<SysUser> queryPageList(SysUser user);
 
     List<JSONObject> getUserMapByMap(@Param("ids") Map<String, String> userIdMap);
+
+    /**
+     *
+     * @param userId 用户id
+     * @param designTeamLeaderName 设计组长姓名
+     * @return
+     */
+    Integer updUserDesignLeaderById(@Param("userId") String userId,@Param("designTeamLeaderName") String designTeamLeaderName);
 }

+ 15 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/WexinConfigMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.common.module.mapper;
+
+import cn.com.ctop.common.module.entity.WexinConfig;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 企业微信配置信息
+ *
+ * @author jeecg-boot
+ * 2021-06-17
+ * @version V1.0
+ */
+public interface WexinConfigMapper extends BaseMapper<WexinConfig> {
+
+}

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

@@ -27,9 +27,9 @@
     </select>
 
 
-    <select id="selectWeiXinIdList" resultType="java.lang.String">
+    <select id="selectWeiXinIdList" resultType="com.alibaba.fastjson.JSONObject">
      select
-     t2.wexin_id
+     t2.wexin_id,t2.corp_id
      from
      ctop_project_member t1
      left join ctop_corp_wexin_user t2
@@ -41,8 +41,8 @@
      and t2.wexin_id != ''
     </select>
 
-    <select id="getWChatIdByUserId" resultType="java.lang.String">
-    select t1.wexin_id
+    <select id="getWChatIdByUserId" resultType="com.alibaba.fastjson.JSONObject">
+    select t1.wexin_id,corp_id
     from ctop_corp_wexin_user t1
     left join  sys_user t2
     on  t1.user_id = t2.id
@@ -58,9 +58,9 @@
     where id = #{userId}
     </select>
 
-    <select id="getWeChatByMail" resultType="java.lang.String">
+    <select id="getWeChatByMail" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-            wexin_id
+            wexin_id,corp_id
         FROM
             ctop_corp_wexin_user
         WHERE

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

@@ -90,8 +90,22 @@
         select
         distinct matInfo.code,
         matInfo.project_id,
-        matInfo.id
+        matInfo.id,
+        t.slogansCount,
+        matInfo.offline_flag
         from ctop_material_info matInfo
+        left JOIN (
+        SELECT
+        video_code,
+        count(*) AS slogansCount
+        FROM
+        ctop_bytedance_video_slogen_info
+        WHERE
+        status = 1
+        GROUP BY
+        video_code
+        ) t ON matInfo.code = t.video_code
+
         <if test="tagCode!=null">
             left join ctop_material_tag_info tagInfo on tagInfo.code = matInfo.code
         </if>
@@ -111,24 +125,21 @@
         <if test="planId !=null and planId != ''">
             and ascription.plan_id = #{planId}
         </if>
-        <if test="projectId !=null and projectId != ''">
-            and matInfo.project_id = #{projectId}
-        </if>
-        <if test="status!=null">
+        <if test="status != null">
             and matInfo.status = #{status}
         </if>
-        <if test="userId!=null">
+        <if test="userId != null and userId != ''">
             and matInfo.user_id = #{userId}
         </if>
-        <if test="code!=null">
+        <if test="code != null">
             and matInfo.code = #{code}
         </if>
-        <if test="materialName!=null">
+        <if test="materialName != null">
             and matInfo.material_name like concat('%',#{materialName},'%')
         </if>
-        <if test="productIds!=null">
-            and matInfo.product_id in
-            <foreach item="item" index="index" collection="productIds" open="(" separator="," close=")">
+        <if test="projectIds != null and projectIds.size() != 0 ">
+            and matInfo.project_id in
+            <foreach item="item" index="index" collection="projectIds" open="(" separator="," close=")">
                 #{item}
             </foreach>
         </if>
@@ -138,9 +149,6 @@
         <if test="endDate != null and endDate != '' ">
             and matInfo.create_time &lt;= #{endDate}
         </if>
-        <if test="projectId!=null">
-            and matInfo.project_id = #{projectId}
-        </if>
         <if test="offlineFlag!=null">
             and matInfo.offline_flag = #{offlineFlag}
         </if>

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

@@ -60,5 +60,20 @@
         from ctop_project
         where product_id = #{productId}
     </select>
+    <select id="getProjectIdsByProductIdAndNotIn" resultType="java.lang.Long">
+        select id from ctop_project
+        where 1 = 1
+        <if test="productId != null and productId != ''">
+            and product_id = #{productId}
+        </if>
+        and material_share = 0
+        <if test="partakeProjectIds != null and partakeProjectIds.size() > 0">
+            and id not in
+            <foreach item="item" index="index" collection="partakeProjectIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+
+    </select>
 
 </mapper>

+ 12 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/SysUserMapper.xml

@@ -91,6 +91,7 @@ SELECT
     <select id="getAllUser" resultType="cn.com.ctop.common.module.vo.SysUserVo">
         SELECT
         t1.id userId,
+        t1.leader_id,
         t1.username userName,
         t1.realname realName,
         (SELECT role_name FROM sys_role WHERE id = t2.role_id ) roleName
@@ -313,6 +314,9 @@ SELECT
         <if test="sex != null and sex != ''">
             AND t1.sex =#{sex}
         </if>
+        <if test="id != null and id != ''">
+            AND t1.id =#{id}
+        </if>
 
         ) t4
         GROUP BY t4.id
@@ -325,4 +329,12 @@ SELECT
         </foreach>
     </select>
 
+
+
+
+    <!-- 修改用户 设计组长姓名 -->
+    <update id="updUserDesignLeaderById">
+        UPDATE sys_user SET design_team_leader_name = #{designTeamLeaderName} WHERE id = #{userId}
+    </update>
+
 </mapper>

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/WexinConfigMapper.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.common.module.mapper.WexinConfigMapper">
+
+</mapper>

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

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

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

@@ -25,8 +25,9 @@ public interface IProjectService extends IService<Project> {
 
     List<JSONObject> getProjectListByIds(JSONArray projectIdArray);
 
-
     Map<Long, String> getProjectMap(Map<Long, Long> projectIdMap);
 
     List<Long> getProjectIdsByProductId(Long productId);
+
+    List<Long> getProjectIdsByProductIdAndNotIn(Long productId, List<Long> partakeProjectIds);
 }

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

@@ -272,4 +272,6 @@ public interface ISysUserService extends IService<SysUser> {
     Map<String, String> getUserMapByMap(Map<String, String> userIdMap);
 
     String getRoleCodeByUserId(String userId);
+
+    Integer updUserDesignLeaderById(String userId,String userName,String roleId);
 }

+ 16 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IWexinConfigService.java

@@ -0,0 +1,16 @@
+package cn.com.ctop.common.module.service;
+
+import cn.com.ctop.common.module.entity.WexinConfig;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 企业微信配置信息
+ *
+ * @author jeecg-boot
+ * 2021-06-17
+ * @version V1.0
+ */
+public interface IWexinConfigService extends IService<WexinConfig> {
+
+    WexinConfig getInfoByCorpId(String corpId);
+}

+ 7 - 4
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MailLogServiceImpl.java

@@ -9,6 +9,7 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CorpWexinUtils;
 import cn.com.feishu.provider.MessageProvider;
 import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Primary;
@@ -25,11 +26,13 @@ import org.springframework.stereotype.Service;
 public class MailLogServiceImpl extends ServiceImpl<MailLogMapper, MailLog> implements IMailLogService {
     @Autowired
     private MailLogMapper mailLogMapper;
+    @Autowired
+    private CorpWexinUtils corpWexinUtils;
 
 
     @Override
     public void sendWeChat(String responsibleId, Long accountId, String projectName, String transferor, String assignee) {
-        String weChatId = mailLogMapper.getWChatIdByUserId(responsibleId);
+        JSONObject weChatId = mailLogMapper.getWChatIdByUserId(responsibleId);
         if (!Check.isNull(weChatId)) {
             String transferorName = mailLogMapper.getUserNameByUserId(transferor); // 转让人姓名
             String assigneeName = mailLogMapper.getUserNameByUserId(assignee); // 转让人姓名
@@ -39,7 +42,7 @@ public class MailLogServiceImpl extends ServiceImpl<MailLogMapper, MailLog> impl
                     .append("账号:" + accountId).append(",申请由:" + transferorName + "转户于:" + assigneeName).append("<br/>")
                     .append("等待您的审核,请您及时处理!");
 
-            CorpWexinUtils.sendMessageByWeChatId(weChatId, text.toString());
+            corpWexinUtils.sendMessageByWeChatId(weChatId, text.toString());
         }
 
         CorpFeishuUser user = corpFeishuUserService.getByUserId(responsibleId);
@@ -74,7 +77,7 @@ public class MailLogServiceImpl extends ServiceImpl<MailLogMapper, MailLog> impl
     @Override
     public void sendWeChatByStatus(String projectName, Integer status, String userId, Long accountId) {
 
-        String weChatId = mailLogMapper.getWChatIdByUserId(userId);
+        JSONObject weChatId = mailLogMapper.getWChatIdByUserId(userId);
         if (!Check.isNull(weChatId)) {
             String statusName = "";
 
@@ -91,7 +94,7 @@ public class MailLogServiceImpl extends ServiceImpl<MailLogMapper, MailLog> impl
                     .append("申请的转户操作已:" + statusName).append("<br/>")
                     .append("请您前往验证,谢谢!");
 
-            CorpWexinUtils.sendMessageByWeChatId(weChatId, text.toString());
+            corpWexinUtils.sendMessageByWeChatId(weChatId, text.toString());
         }
 
         CorpFeishuUser user = corpFeishuUserService.getByUserId(userId);

+ 19 - 9
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -70,7 +70,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     private ISupplierWatermarkService supplierWatermarkService;
     @Resource
     private IProductService productService;
-
     @Value("${oss.replace.download}")
     private String downloadUrl;
 
@@ -172,10 +171,10 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
 
 
     @Override
-    public MaterialInfo getMaterialInfoByCodeAndProductId(String code, Long productId) {
+    public MaterialInfo getMaterialInfoByCodeAndProductId(String code, Long projectId) {
         QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("code", code);
-        queryWrapper.eq("product_id", productId);
+        queryWrapper.eq("project_id", projectId);
         queryWrapper.orderByDesc("id").last("limit 1");
         return this.getOne(queryWrapper);
     }
@@ -190,9 +189,9 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
 
     @Override
-    public Map<String, Object> checkMaterialInfo(String code, Long productId) {
+    public Map<String, Object> checkMaterialInfo(String code, Long projectId) {
         Map<String, Object> result = new HashMap<>();
-        MaterialInfo info = this.getMaterialInfoByCodeAndProductId(code, productId);
+        MaterialInfo info = this.getMaterialInfoByCodeAndProductId(code, projectId);
         if (null != info) {
             //文件已存在
             ResultMapUtils.setResultMap(result, StatusCode.FILE_HAS_UPLOAD.getCode());
@@ -772,8 +771,9 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         return materialInfoMapper.getListByDate(startDate, endDate);
     }
 
+
     @Override
-    public Map<String, Object> getListByParams(String tagCode, String type, Integer status, List<Long> productId, String materialName, String code, String startDate, String endDate, String userId, Long projectId, String clipId, String shotId, String planId,Integer offlineFlag, Integer pageNo, Integer pageSize) {
+    public Map<String, Object> getListByParams(String tagCode, String type, Integer status, String materialName, List<Long> projectIds, String code, String startDate, String endDate, String userId, String clipId, String shotId, String planId, Integer offlineFlag, Integer pageNo, Integer pageSize) {
         Map<String, Object> result = new HashMap<>();
         PageHelper.startPage(pageNo, pageSize);
 
@@ -790,13 +790,14 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             endDate = endDate + " 23:59:59";
         }
 
-
-        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, productId, materialName, code, startDate, endDate, userId, projectId, ascription, clipId, shotId, planId,offlineFlag);
+        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, materialName, code, startDate, endDate, userId, projectIds, ascription, clipId, shotId, planId, offlineFlag);
         List<MaterialInfo> setList = new ArrayList<>();
         PageInfo<MaterialInfo> pageInfo = new PageInfo<>(dailyList);
         if (null != dailyList && !dailyList.isEmpty()) {
             for (MaterialInfo info : dailyList) {
                 MaterialInfo materialInfo = materialInfoMapper.selectById(info.getId());
+                materialInfo.setSlogansCount(info.getSlogansCount());
+                materialInfo.setOfflineFlag(info.getOfflineFlag());
                 //素材名称为空 则使用素材id 同步失败
                 materialInfo.setMaterialName(Check.isNull(materialInfo.getMaterialName()) ? materialInfo.getId() : materialInfo.getMaterialName());
                 //判断是否已经同步到快手平台
@@ -841,7 +842,13 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 } else {
                     materialInfo.setWhetherUnaudited(true);
                 }
-
+                //统计广告语数量
+//                List<BytedanceVideoSlogenInfo> slogenInfos = slogenInfoService.listByParams(materialInfo.getCode(), 1);
+//                JSONArray slogenArray = new JSONArray();
+//                if (null != slogenInfos && !slogenInfos.isEmpty()) {
+//                    slogenArray.addAll(slogenInfos);
+//                }
+//                materialInfo.setSlogans(slogenArray);
                 setList.add(materialInfo);
             }
         }
@@ -851,10 +858,13 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         return result;
     }
 
+
     @Override
     public JSONArray getIdListByProject(Long projectId) {
         return materialInfoMapper.getIdListByProject(projectId);
     }
+
+
 }
 
 

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

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

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

@@ -4,6 +4,7 @@ import cn.com.ctop.common.module.mapper.MailLogMapper;
 import cn.com.ctop.common.module.service.ISendMessageService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CorpWexinUtils;
+import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -13,11 +14,14 @@ import org.springframework.stereotype.Service;
 public class SendMessageServiceImpl implements ISendMessageService {
     @Autowired
     private MailLogMapper mailLogMapper;
+    @Autowired
+    private CorpWexinUtils corpWexinUtils;
+
     @Override
     public void sendMessage(String userId, String text) {
-        String weChatId = mailLogMapper.getWChatIdByUserId(userId);
+        JSONObject weChatId = mailLogMapper.getWChatIdByUserId(userId);
         if (!Check.isNull(weChatId)) {
-            CorpWexinUtils.sendMessageByWeChatId(weChatId, text);
+            corpWexinUtils.sendMessageByWeChatId(weChatId, text);
             log.info("消息发送成功,userId:{}", userId);
         }
     }

+ 24 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/SysUserServiceImpl.java

@@ -521,4 +521,28 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         return userMapper.queryByDepIds(departIds, username);
     }
 
+
+    /**
+     *
+     * @description: 修改用户 设计组长姓名
+     *用户 分配角色 为 设计组长  用户设计组长姓名 为自己真实姓名
+     * @param userId 用户id
+     * @param userName 设计组长姓名
+     * @param roleId 角色id
+     * @return: java.lang.Integer
+     * @author: zianY
+     */
+    @Override
+    public Integer updUserDesignLeaderById(String userId,String userName,String roleId) {
+        String designTeamLeaderName = "";
+        if (!Check.isNull(roleId)){
+            SysRole sysRole = sysRoleMapper.selectById(roleId);
+            if ("designTeamLeader".equals(sysRole.getRoleCode())){
+                designTeamLeaderName = userName;
+            }
+        }
+       return userMapper.updUserDesignLeaderById(userId,designTeamLeaderName);
+    }
+
+
 }

+ 29 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/WexinConfigServiceImpl.java

@@ -0,0 +1,29 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.WexinConfig;
+import cn.com.ctop.common.module.mapper.WexinConfigMapper;
+import cn.com.ctop.common.module.service.IWexinConfigService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 企业微信配置信息
+ *
+ * @author jeecg-boot
+ * 2021-06-17
+ * @version V1.0
+ */
+@Service
+public class WexinConfigServiceImpl extends ServiceImpl<WexinConfigMapper, WexinConfig> implements IWexinConfigService {
+
+    @Override
+    public WexinConfig getInfoByCorpId(String corpId) {
+        QueryWrapper<WexinConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("corp_id", corpId);
+        queryWrapper.orderByDesc("create_time");
+        queryWrapper.last("limit 1");
+        WexinConfig config = this.getOne(queryWrapper);
+        return config;
+    }
+}

+ 45 - 31
module-common/src/main/java/cn/com/ctop/common/module/utils/CorpWexinUtils.java

@@ -1,5 +1,9 @@
 package cn.com.ctop.common.module.utils;
 
+import cn.com.ctop.common.module.entity.WexinConfig;
+import cn.com.ctop.common.module.service.IWexinConfigService;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import lombok.val;
 import me.chanjar.weixin.common.error.WxErrorException;
@@ -7,69 +11,79 @@ import me.chanjar.weixin.cp.api.WxCpService;
 import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
 import me.chanjar.weixin.cp.bean.WxCpMessage;
 import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
+@Service
 @Slf4j
 public class CorpWexinUtils {
-    private static WxCpService wxCpService;
+    @Autowired
+    private IWexinConfigService wexinConfigService;
+    private static Map<String, WexinConfig> configMap = new HashMap<>();
 
-    {
-        initService();
-    }
-
-    public static void initService() {
-        val configStorage = new WxCpDefaultConfigImpl();
-        configStorage.setCorpId("ww24b8a47826f5875f");
-        configStorage.setAgentId(1000002);
-        configStorage.setCorpSecret("MJIlySADGPlgvADnkFQPUpfZD4yV-4WN6066OgNnb0s");
-        configStorage.setToken("hcst2019");
-        configStorage.setAesKey("hcst2019");
-        wxCpService = new WxCpServiceImpl();
-        wxCpService.setWxCpConfigStorage(configStorage);
+    private Map<String, WexinConfig> getConfigMap() {
+        QueryWrapper<WexinConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.orderByDesc("create_time");
+        List<WexinConfig> list = wexinConfigService.list(queryWrapper);
+        for (WexinConfig config : list) {
+            WxCpService wxCpService = new WxCpServiceImpl();
+            val configStorage = new WxCpDefaultConfigImpl();
+            configStorage.setCorpId(config.getCorpId());
+            configStorage.setAgentId(config.getAgentId());
+            configStorage.setCorpSecret(config.getCorpSecret());
+            configStorage.setToken(config.getToken());
+            configStorage.setAesKey(config.getAesKey());
+            wxCpService.setWxCpConfigStorage(configStorage);
+            config.setWxCpService(wxCpService);
+            configMap.put(config.getCorpId(), config);
+        }
+        return configMap;
     }
 
-    public static void sendMessage(List<String> wxUserList, String content) {
-        if (wxCpService == null) {
-            initService();
+    public void sendMessage(List<JSONObject> wxUserList, String content) {
+        if (Check.isNullMap(configMap)) {
+            getConfigMap();
         }
         if (wxUserList != null && wxUserList.size() > 0) {
-            for (String userId : wxUserList) {
+            for (JSONObject userInfo : wxUserList) {
                 WxCpMessage message = new WxCpMessage();
                 message.setMsgType("text");
                 message.setContent(content);
                 message.setAgentId(1000002);
-                message.setToUser(userId);
+                message.setToUser(userInfo.getString("wexin_id"));
                 try {
+                    WexinConfig config = configMap.get(userInfo.getString("corp_id"));
+                    WxCpService wxCpService = config.getWxCpService();
                     wxCpService.messageSend(message);
                 } catch (WxErrorException e) {
-                    log.error("发送信息失败,userId:{}", userId);
+                    log.error("发送信息失败,userId:{}", userInfo.getString("wexin_id"));
                     e.printStackTrace();
                 }
             }
         }
     }
-
-    public synchronized static void sendMessageByWeChatId(String weChatId, String content) {
-        if (wxCpService == null) {
-            initService();
+    public void sendMessageByWeChatId(JSONObject weChatInfo, String content) {
+        if (Check.isNullMap(configMap)) {
+            this.getConfigMap();
         }
-        if (!Check.isNull(weChatId)) {
+        if (!Check.isNull(weChatInfo)) {
             WxCpMessage message = new WxCpMessage();
             message.setMsgType("text");
             message.setContent(content);
             message.setAgentId(1000002);
-            message.setToUser(weChatId);
+            message.setToUser(weChatInfo.getString("wexin_id"));
             try {
+                WexinConfig config = configMap.get(weChatInfo.getString("corp_id"));
+                WxCpService wxCpService = config.getWxCpService();
                 wxCpService.messageSend(message);
             } catch (WxErrorException e) {
-                log.error("发送信息失败,userId:{}", weChatId);
+                log.error("发送信息失败,userId:{}", weChatInfo.getString("wexin_id"));
                 e.printStackTrace();
             }
-
         }
-
-
     }
-
 }

+ 28 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/StringUtils.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.common.module.utils;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -118,4 +119,31 @@ public class StringUtils {
         }
         return dest;
     }
+
+    public static int lengthAsSlogan(String a)  {
+        char[] c = a.toCharArray();
+        int count=0;
+        for (char d : c) {
+            Character.UnicodeBlock ub = Character.UnicodeBlock.of(d);
+            if (ub == Character.UnicodeBlock.GENERAL_PUNCTUATION
+                    || ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION
+                    || ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS
+                    || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_FORMS
+                    || ub == Character.UnicodeBlock.VERTICAL_FORMS
+                    || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
+                    || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
+                    || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B
+                    || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C
+                    || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D
+                    || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS
+                    || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT) {
+                count++;
+            }
+
+        }
+        BigDecimal strNum = new BigDecimal(count);
+        BigDecimal strlen = new BigDecimal(a.length());
+        BigDecimal res = strlen.subtract(strNum).divide(new BigDecimal(2),0, BigDecimal.ROUND_UP).add(strNum);
+        return res.intValue();
+    }
 }

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/vo/SysUserVo.java

@@ -30,4 +30,6 @@ public class SysUserVo implements Serializable {
 
     private String roleName;
 
+    private String leaderId;
+
 }

二進制
module-common/src/main/resources/lib/jave-1.0.jar


+ 1 - 1
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAiCreateJob.java

@@ -9,7 +9,7 @@ import java.util.Date;
 
 @Component
 public class BytedanceAiCreateJob {
-    private static final String URLPREFIX = "http://118.24.244.213:8080/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/autoCreateCreative?hour=";
+    private static final String URLPREFIX = "http://118.24.244.213:8808/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/autoCreateCreative?hour=";
     @XxlJob("bytedanceAutoCreateJob")
     public void execute() throws Exception {
         String hour = DateUtils.getNowHour(new Date());

+ 10 - 6
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceCheckAccountReportJob.java

@@ -23,22 +23,26 @@ public class BytedanceCheckAccountReportJob {
     private IBytedanceCheckReportTaskInfoService checkReportTaskInfoService;
     @XxlJob("initCheckReportJob")
     public void initCheckReportJob() throws Exception {
-        String params = DateUtils.addDay(DateUtils.formatDate(),-1);
-        checkReportTaskInfoService.initTask(params);
+        String date = DateUtils.addDay(DateUtils.formatDate(),-1);
+        String param = XxlJobHelper.getJobParam();
+        if (param==null || param.trim().length()==0) {
+            param = date;
+        }
+        checkReportTaskInfoService.initTask(date);
         //查询初始化的任务
-        List<BytedanceCheckReportTaskInfo>taskInfos = checkReportTaskInfoService.getListByParams(null,params,0);
+        List<BytedanceCheckReportTaskInfo>taskInfos = checkReportTaskInfoService.getListByParams(null,date,0);
         if(null!=taskInfos&&!taskInfos.isEmpty()){
             countDownLatch = new CountDownLatch(taskInfos.size());
-            taskInfos.forEach(taskInfo -> {
+            taskInfos.forEach(taskInfo ->executorService.submit(()->{
                 try {
                     checkReportTaskInfoService.checkCost(taskInfo);
                 }catch (Exception e){
                 }finally {
                     countDownLatch.countDown();
                 }
-            });
+            }));
             countDownLatch.await();
-            XxlJobHelper.log("{}数据初始化完成",params);
+            XxlJobHelper.log("{}数据初始化完成",date);
         }
     }
 

+ 2 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceMaterialsLoadJob.java

@@ -53,7 +53,9 @@ public class BytedanceMaterialsLoadJob {
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
+        //修改视频类型
         videoInfoService.updateMaterialType();
+        //修改图片类型
         imageInfoService.updateType();
         XxlJobHelper.log("物料数据同步完成");
     }

+ 19 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceRejectReasonJob.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.job.bytedance.handler;
+
+import cn.com.ctop.common.module.utils.HttpUtils;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+
+@Component
+public class BytedanceRejectReasonJob {
+    private static final String URLPREFIX = "http://118.24.244.213:8808/bytedance-api/ctop/bytedanceRejectReason/getReasonInRecentHours?hour=";
+    @XxlJob("bytedanceRejectReasonJob")
+    public void execute() throws Exception {
+
+        //定时任务设置每2个小时执行一次,就传入参数hour是2.每次运行获取2个小时内的计划,拉取审核建议
+        HttpUtils.httpGet(URLPREFIX + 24, null, null);
+    }
+}

+ 1 - 1
module-job-bytedance/src/main/resources/application-dev.yml

@@ -86,7 +86,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: ''
+    password:
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

+ 1 - 1
module-job-bytedance/src/main/resources/application-jiaoyang.yml

@@ -101,7 +101,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: ''
+    password: hcst@2021..
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

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

@@ -101,7 +101,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: ''
+    password: hcst@2021..
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

+ 51 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAutoSynchronousProjectMaterialJob.java

@@ -0,0 +1,51 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAppPackageService;
+import com.alibaba.fastjson.JSONArray;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Slf4j
+@Component
+public class KuaishouAutoSynchronousProjectMaterialJob {
+    @Autowired
+    private IUserAllocationService userAllocationService;
+    @Autowired
+    private IKuaishouAppPackageService kuaishouAppPackageService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+
+    @XxlJob("autoSynchronousProjectMaterialJob")
+    public void execute() {
+        List<UserAllocation> userAllocations = userAllocationService.listByMediaId("2", 0);
+        userAllocations.forEach(userAllocation -> executorService.submit(() ->
+                synchronMaterials(userAllocation.getMaterialType(), userAllocation.getAccountId(), userAllocation.getProjectId())
+        ));
+        XxlJobHelper.log("快手物料数据同步完成");
+    }
+
+
+    private void synchronMaterials(String materialType, Long accountId, Long projectId) {
+        if (!Check.isNull(materialType) && materialType.contains("1")) {
+            JSONArray accountIds = new JSONArray();
+            accountIds.add(accountId);
+            //1 有效项目模板
+            List<Long> ids = kuaishouAppPackageService.queryByAppVersion(projectId, null, 1);
+            log.info("同步账户应用,应用模板={}", ids);
+            if (!Check.isNull(ids)) {
+                for (Long id : ids) {
+                    kuaishouAppPackageService.pushAppPackage(id, accountIds);
+                }
+            }
+        }
+    }
+}

+ 16 - 6
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCreateCreativeJob.java

@@ -11,6 +11,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 @Component
 public class KuaishouCreateCreativeJob {
@@ -20,6 +22,7 @@ public class KuaishouCreateCreativeJob {
     private IKuaiShouGroupTemplateService groupTemplateService;
     @Autowired
     private ICtopOauthTokenService tokenService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
 
     @XxlJob("kuaihouCreateCreative")
     public void execute() {
@@ -27,17 +30,24 @@ public class KuaishouCreateCreativeJob {
         templateQueryWrapper.eq("task_status", 2);
         templateQueryWrapper.eq("creative_status", 0);
         templateQueryWrapper.orderByAsc("create_time");
-        templateQueryWrapper.last("limit 20");
+        templateQueryWrapper.last("limit 200");
         List<KuaiShouGroupTemplate> list = groupTemplateService.list(templateQueryWrapper);
         if (Check.isNull(list)) {
             return;
         }
         for (KuaiShouGroupTemplate template : list) {
-            CtopOauthToken token = tokenService.getTokenByAccountId(template.getAccountId());
-            if (Check.isNull(token)) {
-                continue;
-            }
-            groupTemplateService.createCreative(token.getAccessToken(), template.getUnitId(), template);
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    CtopOauthToken token = tokenService.getTokenByAccountId(template.getAccountId());
+                    if (Check.isNull(token)) {
+                        return;
+                    }
+                    groupTemplateService.createCreative(token.getAccessToken(), template.getUnitId(), template);
+                }
+            });
+
+
         }
     }
 }

+ 9 - 3
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyCampaignReportLoadJob.java

@@ -29,14 +29,20 @@ public class KuaishouDailyCampaignReportLoadJob {
 
     @XxlJob("kuaishouDailyCampaignReport")
     public void execute() throws Exception {
-        Date getDate = DateUtils.addDay(new Date(), -1);
+        Date getDate = DateUtils.addDay(new Date(), -2);
+        Date endDate = DateUtils.addDay(new Date(), -1);
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        if (null == tokens || tokens.size() <= 0) {
+        if (null == tokens || tokens.isEmpty()) {
             XxlJobHelper.log("定时获取快手数据异常:未获取到可用的token");
             XxlJobHelper.handleFail();
             return;
         }
-        tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, getDate, getDate)));
+
+        tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, getDate, endDate)));
     }
+
+
+
+
 }

+ 4 - 3
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyGroupReportLoadJob.java

@@ -25,11 +25,12 @@ public class KuaishouDailyGroupReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouReportDailyGroupService reportDailyGroupService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(3);
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
 
     @XxlJob("kuaishouDailyGroupReport")
     public void execute() throws Exception {
-        Date getDate = DateUtils.addDay(new Date(), -1);
+        Date startDate = DateUtils.addDay(new Date(), -2);
+        Date endDate = DateUtils.addDay(new Date(), -1);
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
         if (null == tokens || tokens.size() <= 0) {
@@ -37,6 +38,6 @@ public class KuaishouDailyGroupReportLoadJob {
             XxlJobHelper.handleFail();
             return;
         }
-        tokens.forEach(token -> executorService.submit(() -> reportDailyGroupService.getAdvertiserGroupReportDaily(token, getDate, getDate)));
+        tokens.forEach(token -> executorService.submit(() -> reportDailyGroupService.getAdvertiserGroupReportDaily(token, startDate, endDate)));
     }
 }

+ 11 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouEtlVideoJob.java

@@ -60,4 +60,15 @@ public class KuaishouEtlVideoJob {
             materialReportDailyService.etlKuaishouAccountMaterialReportInfo(DateUtils.formatDate(DateUtils.addDay(new Date(),-i)));
         }
     }
+
+    @XxlJob("etlKuaishouReportCompanyInfo")
+    public void etlKuaishouReportCompanyInfo(){
+        Date date = DateUtils.addDay(new Date(),-1);
+        materialReportDailyService.etlKuaishouReportCompanyInfo(DateUtils.formatDate(date));
+    }
+
+    @XxlJob("etlKuaishouVideoReportStateDate")
+    public void etlKuaishouVideoReportStateDate(){
+        materialReportDailyService.etlKuaishouVideoReportStateDate();
+    }
 }

+ 0 - 46
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouGroupDailyReportJob.java

@@ -1,46 +0,0 @@
-package cn.com.ctop.job.kuaishou.handler;
-
-import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyGroupService;
-import com.xxl.job.core.context.XxlJobHelper;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import org.jeecg.common.util.DateUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-@Component
-public class KuaishouGroupDailyReportJob {
-    @Autowired
-    private ICtopOauthTokenService tokenService;
-    @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
-    @Autowired
-    private IKuaishouReportDailyGroupService reportDailyGroupService;
-
-    static ExecutorService executorService = Executors.newFixedThreadPool(5);
-
-    @XxlJob("kuaishouGroupDailyReportJob")
-    public void execute() throws ParseException {
-        String date = DateUtils.getDate("yyyy-MM-dd");
-        String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", date, -1);
-        String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", date, -2);
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date parse = simpleDateFormat.parse(startDate);
-        Date parse2 = simpleDateFormat.parse(endDate);
-        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        tokens.forEach(token -> executorService.submit(() ->
-                reportDailyGroupService.getAdvertiserGroupReportDaily(token, parse, parse2))
-        );
-        XxlJobHelper.log("快手物料数据同步完成");
-    }
-
-}

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

@@ -102,7 +102,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: foobared
+    password: hcst@2021..
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

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

@@ -102,7 +102,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: foobared
+    password: hcst@2021..
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

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

@@ -102,7 +102,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: foobared
+    password: hcst@2021..
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

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

@@ -25,10 +25,10 @@ public class AiKuaishouCreateCreativeController {
     private IAiKuaishouCreateCreativeService createCreativeService;
     @Autowired
     private IAiKuaishouAdvertiserStrategyService strategyService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(2);
-    static ExecutorService kuaishouCustomCreativeSupplementExecutorService = Executors.newFixedThreadPool(2);
-    static ExecutorService kuaishouProgramCreativeAutoService = Executors.newFixedThreadPool(2);
-    static ExecutorService kuaishouProgramTopCreativeAutoService = Executors.newFixedThreadPool(2);
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+    static ExecutorService kuaishouCustomCreativeSupplementExecutorService = Executors.newFixedThreadPool(3);
+    static ExecutorService kuaishouProgramCreativeAutoService = Executors.newFixedThreadPool(3);
+    static ExecutorService kuaishouProgramTopCreativeAutoService = Executors.newFixedThreadPool(3);
 
 
     /**

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

@@ -328,6 +328,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         return videoCnt;
     }
 
+
     /**
      * 创建程序化创意
      *
@@ -393,7 +394,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         //1:查询可用素材
                         List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, appInfo, createType, videoCnt);
                         if (null == allVideos || allVideos.isEmpty()) {
-                            return;
+                            continue;
                         }
                         Boolean unitOverrun = getUnitOverrun(accountId);
                         if (unitOverrun) {
@@ -804,7 +805,15 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             if (Check.isNull(strategy.getMaterialKeyword())) {
                 customVideos = videoGetService.getNewVideoBetweenTime(strategy.getAccountId(), startTime, endTime, strategy.getChannelType(), "all", null);
                 //2:查询特定素材
-                generalVideos = videoGetService.getNewVideoBetweenTime(strategy.getAccountId(), startTime, endTime, strategy.getChannelType(), appInfo.getAppVersion(), null);
+                String appVersion = appInfo.getAppVersion();
+                if (!Check.isNull(appVersion)) {
+                    String[] split = appVersion.split("-");
+                    if (split.length > 1) {
+                        String version = split[1];
+                        generalVideos = videoGetService.getNewVideoBetweenTime(strategy.getAccountId(), startTime, endTime, strategy.getChannelType(), version, null);
+                    }
+                }
+
             } else { //  tt语音特殊素材查询
                 generalVideos = videoGetService.getNewVideoBetweenTime(strategy.getAccountId(), startTime, endTime, strategy.getChannelType(), strategy.getMaterialKeyword(), null);
 
@@ -825,6 +834,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         }
     }
 
+
     private List<KuaiShouVideoGet> getRelateZeroVideoList(AiKuaishouAdvertiserStrategy strategy, String startTime, String endTime, AiKuaiShouAppInfo appInfo, Integer relativeCnt, Long videoCnt) {
         Integer channelType = null;
         if (null != strategy.getChannelType() && strategy.getChannelType() != 2) {
@@ -833,7 +843,12 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         String appVersion = null;
         if (Check.isNull(strategy.getMaterialKeyword())) {
             if (null != appInfo && null != appInfo.getAppVersion()) {
-                appVersion = appInfo.getAppVersion();
+                String[] split = appInfo.getAppVersion().split("-");
+                if (split.length > 1) {
+                    appVersion = split[1];
+                } else {
+                    return null;
+                }
             }
         } else { //  tt语音特殊素材查询
             appVersion = strategy.getMaterialKeyword();
@@ -849,8 +864,13 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         }
         String appVersion = null;
         if (Check.isNull(strategy.getMaterialKeyword())) {
-            if (null != appInfo && null != appInfo.getAppVersion()) {
-                appVersion = appInfo.getAppVersion();
+            if (!Check.isNull(appInfo.getAppVersion())) {
+                String[] split = appInfo.getAppVersion().split("-");
+                if (split.length > 1) {
+                    appVersion = split[1];
+                } else {
+                    return null;
+                }
             }
         } else { //  tt语音 特殊素材查询
             appVersion = strategy.getMaterialKeyword();
@@ -1517,6 +1537,11 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         if (wildcard.contains("{{应用名称}}") || wildcard.contains("{{应用标记}}")) {
             KuaiShouAppList getAppInfo = appListService.getAppInfo(strategy.getAccountId(), appId);
             if (!Check.isNull(getAppInfo)) {
+                if (!wildcard.contains("{{自定义}}")) {
+                    if (wildcard.contains("{{应用标记}}")) {
+                        wildcard = wildcard.replace("{{应用标记}}", "{{应用标记}}-{{自定义}}");
+                    }
+                }
                 wildcard = wildcard.replace("{{应用名称}}", getAppInfo.getAppName());
                 wildcard = wildcard.replace("{{应用标记}}", getAppInfo.getAppVersion());
             } else {

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

@@ -26,6 +26,7 @@ import org.jeecg.common.system.vo.LoginUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -41,14 +42,14 @@ import java.util.Map;
 @Service
 public class KuaishouLandpagePackageServiceImpl extends ServiceImpl<KuaishouLandpagePackageMapper, KuaishouLandpagePackage> implements IKuaishouLandpagePackageService {
 
-    @Autowired
+    @Resource
     private KuaishouLandpagePackageMapper landpagePackageMapper;
-    @Autowired
+    @Resource
     private KuaishouLandpagePackageRelMapper landpagePackageRelMapper;
     @Autowired
     private KuaishouLandpagePackageRelServiceImpl landpagePackageRelService;
 
-    @Autowired
+    @Resource
     private UserAllocationMapper userAllocationMapper;
     @Autowired
     private ICtopOauthTokenService oauthTokenService;

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

@@ -217,6 +217,7 @@ public class KuaiShouGroupTemplate {
     private Integer createType;
     private String photoIds;
     private String schemaUri;
+    private Integer imageCount;
 
     /**
      * 创建时间

+ 2 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouGroupTemplateMapper.java

@@ -16,9 +16,9 @@ import java.util.List;
  */
 public interface KuaiShouGroupTemplateMapper extends BaseMapper<KuaiShouGroupTemplate> {
 
-    JSONObject getMd5ByPhotoId(@Param("photoId") Long photoId);
+    JSONObject getMd5ByPhotoId(@Param("photoId") String photoId);
 
-    List<JSONObject> getImageListByMd5(@Param("md5") String md5);
+    List<JSONObject> getImageListByMd5(@Param("md5") String md5,@Param("imageCount") Integer imageCount);
 
     Integer getApiCreateCount(@Param("accountId") Long accountId, @Param("date") String date);
 

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupTemplateMapper.xml

@@ -18,7 +18,7 @@
       url as 'url'
       from ctop_material_cut_frame
       where video_signature = #{md5}
-       ORDER BY RAND() LIMIT 6
+      ORDER BY RAND() LIMIT #{imageCount}
     </select>
     <select id="getImageJsonByMd5" resultType="com.alibaba.fastjson.JSONObject">
       select

+ 2 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml

@@ -326,9 +326,9 @@
 
     <select id="getVideoGetByPhotoId" resultType="cn.com.ctop.kuaishou.modules.report.entity.VideoGetvo">
         select signature as 'signature', channel_type as 'channelType'
-        from ctop_kuaishou_video_get
+        from ctop_etl_kuaishou_video_base_info
         where photo_id = #{photoId}
-          and signature is not null limit 1
+         and signature is not null limit 1
     </select>
 
 

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

@@ -273,9 +273,15 @@
         </if>
         group by signature) video
         on video.signature = report.signature
-        left join (SELECT id, photo_id from ctop_ai_creative_limit WHERE account_id = #{accountId}) t2
-        on video.photo_id = t2.photo_id
         where video.id is not null
+        and video.photo_id NOT IN (
+        SELECT
+        photo_id
+        FROM
+        ctop_ai_creative_limit
+        WHERE
+        account_id = #{accountId}
+        )
         group by video.signature
         order by sum(report.charge) desc
         <if test="videoCnt!=null">
@@ -304,12 +310,10 @@
         supplier_account_name
         FROM ctop_kuaishou_video_get t1
         INNER JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
-        WHERE t1.`status` =0
-        AND t2.project_id=#{projectId}
+        WHERE t2.project_id=#{projectId}
         <if test="updateTime!=null and updateTime!=''">
             AND t1.update_time &gt; #{updateTime}
         </if>
-        group by t1.signature
     </select>
 
     <select id="getAccountIds" resultType="com.alibaba.fastjson.JSONObject">

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

@@ -12,6 +12,7 @@ import cn.com.ctop.common.module.utils.SendMailUtil;
 import cn.com.ctop.kuaishou.modules.batch.service.IAccountWarningService;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportHourlyAccountMapper;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,6 +33,8 @@ public class AccountWarningServiceImpl implements IAccountWarningService {
     private MailLogMapper mailLogMapper;
     @Autowired
     private IProjectService projectService;
+    @Autowired
+    private CorpWexinUtils corpWexinUtils;
 
 
     /**
@@ -127,8 +130,8 @@ public class AccountWarningServiceImpl implements IAccountWarningService {
             } catch (Exception e) {
                 e.printStackTrace();
             }
-            List<String> wexinIds = mailLogMapper.selectWeiXinIdList(projectId);
-            CorpWexinUtils.sendMessage(wexinIds, text.toString());
+            List<JSONObject> wexinIds = mailLogMapper.selectWeiXinIdList(projectId);
+            corpWexinUtils.sendMessage(wexinIds, text.toString());
         }
     }
 
@@ -167,8 +170,8 @@ public class AccountWarningServiceImpl implements IAccountWarningService {
                 e.printStackTrace();
             }
         }
-        List<String> wexinIds = mailLogMapper.selectWeiXinIdList(projectId);
-        CorpWexinUtils.sendMessage(wexinIds, text.toString());
+        List<JSONObject> wexinIds = mailLogMapper.selectWeiXinIdList(projectId);
+        corpWexinUtils.sendMessage(wexinIds, text.toString());
 
     }
 

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

@@ -7,11 +7,7 @@ import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTemplate;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouTemplateTarget;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupTemplateMapper;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTemplateService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouMaterialUploadService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouTemplateTargetService;
+import cn.com.ctop.kuaishou.modules.batch.service.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -123,7 +119,11 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
         String description = requestJson.getString("description");
         Long site_id = requestJson.getLong("siteId");
         String schema_uri = requestJson.getString("schemaUri");
-
+        Integer startNumber = 0;
+        if (unitName.contains("{{序号}}")) {
+            startNumber = requestJson.getInteger("startNumber");
+        }
+        Integer imageCount = requestJson.getInteger("imageCount");
 
         List<KuaiShouGroupTemplate> templates = new ArrayList<>();
         for (int i = 0; i < createCount; i++) {
@@ -140,11 +140,22 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
                 }
                 template.setPhotoIds(photoIds.toJSONString());
             }
-            String name = unitName + "_" + i;
+            String name = "";
+            if (!unitName.contains("{{序号}}")) {
+                name = unitName + "_" + i;
+            } else {
+                if (i == 0) {
+                    name = unitName.replace("{{序号}}", String.valueOf(startNumber));
+                } else {
+                    name = unitName.replace("{{序号}}", String.valueOf(startNumber + i));
+                }
+            }
+
+            template.setUnitName(name);
             template.setAccountId(accountId);
             template.setUserId(userId);
             template.setCampaignId(campaignId);
-            template.setUnitName(name);
+
             if (!Check.isNull(template_id)) {
                 template.setTemplateId(template_id);
             }
@@ -238,6 +249,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
             if (!Check.isNull(site_id)) {
                 template.setSiteId(site_id);
             }
+            template.setImageCount(imageCount);
             template.setTaskStatus(0);
             template.setCreativeReviewDetail("创意待创建");
             template.setCreativeStatus(0);
@@ -599,7 +611,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
         Integer createType = template.getCreateType();
         if (createType == 0) { // 单品
             Long photoId = template.getPhotoId();
-            JSONObject videoMd5Json = groupTemplateMapper.getMd5ByPhotoId(photoId);
+            JSONObject videoMd5Json = groupTemplateMapper.getMd5ByPhotoId(String.valueOf(photoId));
             if (Check.isNull(videoMd5Json)) {
                 log.error("未获取到素材详细信息,accountId:{},unitId:{}", template.getAccountId(), unitId);
                 updateTemplate.setCreativeStatus(3);
@@ -609,7 +621,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
             }
             Integer materialType = videoMd5Json.getInteger("materialType");
             String videoMd5 = videoMd5Json.getString("md5");
-            List<JSONObject> imageList = groupTemplateMapper.getImageListByMd5(videoMd5);
+            List<JSONObject> imageList = groupTemplateMapper.getImageListByMd5(videoMd5, template.getImageCount());
             if (Check.isNull(imageList)) {
                 JSONObject json = new JSONObject();
                 json.put("creative_name", template.getCreativeName());
@@ -655,7 +667,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
             }
             for (int i = 0; i < array.size(); i++) {
                 Long photoId = array.getLong(i);
-                JSONObject videoJson = groupTemplateMapper.getMd5ByPhotoId(photoId);
+                JSONObject videoJson = groupTemplateMapper.getMd5ByPhotoId(String.valueOf(photoId));
                 if (Check.isNull(videoJson)) {
                     log.error("未获取到素材详细信息,accountId:{},unitId:{}", template.getAccountId(), unitId);
                     updateTemplate.setCreativeStatus(3);

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

@@ -4,6 +4,7 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.OauthConfig;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.enums.MaterialEnum;
+import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.IMaterialCutFrameService;
 import cn.com.ctop.common.module.service.IOauthConfigService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
@@ -127,7 +128,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     private IKuaishouPopulationGroupService populationGroupService;
     @Autowired
     private IKuaishouAppPackageService appPackageService;
-
+    @Autowired
+    private UserAllocationMapper allocationMapper;
     @Override
     public void getAdvertiserReportHourly(CtopOauthToken token, Date startDate, Date endDate) {
         try {
@@ -779,21 +781,28 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
     @Override
     public void loadKuaishouDataSingle(CtopOauthToken token) throws java.text.ParseException {
-
-
-        Date endDate = new Date();
-        for (int i = 0; i < 7; i++) {
-            Date getStartDate = DateUtils.addDay(endDate, -i);
+        String beginDateStr = allocationMapper.getUserAllocation(token.getAccountId()).getAuthBeginTime();
+        beginDateStr = Check.isNull(beginDateStr) ? DateUtils.formatDate(DateUtils.addDay(new Date(),-180),"yyyy-MM-dd") : beginDateStr;
+        Date beginDate = DateUtils.parseDate(beginDateStr,DateUtils.WEB_FORMAT);
+        Date endDate = DateUtils.addDay(new Date(),-1);
+        while (!beginDate.after(endDate)){
+            beginDate = DateUtils.addDay(beginDate,1);
+            getAdvertiserReportHourly(token, beginDate, beginDate);
+            getAdvertiserReportDaily(token, beginDate, beginDate, null);
+        }
+//        Date endDate = new Date();
+//        for (int i = 0; i < 7; i++) {
+//            Date getStartDate = DateUtils.addDay(endDate, -i);
             //1: 获取广告主信息数据
-            getAdvertiserReportHourly(token, getStartDate, getStartDate);
-            getAdvertiserReportDaily(token, getStartDate, getStartDate, null);
+//            getAdvertiserReportHourly(token, beginDate, endDate);
+//            getAdvertiserReportDaily(token, beginDate, endDate, null);
             //2:获取广告计划信息数据
-            // getAdvertiserCampaignReportHourly(token, getStartDate, getStartDate);
+            //getAdvertiserCampaignReportHourly(token, getStartDate, getStartDate);
             //3:获取广告组信息数据
             // getAdvertiserGroupReportHourly(token, getStartDate, getStartDate);
             //4: 获取广告创意信息数据
             // getAdvertiserCreativeReportHourly(token, getStartDate, getStartDate);
-        }
+//        }
         //获取全量广告计划数据
         getCampaignList(token, null, null);
         //获取全量广组主数据
@@ -802,9 +811,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         getCreativeList(token, null, null);
         getAppList(token.getAccountId(), token.getAccessToken());
         log.info("----------------开始历史数据获取,accountId:{}", token.getAccountId());
-        String endDateStr = DateUtils.getDate("yyyy-MM-dd");
-        String startDate = DateUtils.addMonth(endDateStr, -1);
-        historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
+        String endDateStr = DateUtils.formatDate(endDate,"yyyy-MM-dd");
+//        String startDate = DateUtils.addMonth(endDateStr, -1);
+        historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), beginDateStr, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
         getVideoList(token, null, null);
         //   getSuZaoList(token.getAccessToken(), token.getAccountId(), 1, null, null);
         String nowDate = DateUtils.getNowDate("yyyy-MM-dd");

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

@@ -67,7 +67,7 @@ public class KuaishouProjectVideoGetServiceImpl extends ServiceImpl<KuaishouProj
             if (Check.isNull(updateTime) && pageNo == 1) {
                 updateTime = projectVideoGetMapper.queryLatestUpdateTime(projectId);
             }
-            PageHelper.startPage(pageNo, 1500, false);
+            PageHelper.startPage(pageNo, 1000, false);
             List<KuaishouProjectVideoGet> list = videoGetMapper.selectProjectVideo(projectId, updateTime);
             if (Check.isNull(list)) {
                 return;

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

@@ -12,6 +12,7 @@ import cn.com.ctop.common.module.utils.SendMailUtil;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
 import cn.com.ctop.kuaishou.modules.material.service.IKuaishouBidWarningService;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.xxl.job.core.context.XxlJobHelper;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -30,6 +31,8 @@ public class KuaishouBidWarningServiceImpl implements IKuaishouBidWarningService
     private KuaiShouGroupMapper groupMapper;
     @Autowired
     private MailLogMapper mailLogMapper;
+    @Autowired
+    private CorpWexinUtils corpWexinUtils;
 
 
     /**
@@ -51,7 +54,7 @@ public class KuaishouBidWarningServiceImpl implements IKuaishouBidWarningService
                 }
                 Long maxBid = project.getMaxBid();
                 Long projectId = project.getId();
-                List<UserAllocation> userAllocations = userAllocationService.getByParams(projectId,null,null);
+                List<UserAllocation> userAllocations = userAllocationService.getByParams(projectId, null, null);
                 if (!Check.isNull(userAllocations)) {
                     for (UserAllocation userAllocation : userAllocations) {
                         if (userAllocation.getAccountStatus() == 1) {
@@ -108,7 +111,7 @@ public class KuaishouBidWarningServiceImpl implements IKuaishouBidWarningService
             }
         }
 
-        List<String> wexinIds = mailLogMapper.selectWeiXinIdList(projectId);
-        CorpWexinUtils.sendMessage(wexinIds, text.toString());
+        List<JSONObject> wexinIds = mailLogMapper.selectWeiXinIdList(projectId);
+        corpWexinUtils.sendMessage(wexinIds, text.toString());
     }
 }

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

@@ -59,17 +59,8 @@ public class KsVideoReportCtrl {
     public Result<PageInfo<JSONObject>> getListReport(@RequestBody JSONObject requestBody) {
         Result<PageInfo<JSONObject>> result = new Result<>();
         try {
-            if (Check.isNull(requestBody)) {
-                new Exception("入参不能为空");
-            }
             int pageSize = requestBody.getInteger("pageSize");
-            if (Check.isNull(pageSize)) {
-                throw new Exception("请输入查询每页条数");
-            }
             int pageNo = requestBody.getInteger("pageNo");
-            if (Check.isNull(pageNo)) {
-                throw new Exception("请输入查询页数");
-            }
             String startDate = requestBody.getString("startDate");
             if (Check.isNull(startDate)) {
                 throw new Exception("请输入查询开始时间");
@@ -79,7 +70,6 @@ public class KsVideoReportCtrl {
                 throw new Exception("请输入查询结束时间");
             }
             String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.kuaishouVideoReportMap);
-            //   System.err.println(filedAll);
             if (Check.isNull(filedAll)) {
                 throw new Exception("初始化查询 字段返回为空");
             }

+ 29 - 28
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouAccountReportCtrl.java

@@ -51,7 +51,7 @@ public class KuaiShouAccountReportCtrl {
         String mediaId = requestBody.getString("mediaId");
         BigDecimal discount = requestBody.getBigDecimal("discount");
         JSONArray accounts = requestBody.getJSONArray("accountIds");
-        if(accounts.isEmpty()){
+        if (accounts.isEmpty()) {
             return resultBody;
         }
         String startDate = requestBody.getString("startDate");
@@ -59,8 +59,8 @@ public class KuaiShouAccountReportCtrl {
         try {
             Map<String, Object> sumData = kuaiShouAccountReportService.getSumDataBy(mediaId, discount, accounts, startDate, endDate);
             List<JSONObject> chartData = kuaiShouAccountReportService.getChartDataBy(mediaId, discount, accounts, startDate, endDate);
-            result.put("sumData",sumData);
-            result.put("chartData",chartData);
+            result.put("sumData", sumData);
+            result.put("chartData", chartData);
             resultBody.setResult(result);
             resultBody.setSuccess(true);
         } catch (Exception e) {
@@ -83,16 +83,16 @@ public class KuaiShouAccountReportCtrl {
         String mediaId = requestBody.getString("mediaId");
         BigDecimal discount = requestBody.getBigDecimal("discount");
         JSONArray accounts = requestBody.getJSONArray("accountIds");
-        if(accounts.isEmpty()){
+        if (accounts.isEmpty()) {
             return result;
         }
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
-        int hour= requestBody.getInteger("hour");
-        String target= requestBody.getString("target");
-        String order= requestBody.getString("order");
+        int hour = requestBody.getInteger("hour");
+        String target = requestBody.getString("target");
+        String order = requestBody.getString("order");
         try {
-            List<JSONObject> listData= kuaiShouAccountReportService.getListDataBy(mediaId,discount,accounts,startDate,endDate,hour,target,order);
+            List<JSONObject> listData = kuaiShouAccountReportService.getListDataBy(mediaId, discount, accounts, startDate, endDate, hour, target, order);
             result.setResult(listData);
             result.setSuccess(true);
         } catch (Exception e) {
@@ -103,45 +103,46 @@ public class KuaiShouAccountReportCtrl {
     }
 
     /**
-     *  导出数据
+     * 导出数据
      */
     @PostMapping("/report/excel")
     public void getExcelReport(@RequestBody JSONObject requestBody,
                                HttpServletRequest request,
                                HttpServletResponse response) {
-        JSONArray columns=requestBody.getJSONArray("columns");
-        if(columns.isEmpty()){
+        JSONArray columns = requestBody.getJSONArray("columns");
+        if (columns.isEmpty()) {
             log.error("请选择需要导出的字段");
         }
-        String filed= JsonResourceUtil.joinFiled(AccountReportConstants.dicMapKs,columns);
-        List<String> titles= new ArrayList<>();
+        log.info("需要导出的字段:{}", columns);
+        String filed = JsonResourceUtil.joinFiled(AccountReportConstants.dicMapKs, columns);
+        List<String> titles = new ArrayList<>();
         titles.add("账户Id");
         titles.add("账户名称");
-        titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.dicMapKs,columns));
+        titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.dicMapKs, columns));
         //此处增加两个元素是为了保证数据有序
-        columns.add(0,"accountId");
-        columns.add(1,"authName");
+        columns.add(0, "accountId");
+        columns.add(1, "authName");
         String mediaId = requestBody.getString("mediaId");
         JSONArray accounts = requestBody.getJSONArray("accountIds");
-        if(accounts.isEmpty()){
+        if (accounts.isEmpty()) {
             return;
         }
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
-        String target= requestBody.getString("target");
-        String order= requestBody.getString("order");
-        int hour= requestBody.getInteger("hour");
-        List<JSONObject> excelData= kuaiShouAccountReportService.getExcelDataBy(filed,mediaId,accounts,startDate,endDate,hour,target,order);
-        if(excelData.isEmpty()){
+        String target = requestBody.getString("target");
+        String order = requestBody.getString("order");
+        int hour = requestBody.getInteger("hour");
+        List<JSONObject> excelData = kuaiShouAccountReportService.getExcelDataBy(filed, mediaId, accounts, startDate, endDate, hour, target, order);
+        if (excelData.isEmpty()) {
             return;
         }
-        List<List<Object>> excelList= new ArrayList<>();
-        excelData.forEach(data->{
-            List<Object> temp= new ArrayList<>();
-            columns.forEach(k-> temp.add(data.get(k.toString())));
+        List<List<Object>> excelList = new ArrayList<>();
+        excelData.forEach(data -> {
+            List<Object> temp = new ArrayList<>();
+            columns.forEach(k -> temp.add(data.get(k.toString())));
             excelList.add(temp);
         });
-        try{
+        try {
             String[] headers = titles.toArray(new String[titles.size()]);
             OutputStream os = response.getOutputStream();
             ExportExcelUtils eeu = new ExportExcelUtils();
@@ -151,7 +152,7 @@ public class KuaiShouAccountReportCtrl {
             workbook.write(os);
             os.flush();
             os.close();
-        }catch (IOException e){
+        } catch (IOException e) {
             log.error(e.getMessage());
         }
     }

+ 2 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouYiCheReportController.java

@@ -187,9 +187,7 @@ public class KuaiShouYiCheReportController {
             directApplication.add(directApplicationJson.getString("agent"));
             directApplication.add(directApplicationJson.getString("media"));
             directApplication.add(directApplicationJson.getString("systemType"));
-            if (!Check.isNull(directApplicationJson.getString("statDate"))) {
-                directApplication.add(directApplicationJson.getString("statDate").replace("-", "/"));
-            }
+            directApplication.add(directApplicationJson.getString("statDate"));
             directApplication.add(directApplicationJson.getBigDecimal("charge"));
             directApplication.add(directApplicationJson.getBigDecimal("cashCost"));
             directApplication.add(directApplicationJson.getLong("photoShow"));
@@ -222,9 +220,7 @@ public class KuaiShouYiCheReportController {
                 List<Object> channelSubcontracting = new ArrayList();
                 channelSubcontracting.add(channelSubcontractingJson.getString("agent"));
                 channelSubcontracting.add(channelSubcontractingJson.getString("systemType"));
-                if (!Check.isNull(channelSubcontractingJson.getString("statDate"))) {
-                    channelSubcontracting.add(channelSubcontractingJson.getString("statDate").replace("-", "/"));
-                }
+                channelSubcontracting.add(channelSubcontractingJson.getString("statDate"));
                 channelSubcontracting.add(channelSubcontractingJson.getString("campaignName"));
                 channelSubcontracting.add(channelSubcontractingJson.getBigDecimal("charge"));
                 channelSubcontracting.add(channelSubcontractingJson.getBigDecimal("cashCost"));

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

@@ -21,4 +21,8 @@ public interface EtlKuaishouAccountMaterialReportDailyMapper extends BaseMapper<
     void replaceBatch(@Param(value = "records")List<EtlKuaishouAccountMaterialReportDaily> getList);
 
     void replace(@Param(value = "report")EtlKuaishouAccountMaterialReportDaily report);
+
+    void etlKuaishouReportCompanyInfo(@Param(value = "formatDate") String formatDate);
+
+    void etlKuaishouVideoReportStateDate();
 }

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

@@ -208,6 +208,22 @@
             #{report.play3sCount}
         )
     </insert>
+    <update id="etlKuaishouReportCompanyInfo">
+        update ctop_etl_kuaishou_account_material_report_daily a left join ctop_user_allocation cua on a.account_id = cua.account_id
+            left join user_company uc on cua.user_id = uc.user_id
+            set a.company_name = uc.company_name
+        where a.company_name is null
+          and uc.company_name is not null
+          and a.stat_date = #{formatDate}
+    </update>
+    <update id="etlKuaishouVideoReportStateDate">
+        UPDATE ctop_etl_kuaishou_video_info info
+            LEFT JOIN ( SELECT min( stat_date ) AS minDate, signature FROM ctop_kuaishou_report_daily_material GROUP BY signature ) a ON a.signature = info.video_code
+            SET info.state_date = a.minDate
+        WHERE
+            a.minDate IS NOT NULL
+          AND info.state_date IS NULL
+    </update>
     <select id="etlKuaishouAccountMaterialReportDailyList"
             resultType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily">
     select
@@ -216,7 +232,7 @@
     u.project_id ,
     p.project_name,
     m.account_id,
-    m.signature,
+    video.signature,
     sum(m.charge)as charge ,
     sum(m.photo_show)as photo_show ,
     sum(m.aclick)as aclick ,
@@ -242,6 +258,7 @@
     sum(m.form_count)as form_count,
      round(sum(m.play_3s_ratio*m.photo_show))as play_3s_count
     from ctop_kuaishou_report_daily_material m left join ctop_user_allocation u on u.account_id = m.account_id
+    left  join ctop_kuaishou_video_get video on video.account_id = m.account_id and m.photo_id = video.photo_id
 left join ctop_project p on p.id = u.project_id
 left join user_company c on c.user_id = u.account_id
 where 1=1

+ 49 - 19
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouYiCheReportMapper.xml

@@ -15,7 +15,13 @@
 
     <select id="selectReportByMap" parameterType="java.util.Map" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        t1.system_type systemType,
+        (case when t1.system_type = 'android'
+         then '安卓'
+         when t1.system_type = 'ios'
+         then 'ios'
+         else '-'
+         end
+        ) as systemType,
         t1.auth_name authName,
         ROUND(sum(t2.charge) / #{disCount},3) charge,
         sum(t2.activation) activation,
@@ -64,7 +70,13 @@
 
     <select id="selectSumReportByMap" parameterType="java.util.Map" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        t1.system_type systemType,
+        (case when t1.system_type = 'android'
+        then '安卓'
+        when t1.system_type = 'ios'
+        then 'ios'
+        else '-'
+        end
+        ) as systemType,
         #{dateDesc} authName,
         ROUND(sum(t2.charge) / #{disCount},3) charge,
         sum(t2.activation) activation,
@@ -121,19 +133,25 @@
         '未知'
         END
         ) media,
-        t1.system_type systemType,
-        t2.stat_date statDate,
+        (case when t1.system_type = 'android'
+        then '安卓'
+        when t1.system_type = 'ios'
+        then 'ios'
+        else '-'
+        end
+        ) as systemType,
+        DATE_FORMAT(t2.stat_date,'%Y/%c/%d')  statDate,
         sum(t2.charge) charge,
         ROUND(sum(t2.charge) / #{disCount}, 3) cashCost,
-        sum(t2.photo_show) photoShow,
-        sum(t2.photo_click) photoClick,
+        sum(t2.aclick + t2.photo_show) photoShow,
+        sum(t2.photo_click + t2.bclick) photoClick,
         (
         CASE
         WHEN sum(t2.photo_show) != 0 THEN
         CONCAT(
         CAST(ROUND(
         (
-        sum(t2.photo_click) / sum(t2.photo_show)
+        sum(t2.photo_click + t2.bclick) / sum(t2.photo_show + t2.aclick)
         ) * 100,
         3
         ) AS CHAR)
@@ -281,19 +299,25 @@
         '未知'
         END
         ) media,
-        t2.system_type systemType,
-        t2.stat_date statDate,
+        (case when t2.system_type = 'android'
+        then '安卓'
+        when t2.system_type = 'ios'
+        then 'ios'
+        else '-'
+        end
+        ) as systemType,
+        DATE_FORMAT(t2.stat_date,'%Y/%c/%d') statDate,
         sum(t2.charge) charge,
         ROUND(sum(t2.charge) / #{disCount}, 3) cashCost,
-        sum(t2.photo_show) photoShow,
-        sum(t2.photo_click) photoClick,
+        sum(t2.aclick + t2.photo_show) photoShow,
+        sum(t2.photo_click + t2.bclick) photoClick,
         (
         CASE
         WHEN sum(t2.photo_show) != 0 THEN
         CONCAT(
         CAST( ROUND(
         (
-        sum(t2.photo_click) / sum(t2.photo_show)
+        sum(t2.photo_click + t2.bclick) / sum(t2.photo_show + t2.aclick)
         ) * 100,
         3
         ) AS CHAR)
@@ -446,7 +470,7 @@
         <if test="projectId != null">
             and t.project_id = #{projectId}
         </if>
-        <if test="systemType != null">
+        <if test="statDate != null">
             and t1.stat_date = #{statDate}
         </if>
         ) t2
@@ -471,20 +495,26 @@
         '未知'
         END
         ) media,
-        t2.system_type systemType,
-        t2.stat_date statDate,
+        (case when t2.system_type = 'android'
+        then '安卓'
+        when t2.system_type = 'ios'
+        then 'ios'
+        else '-'
+        end
+        ) as systemType,
+        DATE_FORMAT(t2.stat_date,'%Y/%c/%d') statDate,
         t2.campaignName campaignName ,
         sum(t2.charge) charge,
         ROUND(sum(t2.charge) / #{disCount}, 3) cashCost,
-        sum(t2.photo_show) photoShow,
-        sum(t2.photo_click) photoClick,
+        sum(t2.aclick + t2.photo_show) photoShow,
+        sum(t2.photo_click + t2.bclick) photoClick,
         (
         CASE
         WHEN sum(t2.photo_show) != 0 THEN
         CONCAT(
         CAST( ROUND(
         (
-        sum(t2.photo_click) / sum(t2.photo_show)
+        sum(t2.photo_click + t2.bclick) / sum(t2.photo_show + t2.aclick)
         ) * 100,
         3
         ) AS CHAR)
@@ -626,7 +656,7 @@
         <if test="projectId != null">
             and t.project_id = #{projectId}
         </if>
-        <if test="systemType != null">
+        <if test="statDate != null">
             and t1.stat_date = #{statDate}
         </if>
         ) t2

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

@@ -14,4 +14,8 @@ public interface IEtlKuaishouAccountMaterialReportDailyService extends IService<
     void etlKuaishouAccountMaterialReportDailyData(String date);
 
     void etlKuaishouAccountMaterialReportInfo(String formatDate);
+
+    void etlKuaishouReportCompanyInfo(String formatDate);
+
+    void etlKuaishouVideoReportStateDate();
 }

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

@@ -76,4 +76,14 @@ public class EtlKuaishouAccountMaterialReportDailyServiceImpl extends ServiceImp
         }
         log.info("{}数据获取完成",formatDate);
     }
+
+    @Override
+    public void etlKuaishouReportCompanyInfo(String formatDate) {
+        etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouReportCompanyInfo(formatDate);
+    }
+
+    @Override
+    public void etlKuaishouVideoReportStateDate() {
+        etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouVideoReportStateDate();
+    }
 }

+ 1 - 1
module-kuaishou/src/main/resources/json_template/kuaishou_filed_mapping.json

@@ -192,7 +192,7 @@
     "comment": "按钮点击率"
   },
   "play3sRate": {
-    "filed": "CASE WHEN sum(CEIL(t1.play_3s_ratio * t1.aclick)) / sum(t1.aclick) IS NULL THEN 0 ELSE round(sum(CEIL(t1.play_3s_ratio * t1.aclick)) / sum(t1.aclick)*100,2)end as play3sRate ",
+    "filed": "(CASE WHEN  sum(t1.aclick) != 0 THEN round( sum(t1.play_3s_ratio * t1.aclick) / sum(t1.aclick) * 100,2) ELSE 0 END )AS play3sRate ",
     "comment": "3s播放率"
   },
   "activeRate": {

+ 69 - 10
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/BytedanceVideoSlogenInfoController.java

@@ -1,8 +1,13 @@
 package cn.com.ctop.toutiao.modules.material.controller;
 
+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.toutiao.modules.material.entity.ByteDanceCreativeWordPackage;
 import cn.com.ctop.toutiao.modules.material.entity.BytedanceVideoSlogenInfo;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeWordPackageService;
 import cn.com.ctop.toutiao.modules.material.service.IBytedanceVideoSlogenInfoService;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -17,6 +22,8 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.Date;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * 头条视频文案信息
@@ -31,7 +38,8 @@ import java.util.Date;
 public class BytedanceVideoSlogenInfoController {
 	@Autowired
 	private IBytedanceVideoSlogenInfoService bytedanceVideoSlogenInfoService;
-
+	@Autowired
+	private IByteDanceCreativeWordPackageService byteDanceGeneralCopywriterService;
 	/**
 	  * 分页列表查询
 	 * @param slogenInfo
@@ -85,17 +93,68 @@ public class BytedanceVideoSlogenInfoController {
 	@PostMapping(value = "/edit")
 	public Result<BytedanceVideoSlogenInfo> edit(@RequestBody BytedanceVideoSlogenInfo slogenInfo) {
 		Result<BytedanceVideoSlogenInfo> result = new Result<>();
-		BytedanceVideoSlogenInfo bytedanceVideoSlogenInfoEntity = bytedanceVideoSlogenInfoService.getById(slogenInfo.getId());
-		if(bytedanceVideoSlogenInfoEntity==null) {
-			result.error500("未找到对应实体");
+		try{
+			BytedanceVideoSlogenInfo bytedanceVideoSlogenInfoEntity = bytedanceVideoSlogenInfoService.getById(slogenInfo.getId());
+			if(bytedanceVideoSlogenInfoEntity==null) {
+				result.error500("未找到对应实体");
+				return result;
+			}
+			LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+			slogenInfo.setUpdateBy(user.getId());
+			slogenInfo.setUpdateTime(new Date());
+
+			String title = slogenInfo.getSlogan();
+			title = title.trim().replaceAll("[\\{]{2,}", "{");
+			title = title.trim().replaceAll("[\\}]{2,}", "}");
+			slogenInfo.setSlogan(title);
+
+
+			String reg = "\\{[\\u4e00-\\u9fa5\\-]{2,6}\\}";
+			Pattern pattern = Pattern.compile(reg);
+			Matcher matcher = pattern.matcher(title);
+			JSONArray creativeWordIdsArray = new JSONArray();
+
+			int len = StringUtils.lengthAsSlogan(title);
+			int left = title.indexOf("{");
+			int right = title.indexOf("}");
+			if (left >= 0 || right >= 0) {
+				int times = 0;
+				while (matcher.find()) { //此处find()每次被调用后,会偏移到下一个匹配
+					times++;
+					if (times >= 3) {
+						result.error500("动态词包不合法,词包数量超过2个");
+						return result;
+					}
+					String matchStr = matcher.group();//获取当前匹配的值
+					title = title.replace(matchStr,"");
+					ByteDanceCreativeWordPackage creativeWordPackage = byteDanceGeneralCopywriterService.selectCreativeWordPackageByName(matchStr.substring(1, matchStr.length() - 1));
+					if (Check.isNull(creativeWordPackage)) {
+						return result.error500("动态词包不合法,词包不存在或者含有单独的非词包大括号");
+					}
+					creativeWordIdsArray.add(creativeWordPackage.getCreativeWordId());
+					len = len - (right - left) + creativeWordPackage.getMaxWordLen();
+					left = title.indexOf("{");
+					right = title.indexOf("}");
+				}
+				if(title.contains("{") || title.contains("}")){
+					return result.error500("大括号单独出现或大括号中内容不合法");
+				}
+				slogenInfo.setCreativeWordIds(creativeWordIdsArray.toJSONString());
+			}
+			//校验标题长度,长度小于5和大于30的全部过滤
+			if (len < 5 || len > 30) {
+				return result.error500("文案长度不合法,小于5或大于30");
+			}
+
+			bytedanceVideoSlogenInfoService.updateById(slogenInfo);
+			result.setCode(0);
+			result.setMessage("修改成功!");
+			return result;
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
 			return result;
 		}
-		LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-		slogenInfo.setUpdateBy(user.getId());
-		slogenInfo.setUpdateTime(new Date());
-		bytedanceVideoSlogenInfoService.updateById(slogenInfo);
-		result.success("修改成功!");
-		return result;
 	}
 
 	/**

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

@@ -15,4 +15,6 @@ import java.util.List;
  */
 public interface ByteDanceCreativeWordPackageMapper extends BaseMapper<ByteDanceCreativeWordPackage> {
     void replaceBatch(@Param(value = "creativeWordPackages") List<ByteDanceCreativeWordPackage> creativeWordPackages);
+
+    ByteDanceCreativeWordPackage selectCreativeWordPackageByName(String name);
 }

+ 6 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/BytedanceImageInfoMapper.java

@@ -16,7 +16,12 @@ public interface BytedanceImageInfoMapper extends BaseMapper<BytedanceImageInfo>
 
     void replaceBatch(@Param(value = "imageInfos")List<BytedanceImageInfo> imageInfos);
 
+    //大图竖图
     void updateImageVerticalType();
-
+    //大图横图
     void updateImageHorizonType();
+    //开屏
+    void updateImageUnionType();
+    //开屏 或者 竖图
+    //void updateImageUnionIOrVerticalType();
 }

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


部分文件因文件數量過多而無法顯示