소스 검색

Merge remote-tracking branch 'origin/master'

yumeng 4 년 전
부모
커밋
7a46af3d56
53개의 변경된 파일555개의 추가작업 그리고 252개의 파일을 삭제
  1. 8 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  2. 57 34
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  3. 7 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java
  4. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ReleaseViewRecordController.java
  5. 14 12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/ProjectMemberMapper.java
  6. 3 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MaterialReportOverViewMapper.xml
  7. 14 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ProjectMemberMapper.xml
  8. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IProjectMemberService.java
  9. 6 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java
  10. 0 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java
  11. 32 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java
  12. 19 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/UserCompanyController.java
  13. 18 11
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  14. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/Project.java
  15. 3 1
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java
  16. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/ProjectMapper.java
  17. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/UserCompanyMapper.java
  18. 16 22
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml
  19. 15 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ProjectMapper.xml
  20. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/SysUserMapper.xml
  21. 7 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserCompanyMapper.xml
  22. 2 1
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  23. 2 1
      module-common/src/main/java/cn/com/ctop/common/module/service/IProjectService.java
  24. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IUserCompanyService.java
  25. 6 3
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  26. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/ProjectServiceImpl.java
  27. 11 2
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserCompanyServiceImpl.java
  28. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/vo/SysUserVo.java
  29. 1 1
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAiCreateJob.java
  30. 2 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceMaterialsLoadJob.java
  31. 19 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceRejectReasonJob.java
  32. 2 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouVideoRelateCreativesJob.java
  33. 4 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouCreateCreativeController.java
  34. 30 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java
  35. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouVideoGetController.java
  36. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroupTemplate.java
  37. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouGroupTemplateMapper.java
  38. 3 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouReportDailyMaterialMapper.java
  39. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupTemplateMapper.xml
  40. 95 51
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml
  41. 8 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouVideoGetMapper.xml
  42. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouReportDailyMaterialService.java
  43. 21 9
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java
  44. 4 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouReportDailyMaterialServiceImpl.java
  45. 19 10
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  46. 0 10
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java
  47. 6 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/BytedanceImageInfoMapper.java
  48. 22 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/BytedanceImageInfoMapper.xml
  49. 3 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IBytedanceImageInfoService.java
  50. 6 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceImageInfoServiceImpl.java
  51. 0 3
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/operation/util/GetChangeDateUtil.java
  52. 41 16
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java
  53. 0 17
      pom.xml

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

@@ -162,11 +162,13 @@ public class CallbackController {
                     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"));
@@ -212,8 +214,9 @@ public class CallbackController {
                     userAllocation.setCreateTime(new Date());
                     userAllocation.setUpdateTime(new Date());
                     //自动投放,0关闭,1开启
+                    /* TODO
                     userAllocation.setAutoDelivery(autoDelivery);
-                    userAllocation.setMaterialType(materialTypeStr);
+                    userAllocation.setMaterialType(materialTypeStr);*/
                     allocationMapper.deleteById(userAllocation.getId());
                     Map<String, Object> deleteUserMap = new HashMap<>();
                     deleteUserMap.put("advertiser_id", advertiserId);
@@ -224,7 +227,7 @@ public class CallbackController {
                     if (i > 0) {
                         log.info("同步分配用户表完成,task_id:{},accountId:{}", state, accountId);
                     }
-                    Integer materialType = materialTypeArr.getInteger(0);
+                   /* TODO Integer materialType = materialTypeArr.getInteger(0);*/
                     //账号绑定
                     bindAccountAuthService.addBindAccount(accountId, KuaishouInterfaceConstant.LOGIN_TYPE_KUAISHOU, advertiserId);
                     Thread t = new Thread() {
@@ -232,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();
                             }

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

@@ -20,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;
@@ -79,6 +78,9 @@ public class MaterialInfoController {
     @Autowired
     private IProjectService projectService;
     @Autowired
+    private IProjectMemberService projectMemberService;
+
+    @Autowired
     private IByteDanceCreativeWordPackageService byteDanceGeneralCopywriterService;
 
     @GetMapping("/supplierWatermark")
@@ -298,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);
         }
     }
 
@@ -520,12 +543,12 @@ public class MaterialInfoController {
             if (null != slogans && !slogans.isEmpty()) {
 
 
-                for (int i = 0;i<slogans.size();i++) {
+                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);
+                    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);
@@ -534,44 +557,44 @@ public class MaterialInfoController {
                     int len = StringUtils.lengthAsSlogan(title);
                     int left = title.indexOf("{");
                     int right = title.indexOf("}");
-                    if(left >= 0 || right >= 0){
+                    if (left >= 0 || right >= 0) {
                         int times = 0;
                         while (matcher.find()) { //此处find()每次被调用后,会偏移到下一个匹配
                             times++;
-                            if(times>=3){
+                            if (times >= 3) {
                                 result.setCode(500);
                                 result.setMessage("动态词包不合法,词包数量超过2个");
-                                return  result;
+                                return result;
                             }
                             String matchStr = matcher.group();//获取当前匹配的值
-                            title = title.replace(matchStr,"");
-                            ByteDanceCreativeWordPackage creativeWordPackage = byteDanceGeneralCopywriterService.selectCreativeWordPackageByName(matchStr.substring(1,matchStr.length()-1));
-                            if(Check.isNull(creativeWordPackage)){
+                            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;
+                                return result;
                             }
                             creativeWordIdsArray.add(creativeWordPackage.getCreativeWordId());
                             len = len - (right - left) + creativeWordPackage.getMaxWordLen();
                             left = title.indexOf("{");
                             right = title.indexOf("}");
                         }
-                        if(title.contains("{") || title.contains("}")){
+                        if (title.contains("{") || title.contains("}")) {
                             return result.error500("大括号单独出现或大括号中内容不合法");
                         }
-                        slogenInfo.put("creative_word_ids",creativeWordIdsArray.toJSONString());
+                        slogenInfo.put("creative_word_ids", creativeWordIdsArray.toJSONString());
                     }
                     //校验标题长度,长度小于5和大于30的全部过滤
-                    if(len<5 || len>30){
+                    if (len < 5 || len > 30) {
                         result.setCode(500);
                         result.setMessage("文案长度不合法,小于5或大于30");
-                        return  result;
+                        return result;
                     }
                 }
 
                 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-                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());
+                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);

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

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

@@ -2,6 +2,7 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
 import cn.com.ctop.common.module.utils.QueryGenerator;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.Arrays;
+import java.util.List;
 import java.util.Map;
 
 /**

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

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

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

+ 32 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java

@@ -30,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;
@@ -131,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();
@@ -141,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;
+
+    }
+
 
     /**
      * 获取用户列表数据
@@ -359,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 {
@@ -372,6 +388,18 @@ public class SysUserController {
             } 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());
@@ -384,7 +412,7 @@ public class SysUserController {
 
                 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");//用户角色

+ 19 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/UserCompanyController.java

@@ -23,7 +23,15 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
 import org.jeecgframework.poi.excel.entity.ImportParams;
 import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
 import org.springframework.web.servlet.ModelAndView;
@@ -121,6 +129,16 @@ public class UserCompanyController {
         return result;
     }
 
+    @GetMapping(value = "/allCompany")
+    public Result<Object> allCompany() {
+        try {
+            return userCompanyService.allCompany();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
     /**
      * 添加
      *

+ 18 - 11
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -6,8 +6,8 @@ import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily;
 import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouAccountMaterialReportDailyMapper;
-import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouAccountMaterialReportDailyService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyImageService;
 import cn.com.ctop.oa.modules.service.IWechatNoListService;
 import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
@@ -76,23 +76,19 @@ public class SampleTest {
     private IBytedanceReportService bytedanceReportService;
     @Autowired
     private IETLReportBytedanceVideoService etlReportBytedanceVideoService;
-    @Autowired
-    private IEtlKuaishouAccountMaterialReportDailyService materialReportDailyService;
 
     @Test
     public void loadKuaishouCookie() throws ParseException {
+        CtopOauthToken tokenByAccountId = tokenService.getTokenByAccountId(1700996735138951L);
+        advertiserDataService.getMaterialList(tokenByAccountId);
 
-        Date startDate = new Date();
-        for (int i = 1; i <= 2; i++) {
-            if (i == 1) {
-                continue;
-            }
-            System.err.println(DateUtils.addDay(new Date(), -i));
-            materialReportDailyService.etlKuaishouAccountMaterialReportInfo(DateUtils.formatDate(DateUtils.addDay(new Date(), -i)));
-        }
+        CtopOauthToken tokenByAccountId1 = tokenService.getTokenByAccountId(1700996735589383L);
+        advertiserDataService.getMaterialList(tokenByAccountId1);
     }
 
 
+
+
     @Test
     public void deleteKuaishouComment() {
         Long start = System.currentTimeMillis();
@@ -127,6 +123,7 @@ public class SampleTest {
     }
 
 
+
     @Test
     public void etlBytedanceVideoInfo() {
         String startDate = "2021-02-01";
@@ -150,6 +147,7 @@ public class SampleTest {
     }
 
 
+
     @Test
     public void formatVideoReportData() {
         for (int i = 1; i < 45; i++) {
@@ -237,4 +235,13 @@ public class SampleTest {
         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"));
+        }
+    }
 }

+ 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;
     /**
      * 创建时间
      */

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 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);
 }

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/UserCompanyMapper.java

@@ -1,7 +1,11 @@
 package cn.com.ctop.common.module.mapper;
 
 import cn.com.ctop.common.module.entity.UserCompany;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.common.api.vo.Result;
+
+import java.util.List;
 
 /**
  * 用户够公司
@@ -12,4 +16,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface UserCompanyMapper extends BaseMapper<UserCompany> {
 
+    List<JSONObject> allCompany();
 }

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

@@ -95,15 +95,15 @@
         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
+        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">
@@ -125,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>
@@ -152,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>

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

+ 7 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserCompanyMapper.xml

@@ -2,4 +2,11 @@
 <!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.UserCompanyMapper">
 
+    <select id="allCompany" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT company_id as 'companyId',
+               company_name as 'companyName'
+        FROM user_company
+        GROUP BY company_id
+    </select>
+
 </mapper>

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

@@ -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);
 }

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

@@ -3,6 +3,7 @@ package cn.com.ctop.common.module.service;
 import cn.com.ctop.common.module.entity.SysUser;
 import cn.com.ctop.common.module.entity.UserCompany;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
 
 /**
  * 用户够公司
@@ -18,4 +19,6 @@ public interface IUserCompanyService extends IService<UserCompany> {
     void removeByUserId(String id);
 
     UserCompany getByUserId(String userId);
+
+    Result<Object> allCompany();
 }

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

@@ -38,6 +38,7 @@ import java.util.concurrent.Executors;
 
 import static cn.com.ctop.common.module.utils.CloudVideoProcessUtil.getTaskDetailResponse;
 import static cn.com.ctop.common.module.utils.CloudVideoProcessUtil.videoWatermarkHandle;
+
 /**
  * 素材信息
  *
@@ -770,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);
 
@@ -788,8 +790,7 @@ 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()) {
@@ -862,6 +863,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     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);
+    }
 }

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

@@ -9,14 +9,17 @@ import cn.com.ctop.common.module.mapper.SysUserDepartMapper;
 import cn.com.ctop.common.module.mapper.UserCompanyMapper;
 import cn.com.ctop.common.module.service.IUserCompanyService;
 import cn.com.ctop.common.module.utils.Check;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -96,9 +99,15 @@ public class UserCompanyServiceImpl extends ServiceImpl<UserCompanyMapper, UserC
 
     @Override
     public UserCompany getByUserId(String userId) {
-        QueryWrapper<UserCompany>queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("user_id",userId);
+        QueryWrapper<UserCompany> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("user_id", userId);
         queryWrapper.last("limit 1");
         return null;
     }
+
+    @Override
+    public Result<Object> allCompany() {
+        List<JSONObject> data = userCompanyMapper.allCompany();
+        return Result.ok(data);
+    }
 }

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

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

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

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

@@ -42,14 +42,14 @@ public class KuaishouVideoRelateCreativesJob {
     public void execute() throws Exception {
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
         if (null == tokens || tokens.isEmpty()) {
-            XxlJobHelper.log("定时获取人群分析报表数据异常:未获取到可用的token");
+            XxlJobHelper.log("未获取到可用的token");
             XxlJobHelper.handleFail();
             return;
         }
         //查询有效策略的账户ID
         List<Long> accountIds = kuaishouStrategyService.queryActiveAccount();
         if (Check.isNull(accountIds) || accountIds.size() == 0) {
-            XxlJobHelper.log("定时获取人群分析报表数据异常:未获取到有效策略账户信息");
+            XxlJobHelper.log("未获取到有效策略账户信息");
             XxlJobHelper.handleFail();
             return;
         }

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

+ 2 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouVideoGetController.java

@@ -99,12 +99,12 @@ public class KuaiShouVideoGetController {
      * @return
      */
     @GetMapping(value = "/labelMaterialList")
-    public Result<Object> labelMaterialList(String realname, String roleCode, String startTime, String endTime, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+    public Result<Object> labelMaterialList(String companyId, String realname, String roleCode, String startTime, String endTime, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
         try {
             if (Check.isNull(startTime) || Check.isNull(endTime)) {
                 return Result.error("请选择查询日期");
             }
-            return kuaiShouReportDailyMaterialService.labelMaterialList(realname, roleCode, startTime, endTime, pageNo, pageSize);
+            return kuaiShouReportDailyMaterialService.labelMaterialList(companyId, realname, roleCode, startTime, endTime, pageNo, pageSize);
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 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;
 
     /**
      * 创建时间

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

@@ -18,7 +18,7 @@ public interface KuaiShouGroupTemplateMapper extends BaseMapper<KuaiShouGroupTem
 
     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);
 

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

@@ -39,9 +39,9 @@ public interface KuaiShouReportDailyMaterialMapper extends BaseMapper<KuaiShouRe
 
     List<JSONObject> getVideoInfoByList(@Param("photoIdList") List<Long> photoIdList);
 
-    Long labelMaterialListTotal(@Param("realname") String realname, @Param("roleCode") String roleCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
+    Long labelMaterialListTotal(@Param("companyId") String companyId, @Param("realname") String realname, @Param("roleCode") String roleCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
-    List<JSONObject> labelMaterialList(@Param("realname") String realname, @Param("roleCode") String roleCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
+    List<JSONObject> labelMaterialList(@Param("companyId") String companyId, @Param("realname") String realname, @Param("roleCode") String roleCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
-    JSONObject labelMaterialAll(@Param("realname") String realname, @Param("roleCode") String roleCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
+    JSONObject labelMaterialAll(@Param("companyId") String companyId, @Param("realname") String realname, @Param("roleCode") String roleCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
 }

+ 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

+ 95 - 51
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>
 
 
@@ -445,15 +445,16 @@
         LEFT JOIN ctop_tag_info t2 ON t2.id = t1.tag_id
         INNER JOIN
         (
-        SELECT signature  FROM ctop_kuaishou_video_get
-        WHERE  stat_date &gt;=  #{startTime}
-        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        SELECT signature FROM ctop_kuaishou_video_get
+        WHERE stat_date &gt;= #{startTime}
+        AND stat_date &lt;= concat(#{endTime},' 23:59:59')
         GROUP BY signature
         ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
         LEFT JOIN sys_role tt3 ON tt2.role_id = tt3.id
+        LEFT JOIN user_company tt4 ON tt1.id = tt4.user_id
         WHERE 1=1
         <if test="realname!=null">
             and tt1.realname LIKE CONCAT('%',#{realname},'%')
@@ -464,6 +465,9 @@
         <if test="roleCode==null">
             AND tt3.role_code in ('clip','shot','plan')
         </if>
+        <if test="companyId!=null">
+            AND tt4.company_id = #{companyId}
+        </if>
         ) t3 ON t3.id = t1.user_id
         WHERE t2.parent_id in(60155,60156)
         GROUP BY t1.user_id
@@ -487,19 +491,23 @@
         t3.realname,
         t3.role_name
         FROM ctop_material_tag_info t1
-        LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
+        LEFT JOIN ctop_tag_info t2 ON t2.id = t1.tag_id
         INNER JOIN
         (
-        SELECT signature  FROM ctop_kuaishou_video_get
-        WHERE  stat_date &gt;=  #{startTime}
-        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        SELECT signature FROM ctop_kuaishou_video_get
+        WHERE stat_date &gt;= #{startTime}
+        AND stat_date &lt;= concat(#{endTime},' 23:59:59')
         GROUP BY signature
         ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
         LEFT JOIN sys_role tt3 ON tt2.role_id = tt3.id
+        LEFT JOIN user_company tt4 ON tt1.id = tt4.user_id
         WHERE 1=1
+        <if test="companyId!=null">
+            AND tt4.company_id = #{companyId}
+        </if>
         <if test="realname!=null">
             and tt1.realname LIKE CONCAT('%',#{realname},'%')
         </if>
@@ -515,22 +523,26 @@
         ) k
         LEFT JOIN
         (
-            SELECT
+        SELECT
         t1.user_id, SUM(t5.charge) 'zhenren_charge'
         FROM ctop_material_tag_info t1
-        LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
+        LEFT JOIN ctop_tag_info t2 ON t2.id = t1.tag_id
         INNER JOIN
         (
-        SELECT signature  FROM ctop_kuaishou_video_get
-        WHERE  stat_date &gt;=  #{startTime}
-        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        SELECT signature FROM ctop_kuaishou_video_get
+        WHERE stat_date &gt;= #{startTime}
+        AND stat_date &lt;= concat(#{endTime},' 23:59:59')
         GROUP BY signature
         ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
         LEFT JOIN sys_role tt3 ON tt2.role_id = tt3.id
+        LEFT JOIN user_company tt4 ON tt1.id = tt4.user_id
         WHERE 1=1
+        <if test="companyId!=null">
+            AND tt4.company_id = #{companyId}
+        </if>
         <if test="realname!=null">
             and tt1.realname LIKE CONCAT('%',#{realname},'%')
         </if>
@@ -541,7 +553,7 @@
             AND tt3.role_code in ('clip','shot','plan')
         </if>
         ) t3 ON t3.id = t1.user_id
-        LEFT JOIN ctop_kuaishou_report_daily_material t5 ON  t1.`code` = t5.signature
+        LEFT JOIN ctop_kuaishou_report_daily_material t5 ON t1.`code` = t5.signature
         WHERE t2.parent_id = 60155
         GROUP BY t1.user_id
         ) k1 ON k1.user_id =k.user_id
@@ -550,19 +562,23 @@
         SELECT
         t1.user_id,t4.signature
         FROM ctop_material_tag_info t1
-        LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
+        LEFT JOIN ctop_tag_info t2 ON t2.id = t1.tag_id
         INNER JOIN
         (
-        SELECT signature  FROM ctop_kuaishou_video_get
-        WHERE  stat_date &gt;=  #{startTime}
-        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        SELECT signature FROM ctop_kuaishou_video_get
+        WHERE stat_date &gt;= #{startTime}
+        AND stat_date &lt;= concat(#{endTime},' 23:59:59')
         GROUP BY signature
         ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
         LEFT JOIN sys_role tt3 ON tt2.role_id = tt3.id
+        LEFT JOIN user_company tt4 ON tt1.id = tt4.user_id
         WHERE 1=1
+        <if test="companyId!=null">
+            AND tt4.company_id = #{companyId}
+        </if>
         <if test="realname!=null">
             and tt1.realname LIKE CONCAT('%',#{realname},'%')
         </if>
@@ -583,19 +599,23 @@
         SELECT
         t1.user_id, SUM(t5.charge) 'zhizuo_charge'
         FROM ctop_material_tag_info t1
-        LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
+        LEFT JOIN ctop_tag_info t2 ON t2.id = t1.tag_id
         INNER JOIN
         (
-        SELECT signature  FROM ctop_kuaishou_video_get
-        WHERE  stat_date &gt;=  #{startTime}
-        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        SELECT signature FROM ctop_kuaishou_video_get
+        WHERE stat_date &gt;= #{startTime}
+        AND stat_date &lt;= concat(#{endTime},' 23:59:59')
         GROUP BY signature
         ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
         LEFT JOIN sys_role tt3 ON tt2.role_id = tt3.id
+        LEFT JOIN user_company tt4 ON tt1.id = tt4.user_id
         WHERE 1=1
+        <if test="companyId!=null">
+            AND tt4.company_id = #{companyId}
+        </if>
         <if test="realname!=null">
             and tt1.realname LIKE CONCAT('%',#{realname},'%')
         </if>
@@ -606,7 +626,7 @@
             AND tt3.role_code in ('clip','shot','plan')
         </if>
         ) t3 ON t3.id = t1.user_id
-        LEFT JOIN ctop_kuaishou_report_daily_material t5 ON  t1.`code` = t5.signature
+        LEFT JOIN ctop_kuaishou_report_daily_material t5 ON t1.`code` = t5.signature
         WHERE t2.parent_id = 60156
         GROUP BY t1.user_id
         )k3 ON k3.user_id =k.user_id
@@ -615,19 +635,23 @@
         SELECT
         t1.user_id,t4.signature
         FROM ctop_material_tag_info t1
-        LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
+        LEFT JOIN ctop_tag_info t2 ON t2.id = t1.tag_id
         INNER JOIN
         (
-        SELECT signature  FROM ctop_kuaishou_video_get
-        WHERE  stat_date &gt;=  #{startTime}
-        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        SELECT signature FROM ctop_kuaishou_video_get
+        WHERE stat_date &gt;= #{startTime}
+        AND stat_date &lt;= concat(#{endTime},' 23:59:59')
         GROUP BY signature
         ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
         LEFT JOIN sys_role tt3 ON tt2.role_id = tt3.id
+        LEFT JOIN user_company tt4 ON tt1.id = tt4.user_id
         WHERE 1=1
+        <if test="companyId!=null">
+            AND tt4.company_id = #{companyId}
+        </if>
         <if test="realname!=null">
             and tt1.realname LIKE CONCAT('%',#{realname},'%')
         </if>
@@ -638,7 +662,7 @@
             AND tt3.role_code in ('clip','shot','plan')
         </if>
         ) t3 ON t3.id = t1.user_id
-        WHERE  t2.parent_id = 60156
+        WHERE t2.parent_id = 60156
         GROUP BY t1.user_id,t1.`code`
         ) t
         GROUP BY user_id
@@ -669,19 +693,23 @@
         t3.realname,
         t3.role_name
         FROM ctop_material_tag_info t1
-        LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
+        LEFT JOIN ctop_tag_info t2 ON t2.id = t1.tag_id
         INNER JOIN
         (
-        SELECT signature  FROM ctop_kuaishou_video_get
-        WHERE  stat_date &gt;=  #{startTime}
-        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        SELECT signature FROM ctop_kuaishou_video_get
+        WHERE stat_date &gt;= #{startTime}
+        AND stat_date &lt;= concat(#{endTime},' 23:59:59')
         GROUP BY signature
         ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
         LEFT JOIN sys_role tt3 ON tt2.role_id = tt3.id
+        LEFT JOIN user_company tt4 ON tt1.id = tt4.user_id
         WHERE 1=1
+        <if test="companyId!=null">
+            AND tt4.company_id = #{companyId}
+        </if>
         <if test="realname!=null">
             and tt1.realname LIKE CONCAT('%',#{realname},'%')
         </if>
@@ -700,12 +728,12 @@
         SELECT
         t1.user_id, SUM(t5.charge) 'zhenren_charge'
         FROM ctop_material_tag_info t1
-        LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
+        LEFT JOIN ctop_tag_info t2 ON t2.id = t1.tag_id
         INNER JOIN
         (
-        SELECT signature  FROM ctop_kuaishou_video_get
-        WHERE  stat_date &gt;=  #{startTime}
-        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        SELECT signature FROM ctop_kuaishou_video_get
+        WHERE stat_date &gt;= #{startTime}
+        AND stat_date &lt;= concat(#{endTime},' 23:59:59')
         GROUP BY signature
         ) t4 ON t4.signature= t1.`code`
         INNER JOIN
@@ -713,7 +741,11 @@
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
         LEFT JOIN sys_role tt3 ON tt2.role_id = tt3.id
+        LEFT JOIN user_company tt4 ON tt1.id = tt4.user_id
         WHERE 1=1
+        <if test="companyId!=null">
+            AND tt4.company_id = #{companyId}
+        </if>
         <if test="realname!=null">
             and tt1.realname LIKE CONCAT('%',#{realname},'%')
         </if>
@@ -724,7 +756,7 @@
             AND tt3.role_code in ('clip','shot','plan')
         </if>
         ) t3 ON t3.id = t1.user_id
-        LEFT JOIN ctop_kuaishou_report_daily_material t5 ON  t1.`code` = t5.signature
+        LEFT JOIN ctop_kuaishou_report_daily_material t5 ON t1.`code` = t5.signature
         WHERE t2.parent_id = 60155
         GROUP BY t1.user_id
         )k1 ON k1.user_id =k.user_id
@@ -733,19 +765,23 @@
         SELECT
         t1.user_id,t4.signature
         FROM ctop_material_tag_info t1
-        LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
+        LEFT JOIN ctop_tag_info t2 ON t2.id = t1.tag_id
         INNER JOIN
         (
-        SELECT signature  FROM ctop_kuaishou_video_get
-        WHERE  stat_date &gt;=  #{startTime}
-        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        SELECT signature FROM ctop_kuaishou_video_get
+        WHERE stat_date &gt;= #{startTime}
+        AND stat_date &lt;= concat(#{endTime},' 23:59:59')
         GROUP BY signature
         ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
         LEFT JOIN sys_role tt3 ON tt2.role_id = tt3.id
+        LEFT JOIN user_company tt4 ON tt1.id = tt4.user_id
         WHERE 1=1
+        <if test="companyId!=null">
+            AND tt4.company_id = #{companyId}
+        </if>
         <if test="realname!=null">
             and tt1.realname LIKE CONCAT('%',#{realname},'%')
         </if>
@@ -766,19 +802,23 @@
         SELECT
         t1.user_id, SUM(t5.charge) 'zhizuo_charge'
         FROM ctop_material_tag_info t1
-        LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
+        LEFT JOIN ctop_tag_info t2 ON t2.id = t1.tag_id
         INNER JOIN
         (
-        SELECT signature  FROM ctop_kuaishou_video_get
-        WHERE  stat_date &gt;=  #{startTime}
-        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        SELECT signature FROM ctop_kuaishou_video_get
+        WHERE stat_date &gt;= #{startTime}
+        AND stat_date &lt;= concat(#{endTime},' 23:59:59')
         GROUP BY signature
         ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
         LEFT JOIN sys_role tt3 ON tt2.role_id = tt3.id
+        LEFT JOIN user_company tt4 ON tt1.id = tt4.user_id
         WHERE 1=1
+        <if test="companyId!=null">
+            AND tt4.company_id = #{companyId}
+        </if>
         <if test="realname!=null">
             and tt1.realname LIKE CONCAT('%',#{realname},'%')
         </if>
@@ -789,7 +829,7 @@
             AND tt3.role_code in ('clip','shot','plan')
         </if>
         ) t3 ON t3.id = t1.user_id
-        LEFT JOIN ctop_kuaishou_report_daily_material t5 ON  t1.`code` = t5.signature
+        LEFT JOIN ctop_kuaishou_report_daily_material t5 ON t1.`code` = t5.signature
         WHERE t2.parent_id = 60156
         GROUP BY t1.user_id
         )k3 ON k3.user_id =k.user_id
@@ -798,19 +838,23 @@
         SELECT
         t1.user_id,t4.signature
         FROM ctop_material_tag_info t1
-        LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
+        LEFT JOIN ctop_tag_info t2 ON t2.id = t1.tag_id
         INNER JOIN
         (
-        SELECT signature  FROM ctop_kuaishou_video_get
-        WHERE  stat_date &gt;=  #{startTime}
-        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        SELECT signature FROM ctop_kuaishou_video_get
+        WHERE stat_date &gt;= #{startTime}
+        AND stat_date &lt;= concat(#{endTime},' 23:59:59')
         GROUP BY signature
         ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
         LEFT JOIN sys_role tt3 ON tt2.role_id = tt3.id
+        LEFT JOIN user_company tt4 ON tt1.id = tt4.user_id
         WHERE 1=1
+        <if test="companyId!=null">
+            AND tt4.company_id = #{companyId}
+        </if>
         <if test="realname!=null">
             and tt1.realname LIKE CONCAT('%',#{realname},'%')
         </if>

+ 8 - 2
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">

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

@@ -28,5 +28,5 @@ public interface IKuaiShouReportDailyMaterialService extends IService<KuaiShouRe
 
     List<KuaiShouReportDailyMaterial> getVideoInfoByList(List<KuaiShouReportDailyMaterial> addList, List<Long> photoIdList);
 
-    Result<Object> labelMaterialList(String realname, String roleCode, String startTime, String endTime, Integer pageNo, Integer pageSize);
+    Result<Object> labelMaterialList(String companyId,String realname, String roleCode, String startTime, String endTime, Integer pageNo, Integer pageSize);
 }

+ 21 - 9
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);
@@ -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());

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

@@ -127,15 +127,15 @@ public class KuaiShouReportDailyMaterialServiceImpl extends ServiceImpl<KuaiShou
     }
 
     @Override
-    public Result<Object> labelMaterialList(String realname, String roleCode, String startTime, String endTime, Integer pageNo, Integer pageSize) {
-        Long total = dailyMaterialMapper.labelMaterialListTotal(realname, roleCode, startTime, endTime);
+    public Result<Object> labelMaterialList(String companyId, String realname, String roleCode, String startTime, String endTime, Integer pageNo, Integer pageSize) {
+        Long total = dailyMaterialMapper.labelMaterialListTotal(companyId, realname, roleCode, startTime, endTime);
         PageHelper.startPage(pageNo, pageSize, false);
-        PageInfo pageInfo = new PageInfo(dailyMaterialMapper.labelMaterialList(realname, roleCode, startTime, endTime));
+        PageInfo pageInfo = new PageInfo(dailyMaterialMapper.labelMaterialList(companyId, realname, roleCode, startTime, endTime));
         pageInfo.setTotal(total);
         JSONObject data = new JSONObject();
         data.put("pageInfo", pageInfo);
         if (total > 0) {
-            data.put("total", dailyMaterialMapper.labelMaterialAll(realname, roleCode, startTime, endTime));
+            data.put("total", dailyMaterialMapper.labelMaterialAll(companyId, realname, roleCode, startTime, endTime));
         }
         return Result.ok(data);
     }

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

@@ -780,19 +780,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);
         //获取全量广组主数据
@@ -801,9 +810,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");

+ 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("初始化查询 字段返回为空");
             }

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

+ 22 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/BytedanceImageInfoMapper.xml

@@ -15,7 +15,8 @@
         signature,
         image_create_time,
         create_time,
-        update_time,image_url)
+        update_time,image_url,
+        file_name)
         values
         <foreach collection="imageInfos" item="imageInfo" separator=",">
             (#{imageInfo.id},
@@ -29,10 +30,28 @@
             #{imageInfo.signature},
             #{imageInfo.imageCreateTime},
             #{imageInfo.createTime},
-            #{imageInfo.updateTime},#{imageInfo.imageUrl})
+            #{imageInfo.updateTime},#{imageInfo.imageUrl},
+            #{imageInfo.fileName})
         </foreach>
     </insert>
 
+    <!-- 开屏 或者 竖图 -->
+    <update id="updateImageUnionIOrVerticalType">
+        update
+            ctop_bytedance_image_info
+        set type = 4
+        where width &lt; height and (type is null or type = 3)
+          and (width between 1080 and 1440)  and (height between 1920 and 2560)
+    </update>
+    <!-- 开屏 -->
+    <update id="updateImageUnionType">
+        update
+            ctop_bytedance_image_info
+        set type = 3
+        where width &lt; height and type is null
+          and width = 1080 and height = 1920
+    </update>
+    <!-- 大图竖图 -->
     <update id="updateImageVerticalType">
         update
             ctop_bytedance_image_info
@@ -40,6 +59,7 @@
         where height &gt; width and type is null
         and (height between 1280 and 2560)  and (width between 720 and 1440);
     </update>
+    <!-- 大图横图 -->
     <update id="updateImageHorizonType">
         update ctop_bytedance_image_info
             set type = 1

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

@@ -14,5 +14,8 @@ import java.util.List;
 public interface IBytedanceImageInfoService extends IService<BytedanceImageInfo> {
     void replaceBatch(List<BytedanceImageInfo> videoInfoList);
 
+    /**
+     * 清洗图片素材类型
+     */
     void updateType();
 }

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

@@ -27,7 +27,13 @@ public class BytedanceImageInfoServiceImpl extends ServiceImpl<BytedanceImageInf
 
     @Override
     public void updateType() {
+        //大图竖图 -2
         imageInfoMapper.updateImageVerticalType();
+        //大图横图 -1
         imageInfoMapper.updateImageHorizonType();
+        //开屏-3
+        imageInfoMapper.updateImageUnionType();
+        //开屏 或者 竖图 -4
+        //imageInfoMapper.updateImageUnionIOrVerticalType();
     }
 }

+ 0 - 3
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/operation/util/GetChangeDateUtil.java

@@ -1,13 +1,10 @@
 package cn.com.ctop.toutiao.modules.operation.util;
 
 import cn.com.ctop.common.module.entity.SysUser;
-import cn.com.ctop.toutiao.modules.operation.entity.BytedanceOperationLog;
-import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
 
 import java.beans.Introspector;
 import java.beans.PropertyDescriptor;
 import java.lang.reflect.Method;
-import java.security.Timestamp;
 import java.util.*;
 
 public class GetChangeDateUtil {

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

@@ -74,7 +74,7 @@ public class ReportServiceImpl implements IReportService {
     private IByteDanceAdvertiserDataService advertiserDataService;
     @Autowired
     private IBytedanceInterfaceService bytedanceInterfaceService;
-    @Autowired
+    @Resource
     private UserAllocationMapper allocationMapper;
 
     @Override
@@ -444,24 +444,36 @@ public class ReportServiceImpl implements IReportService {
 
     @Override
     public void loadBytedanceHistoryData(CtopOauthToken token) {
-        for (int i = 1; i < 180; i++) {
-            Date getDate = DateUtils.addDay(new Date(),-i);
-            this.getAdvertiserCreativeReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-            this.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-            this.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-        }
-
         try {
+            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 endDate2 = DateUtils.addDay(new Date(),-1);
+            while (!beginDate.after(endDate2)){
+                beginDate = DateUtils.addDay(beginDate,1);
+    //        for (int i = 1; i < 180; i++) {
+    //            Date getDate = DateUtils.addDay(new Date(),1);
+                this.getAdvertiserCreativeReport(token, beginDate, beginDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+                this.getAdvertiserPlanReport(token, beginDate, beginDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+                this.getAdvertiserReport(token, beginDate, beginDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+    //        }
+
+            }
+
+
             advertiserDataService.getMaterialList(token);
             log.info("获取历史素材报表:accountId:{}", token.getAccountId());
-            String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-            String endDate = DateUtils.addDay(nowDate, -180);
+//            String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+//            String endDate = DateUtils.addDay(nowDate, -180);
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-            Date end = simpleDateFormat.parse(nowDate);
-            Date start = simpleDateFormat.parse(endDate);
-            List<Date> dates = DateUtils.findDates(start, end);
-            for (int i = 0; i < dates.size(); i++) {
-                String formatDate = simpleDateFormat.format(dates.get(i));
+//            Date end = simpleDateFormat.parse(nowDate);
+//            Date start = simpleDateFormat.parse(endDate);
+//            List<Date> dates = DateUtils.findDates(start, end);
+
+            beginDate = DateUtils.parseDate(beginDateStr,DateUtils.WEB_FORMAT);
+            while (!beginDate.after(endDate2)){
+                beginDate = DateUtils.addDay(beginDate,1);
+                String formatDate = simpleDateFormat.format(beginDate);
                 //试玩报表
                 bytedanceInterfaceService.bytedancePlayableReport(token,formatDate,formatDate);
                 //
@@ -472,8 +484,21 @@ public class ReportServiceImpl implements IReportService {
                     byteDanceVideoReportDailyService.videoInfoListByAccountId(formatDate, formatDate, token.getAccountId());
                 }
 
-                //
             }
+//            for (int i = 0; i < dates.size(); i++) {
+//                String formatDate = simpleDateFormat.format(dates.get(i));
+//                //试玩报表
+//                bytedanceInterfaceService.bytedancePlayableReport(token,formatDate,formatDate);
+//                //
+//                //素材报表
+//                int code = bytedanceReportService.bytedanceMaterialReport(token, formatDate, formatDate);
+//                //如果成功的话跑视频清洗数据方法,失败会进入重试库,重试成功后再清洗数据
+//                if (code == 200 || code == 1) {
+//                    byteDanceVideoReportDailyService.videoInfoListByAccountId(formatDate, formatDate, token.getAccountId());
+//                }
+//
+//                //
+//            }
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 0 - 17
pom.xml

@@ -69,25 +69,8 @@
             <name>maven-3rdparty</name>
             <url>https://packages.atlassian.com/maven-3rdparty/</url>
         </repository>
-
-        <repository>
-            <id>ctop</id>
-            <name>ctop</name>
-            <url>http://118.24.244.213:8081/3rd_part/</url>
-        </repository>
     </repositories>
 
-    <pluginRepositories>
-        <pluginRepository>
-            <snapshots>
-                <enabled>true</enabled>
-            </snapshots>
-            <id>ctop</id>
-            <url>http://118.24.244.213:8081/3rd_part/</url>
-        </pluginRepository>
-    </pluginRepositories>
-
-
     <properties>
         <jeecgboot.common.version>2.0.2</jeecgboot.common.version>
         <java.version>1.8</java.version>