Browse Source

Merge remote-tracking branch 'origin/test' into test

zhouzeyu@c-top.com.cn 4 years ago
parent
commit
c1d4f7f5ce
61 changed files with 963 additions and 569 deletions
  1. 4 6
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/query/QueryGenerator.java
  2. 36 10
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java
  3. 2 2
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MD5Util.java
  4. 1 1
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/PmsUtil.java
  5. 0 3
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/YouBianCodeUtil.java
  6. 2 2
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/oConvertUtils.java
  7. 0 17
      jeecg-boot-bytedance-ad/src/main/java/ctop/bytedance/ad/advertise/controller/AiBytedanceAdvertiserStrategyController.java
  8. 3 27
      jeecg-boot-bytedance-ad/src/main/java/ctop/bytedance/ad/advertise/service/impl/AiBytedanceAdvertiserStrategyServiceImpl.java
  9. 5 0
      jeecg-boot-finance/src/main/resources/application-dev.yml
  10. 6 1
      jeecg-boot-finance/src/main/resources/application-prod.yml
  11. 7 2
      jeecg-boot-finance/src/main/resources/application-test.yml
  12. 0 5
      jeecg-boot-finance/src/main/resources/application.yml
  13. 4 6
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java
  14. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/ProjectMapper.java
  15. 6 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/UserCompanyMapper.java
  16. 17 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/ProjectMapper.xml
  17. 29 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/UserCompanyMapper.xml
  18. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IProjectService.java
  19. 6 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IUserCompanyService.java
  20. 0 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/MaterialImageInfoServiceImpl.java
  21. 89 101
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  22. 5 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/ProjectServiceImpl.java
  23. 12 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/UserCompanyServiceImpl.java
  24. 9 8
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java
  25. 1 16
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouProjectCreateCreativeServiceImpl.java
  26. 0 11
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiStrategyServiceImpl.java
  27. 3 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouReportDailyMaterialMapper.java
  28. 6 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouVideoGetMapper.java
  29. 53 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml
  30. 37 4
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouVideoGetMapper.xml
  31. 3 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouReportDailyMaterialService.java
  32. 5 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouVideoGetService.java
  33. 0 4
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java
  34. 0 10
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java
  35. 0 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouMaterialUploadServiceImpl.java
  36. 7 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouReportDailyMaterialServiceImpl.java
  37. 11 3
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouVideoGetServiceImpl.java
  38. 5 5
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/mapper/KuaishouAccountCleanTemplateMapper.java
  39. 1 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/service/KuaiShouAccountCleanService.java
  40. 74 37
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/entity/EtlKuaishouVideoInfo.java
  41. 7 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/mapper/EtlKuaishouVideoInfoMapper.java
  42. 50 7
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/mapper/xml/EtlKuaishouVideoInfoMapper.xml
  43. 4 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/service/IEtlKuaishouVideoInfoService.java
  44. 85 48
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/service/impl/EtlKuaishouVideoInfoServiceImpl.java
  45. 47 92
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java
  46. 100 42
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/EtlKuaishouAccountMaterialReportDaily.java
  47. 14 7
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaishouAccountMaterialReportDailyMapper.java
  48. 80 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouAccountMaterialReportDailyMapper.xml
  49. 6 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsVideoReportMapper.xml
  50. 8 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IEtlKuaishouAccountMaterialReportDailyService.java
  51. 51 8
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouAccountMaterialReportDailyServiceImpl.java
  52. 0 4
      jeecg-boot-module-system/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadImageServiceImpl.java
  53. 8 24
      jeecg-boot-module-system/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java
  54. 0 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceReportServiceImpl.java
  55. 18 12
      jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/utils/LinkUtils.java
  56. 15 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  57. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java
  58. 1 1
      jeecg-cloud-module/jeecg-cloud-nacos/src/main/resources/application-prod.yml
  59. 14 14
      jeecg-cloud-module/jeecg-cloud-system-start/src/main/resources/application-prod.yml
  60. 1 1
      jeecg-cloud-module/jeecg-cloud-system-start/src/main/resources/application-test.yml
  61. 0 1
      jeecg-cloud-module/jeecg-cloud-xxljob/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java

+ 4 - 6
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/query/QueryGenerator.java

@@ -105,7 +105,7 @@ public class QueryGenerator {
 		*/
 		
 		//区间条件组装 模糊查询 高级查询组装 简单排序 权限查询
-		PropertyDescriptor origDescriptors[] = PropertyUtils.getPropertyDescriptors(searchObj);
+		PropertyDescriptor[] origDescriptors = PropertyUtils.getPropertyDescriptors(searchObj);
 		Map<String,SysPermissionDataRuleModel> ruleMap = getRuleMap();
 		
 		//权限规则自定义SQL表达式
@@ -493,7 +493,6 @@ public class QueryGenerator {
 			return;
 		}
 		name = oConvertUtils.camelToUnderline(name);
-		log.info("--查询规则-->"+name+" "+rule.getValue()+" "+value);
 		switch (rule) {
 		case GT:
 			queryWrapper.gt(name, value);
@@ -538,7 +537,6 @@ public class QueryGenerator {
 			queryWrapper.likeRight(name, value);
 			break;
 		default:
-			log.info("--查询规则未匹配到---");
 			break;
 		}
 	}
@@ -820,7 +818,7 @@ public class QueryGenerator {
 
 	private static String getInConditionValue(Object value,boolean isString) {
 		if(isString) {
-			String temp[] = value.toString().split(",");
+			String[] temp = value.toString().split(",");
 			String res="";
 			for (String string : temp) {
 				if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
@@ -890,7 +888,7 @@ public class QueryGenerator {
 		StringBuffer sb = new StringBuffer();
 		//权限查询
 		Map<String,SysPermissionDataRuleModel> ruleMap = getRuleMap();
-		PropertyDescriptor origDescriptors[] = PropertyUtils.getPropertyDescriptors(clazz);
+		PropertyDescriptor[] origDescriptors = PropertyUtils.getPropertyDescriptors(clazz);
 		String sql_and = " and ";
 		for (String c : ruleMap.keySet()) {
 			if(oConvertUtils.isNotEmpty(c) && c.startsWith(SQL_RULES_COLUMN)){
@@ -935,7 +933,7 @@ public class QueryGenerator {
 	public static void installAuthMplus(QueryWrapper<?> queryWrapper,Class<?> clazz) {
 		//权限查询
 		Map<String,SysPermissionDataRuleModel> ruleMap = getRuleMap();
-		PropertyDescriptor origDescriptors[] = PropertyUtils.getPropertyDescriptors(clazz);
+		PropertyDescriptor[] origDescriptors = PropertyUtils.getPropertyDescriptors(clazz);
 		for (String c : ruleMap.keySet()) {
 			if(oConvertUtils.isNotEmpty(c) && c.startsWith(SQL_RULES_COLUMN)){
 				queryWrapper.and(i ->i.apply(getSqlRuleValue(ruleMap.get(c).getRuleValue())));

+ 36 - 10
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -1,5 +1,9 @@
 package org.jeecg.common.util;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.util.StringUtils;
+
 import java.beans.PropertyEditorSupport;
 import java.sql.Timestamp;
 import java.text.DateFormat;
@@ -7,11 +11,6 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
-import org.jeecg.common.constant.SystemDateConstant;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.util.StringUtils;
-
 /**
  * 类描述:时间操作定义类
  *
@@ -63,6 +62,8 @@ public class DateUtils extends PropertyEditorSupport {
             return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         }
     };
+    public static SimpleDateFormat format1 = new SimpleDateFormat(
+            "yyyy-MM-dd HH:mm:ss");
 
     // 以毫秒表示的时间
     private static final long DAY_IN_MILLIS = 24 * 3600 * 1000;
@@ -71,12 +72,12 @@ public class DateUtils extends PropertyEditorSupport {
     private static final long SECOND_IN_MILLIS = 1000;
 
     //系統年月日时间格式
-    public static String yyyy_MM_dd="yyyy-MM-dd";
+    public static String yyyy_MM_dd = "yyyy-MM-dd";
 
-    public static String yyyy_MM="yyyy-MM";
+    public static String yyyy_MM = "yyyy-MM";
 
     //系统数据起始时间
-    public static String BEGIN_TIME="2019-09-01";
+    public static String BEGIN_TIME = "2019-09-01";
 
     /**
      * 时间戳转换为字符串
@@ -91,6 +92,7 @@ public class DateUtils extends PropertyEditorSupport {
         }
         return date2Str(date_sdf.get());
     }
+
     /**
      * 字符串转换时间戳
      *
@@ -101,6 +103,7 @@ public class DateUtils extends PropertyEditorSupport {
         Date date = str2Date(str, date_sdf.get());
         return new Timestamp(date.getTime());
     }
+
     /**
      * 日期转换为字符串
      *
@@ -122,13 +125,13 @@ public class DateUtils extends PropertyEditorSupport {
     }
 
 
-
     public static Date addHour(Date date, int hour) {
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(date);
         calendar.add(Calendar.HOUR_OF_DAY, hour);
         return calendar.getTime();
     }
+
     /**
      * 格式常量
      */
@@ -915,6 +918,27 @@ public class DateUtils extends PropertyEditorSupport {
         return new Date(time1);
     }
 
+    public static Date getStartDate(String date) {
+       String temp =  date + " 00:00:00";
+        try {
+            return format1.parse(temp);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+
+    }
+
+    public static Date getEndDate(String date) {
+        String temp = date + " 23:59:59";
+        try {
+            return format1.parse(temp);
+        } catch (Exception e) {
+            return null;
+        }
+
+    }
+
 
     /**
      * String类型 转换为Date, 如果参数长度为10 转换格式”yyyy-MM-dd“ 如果参数长度为19 转换格式”yyyy-MM-dd
@@ -1513,7 +1537,7 @@ public class DateUtils extends PropertyEditorSupport {
      * 获取指定日期下个月的第一天
      *
      * @param dateStr 日期
-     * @param format 格式
+     * @param format  格式
      * @return 数据
      */
     public static Map<String, String> getMaxMinDaysOfAddMonth(String dateStr, String format, int addMonth) {
@@ -1692,7 +1716,9 @@ public class DateUtils extends PropertyEditorSupport {
 
         return days;
     }
+
     private static Logger logger = LoggerFactory.getLogger(DateUtils.class);
+
     /**
      * 判断time是否在from,to之内
      *

+ 2 - 2
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MD5Util.java

@@ -69,7 +69,7 @@ public class MD5Util {
 		return toHexStr(md5.digest(url.getBytes()));
 	}
 
-	public static String byteArrayToHexString(byte b[]) {
+	public static String byteArrayToHexString(byte[] b) {
 		StringBuffer resultSb = new StringBuffer();
 		for (int i = 0; i < b.length; i++){
 			resultSb.append(byteToHexString(b[i]));
@@ -102,7 +102,7 @@ public class MD5Util {
 		return resultString;
 	}
 
-	private static final String hexDigits[] = { "0", "1", "2", "3", "4", "5",
+	private static final String[] hexDigits = { "0", "1", "2", "3", "4", "5",
 			"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
 
 	private static final String[] HEX_DIGITS = {"0", "1", "2", "3", "4", "5",

+ 1 - 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/PmsUtil.java

@@ -41,7 +41,7 @@ public class PmsUtil {
             for (String s : msg) {
                 //写数据
                 if (s.indexOf("_") > 0) {
-                    String arr[] = s.split("_");
+                    String[] arr = s.split("_");
                     bw.write("第" + arr[0] + "行:" + arr[1]);
                 } else {
                     bw.write(s);

+ 0 - 3
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/YouBianCodeUtil.java

@@ -35,9 +35,6 @@ public class YouBianCodeUtil {
 			String after_code = code.substring(code.length() - 1 - numLength,code.length());
 			char after_code_zimu = after_code.substring(0, 1).charAt(0);
 			Integer after_code_num = Integer.parseInt(after_code.substring(1));
-//			org.jeecgframework.core.util.LogUtil.info(after_code);
-//			org.jeecgframework.core.util.LogUtil.info(after_code_zimu);
-//			org.jeecgframework.core.util.LogUtil.info(after_code_num);
 
 			String nextNum = "";
 			char nextZimu = 'A';

+ 2 - 2
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/oConvertUtils.java

@@ -438,7 +438,7 @@ public class oConvertUtils {
 			//update-end--Author:zhoujf  Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
 		}
 		// 用下划线将原始字符串分割
-		String camels[] = name.split("_");
+		String[] camels = name.split("_");
 		for (String camel : camels) {
 			// 跳过原始字符串中开头、结尾的下换线或双重下划线
 			if (camel.isEmpty()) {
@@ -501,7 +501,7 @@ public class oConvertUtils {
 			return name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase();
 		}
 		// 用下划线将原始字符串分割
-		String camels[] = name.split("_");
+		String[] camels = name.split("_");
 		for (String camel : camels) {
 			// 跳过原始字符串中开头、结尾的下换线或双重下划线
 			if (camel.isEmpty()) {

+ 0 - 17
jeecg-boot-bytedance-ad/src/main/java/ctop/bytedance/ad/advertise/controller/AiBytedanceAdvertiserStrategyController.java

@@ -132,12 +132,6 @@ public class AiBytedanceAdvertiserStrategyController {
 		try {
 			//复制功能 防止前端传id到后台
 			aiBytedanceAdvertiserStrategy.setId(null);
-			// 组名称 计划名称 是否重复
-			/*Result<AiBytedanceAdvertiserStrategy> resultName = aiBytedanceAdvertiserStrategyService.getStrategyInfoByName(aiBytedanceAdvertiserStrategy);
-			if (!resultName.isSuccess()) {
-				return Result.error(resultName.getMessage());
-			}*/
-
 			return aiBytedanceAdvertiserStrategyService.addBytedanceStrategy(aiBytedanceAdvertiserStrategy);
 		} catch (Exception e) {
 			log.error(e.getMessage(),e);
@@ -153,13 +147,6 @@ public class AiBytedanceAdvertiserStrategyController {
 	@ApiOperation(value="头条智能投放账户配置信息表-编辑", notes="头条智能投放账户配置信息表-编辑")
 	@PutMapping(value = "/edit")
 	public Result<AiBytedanceAdvertiserStrategy> edit(@RequestBody AiBytedanceAdvertiserStrategy aiBytedanceAdvertiserStrategy) {
-		// 组名称 计划名称 是否重复
-		/*
-		Result<AiBytedanceAdvertiserStrategy> resultName = aiBytedanceAdvertiserStrategyService.getStrategyInfoByName(aiBytedanceAdvertiserStrategy);
-		if (!resultName.isSuccess()) {
-			return Result.errorMsg(resultName.getMessage());
-		}
-		*/
 		CtopOauthToken token = tokenService.getOauthTokenByAccountId(String.valueOf(aiBytedanceAdvertiserStrategy.getAccountId()));
 		//修改后预算金额不能低于当前已消费金额的105%
 		QueryWrapper<RuleDataAccount> ruleDataAccountQueryWrapper = new QueryWrapper<>();
@@ -202,10 +189,6 @@ public class AiBytedanceAdvertiserStrategyController {
 			// BUDGET_MODE_INFINITE-不限
 			String accountBudgetMode = "1".equals(aiBytedanceAdvertiserStrategy.getAccountBudgetMode()) ? "BUDGET_MODE_INFINITE" : "BUDGET_MODE_DAY";
 			Result resultBudget = marketingService.updateBudget(token,accountBudgetMode,aiBytedanceAdvertiserStrategy.getAccountBudget());
-			/*if (!resultBudget.isSuccess()){
-				return Result.errorMsg(resultBudget.getMessage());
-			}*/
-
 		}
 		return Result.successMsg("修改成功!", null);
 

+ 3 - 27
jeecg-boot-bytedance-ad/src/main/java/ctop/bytedance/ad/advertise/service/impl/AiBytedanceAdvertiserStrategyServiceImpl.java

@@ -109,7 +109,6 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         if(timeEnd != 0){
             endTime = DateUtils.formatDateTime(now + timeEnd * 60 * 1000L);
         }
-        //List<ByteDanceVideoInfo> videoInfos = getVideoInfoByCreateType(userAllocation.getProjectId(),strategy,startTime,endTime,createType,videoCnt);
         List<ByteDanceVideoInfo> videoInfos = getvideoOrImageInfoByCreateType(userAllocation.getProjectId(),strategy,startTime,endTime,createType,videoCnt);
         if(null == videoInfos||videoInfos.isEmpty()){
             log.info("获取{}视频素材为空=>accountId:{}",BytedanceCreativeMatTypeEnum.getNameByType(createType+""),token.getAccountId());
@@ -497,11 +496,6 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         if(!Check.isNull(creativeDisplayMode)){
             params.put("creative_display_mode",creativeDisplayMode);
         }
-//        允许客户端下载视频功能
-//        Integer adDownloadStatus = strategy.getCreativeAdDownloadStatus();
-//        if(!Check.isNull(adDownloadStatus)&&adDownloadStatus!=0){
-//            params.put("ad_download_status",adDownloadStatus);
-//        }
         //商品推广卡片
         String imageCode = strategy.getCreativeProductImageCode();
         if(!Check.isNull(imageCode)){
@@ -568,10 +562,6 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         if(!Check.isNull(videoPlayEffectiveTrackUrl)){
             params.put("video_play_effective_track_url",videoPlayEffectiveTrackUrl);
         }
-//        String videoPlayDoneTrackUrl = strategy.getCreativeVideoPlayDoneTrackUrl();
-//        if(!Check.isNull(videoPlayDoneTrackUrl)){
-//            params.put("video_play_done_track_url",videoPlayDoneTrackUrl);
-//        }
         String videoPlayTrackUrl = strategy.getCreativeVideoPlayTrackUrl();
         if(!Check.isNull(videoPlayTrackUrl)){
             params.put("video_play_track_url",videoPlayTrackUrl);
@@ -646,8 +636,6 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         if(!Check.isNull(strategy.getAdPackage())){
             params.put("package",strategy.getAdPackage());
         }
-        //params.put("download_url","https://apps.bytesfield.com/download/basic/cur/1c728178004c8d4d6c83444a05c414c1a1cfae48");
-       // params.put("package","com.taobao.litetao");
         if(!Check.isNull(strategy.getAdQuickAppUrl())){
             params.put("quick_app_url",strategy.getAdQuickAppUrl());
         }
@@ -1296,11 +1284,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
             //BUDGET_MODE_DAY-日预算
             // BUDGET_MODE_INFINITE-不限
             String accountBudgetMode = "1".equals(updAdStaOrCpaOrBudget.getBudgetType()) ? "BUDGET_MODE_INFINITE" : "BUDGET_MODE_DAY";
-            Result resultBudget = marketingService.updateBudget(token,accountBudgetMode,new BigDecimal(updAdStaOrCpaOrBudget.getBudget()));
-           /* if (!resultBudget.isSuccess()){
-                return Result.error(resultBudget.getMessage());
-            }*/
-
+            marketingService.updateBudget(token,accountBudgetMode,new BigDecimal(updAdStaOrCpaOrBudget.getBudget()));
         }
         return Result.successMsg("修改"+(BytedanceConstant.UPDTYPE_BID.equals(updAdStaOrCpaOrBudget.getType()) ? "出价" : "预算")+"成功。",null);
     }
@@ -1539,8 +1523,6 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         aiBytedanceAdvertiserStrategy.setCreativeAdKeywords(org.apache.commons.lang3.StringUtils.join(aiBytedanceAdvertiserStrategy.getAdKeywords(), ","));
         aiBytedanceAdvertiserStrategy.setCreateTime(new Date());
         //默认组数量为 1 -前端已修改完成
-        //aiBytedanceAdvertiserStrategy.setCampaignAdCnt(aiBytedanceAdvertiserStrategy.getCampaignAdCnt() == 0L ? 1 : aiBytedanceAdvertiserStrategy.getCampaignAdCnt());
-
         //同一账户下 同素材类型 只能有一条信息为开启
         //关闭 账户下 其他数据信息(不包含本条id信息) 状态为 关闭
         aiBytedanceAdvertiserStrategyMapper.updStaByAccountId(String.valueOf(aiBytedanceAdvertiserStrategy.getAccountId()),aiBytedanceAdvertiserStrategy.getCreativeImageMode(),"1",null);
@@ -1562,10 +1544,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         //BUDGET_MODE_DAY-日预算
         // BUDGET_MODE_INFINITE-不限
         String accountBudgetMode = "1".equals(aiBytedanceAdvertiserStrategy.getAccountBudgetMode()) ? "BUDGET_MODE_INFINITE" : "BUDGET_MODE_DAY";
-        Result resultBudget = marketingService.updateBudget(token,accountBudgetMode,aiBytedanceAdvertiserStrategy.getAccountBudget());
-       /* if (!resultBudget.isSuccess()){
-            return Result.error(resultBudget.getMessage());
-        }*/
+        marketingService.updateBudget(token,accountBudgetMode,aiBytedanceAdvertiserStrategy.getAccountBudget());
         return Result.successMsg("新增成功。",aiBytedanceAdvertiserStrategy);
     }
 
@@ -1660,10 +1639,8 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
      */
     @Override
     public Result getAdActionText(String accountId, String landingType, String advancedCreativeType) throws Exception{
-        CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
-      // return marketingService.getActionText(token,landingType,advancedCreativeType);
         //行动号召 不使用 api接口获取 使用自定义
-        String actionText[] = {"购买同款","专属优惠","抢抢看","去看看","立即下单",
+        String[] actionText = {"购买同款","专属优惠","抢抢看","去看看","立即下单",
                                 "获取优惠","查看详情","更多精彩","查看惊喜","领取好礼",
                                 "去逛逛","领取福利","来拼一拼","立即抢购","更多秒杀",
                                 "更多优惠","了解更多","了解详情","点击抢购"};
@@ -1740,7 +1717,6 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
        if (!list.isSuccess()){
            return Result.errorMsg(list.getMessage());
        }
-        //List<Map<String,Object>> listMap = (List<Map<String, Object>>) list.getResult();
         JSONArray array =(JSONArray)list.getResult();
         List<Map<String,Object>> dataList = JSONArray.parseObject(array.toJSONString(),List.class);
         //获取人群包id  List

+ 5 - 0
jeecg-boot-finance/src/main/resources/application-dev.yml

@@ -16,6 +16,11 @@ management:
    exposure:
     include: metrics,httptrace
 spring:
+  cloud:
+    nacos:
+      discovery:
+        server-addr: 127.0.0.1:8848
+        service: jeecg-cloud-finance
   servlet:
      multipart:
         max-file-size: 10MB

+ 6 - 1
jeecg-boot-finance/src/main/resources/application-prod.yml

@@ -16,6 +16,11 @@ management:
    exposure:
     include: metrics,httptrace
 spring:
+  cloud:
+    nacos:
+      discovery:
+        server-addr: 172.30.0.7:8848
+        service: jeecg-cloud-finance
   servlet:
      multipart:
         max-file-size: 10MB
@@ -101,7 +106,7 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+          url: jdbc:mysql://139.186.27.96:3390/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
           username: data
           password: hcst@2021
           driver-class-name: com.mysql.jdbc.Driver

+ 7 - 2
jeecg-boot-finance/src/main/resources/application-test.yml

@@ -12,6 +12,11 @@ management:
       exposure:
         include: metrics,httptrace
 spring:
+  cloud:
+    nacos:
+      discovery:
+        server-addr: 139.186.134.115:8848
+        service: jeecg-cloud-finance
   servlet:
     multipart:
       max-file-size: -1
@@ -242,7 +247,7 @@ bytedance:
     advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/
 ai:
   callback:
-    callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
-    callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
+    callback-unit-url: http://139.186.165.84::31012/ai_callback_add_group
+    callback-creative-url: http://139.186.165.84::31012/ai_callback_add_creative
 xxl-job:
   requestUrl: http://jiaoyangapi.shyouteng.com.cn

+ 0 - 5
jeecg-boot-finance/src/main/resources/application.yml

@@ -8,10 +8,5 @@ spring:
     name: jeecg-cloud-finance
   profiles:
     active: @activatedProperties@
-  cloud:
-    nacos:
-      discovery:
-        server-addr: 127.0.0.1:8848
-        service: jeecg-cloud-finance
   main:
     allow-bean-definition-overriding: true

+ 4 - 6
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java

@@ -125,13 +125,11 @@ public class MaterialInfo implements Serializable {
      * createTime
      */
     @ApiModelProperty(value = "createTime")
-    // @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
     private Date createTime;
     /**
      * updateTime
      */
     @ApiModelProperty(value = "updateTime")
-    // @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
     private Date updateTime;
 
     //判断是否为头条有效素材0否_1是
@@ -178,16 +176,16 @@ public class MaterialInfo implements Serializable {
     private Boolean whetherUnaudited;
 
     @TableField(exist = false)
-    private String mediaId;  // 是否有未审核封面
+    private String mediaId;
 
     @TableField(exist = false)
-    private String projectName;  // 是否有未审核封面
+    private String projectName;
 
     @TableField(exist = false)
-    private String startDate;  // 是否有未审核封面
+    private String startDate;
 
     @TableField(exist = false)
-    private String endDate;  // 是否有未审核封面
+    private String endDate;
 
     //视频关联广告语信息--头条
     @TableField(exist = false)

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

@@ -31,4 +31,6 @@ public interface ProjectMapper extends BaseMapper<Project> {
     List<Long> getProjectIdsByProductId(@Param("productId") Long productId);
 
     List<Long> getProjectIdsByProductIdAndNotIn(@Param("productId") Long productId, @Param("partakeProjectIds") List<Long> partakeProjectIds);
+
+    JSONObject getProjectByAccountId(@Param("accountId") Long accountId);
 }

+ 6 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/UserCompanyMapper.java

@@ -3,6 +3,8 @@ 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.apache.ibatis.annotations.Param;
+import org.jeecg.common.api.vo.Result;
 
 import java.util.List;
 
@@ -16,4 +18,8 @@ import java.util.List;
 public interface UserCompanyMapper extends BaseMapper<UserCompany> {
 
     List<JSONObject> allCompany();
+
+    JSONObject getCompanyInfoByAccountId(@Param("accountId") Long accountId);
+
+    JSONObject getCompanyInfoByUserId(@Param("userId") String userId);
 }

+ 17 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/ProjectMapper.xml

@@ -75,5 +75,22 @@
         </if>
 
     </select>
+    <select id="getProjectByAccountId" resultType="com.alibaba.fastjson.JSONObject">
+    SELECT
+	id AS 'projectId',
+	project_name AS 'projectName'
+    FROM
+	ctop_project
+    WHERE
+	id = (
+		SELECT
+			project_id
+		FROM
+			ctop_user_allocation
+		WHERE
+			account_id = #{accountId}
+		LIMIT 1
+	)
+    </select>
 
 </mapper>

+ 29 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/UserCompanyMapper.xml

@@ -2,11 +2,39 @@
 <!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 id="allCompany" resultType="com.alibaba.fastjson.JSONObject">
         SELECT company_id as 'companyId',
                company_name as 'companyName'
         FROM user_company
         GROUP BY company_id
     </select>
+	<select id="getCompanyInfoByAccountId" resultType="com.alibaba.fastjson.JSONObject">
+    SELECT
+	company_id AS 'companyId',
+	company_name AS 'companyName'
+	FROM
+	user_company
+	WHERE
+	user_id = (
+		SELECT
+			user_id
+		FROM
+			ctop_user_allocation
+		WHERE
+			account_id = #{accountId}
+		LIMIT 1
+	)
+
+    </select>
+	<select id="getCompanyInfoByUserId" resultType="com.alibaba.fastjson.JSONObject">
+	SELECT
+	company_id AS 'companyId',
+	company_name AS 'companyName'
+	FROM
+	user_company
+	WHERE
+	user_id = #{userId}
+	</select>
+
 
 </mapper>

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

@@ -30,4 +30,6 @@ public interface IProjectService extends IService<Project> {
     List<Long> getProjectIdsByProductId(Long productId);
 
     List<Long> getProjectIdsByProductIdAndNotIn(Long productId, List<Long> partakeProjectIds);
+
+    JSONObject getProjectByAccountId(Long accountId);
 }

+ 6 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IUserCompanyService.java

@@ -1,6 +1,8 @@
 package cn.com.ctop.common.module.service;
 
+
 import cn.com.ctop.common.module.entity.UserCompany;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.entity.SysUser;
@@ -25,4 +27,8 @@ public interface IUserCompanyService extends IService<UserCompany> {
     List<UserCompany> getAllByUserId(String userId);
 
     Result<Object> allCompany();
+
+    JSONObject getCompanyInfoByAccountId(Long accountId);
+
+    JSONObject getCompanyInfoByUserId(String clipId);
 }

+ 0 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/MaterialImageInfoServiceImpl.java

@@ -48,11 +48,9 @@ public class MaterialImageInfoServiceImpl extends ServiceImpl<MaterialImageInfoM
     @Override
     public void insertImage(JSONObject imageJson) {
         try {
-
             String videoId = imageJson.getString("videoId");
             if (Check.isNull(videoId)) {
                 log.error("视频id不能为空");
-
             }
             String userId = imageJson.getString("userId");
             JSONArray imageArr = imageJson.getJSONArray("imageArr");

+ 89 - 101
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -18,7 +18,6 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.tencentcloudapi.mps.v20190612.models.DescribeTaskDetailResponse;
 import it.sauronsoftware.jave.Encoder;
-import it.sauronsoftware.jave.EncoderException;
 import it.sauronsoftware.jave.MultimediaInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shiro.SecurityUtils;
@@ -31,7 +30,10 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.io.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.net.URLDecoder;
@@ -55,7 +57,6 @@ import static cn.com.ctop.common.module.utils.CloudVideoProcessUtil.videoWaterma
 public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, MaterialInfo> implements IMaterialInfoService {
 
     private static ExecutorService uploadExecutorService = Executors.newFixedThreadPool(5);
-
     @Resource
     private ITencentWatermarkTemplateService tencentWatermarkTemplateService;
     @Resource
@@ -72,8 +73,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     private IMaterialCutFrameService materialCutFrameService;
     @Autowired
     private ISupplierWatermarkService supplierWatermarkService;
-    @Resource
-    private IProductService productService;
     @Value("${oss.replace.download}")
     private String downloadUrl;
 
@@ -317,9 +316,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 }
             }
         }
-
         getFile(info);
-
     }
 
 
@@ -397,73 +394,68 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             @Override
             public void run() {
                 log.info("获取素材基本信息,code:{}", materialInfo.getCode());
-                if (!Check.isNull(materialInfo)) {
-                    long l = System.currentTimeMillis();
-                    String url = materialInfo.getUrl();
-                    log.info("replaceUrl:{}", url);
-                    String localUrl = null;
-                    MultimediaInfo m = null;
-                    FileInputStream fis = null;
+
+                long l = System.currentTimeMillis();
+                String url = materialInfo.getUrl();
+                log.info("replaceUrl:{}", url);
+                String localUrl = null;
+                MultimediaInfo m = null;
+                FileInputStream fis = null;
+                try {
+                    localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
+                    File file = new File(localUrl);
+                    it.sauronsoftware.jave.Encoder encoder = new Encoder();
+                    m = encoder.getInfo(file);
+                    long duration = m.getDuration();
+                    long secondDuration = duration / 1000;
+                    MaterialParameter materialParameter = new MaterialParameter();
+                    materialParameter.setMaterialId(materialInfo.getCode());
+                    // 视频秒数
+                    materialParameter.setSecond(secondDuration);
+                    // 视频格式
+                    materialParameter.setFormat(m.getFormat());
+                    // 视频宽
+                    String width = String.valueOf(m.getVideo().getSize().getWidth());
+                    materialParameter.setWidth(width);
+                    // 视频高
+                    String height = String.valueOf(m.getVideo().getSize().getHeight());
+                    materialParameter.setHeight(height);
+                    fis = new FileInputStream(file);
+                    FileChannel fc = fis.getChannel();
+                    BigDecimal fileSize = new BigDecimal(fc.size());
+                    String size = fileSize.divide(new BigDecimal(1048576), 2, RoundingMode.HALF_UP) + "MB";
+                    materialParameter.setSize(size);
+                    materialParameter.setUpdateTime(new Date());
+
+                    Map<String, Object> deleteMap = new HashMap<>();
+                    deleteMap.put("material_id", materialInfo.getId());
+                    materialParameterMapper.deleteByMap(deleteMap);
+                    int insert = materialParameterMapper.insert(materialParameter);
+                    if (insert > 0) {
+                        log.info("素材基本信息入库完成,用时:{} s", (System.currentTimeMillis() - l) / 1000);
+                    }
+                    // 默认抽帧 素造供应商
+                    Long templateId = MaterialSupplierEnum.getTemplateIdBySize(Integer.valueOf(width), Integer.valueOf(height));
+                    if (!Check.isNull(templateId)) {
+                        Thread thread = new Thread() {
+                            @Override
+                            public void run() {
+                                watermarkVideoBySupplierCode(materialInfo.getCode(), materialInfo.getUrl(), templateId);
+                            }
+                        };
+                        thread.start();
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                } finally {
                     try {
-                        localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
-                        File file = new File(localUrl);
-                        it.sauronsoftware.jave.Encoder encoder = new Encoder();
-                        m = encoder.getInfo(file);
-                        long duration = m.getDuration();
-                        long secondDuration = duration / 1000;
-                        MaterialParameter materialParameter = new MaterialParameter();
-                        materialParameter.setMaterialId(materialInfo.getCode());
-                        // 视频秒数
-                        materialParameter.setSecond(secondDuration);
-                        // 视频格式
-                        materialParameter.setFormat(m.getFormat());
-                        // 视频宽
-                        String width = String.valueOf(m.getVideo().getSize().getWidth());
-                        materialParameter.setWidth(width);
-                        // 视频高
-                        String height = String.valueOf(m.getVideo().getSize().getHeight());
-                        materialParameter.setHeight(height);
-
-                        fis = new FileInputStream(file);
-                        FileChannel fc = fis.getChannel();
-                        BigDecimal fileSize = new BigDecimal(fc.size());
-                        String size = fileSize.divide(new BigDecimal(1048576), 2, RoundingMode.HALF_UP) + "MB";
-                        materialParameter.setSize(size);
-                        materialParameter.setUpdateTime(new Date());
-
-                        Map<String, Object> deleteMap = new HashMap<>();
-                        deleteMap.put("material_id", materialInfo.getId());
-                        materialParameterMapper.deleteByMap(deleteMap);
-                        int insert = materialParameterMapper.insert(materialParameter);
-                        if (insert > 0) {
-                            log.info("素材基本信息入库完成,用时:{} s", (System.currentTimeMillis() - l) / 1000);
+                        if (fis != null) {
+                            fis.close();
                         }
-                        // 默认抽帧 素造供应商
-                        Long templateId = MaterialSupplierEnum.getTemplateIdBySize(Integer.valueOf(width), Integer.valueOf(height));
-                        if (!Check.isNull(templateId)) {
-                            Thread thread = new Thread() {
-                                @Override
-                                public void run() {
-                                    watermarkVideoBySupplierCode(materialInfo.getCode(), materialInfo.getUrl(), templateId);
-                                }
-                            };
-                            thread.start();
-                        }
-                    } catch (FileNotFoundException e) {
-                        e.printStackTrace();
                     } catch (IOException e) {
                         e.printStackTrace();
-                    } catch (EncoderException e) {
-                        e.printStackTrace();
-                    } finally {
-                        try {
-                            if (fis != null) {
-                                fis.close();
-                            }
-                        } catch (IOException e) {
-                            e.printStackTrace();
-                        }
                     }
+                    LoadFileUtil.delFile(localUrl);
                 }
             }
         });
@@ -522,7 +514,13 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             info.setProductId(productId);
             info.setWatermarkCode(json.getString("watermarkCode"));
             info.setStatus(0);
-            info.setMaterialName(StringUtils.getFileNameNoEx(json.getString("materialName")));
+            String fileName = AesEncryptUtil.getUrlDecoderString(url.substring(url.lastIndexOf("/") + 1));
+            String fileNameNoEx = StringUtils.getFileNameNoEx(fileName);
+            if (fileNameNoEx.contains("-")) {
+                fileNameNoEx = fileNameNoEx.substring(0, fileNameNoEx.lastIndexOf("-"));
+            }
+
+            info.setMaterialName(fileNameNoEx);
             info.setWatermarkMaterialName(json.getString("watermarkMaterialName"));
             info.setMaterialDescribe(json.getString("materialDescribe"));
             info.setCreateTime(new Date());
@@ -580,17 +578,17 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 //TODO 需要添加获取设计负责人代码
                 SysUser clip = userService.getById(clipId);
                 String roleCode = userService.getRoleCodeByUserId(clipId);
-                log.info("剪辑人员名称:"+clip.getRealname()+";ID:"+clipId);
+                log.info("剪辑人员名称:" + clip.getRealname() + ";ID:" + clipId);
                 String leaderName = "";
                 String leaderId = "";
-                if("designTeamLeader".equals(roleCode)){
+                if ("designTeamLeader".equals(roleCode)) {
                     leaderId = clipId;
                     leaderName = clip.getRealname();
-                }else{
+                } else {
                     leaderId = clip.getLeaderId();
                     leaderName = clip.getLeaderName();
                 }
-                log.info("负责人名称:"+leaderName+";ID:"+leaderId);
+                log.info("负责人名称:" + leaderName + ";ID:" + leaderId);
                 materialAscription.setLeaderName(leaderName);
                 materialAscription.setLeaderId(leaderId);
                 int result = materialAscriptionMapper.insert(materialAscription);
@@ -617,21 +615,21 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
 
     @Override
     public JSONArray checkArrayCode(JSONArray array) {
-        if(null == array||array.isEmpty()){
+        if (null == array || array.isEmpty()) {
             return new JSONArray();
         }
-        Map<String,String> codeMap = new HashMap<>();
+        Map<String, String> codeMap = new HashMap<>();
         JSONArray resultArray = new JSONArray();
-        for(int i=0;i<array.size();i++){
+        for (int i = 0; i < array.size(); i++) {
             JSONObject data = array.getJSONObject(i);
-            String url = "https:"+data.getString("url");
-            data.put("url",url);
+            String url = "https:" + data.getString("url");
+            data.put("url", url);
             String code = MD5Util.md5ByUrl(url);
-            if(codeMap.containsKey(code)){
+            if (codeMap.containsKey(code)) {
                 continue;
             }
-            codeMap.put(code,code);
-            data.put("code",code);
+            codeMap.put(code, code);
+            data.put("code", code);
             resultArray.add(data);
         }
         return resultArray;
@@ -728,17 +726,17 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 //TODO 需要添加获取设计负责人代码
                 SysUser clip = userService.getById(clipId);
                 String roleCode = userService.getRoleCodeByUserId(clipId);
-                log.info("剪辑人员名称:"+clip.getRealname()+";ID:"+clipId);
+                log.info("剪辑人员名称:" + clip.getRealname() + ";ID:" + clipId);
                 String leaderName = "";
                 String leaderId = "";
-                if("designTeamLeader".equals(roleCode)){
+                if ("designTeamLeader".equals(roleCode)) {
                     leaderId = clipId;
                     leaderName = clip.getRealname();
-                }else{
+                } else {
                     leaderId = clip.getLeaderId();
                     leaderName = clip.getLeaderName();
                 }
-                log.info("负责人名称:"+leaderName+";ID:"+leaderId);
+                log.info("负责人名称:" + leaderName + ";ID:" + leaderId);
                 materialAscription.setLeaderName(leaderName);
                 materialAscription.setLeaderId(leaderId);
                 int result = materialAscriptionMapper.insert(materialAscription);
@@ -763,6 +761,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         }
         return resultMap;
     }
+
     @Autowired
     private ISysUserService userService;
 
@@ -935,7 +934,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
 
 
     @Override
-    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, String leaderName,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, String leaderName, Integer offlineFlag, Integer pageNo, Integer pageSize) {
         Map<String, Object> result = new HashMap<>();
         PageHelper.startPage(pageNo, pageSize);
 
@@ -953,10 +952,10 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             endDate = endDate + " 23:59:59";
         }
 
-        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, materialName, code, startDate, endDate, userId, projectIds, ascription, clipId, shotId, planId,leaderName, offlineFlag);
+        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, materialName, code, startDate, endDate, userId, projectIds, ascription, clipId, shotId, planId, leaderName, offlineFlag);
         List<MaterialInfo> setList = new ArrayList<>();
         PageInfo<MaterialInfo> pageInfo = new PageInfo<>(dailyList);
-        if (null != dailyList && !dailyList.isEmpty()) {
+        if (!dailyList.isEmpty()) {
             for (MaterialInfo info : dailyList) {
                 MaterialInfo materialInfo = materialInfoMapper.selectById(info.getId());
                 materialInfo.setSlogansCount(info.getSlogansCount());
@@ -1001,18 +1000,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 imageInfoQueryWrapper.eq("video_id", info.getCode());
                 imageInfoQueryWrapper.eq("status", 0);
                 List<MaterialImageInfo> imageInfoList = materialImageInfoService.list(imageInfoQueryWrapper);
-                if (Check.isNull(imageInfoList)) {
-                    materialInfo.setWhetherUnaudited(false);
-                } else {
-                    materialInfo.setWhetherUnaudited(true);
-                }
-                //统计广告语数量
-//                List<BytedanceVideoSlogenInfo> slogenInfos = slogenInfoService.listByParams(materialInfo.getCode(), 1);
-//                JSONArray slogenArray = new JSONArray();
-//                if (null != slogenInfos && !slogenInfos.isEmpty()) {
-//                    slogenArray.addAll(slogenInfos);
-//                }
-//                materialInfo.setSlogans(slogenArray);
+                materialInfo.setWhetherUnaudited(!Check.isNull(imageInfoList));
                 setList.add(materialInfo);
             }
         }

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

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

+ 12 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/UserCompanyServiceImpl.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.common.module.service.impl;
 
+
 import cn.com.ctop.common.module.entity.SysUserDepart;
 import cn.com.ctop.common.module.entity.UserCompany;
 import cn.com.ctop.common.module.mapper.SysDepartMapper;
@@ -123,7 +124,7 @@ public class UserCompanyServiceImpl extends ServiceImpl<UserCompanyMapper, UserC
         QueryWrapper<UserCompany> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("user_id", userId);
         queryWrapper.last("limit 1");
-        return this.getOne(queryWrapper);
+        return userCompanyMapper.selectOne(queryWrapper);
     }
 
     @Override
@@ -138,4 +139,14 @@ public class UserCompanyServiceImpl extends ServiceImpl<UserCompanyMapper, UserC
         List<JSONObject> data = userCompanyMapper.allCompany();
         return Result.ok(data);
     }
+
+    @Override
+    public JSONObject getCompanyInfoByAccountId(Long accountId) {
+        return userCompanyMapper.getCompanyInfoByAccountId(accountId);
+    }
+
+    @Override
+    public JSONObject getCompanyInfoByUserId(String clipId) {
+        return userCompanyMapper.getCompanyInfoByUserId(clipId);
+    }
 }

+ 9 - 8
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java

@@ -749,7 +749,10 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         programJson.put("cover_image_tokens", coverImageTokens);
 
         if (!Check.isNull(strategy.getSiteId())) {
-            programJson.put("site_id", strategy.getSiteId());
+            if (strategy.getSiteId() != -1) {
+                programJson.put("site_id", strategy.getSiteId());
+            }
+
         }
         if (!Check.isNull(strategy.getStickerTitle())) {
             programJson.put("sticker_styles", strategy.getStickerTitle());
@@ -1418,10 +1421,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         // 根据imageUrl 和 imageCode,获取 imageToken (创建创意用)
         KuaiShouImageGet imageGet = imageGetService.getOneByParams(null, imageCode);
         if ((null == imageGet) || ("".equals(imageGet.getImageToken()))) {
-            /**
-             * 如果取不到image_token
-             * 则调用上传url的方法 kuauiShouImageUpload(url, signature, accountId, oauthToken.getAccessToken());
-             */
             return materialUploadService.kuauiShouImageUpload(imageUrl, imageCode, accountId, token);
         }
         return imageGet.getImageToken();
@@ -1451,12 +1450,14 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             creativeParams.put("expose_tag", strategy.getExposeTag());
         }
         // 广告标签2期
-        if (Check.isNull(strategy.getNewExposeTag())) {
+        if (!Check.isNull(strategy.getNewExposeTag())) {
             creativeParams.put("new_expose_tag", JSON.parseArray(strategy.getNewExposeTag()));
         }
         // 安卓下载中间页ID
-        if (Check.isNull(strategy.getSiteId())) {
-            creativeParams.put("site_id", strategy.getSiteId());
+        if (!Check.isNull(strategy.getSiteId())) {
+            if (strategy.getSiteId() != -1) {
+                creativeParams.put("site_id", strategy.getSiteId());
+            }
         }
         if (null != strategy.getClickTrackUrl() && !"".equals(strategy.getClickTrackUrl())) {
             creativeParams.put("click_track_url", strategy.getClickTrackUrl());

+ 1 - 16
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouProjectCreateCreativeServiceImpl.java

@@ -961,18 +961,7 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
             if (!Check.isNull(strategy.getSpeed())) {
                 unitParams.put("speed", strategy.getSpeed());
             }
-            //预约广告
-//        if (!Check.isNull(strategy.getSiteType())) {
-//            unitParams.put("site_type", strategy.getSiteType());
-//        }
-            //智能定向
-//        if (!Check.isNull(strategy.getAutoTarget())) {
-//            unitParams.put("auto_target", strategy.getAutoTarget());
-//        }
-            //是否开启自动生成视频
-//        if (!Check.isNull(strategy.getAutoCreatePhoto())) {
-//            unitParams.put("auto_create_photo", strategy.getAutoCreatePhoto());
-//        }
+
             if (unitType == 7) {
                 //是否开启智能抽帧
                 if (!Check.isNull(strategy.getSmartCover())) {
@@ -1289,10 +1278,6 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
         // 根据imageUrl 和 imageCode,获取 imageToken (创建创意用)
         KuaiShouImageGet imageGet = imageGetService.getOneByParams(null, imageCode);
         if ((null == imageGet) || ("".equals(imageGet.getImageToken()))) {
-            /**
-             * 如果取不到image_token
-             * 则调用上传url的方法 kuauiShouImageUpload(url, signature, accountId, oauthToken.getAccessToken());
-             */
             return materialUploadService.kuauiShouImageUpload(imageUrl, imageCode, accountId, token);
         }
         return imageGet.getImageToken();

+ 0 - 11
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiStrategyServiceImpl.java

@@ -86,18 +86,9 @@ public class AiStrategyServiceImpl implements IAiStrategyService {
         // 1: 根据模板信息表里的 material_select_method (素材选择方式),得到"跑量视频"和"上新视频"获取方式
         // {'highQualityMaterial':{'days':7, 'num':5},'newMaterialNum':5}
         // TODO 更新该账户下的 ctop_kuaishou_video_get 数据
-
         // 获取当天零点到现在的非素造的视频
         kuaishouInterfaceService.getVideoList(token,DateUtils.date2Str(),DateUtils.date2Str());
 
-        /*// 获取当天零点到现在的素造视频
-        String startDate = DateUtils.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss");
-        // 时间差,单位为分钟
-        int dimeDiff = 5;
-        Date now = new Date();
-        String endDate = DateUtils.formatDate(new Date(now.getTime() - dimeDiff*60*1000),"yyyy-MM-dd HH:mm:ss");
-        kuaishouInterfaceService.getSuZaoList(token.getAccessToken(), token.getAccountId(), 1, startDate, endDate)));*/
-
         JSONObject materialSelectMethod = JSONObject.parseObject(strategyTemplate.getMaterialSelectMethod());
         List<KuaiShouVideoGet> newVideos = new ArrayList<KuaiShouVideoGet>();
         List<KuaiShouVideoGet> highQualityVideos = new ArrayList<KuaiShouVideoGet>();
@@ -674,8 +665,6 @@ public class AiStrategyServiceImpl implements IAiStrategyService {
         // 根据imageUrl 和 imageCode,获取 imageToken (创建创意用)
         KuaiShouImageGet imageGet = imageGetService.getOneByParams(null,imageCode);
         if ((null == imageGet) || ("".equals(imageGet.getImageToken()))){
-            // 如果取不到image_token
-            // 则调用上传url的方法 kuauiShouImageUpload(url, signature, accountId, oauthToken.getAccessToken());
             return materialUploadService.kuauiShouImageUpload(imageUrl,imageCode,accountId,token);
         }
 

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

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.mapper;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.KuaiShouVideoGetVo;
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterialVo;
 import cn.com.ctop.kuaishou.modules.report.entity.VideoGetvo;
@@ -44,4 +45,6 @@ public interface KuaiShouReportDailyMaterialMapper extends BaseMapper<KuaiShouRe
     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("companyId") String companyId, @Param("realname") String realname, @Param("roleCode") String roleCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
+
+    List<EtlKuaishouAccountMaterialReportDaily> getReportList(@Param("accountId") Long accountId,@Param("statDate") String statDate,@Param("projectId") Long projectId, @Param("projectName") String projectName);
 }

+ 6 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouVideoGetMapper.java

@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -55,5 +56,9 @@ public interface KuaiShouVideoGetMapper extends BaseMapper<KuaiShouVideoGet> {
 
     List<String> queryPhotoIdsByProjectAndMd5(@Param("projectId") Long projectId, @Param("signature") String signature, @Param("accountId") JSONArray accountId);
 
-    JSONObject getVideoByPhotoIdAndAccountId(@Param("accountId") Long accountId,@Param("photoId") Long photoId);
+    JSONObject getVideoByPhotoIdAndAccountId(@Param("accountId") Long accountId, @Param("photoId") Long photoId);
+
+    List<JSONObject> getVideoListByDate(@Param("startDate") Date startDate,@Param("endDate") Date endDate);
+
+    List<String> getDateList();
 }

+ 53 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml

@@ -873,5 +873,58 @@
         ORDER BY k1.zhenren_charge DESC,k3.zhizuo_charge DESC
         )t
     </select>
+    <select id="getReportList" resultType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily">
+        SELECT
+        #{projectId} as 'projectId',
+        #{projectName} as 'projectName',
+	    t1.account_id AS 'accountId',
+        t1.signature as 'signature',
+	    t1.photo_id AS 'photoId',
+	    sum(t1.charge) AS 'charge',
+	    sum(t1.photo_show) AS 'photoShow',
+	    sum(t1.aclick) AS 'aclick',
+	    sum(t1.bclick) AS 'bclick',
+	    sum(t1.download_started) AS 'downloadStarted',
+	    sum(t1.download_completed) AS 'downloadCompleted',
+	    sum(t1.activation) AS 'activation',
+	    sum(t1.submit) AS 'submit',
+	    t1.stat_date AS 'statDate',
+	    sum(t1.photo_click) AS 'photoClick',
+	    sum(t1.event_pay_first_day) AS 'eventPayFirstDay',
+	    sum(
+		t1.event_pay_purchase_amount_first_day
+	    ) AS 'eventPayPurchaseAmountFirstDay',
+	    sum(t1.event_pay) AS 'eventPay',
+	    sum(
+		t1.event_pay_purchase_amount
+    	) AS 'eventPayPurchaseAmount',
+	    sum(t1.event_register) AS 'eventRegister',
+	    sum(t1.event_jin_jian_app) AS 'eventJinJianApp',
+	    sum(t1.event_credit_grant_app) AS 'eventCreditGrantApp',
+	    sum(t1.event_order_paid) AS 'eventOrderPaid',
+	    sum(
+		t1.event_order_paid_purchase_amount
+	    ) AS 'eventOrderPaidPurchaseAmount',
+	    sum(
+		t1.event_jin_jian_landing_page
+	    ) AS 'eventJinJianLandingPage',
+	    sum(
+		t1.event_credit_grant_landing_page
+	    ) AS 'eventCreditGrantLandingPage',
+	    sum(t1.event_next_day_stay) AS 'eventNextDayStay',
+	    sum(t1.form_count) AS 'formCount',
+	    round(
+		sum(
+			t1.play_3s_ratio * t1.photo_show
+		)
+	    ) AS play3sCount
+        FROM
+	    ctop_kuaishou_report_daily_material t1
+        WHERE
+	    t1.account_id = #{accountId}
+        AND t1.stat_date = #{statDate}
+        GROUP BY
+	    t1.photo_id;
+    </select>
 </mapper>
 

+ 37 - 4
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouVideoGetMapper.xml

@@ -317,11 +317,14 @@
     </select>
 
     <select id="getAccountIds" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT account_id 'accountId',DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 65 MINUTE), '%Y-%m-%d %H:%i:%s') 'startDate'
-        FROM ctop_kuaishou_video_get
+        SELECT t1.account_id 'accountId',DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 15 MINUTE), '%Y-%m-%d %H:%i:%s') 'startDate'
+        FROM ctop_kuaishou_video_get t1
+                 LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
         where channel_type = 1
-          and status = 0
-        GROUP BY account_id
+          AND t2.account_status = 0
+          AND t1.status = 0
+          AND t1.stat_date >=DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 2 DAY), '%Y-%m-%d')
+        GROUP BY t1.account_id
     </select>
 
     <select id="queryPhotoIdsByProjectAndMd5" resultType="java.lang.String">
@@ -349,6 +352,36 @@
 
     </select>
 
+    <select id="getVideoListByDate" resultType="com.alibaba.fastjson.JSONObject">
+     SELECT
+     account_id as 'accountId',
+     signature as 'signature',
+     photo_name as 'photoName',
+     url as 'url',
+     cover_url as 'coverUrl',
+     channel_type as 'channelType'
+    from ctop_kuaishou_video_get WHERE stat_date BETWEEN #{startDate} AND #{endDate}
+     group by signature
+
+    </select>
+    <select id="getDateList" resultType="java.lang.String">
+       SELECT
+	    *
+        FROM
+	(
+		SELECT DISTINCT
+			(
+				DATE_FORMAT(stat_date, '%Y-%m-%d')
+			) AS 'date'
+		FROM
+			ctop_kuaishou_video_get
+			where stat_date is  not null
+	) t1
+        ORDER BY
+	t1.date asc
+
+    </select>
+
     <update id="updateBatch">
         UPDATE ctop_kuaishou_video_get SET
         material_tag = CASE id

+ 3 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouReportDailyMaterialService.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.service;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.KuaiShouVideoGetVo;
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.common.api.vo.Result;
@@ -29,4 +30,6 @@ public interface IKuaiShouReportDailyMaterialService extends IService<KuaiShouRe
     List<KuaiShouReportDailyMaterial> getVideoInfoByList(List<KuaiShouReportDailyMaterial> addList, List<Long> photoIdList);
 
     Result<Object> labelMaterialList(String companyId,String realname, String roleCode, String startTime, String endTime, Integer pageNo, Integer pageSize);
+
+    List<EtlKuaishouAccountMaterialReportDaily> getReportList(Long accountId, String statDate, Long projectId, String projectName);
 }

+ 5 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouVideoGetService.java

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -61,4 +62,8 @@ public interface IKuaiShouVideoGetService extends IService<KuaiShouVideoGet> {
     List<String> queryPhotoIdsByProjectAndMd5(Long projectId, String signature, JSONArray accountId);
 
     JSONObject getVideoByPhotoIdAndAccountId(Long accountId, Long photoId);
+
+    List<JSONObject> getVideoListByDate(Date startDate, Date endDate);
+
+    List<String> getDateList();
 }

+ 0 - 4
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java

@@ -29,10 +29,6 @@ import static java.lang.Integer.valueOf;
 @Slf4j
 @Service
 public class BatchServiceImpl implements IBatchService {
-
-    @Value("${oss.replace.download}")
-    private String downloadUrl;
-
     @Autowired
     private BatchMapper batchMapper;
     @Autowired

+ 0 - 10
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java

@@ -52,16 +52,6 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
     private ICtopOauthTokenService ctopOauthTokenService;
     @Autowired
     private KuaishouReportDailyAccountMapper reportDailyAccountMapper;
-
-    @Autowired
-    private KuaishouReportDailyCampaignMapper reportDailyCampaignMapper;
-
-
-    @Autowired
-    private KuaishouReportDailyGroupMapper reportDailyGroupMapper;
-
-    @Autowired
-    private KuaishouReportDailyCreativeMapper reportDailyCreativeMapper;
     @Autowired
     private IKuaiShouDailyReportTaskService dailyReportTaskService;
 

+ 0 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouMaterialUploadServiceImpl.java

@@ -33,10 +33,8 @@ import java.util.Map;
 @Slf4j
 @Service
 public class KuaiShouMaterialUploadServiceImpl implements IKuaiShouMaterialUploadService {
-
     @Value("${oss.replace.download}")
     private String downloadUrl;
-
     @Autowired
     private IKuaiShouImageGetService iKuaiShouImageGetService;
     @Autowired

+ 7 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouReportDailyMaterialServiceImpl.java

@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.KuaiShouVideoGetVo;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouReportDailyMaterialMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouReportHourlyMaterialMapper;
 import com.alibaba.fastjson.JSONArray;
@@ -14,6 +15,7 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -141,6 +143,11 @@ public class KuaiShouReportDailyMaterialServiceImpl extends ServiceImpl<KuaiShou
     }
 
     @Override
+    public List<EtlKuaishouAccountMaterialReportDaily> getReportList(Long accountId, String statDate, Long projectId, String projectName) {
+        return dailyMaterialMapper.getReportList(accountId, statDate, projectId, projectName);
+    }
+
+    @Override
     public List<KuaiShouReportDailyMaterial> getSignatureByDate(String date) {
         return dailyMaterialMapper.getSignatureByDate(date);
     }

+ 11 - 3
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouVideoGetServiceImpl.java

@@ -39,10 +39,8 @@ public class KuaiShouVideoGetServiceImpl extends ServiceImpl<KuaiShouVideoGetMap
     private IMaterialCutFrameService materialCutFrameService;
     @Value("${oss.replace.download}")
     private String downloadUrl;
-
     @Autowired
     private IKuaiShouVideoLastTimeService lastTimeService;
-
     @Override
     public void replaceBatch(List<KuaiShouVideoGet> videoGets) {
         videoGetMapper.replaceBatch(videoGets);
@@ -163,7 +161,7 @@ public class KuaiShouVideoGetServiceImpl extends ServiceImpl<KuaiShouVideoGetMap
             queryWrapper.eq("channel_type", channelType);
         }
 
-        if (null != appVersion && !"".equals(appVersion.trim())) {
+        if (null != appVersion && !appVersion.trim().equals("")) {
             queryWrapper.likeRight("photo_name", appVersion);
         }
         if (null != videoCnt && videoCnt != 0) {
@@ -351,4 +349,14 @@ public class KuaiShouVideoGetServiceImpl extends ServiceImpl<KuaiShouVideoGetMap
     public JSONObject getVideoByPhotoIdAndAccountId(Long accountId, Long photoId) {
         return videoGetMapper.getVideoByPhotoIdAndAccountId(accountId, photoId);
     }
+
+    @Override
+    public List<JSONObject> getVideoListByDate(Date startDate, Date endDate) {
+        return videoGetMapper.getVideoListByDate(startDate, endDate);
+    }
+
+    @Override
+    public List<String> getDateList() {
+        return videoGetMapper.getDateList();
+    }
 }

+ 5 - 5
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/mapper/KuaishouAccountCleanTemplateMapper.java

@@ -33,7 +33,7 @@ public interface KuaishouAccountCleanTemplateMapper {
     //根据id和accountId 删除关联表信息
     void removeBinding(@Param("templateId")String templateId,@Param("accountId")String accountId);
     //查询清理日志记录
-    List<KuaiShouAccountCleanLogInfo> getCleanUpLog(@Param("templateId")String templateId, @Param("userId")String userId);
+    List<KuaiShouAccountCleanLogInfo> getCleanUpLog(@Param("templateId") String templateId, @Param("userId") String userId);
 
     //根据账户id 运营名称 查询个人模板信息
     List<KuaiShouAccountCleanTemplateInfo> getMyselfTemplateList(@Param("accountId")String accountId, @Param("userName")String userName, @Param("createId")String createId);
@@ -41,17 +41,17 @@ public interface KuaishouAccountCleanTemplateMapper {
     //查询所有启用的模板
     List<KuaiShouAccountCleanTemplateInfo> getTemplateListBystatus();
     //根据规则模板查询相应组信息
-    String getGroupMessage(@Param("template")KuaiShouAccountCleanTemplateInfo kuaiShouAccountCleanTemplateInfo,@Param("optimizationObjective")String optimizationObjective, @Param("startDate")String startDate, @Param("unitId")String unitId);
-    List<Map> getGroupByAccount( @Param("accountId")String accountId);
+    String getGroupMessage(@Param("template") KuaiShouAccountCleanTemplateInfo kuaiShouAccountCleanTemplateInfo, @Param("optimizationObjective") String optimizationObjective, @Param("startDate") String startDate, @Param("unitId") String unitId);
+    List<Map> getGroupByAccount(@Param("accountId") String accountId);
 
     //保存操作日志
     void saveCleamLog(KuaiShouAccountCleanLogInfo kuaiShouAccountCleanLogInfo);
 
     Map<String,String> getUserNameByAccountId(@Param("accountId")String accountId);
 
-    String getUserRealName(@Param("userId")String userId);
+    String getUserRealName(@Param("userId") String userId);
     /**
      * 根据模板名称查询
      */
-    int getTemplateName(@Param("templateName")String templateName);
+    int getTemplateName(@Param("templateName") String templateName);
 }

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/service/KuaiShouAccountCleanService.java

@@ -22,7 +22,7 @@ public interface KuaiShouAccountCleanService {
      * @param templateId 模板id  createUser创建人
      * @return
      */
-    Result getTemplateList(String templateId, String createUser,String userId,String pageNum, String pageSize);
+    Result getTemplateList(String templateId, String createUser, String userId, String pageNum, String pageSize);
     /**
      * 预览模板
      *

+ 74 - 37
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/entity/EtlKuaishouVideoInfo.java

@@ -9,48 +9,85 @@ import java.util.Date;
 
 /**
  * 快手视频报表信息
+ *
  * @author jeecg-boot
- * @date   2021-02-20
  * @version V1.0
+ * @date 2021-02-20
  */
 @Data
 @TableName("ctop_etl_kuaishou_video_info")
 public class EtlKuaishouVideoInfo {
 
-	/**id*/
-	@TableId(type = IdType.AUTO)
-	private Long id;
-	/**视频唯一标识*/
-	private String videoCode;
-	private String videoName;
-	/**初次产生消耗时间*/
-	private Date stateDate;
-	/**url*/
-	private String url;
-	/**coverUrl*/
-	private String coverUrl;
-	/**渠道类型*/
-	private String channelType;
-	/**渠道名称*/
-	private String channelName;
-	/**planId*/
-	private String planId;
-	/**planName*/
-	private String planName;
-	/**clipId*/
-	private String clipId;
-	/**clipName*/
-	private String clipName;
-	/**shotId*/
-	private String shotId;
-	/**shotName*/
-	private String shotName;
-	/**designTeamLeaderId*/
-	private String designTeamLeaderId;
-	/**designTeamLeaderName*/
-	private String designTeamLeaderName;
-	/**createTime*/
-	private Date createTime;
-	/**updateTime*/
-	private Date updateTime;
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+    /**
+     * 视频唯一标识
+     */
+    private String companyId;
+    private String companyName;
+    private String videoCode;
+    private String videoName;
+    /**
+     * 初次产生消耗时间
+     */
+    private Date stateDate;
+    /**
+     * url
+     */
+    private String url;
+    /**
+     * coverUrl
+     */
+    private String coverUrl;
+    /**
+     * 渠道类型
+     */
+    private String channelType;
+    /**
+     * 渠道名称
+     */
+    private String channelName;
+    /**
+     * planId
+     */
+    private String planId;
+    /**
+     * planName
+     */
+    private String planName;
+    /**
+     * clipId
+     */
+    private String clipId;
+    /**
+     * clipName
+     */
+    private String clipName;
+    /**
+     * shotId
+     */
+    private String shotId;
+    /**
+     * shotName
+     */
+    private String shotName;
+    /**
+     * designTeamLeaderId
+     */
+    private String designTeamLeaderId;
+    /**
+     * designTeamLeaderName
+     */
+    private String designTeamLeaderName;
+    /**
+     * createTime
+     */
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    private Date updateTime;
 }

+ 7 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/mapper/EtlKuaishouVideoInfoMapper.java

@@ -4,15 +4,20 @@ import cn.com.ctop.kuaishou.modules.material.entity.EtlKuaishouVideoInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
  * 快手视频报表信息
+ *
  * @author: jeecg-boot
- * @date:   2021-02-20
+ * @date: 2021-02-20
  * @cersion: V1.0
  */
 public interface EtlKuaishouVideoInfoMapper extends BaseMapper<EtlKuaishouVideoInfo> {
 
     String getVideoMinDate(@Param(value = "signature") String signature);
 
-    void replaceVideoInfo(@Param(value = "etlKuaishouVideoInfo")EtlKuaishouVideoInfo etlKuaishouVideoInfo);
+    void replaceVideoInfo(@Param(value = "etlKuaishouVideoInfo") EtlKuaishouVideoInfo etlKuaishouVideoInfo);
+
+    void addBatch(@Param("addList") List<EtlKuaishouVideoInfo> addList);
 }

+ 50 - 7
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/mapper/xml/EtlKuaishouVideoInfoMapper.xml

@@ -4,6 +4,8 @@
     <insert id="replaceVideoInfo" parameterType="cn.com.ctop.kuaishou.modules.material.entity.EtlKuaishouVideoInfo">
         replace into ctop_etl_kuaishou_video_info
             (
+            company_id,
+            company_name,
             video_code,
             video_name,
             state_date,
@@ -21,9 +23,11 @@
             design_team_leader_name)
             values
             (
-           #{etlKuaishouVideoInfo.videoCode},
-           #{etlKuaishouVideoInfo.videoName},
-           #{etlKuaishouVideoInfo.stateDate},
+                #{etlKuaishouVideoInfo.companyId},
+                #{etlKuaishouVideoInfo.companyName},
+                #{etlKuaishouVideoInfo.videoCode},
+                #{etlKuaishouVideoInfo.videoName},
+                #{etlKuaishouVideoInfo.stateDate},
                 #{etlKuaishouVideoInfo.url},
                 #{etlKuaishouVideoInfo.coverUrl},
                 #{etlKuaishouVideoInfo.channelType},
@@ -37,10 +41,49 @@
                 #{etlKuaishouVideoInfo.designTeamLeaderId},
                 #{etlKuaishouVideoInfo.designTeamLeaderName}
         )
-
-
-
-
+    </insert>
+    <insert id="addBatch">
+        replace into ctop_etl_kuaishou_video_info
+        (
+        company_id,
+        company_name,
+        video_code,
+        video_name,
+        state_date,
+        url,
+        cover_url,
+        channel_type,
+        channel_name,
+        plan_id,
+        plan_name,
+        clip_id,
+        clip_name,
+        shot_id,
+        shot_name,
+        design_team_leader_id,
+        design_team_leader_name)
+        values
+        <foreach collection="addList" item="ad" separator=",">
+            (
+            #{ad.companyId},
+            #{ad.companyName},
+            #{ad.videoCode},
+            #{ad.videoName},
+            #{ad.stateDate},
+            #{ad.url},
+            #{ad.coverUrl},
+            #{ad.channelType},
+            #{ad.channelName},
+            #{ad.planId},
+            #{ad.planName},
+            #{ad.clipId},
+            #{ad.clipName},
+            #{ad.shotId},
+            #{ad.shotName},
+            #{ad.designTeamLeaderId},
+            #{ad.designTeamLeaderName}
+            )
+        </foreach>
     </insert>
 
     <select id="getVideoMinDate" resultType="java.lang.String">

+ 4 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/service/IEtlKuaishouVideoInfoService.java

@@ -6,11 +6,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
 /**
  * @Description: 快手视频报表信息
  * @Author: jeecg-boot
- * @Date:   2021-02-20
+ * @Date: 2021-02-20
  * @Version: V1.0
  */
 public interface IEtlKuaishouVideoInfoService extends IService<EtlKuaishouVideoInfo> {
-    void  etlKuaishouVideoInfo(String date);
+    void etlKuaishouVideoInfo(String date);
 
     EtlKuaishouVideoInfo getOneByVideoCode(String signature);
+
+
 }

+ 85 - 48
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/service/impl/EtlKuaishouVideoInfoServiceImpl.java

@@ -4,7 +4,8 @@ import cn.com.ctop.common.module.entity.MaterialInfo;
 import cn.com.ctop.common.module.service.IMaterialAscriptionService;
 import cn.com.ctop.common.module.service.IMaterialInfoService;
 import cn.com.ctop.common.module.service.ISysUserService;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
+import cn.com.ctop.common.module.service.IUserCompanyService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
 import cn.com.ctop.kuaishou.modules.material.entity.EtlKuaishouVideoInfo;
 import cn.com.ctop.kuaishou.modules.material.mapper.EtlKuaishouVideoInfoMapper;
@@ -12,6 +13,7 @@ import cn.com.ctop.kuaishou.modules.material.service.IEtlKuaishouVideoInfoServic
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.system.entity.SysUser;
 import org.jeecg.common.util.DateUtils;
@@ -19,17 +21,18 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
 /**
  * 快手视频报表信息
+ *
  * @author jeecg-boot
- * @date   2021-02-20
  * @version V1.0
+ * @date 2021-02-20
  */
 @Service
 @Slf4j
@@ -44,100 +47,134 @@ public class EtlKuaishouVideoInfoServiceImpl extends ServiceImpl<EtlKuaishouVide
     private ISysUserService sysUserService;
     @Autowired
     private IMaterialInfoService materialInfoService;
-    ExecutorService executorService = Executors.newFixedThreadPool(200);
+    @Autowired
+    private IUserCompanyService companyService;
+    ExecutorService executorService = Executors.newFixedThreadPool(5);
+
     @Override
     public void etlKuaishouVideoInfo(String date) {
-        //1:查询当前日期内的所有存在md5码信息的视频数据
-        List<KuaiShouVideoGet> videoGets = videoGetService.getVideoInfoGroupBySignature(date);
-        if(null!=videoGets&&!videoGets.isEmpty()){
-            CountDownLatch countDownLatch = new CountDownLatch(videoGets.size());
-            videoGets.forEach(videoGet -> {
-                executorService.submit(()->{
+        Date startDate = DateUtils.getStartDate(date);
+        Date endDate = DateUtils.getEndDate(date);
+        List<JSONObject> videoList = videoGetService.getVideoListByDate(startDate, endDate);
+        if (Check.isNull(videoList)) {
+            return;
+        }
+        log.info("日期:{},视频数量:{}", date, videoList.size());
+        List<List<JSONObject>> partition = Lists.partition(videoList, 500);
+        for (int i = 0; i < partition.size(); i++) {
+            List<JSONObject> videos = partition.get(i);
+            executorService.submit(() -> {
+                List<EtlKuaishouVideoInfo> addList = new ArrayList<>();
+                for (int j = 0; j < videos.size(); j++) {
+                    JSONObject videoJson = videos.get(j);
+                    if (Check.isNull(videoJson)) {
+                        continue;
+                    }
+                    String signature = videoJson.getString("signature");
+                    if (Check.isNull(signature)) {
+                        continue;
+                    }
                     try {
                         //1:查询素材名称
                         EtlKuaishouVideoInfo etlKuaishouVideoInfo = new EtlKuaishouVideoInfo();
-                        MaterialInfo materialInfo = materialInfoService.getMaterialInfoByCode(videoGet.getSignature());
-                        if(null != materialInfo){
+                        MaterialInfo materialInfo = materialInfoService.getMaterialInfoByCode(signature);
+                        if (null != materialInfo) {
                             etlKuaishouVideoInfo.setVideoName(materialInfo.getMaterialName());
-                        }else{
-                            etlKuaishouVideoInfo.setVideoName(videoGet.getPhotoName());
+                        } else {
+                            etlKuaishouVideoInfo.setVideoName(videoJson.getString("photoName"));
                         }
-                        etlKuaishouVideoInfo.setVideoCode(videoGet.getSignature());
-                        etlKuaishouVideoInfo.setUrl(videoGet.getUrl());
-                        etlKuaishouVideoInfo.setCoverUrl(videoGet.getCoverUrl());
-                        etlKuaishouVideoInfo.setChannelType(videoGet.getChannelType().toString());
-                        if(videoGet.getChannelType() == 0){
+                        etlKuaishouVideoInfo.setVideoCode(signature);
+                        etlKuaishouVideoInfo.setUrl(videoJson.getString("url"));
+                        etlKuaishouVideoInfo.setCoverUrl(videoJson.getString("coverUrl"));
+                        String channelType = videoJson.getString("channelType");
+                        etlKuaishouVideoInfo.setChannelType(channelType);
+                        if (channelType.equals("0")) {
                             etlKuaishouVideoInfo.setChannelName("内部");
-                        }else {
+                        } else {
                             etlKuaishouVideoInfo.setChannelName("素造");
                         }
                         //查询相关设计人员信息
-                        JSONObject ascription = ascriptionService.getDetailByCode(videoGet.getSignature());
-                        if(null!=ascription){
-                            String clipId = ascription.getString("clipId");
-                            if(null!=clipId&&!"".equals(clipId.trim())){
+                        String clipId = null;
+                        JSONObject ascription = ascriptionService.getDetailByCode(signature);
+                        if (null != ascription) {
+                            clipId = ascription.getString("clipId");
+                            if (null != clipId && !"".equals(clipId.trim())) {
                                 etlKuaishouVideoInfo.setClipId(clipId);
                                 //根据id查询剪辑所属的设计负责人
                                 SysUser user = sysUserService.getById(clipId);
-                                if(null!=user){
+                                if (null != user) {
                                     String roleCode = sysUserService.getRoleCodeByUserId(user.getId());
-                                    if(null!=roleCode&& "designTeamLeader".equals(roleCode.trim())){
+                                    if (null != roleCode && "designTeamLeader".equals(roleCode.trim())) {
                                         etlKuaishouVideoInfo.setDesignTeamLeaderId(user.getId());
                                         etlKuaishouVideoInfo.setDesignTeamLeaderName(user.getRealname());
-                                    }else{
+                                    } else {
                                         etlKuaishouVideoInfo.setDesignTeamLeaderId(user.getLeaderId());
                                         etlKuaishouVideoInfo.setDesignTeamLeaderName(user.getLeaderName());
                                     }
                                 }
                             }
                             String clipName = ascription.getString("clipName");
-                            if(null!=clipName&&!"".equals(clipName.trim())){
+                            if (null != clipName && !"".equals(clipName.trim())) {
                                 etlKuaishouVideoInfo.setClipName(clipName);
                             }
                             String planId = ascription.getString("planId");
-                            if(null!=planId&&!"".equals(planId.trim())){
+                            if (null != planId && !"".equals(planId.trim())) {
                                 etlKuaishouVideoInfo.setPlanId(planId);
                             }
                             String planName = ascription.getString("planName");
-                            if(null!=planName&&!"".equals(planName.trim())){
+                            if (null != planName && !"".equals(planName.trim())) {
                                 etlKuaishouVideoInfo.setPlanName(planName);
                             }
                             String shotId = ascription.getString("shotId");
-                            if(null!=shotId&&!"".equals(shotId.trim())){
+                            if (null != shotId && !"".equals(shotId.trim())) {
                                 etlKuaishouVideoInfo.setShotId(shotId);
                             }
                             String shotName = ascription.getString("shotName");
-                            if(null!=shotName&&!"".equals(shotName.trim())){
+                            if (null != shotName && !"".equals(shotName.trim())) {
                                 etlKuaishouVideoInfo.setShotName(shotName);
                             }
                         }
+                        if (Check.isNull(clipId)) {
+                            Long accountId = videoJson.getLong("accountId");
+                            if (!Check.isNull(accountId)) {
+                                JSONObject companyJson = companyService.getCompanyInfoByAccountId(accountId);
+                                if (!Check.isNull(companyJson)) {
+                                    etlKuaishouVideoInfo.setCompanyId(companyJson.getString("companyId"));
+                                    etlKuaishouVideoInfo.setCompanyName(companyJson.getString("companyName"));
+                                }
+                            }
+                        } else {
+                            JSONObject companyJson = companyService.getCompanyInfoByUserId(clipId);
+                            etlKuaishouVideoInfo.setCompanyId(companyJson.getString("companyId"));
+                            etlKuaishouVideoInfo.setCompanyName(companyJson.getString("companyName"));
+                        }
                         //查询视频初次消耗时间
-                        String minDate = etlKuaishouVideoInfoMapper.getVideoMinDate(videoGet.getSignature());
-                        if(null!=minDate&&!"".equals(minDate)){
-                            Date getDate = DateUtils.parseDate(minDate,"yyyy-MM-dd");
+                        String minDate = etlKuaishouVideoInfoMapper.getVideoMinDate(signature);
+                        if (null != minDate && !"".equals(minDate)) {
+                            Date getDate = DateUtils.parseDate(minDate, "yyyy-MM-dd");
                             etlKuaishouVideoInfo.setStateDate(getDate);
                         }
-                        etlKuaishouVideoInfoMapper.replaceVideoInfo(etlKuaishouVideoInfo);
-                    }catch (Exception e){
+                        addList.add(etlKuaishouVideoInfo);
+                    } catch (Exception e) {
                         e.printStackTrace();
-                    }finally {
-                        countDownLatch.countDown();
                     }
-                });
+                }
+                if (!Check.isNull(addList)) {
+                    etlKuaishouVideoInfoMapper.addBatch(addList);
+
+                }
             });
-            try {
-                countDownLatch.await();
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-            log.info("{}数据获取完成",date);
         }
+        log.info("{}数据获取完成", date);
     }
+
+
     @Override
     public EtlKuaishouVideoInfo getOneByVideoCode(String signature) {
-        QueryWrapper<EtlKuaishouVideoInfo>queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("video_code",signature);
+        QueryWrapper<EtlKuaishouVideoInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("video_code", signature);
         queryWrapper.last("limit 1");
         return this.getOne(queryWrapper);
     }
+
 }

+ 47 - 92
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java

@@ -1,5 +1,8 @@
 package cn.com.ctop.kuaishou.modules.report.controller;
 
+import cn.com.ctop.common.module.entity.UserCompany;
+import cn.com.ctop.common.module.service.ISysUserService;
+import cn.com.ctop.common.module.service.IUserCompanyService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.ExportExcelUtils;
 import cn.com.ctop.common.module.utils.HttpUtils;
@@ -9,8 +12,11 @@ import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.AccountReportConstants;
+import org.jeecg.common.system.entity.SysUser;
+import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.utils.JsonResourceUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -37,6 +43,8 @@ public class KsVideoReportCtrl {
 
     @Autowired
     IKsVideoReportService ksVideoReportService;
+    @Autowired
+    private IUserCompanyService companyService;
 
 
     @PostMapping("/getDesignList")
@@ -55,6 +63,9 @@ public class KsVideoReportCtrl {
         return result;
     }
 
+    @Autowired
+    private ISysUserService sysUserService;
+
     @PostMapping("/list")
     public Result<PageInfo<JSONObject>> getListReport(@RequestBody JSONObject requestBody) {
         Result<PageInfo<JSONObject>> result = new Result<>();
@@ -73,7 +84,22 @@ public class KsVideoReportCtrl {
             if (Check.isNull(filedAll)) {
                 throw new Exception("初始化查询 字段返回为空");
             }
+            String userId = requestBody.getString("userId");
+            if (Check.isNull(userId)) {
+                throw new Exception("用户id不能为空");
+            }
             Map<String, Object> requestMap = new HashMap<>();
+            SysUser user = sysUserService.getById(userId);
+            if (Check.isNull(user)) {
+                throw new Exception("用户信息为空");
+            }
+            if (!"管理员".equals(user.getRealname()) && !"吴睿刚".equals(user.getRealname())) {
+                UserCompany userCompany = companyService.getByUserId(userId);
+                if (Check.isNull(userCompany)) {
+                    throw new Exception("公司信息为空");
+                }
+                requestMap.put("companyId", userCompany.getCompanyId());
+            }
             requestMap.put("filed", filedAll);
             requestMap.put("startDate", startDate);
             requestMap.put("endDate", endDate);
@@ -98,8 +124,8 @@ public class KsVideoReportCtrl {
             if (!Check.isNull(requestBody.getString("order"))) {
                 requestMap.put("order", requestBody.getString("order"));
             }
-            if (!Check.isNull(requestBody.getInteger("channelType"))) {
-                requestMap.put("channelType", requestBody.getInteger("channelType"));
+            if (!Check.isNull(requestBody.getString("channelType"))) {
+                requestMap.put("channelType", requestBody.getString("channelType"));
             }
             PageInfo<JSONObject> listData = ksVideoReportService.getKuaiShouVideoPageReportByMap(requestMap, pageSize, pageNo);
             if (Check.isNull(listData)) {
@@ -127,9 +153,7 @@ public class KsVideoReportCtrl {
             String signature = requestBody.getString("signature");
             String startDate = requestBody.getString("startDate");
             String endDate = requestBody.getString("endDate");
-
             String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getDicMapKs());
-
             try {
                 if (accountIds.isEmpty()) {
                     accountIds = null;
@@ -145,89 +169,6 @@ public class KsVideoReportCtrl {
         return result;
     }
 
-    @PostMapping("/excel")
-    public void getExcelReport(@RequestBody JSONObject requestBody,
-                               HttpServletRequest request,
-                               HttpServletResponse response) {
-        //加一个参数区分是table页,还是详情页。
-        String exportType = requestBody.getString("exportType");
-        if (exportType.isEmpty()) {
-            return;
-        }
-        JSONArray columns = requestBody.getJSONArray("columns");
-        if (columns.isEmpty()) {
-            //默认消耗必查
-            columns.add("cost");
-        }
-        String filed = JsonResourceUtil.joinFiled(AccountReportConstants.getDicMapKs(), columns);
-        List<String> titles = new ArrayList<>(JsonResourceUtil.joinTitle(AccountReportConstants.getDicMapKs(), columns));
-        //此处增加两个元素是为了保证数据顺序
-        if ("exportDetail".equals(exportType)) {
-            titles.add(0, "客户");
-            titles.add(1, "项目名称");
-            titles.add(2, "时间");
-            titles.add(3, "消耗");
-            columns.add(0, "advertiserName");
-            columns.add(1, "projectName");
-            columns.add(2, "statDate");
-        } else {
-            titles.add(0, "唯一标识");
-            titles.add(1, "视频");
-            titles.add(2, "视频名称");
-            titles.add(3, "项目名称");
-            titles.add(4, "上传时间");
-            titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.getDicMapKs(), columns));
-            columns.add(0, "signature");
-            columns.add(1, "url");
-            columns.add(2, "materialName");
-            columns.add(3, "projectName");
-            columns.add(4, "createTime");
-        }
-
-        JSONArray accountIds = requestBody.getJSONArray("accountIds");
-        if (accountIds.isEmpty()) {
-            accountIds = null;
-        }
-        String startDate = requestBody.getString("startDate");
-        String endDate = requestBody.getString("endDate");
-        String signature = requestBody.getString("signature");
-        String clip = requestBody.getString("clip");
-        String shot = requestBody.getString("shot");
-        String plan = requestBody.getString("plan");
-        String target = requestBody.getString("target");
-        String order = requestBody.getString("order");
-        List<JSONObject> excelData = null;
-        if ("exportTable".equals(exportType)) {
-            excelData = ksVideoReportService.exportExcelReportBy(accountIds, startDate, endDate, filed, target, order, clip, shot, plan);
-        } else if ("exportDetail".equals(exportType)) {
-            excelData = ksVideoReportService.getVideoDetailBy(accountIds, startDate, endDate, filed, signature);
-        }
-        if (null != excelData && excelData.isEmpty()) {
-            return;
-        }
-        List<List<Object>> excelList = new ArrayList<>();
-        excelData.forEach(data -> {
-            List<Object> temp = new ArrayList<>();
-            columns.forEach(k -> {
-                temp.add(data.get(k.toString()));
-            });
-            excelList.add(temp);
-        });
-        try {
-            String[] headers = titles.toArray(new String[titles.size()]);
-            OutputStream os = response.getOutputStream();
-            ExportExcelUtils eeu = new ExportExcelUtils();
-            XSSFWorkbook workbook = new XSSFWorkbook();
-            eeu.exportExcel(workbook, 0, "快手视频报表", headers, excelList);
-            HttpUtils.setResponseHeader(response, "快手视频报表.xlsx");
-            workbook.write(os);
-            os.flush();
-            os.close();
-        } catch (IOException e) {
-            log.error(e.getMessage());
-        }
-    }
-
 
     @PostMapping("/excelV2")
     public void excelV2(@RequestBody JSONObject requestBody,
@@ -249,12 +190,27 @@ public class KsVideoReportCtrl {
             if (Check.isNull(endDate)) {
                 throw new Exception("请输入查询结束时间");
             }
+
+            String userId = requestBody.getString("userId");
+            if (Check.isNull(userId)) {
+                throw new Exception("用户id不能为空");
+            }
+            Map<String, Object> requestMap = new HashMap<>();
+            SysUser user = sysUserService.getById(userId);
+            if (Check.isNull(user)) {
+                throw new Exception("用户信息为空");
+            }
+            if (!"管理员".equals(user.getRealname()) && !"吴睿刚".equals(user.getRealname())) {
+                UserCompany userCompany = companyService.getByUserId(userId);
+                if (Check.isNull(userCompany)) {
+                    throw new Exception("公司信息为空");
+                }
+                requestMap.put("companyId", userCompany.getCompanyId());
+            }
             String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getKuaishouVideoReportMap());
-            //   System.err.println(filedAll);
             if (Check.isNull(filedAll)) {
                 throw new Exception("初始化查询 字段返回为空");
             }
-            Map<String, Object> requestMap = new HashMap<>();
             requestMap.put("filed", filedAll);
             requestMap.put("startDate", startDate);
             requestMap.put("endDate", endDate);
@@ -279,10 +235,9 @@ public class KsVideoReportCtrl {
             if (!Check.isNull(requestBody.getString("order"))) {
                 requestMap.put("order", requestBody.getString("order"));
             }
-            if (!Check.isNull(requestBody.getInteger("channelType"))) {
-                requestMap.put("channelType", requestBody.getInteger("channelType"));
+            if (!Check.isNull(requestBody.getString("channelType"))) {
+                requestMap.put("channelType", requestBody.getString("channelType"));
             }
-
             JSONArray columns2 = new JSONArray();
             columns2.add(0, "materialName");
             columns2.add(1, "signature");

+ 100 - 42
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/EtlKuaishouAccountMaterialReportDaily.java

@@ -14,92 +14,150 @@ import java.util.Date;
 
 /**
  * 快手账户素材报表清洗表
+ *
  * @author jeecg-boot
- * @date   2021-02-25
  * @version V1.0
+ * @date 2021-02-25
  */
 @Data
 @TableName("ctop_etl_kuaishou_account_material_report_daily")
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
-@ApiModel(value="ctop_etl_kuaishou_account_material_report_daily对象", description="快手账户素材报表清洗表")
+@ApiModel(value = "ctop_etl_kuaishou_account_material_report_daily对象", description = "快手账户素材报表清洗表")
 public class EtlKuaishouAccountMaterialReportDaily {
 
-	/**id*/
+	/**
+	 * id
+	 */
 	@TableId(type = IdType.AUTO)
 	private Long id;
 	private Long photoId;
-	/**账户ID*/
+	/**
+	 * 账户ID
+	 */
 	private Long accountId;
-	/**channelType*/
-	private Integer channelType;
-	/**signature*/
+	/**
+	 * signature
+	 */
 	private String signature;
-	/**companyId*/
-	private String companyId;
-	/**companyName*/
-	private String companyName;
-	/**projectId*/
+	/**
+	 * projectId
+	 */
 	private String projectId;
-	/**projectName*/
+	/**
+	 * projectName
+	 */
 	private String projectName;
 	/**封面url*/
-	private String coverUrl;
+
 	/**视频url*/
-	private String photoUrl;
-	/**素材类型*/
+	/**
+	 * 素材类型
+	 */
 	private String materialType;
-	/**花费(元)*/
+	/**
+	 * 花费(元)
+	 */
 	private BigDecimal charge;
-	/**曝光数*/
+	/**
+	 * 曝光数
+	 */
 	private Long photoShow;
-	/**素材曝光数*/
+	/**
+	 * 素材曝光数
+	 */
 	private Long aclick;
-	/**行为数*/
+	/**
+	 * 行为数
+	 */
 	private Long bclick;
-	/**应用下载数据-安卓下载开始数*/
+	/**
+	 * 应用下载数据-安卓下载开始数
+	 */
 	private Long downloadStarted;
-	/**应用下载数据-安卓下载完成数*/
+	/**
+	 * 应用下载数据-安卓下载完成数
+	 */
 	private Long downloadCompleted;
-	/**应用下载数据-激活数*/
+	/**
+	 * 应用下载数据-激活数
+	 */
 	private Long activation;
-	/**提交按钮点击数*/
+	/**
+	 * 提交按钮点击数
+	 */
 	private Long submit;
-	/**日期*/
+	/**
+	 * 日期
+	 */
 	private Date statDate;
-	/**封面点击数*/
+	/**
+	 * 封面点击数
+	 */
 	private Long photoClick;
-	/**应用下载数据-首日付费次数*/
+	/**
+	 * 应用下载数据-首日付费次数
+	 */
 	private Long eventPayFirstDay;
-	/**应用下载数据-首日付费金额*/
+	/**
+	 * 应用下载数据-首日付费金额
+	 */
 	private BigDecimal eventPayPurchaseAmountFirstDay;
-	/**应用下载数据-付费次数*/
+	/**
+	 * 应用下载数据-付费次数
+	 */
 	private Long eventPay;
-	/**应用下载数据-付费金额*/
+	/**
+	 * 应用下载数据-付费金额
+	 */
 	private BigDecimal eventPayPurchaseAmount;
-	/**应用下载数据-注册数*/
+	/**
+	 * 应用下载数据-注册数
+	 */
 	private Long eventRegister;
-	/**应用下载数据-完件数*/
+	/**
+	 * 应用下载数据-完件数
+	 */
 	private Long eventJinJianApp;
-	/**应用下载数据-授信数*/
+	/**
+	 * 应用下载数据-授信数
+	 */
 	private Long eventCreditGrantApp;
-	/**应用下载数据-付款成功数*/
+	/**
+	 * 应用下载数据-付款成功数
+	 */
 	private Long eventOrderPaid;
-	/**应用下载数据-付款成功金额*/
+	/**
+	 * 应用下载数据-付款成功金额
+	 */
 	private BigDecimal eventOrderPaidPurchaseAmount;
-	/**落地页数据-落地页完件数*/
+	/**
+	 * 落地页数据-落地页完件数
+	 */
 	private Long eventJinJianLandingPage;
-	/**落地页数据-落地页授信数*/
+	/**
+	 * 落地页数据-落地页授信数
+	 */
 	private Long eventCreditGrantLandingPage;
-	/**应用下载数据-次留数(仅支持分日查询)*/
+	/**
+	 * 应用下载数据-次留数(仅支持分日查询)
+	 */
 	private Long eventNextDayStay;
-	/**落地页数据-表单提交数*/
+	/**
+	 * 落地页数据-表单提交数
+	 */
 	private Long formCount;
-	/**3s播放数*/
+	/**
+	 * 3s播放数
+	 */
 	@TableField(value = "play_3s_count")
 	private Long play3sCount;
-	/**创建时间*/
+	/**
+	 * 创建时间
+	 */
 	private Date createTime;
-	/**修改时间*/
+	/**
+	 * 修改时间
+	 */
 	private Date updateTime;
 }

+ 14 - 7
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaishouAccountMaterialReportDailyMapper.java

@@ -8,19 +8,20 @@ import java.util.List;
 
 /**
  * 快手账户素材报表清洗表
+ *
  * @author: jeecg-boot
- * @date:   2021-02-25
+ * @date: 2021-02-25
  * @cersion: V1.0
  */
 public interface EtlKuaishouAccountMaterialReportDailyMapper extends BaseMapper<EtlKuaishouAccountMaterialReportDaily> {
 
     void etlKuaishouAccountMaterialReportDailyData(@Param(value = "date") String date);
 
-    List<EtlKuaishouAccountMaterialReportDaily> etlKuaishouAccountMaterialReportDailyList(@Param(value = "date")String date,@Param(value = "accountId")Long accountId);
+    List<EtlKuaishouAccountMaterialReportDaily> etlKuaishouAccountMaterialReportDailyList(@Param(value = "date") String date, @Param(value = "accountId") Long accountId);
 
-    void replaceBatch(@Param(value = "records")List<EtlKuaishouAccountMaterialReportDaily> getList);
+    void replaceBatch(@Param(value = "records") List<EtlKuaishouAccountMaterialReportDaily> getList);
 
-    void replace(@Param(value = "report")EtlKuaishouAccountMaterialReportDaily report);
+    void replace(@Param(value = "report") EtlKuaishouAccountMaterialReportDaily report);
 
     void etlKuaishouVideoReportStateDate();
 
@@ -28,9 +29,15 @@ public interface EtlKuaishouAccountMaterialReportDailyMapper extends BaseMapper<
 
     void etlKuaishouVideoTypeZz(@Param(value = "videoType") String videoType);
 
-    void etlKuaishouVideoTypeZr(@Param(value = "videoType")String videoType);
+    void etlKuaishouVideoTypeZr(@Param(value = "videoType") String videoType);
 
-    void etlBytedanceVideoTypeZr(@Param(value = "videoType")String videoType);
+    void etlBytedanceVideoTypeZr(@Param(value = "videoType") String videoType);
 
-    void etlBytedanceVideoTypeZz(@Param(value = "videoType")String videoType);
+    void etlBytedanceVideoTypeZz(@Param(value = "videoType") String videoType);
+
+    void addBatch(@Param("addList") List<EtlKuaishouAccountMaterialReportDaily> addList);
+
+    List<String> getDateList();
+
+    List<Long> getAccountList(String date);
 }

+ 80 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouAccountMaterialReportDailyMapper.xml

@@ -144,7 +144,9 @@
     </insert>
     <insert id="replace">
     replace into ctop_etl_kuaishou_account_material_report_daily(
-        photo_id,photo_url,cover_url
+        photo_id,
+        photo_url,
+        cover_url,
         company_id ,
         company_name ,
         project_id ,
@@ -177,7 +179,7 @@
         play_3s_count)
         values
         (
-    #{report.photoId},
+       #{report.photoId},
     #{report.photoUrl},
     #{report.coverUrl},
             #{report.companyId},
@@ -212,6 +214,7 @@
             #{report.play3sCount}
         )
     </insert>
+
     <update id="etlKuaishouVideoReportStateDate">
         UPDATE ctop_etl_kuaishou_video_info info
             LEFT JOIN ( select video_code,min(report.stat_date) as minDate from ctop_kuaishou_report_daily_material report left join ctop_kuaishou_video_get ckvg on report.account_id = ckvg.account_id
@@ -289,6 +292,81 @@ where 1=1
 and m.stat_date = #{date} and m.account_id = #{accountId}
 group by m.account_id,m.photo_id
     </select>
+    <select id="getDateList" resultType="java.lang.String">
+        SELECT DISTINCT stat_date  from  ctop_kuaishou_report_daily_material ORDER BY stat_date DESC
+    </select>
+    <select id="getAccountList" resultType="java.lang.Long">
+       SELECT DISTINCT account_id  from  ctop_kuaishou_report_daily_material where stat_date = #{date}
+    </select>
+
+
+    <insert id="addBatch">
+        replace into ctop_etl_kuaishou_account_material_report_daily(
+        project_id,
+        project_name,
+        photo_id,
+        account_id,
+        signature,
+        charge,
+        photo_show,
+        aclick,
+        bclick,
+        download_started,
+        download_completed,
+        activation,
+        submit,
+        stat_date,
+        photo_click,
+        event_pay_first_day,
+        event_pay_purchase_amount_first_day,
+        event_pay,
+        event_pay_purchase_amount,
+        event_register,
+        event_jin_jian_app,
+        event_credit_grant_app,
+        event_order_paid,
+        event_order_paid_purchase_amount,
+        event_jin_jian_landing_page,
+        event_credit_grant_landing_page,
+        event_next_day_stay,
+        form_count,
+        play_3s_count)
+        values
+        <foreach collection="addList" item="report" separator=",">
+            (
+            #{report.projectId},
+            #{report.projectName},
+            #{report.photoId},
+            #{report.accountId},
+            #{report.signature},
+            #{report.charge},
+            #{report.photoShow},
+            #{report.aclick},
+            #{report.bclick},
+            #{report.downloadStarted},
+            #{report.downloadCompleted},
+            #{report.activation},
+            #{report.submit},
+            #{report.statDate},
+            #{report.photoClick},
+            #{report.eventPayFirstDay},
+            #{report.eventPayPurchaseAmountFirstDay},
+            #{report.eventPay},
+            #{report.eventPayPurchaseAmount},
+            #{report.eventRegister},
+            #{report.eventJinJianApp},
+            #{report.eventCreditGrantApp},
+            #{report.eventOrderPaid},
+            #{report.eventOrderPaidPurchaseAmount},
+            #{report.eventJinJianLandingPage},
+            #{report.eventCreditGrantLandingPage},
+            #{report.eventNextDayStay},
+            #{report.formCount},
+            #{report.play3sCount}
+            )
+        </foreach>
+
+    </insert>
 
 
 </mapper>

+ 6 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsVideoReportMapper.xml

@@ -52,6 +52,9 @@
         <if test="shotId !=null and shotId != ''">
             AND t2.shot_id = #{shotId}
         </if>
+        <if test="companyId !=null and companyId != ''">
+            AND t2.company_id = #{companyId}
+        </if>
         ORDER BY ${target} ${order}
     </select>
 
@@ -98,7 +101,9 @@
         <if test="shotId !=null and shotId != ''">
             AND t2.shot_id = #{shotId}
         </if>
-
+        <if test="companyId !=null and companyId != ''">
+            AND t2.company_id = #{companyId}
+        </if>
 
     </select>
 

+ 8 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IEtlKuaishouAccountMaterialReportDailyService.java

@@ -3,6 +3,8 @@ package cn.com.ctop.kuaishou.modules.report.service;
 import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * @Description: 快手账户素材报表清洗表
  * @Author: jeecg-boot
@@ -19,4 +21,10 @@ public interface IEtlKuaishouAccountMaterialReportDailyService extends IService<
 
     void etlKuaishouVideoType();
 
+    void cleanVideoInfo(Long accountId,String statDate);
+
+
+    List<String> getDateList();
+
+    List<Long> getAccountListByDate(String date);
 }

+ 51 - 8
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouAccountMaterialReportDailyServiceImpl.java

@@ -2,11 +2,16 @@ package cn.com.ctop.kuaishou.modules.report.service.impl;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
 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 com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -19,9 +24,10 @@ import java.util.concurrent.Executors;
 
 /**
  * 快手账户素材报表清洗表
+ *
  * @author jeecg-boot
- * @date   2021-02-25
  * @version V1.0
+ * @date 2021-02-25
  */
 @Service
 @Slf4j
@@ -30,21 +36,24 @@ public class EtlKuaishouAccountMaterialReportDailyServiceImpl extends ServiceImp
     private EtlKuaishouAccountMaterialReportDailyMapper etlKuaishouAccountMaterialReportDailyMapper;
     @Autowired
     private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IKuaiShouReportDailyMaterialService dailyMaterialService;
     static ExecutorService etlExecutorService = Executors.newFixedThreadPool(10);
+    static ExecutorService accountEtlExecutorService = Executors.newFixedThreadPool(10);
 
     @Override
     public void etlKuaishouAccountMaterialReportInfo(String formatDate) {
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
         CountDownLatch countDownLatch = new CountDownLatch(tokens.size());
-        tokens.forEach(token -> etlExecutorService.submit(()->{
+        tokens.forEach(token -> etlExecutorService.submit(() -> {
             try {
-                List<EtlKuaishouAccountMaterialReportDaily> getList = etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouAccountMaterialReportDailyList(formatDate,token.getAccountId());
-                if(null!=getList&&!getList.isEmpty()){
-                    getList.forEach(report->etlKuaishouAccountMaterialReportDailyMapper.replace(report));
+                List<EtlKuaishouAccountMaterialReportDaily> getList = etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouAccountMaterialReportDailyList(formatDate, token.getAccountId());
+                if (null != getList && !getList.isEmpty()) {
+                    getList.forEach(report -> etlKuaishouAccountMaterialReportDailyMapper.replace(report));
                 }
-            }catch (Exception e){
+            } catch (Exception e) {
                 e.printStackTrace();
-            }finally {
+            } finally {
                 countDownLatch.countDown();
             }
         }));
@@ -53,7 +62,7 @@ public class EtlKuaishouAccountMaterialReportDailyServiceImpl extends ServiceImp
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
-        log.info("{}数据获取完成",formatDate);
+        log.info("{}数据获取完成", formatDate);
     }
 
     @Override
@@ -73,4 +82,38 @@ public class EtlKuaishouAccountMaterialReportDailyServiceImpl extends ServiceImp
         etlKuaishouAccountMaterialReportDailyMapper.etlBytedanceVideoTypeZr(CtopAdConstant.VIDEO_TYPR_ZR);
         etlKuaishouAccountMaterialReportDailyMapper.etlBytedanceVideoTypeZz(CtopAdConstant.VIDEO_TYPR_ZZ);
     }
+
+    @Autowired
+    private IProjectService projectService;
+
+    @Override
+    public void cleanVideoInfo(Long accountId, String statDate) {
+        accountEtlExecutorService.submit(() -> {
+            log.info("开始:{},账户数据清洗",accountId);
+            JSONObject projectJson = projectService.getProjectByAccountId(accountId);
+            Long projectId = projectJson.getLong("projectId");
+            String projectName = projectJson.getString("projectName");
+            List<EtlKuaishouAccountMaterialReportDaily> reportList = dailyMaterialService.getReportList(accountId, statDate, projectId, projectName);
+            if (Check.isNull(reportList)) {
+                return;
+            }
+            List<List<EtlKuaishouAccountMaterialReportDaily>> partition = Lists.partition(reportList, 500);
+            for (int i = 0; i < partition.size(); i++) {
+                List<EtlKuaishouAccountMaterialReportDaily> addList = partition.get(i);
+                if (!Check.isNull(addList)) {
+                    etlKuaishouAccountMaterialReportDailyMapper.addBatch(addList);
+                }
+            }
+        });
+    }
+
+    @Override
+    public List<String> getDateList() {
+        return etlKuaishouAccountMaterialReportDailyMapper.getDateList();
+    }
+
+    @Override
+    public List<Long> getAccountListByDate(String date) {
+        return etlKuaishouAccountMaterialReportDailyMapper.getAccountList(date);
+    }
 }

+ 0 - 4
jeecg-boot-module-system/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadImageServiceImpl.java

@@ -37,10 +37,6 @@ import java.util.concurrent.Executors;
 @Service
 public class MaterialUploadImageServiceImpl implements IMaterialUploadImageService {
     static ExecutorService executorService = Executors.newFixedThreadPool(15);
-
-    @Value("${oss.replace.download}")
-    private String downloadUrl;
-
     @Autowired
     private IMaterialImageInfoService materialImageInfoService;
     @Autowired

+ 8 - 24
jeecg-boot-module-system/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java

@@ -101,12 +101,11 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
             try {
                 String url = "";
                 if (Check.isNull(materialInfo)) {
-                    url = (String) materialImageInfo.getUrl();
+                    url = materialImageInfo.getUrl();
                 } else {
                     url = materialInfo.getUrl();
                 }
                 String localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
-
                 for (int i = 0; i < accountArray.size(); i++) {
                     Long accountId = accountArray.getLong(i);
                     if (Check.isNull(accountId)) {
@@ -120,7 +119,6 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                                 log.info("头条文件多线程上传:{},accountId:{}", Thread.currentThread().getName(), accountId);
                                 if (materialInfo != null && "VIDEO".equals(materialInfo.getType())) {
                                     fileInfoService.uploadVideoToBytedance(String.valueOf(accountId), localUrl, userId, materialInfo.getMaterialName());
-
                                 } else if ("IMAGE".equals(materialImageInfo.getType())) {
                                     fileInfoService.uploadImageToBytedance(String.valueOf(accountId), finalUrl);
                                 }
@@ -148,7 +146,6 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
             }
             try {
                 String url = materialInfo.getUrl();
-                log.info("replaceUrl:{}", url);
                 String localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
                 FileSystemResource resource = new FileSystemResource(new File(localUrl));
                 Map<String, String> headerMap = new HashMap<>();
@@ -175,11 +172,7 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                 }
                 for (int i = 0; i < accountArray.size(); i++) {
                     Long accountId = accountArray.getLong(i);
-                    QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
-                    tokenQueryWrapper.eq("account_id", accountId);
-                    tokenQueryWrapper.orderByDesc("create_time");
-                    tokenQueryWrapper.last("limit 1");
-                    CtopOauthToken ctopOauthToken = oauthTokenMapper.selectOne(tokenQueryWrapper);
+                    CtopOauthToken ctopOauthToken = oauthTokenMapper.selectByAccountId(accountId);
                     if (Check.isNull(ctopOauthToken)) {
                         continue;
                     }
@@ -195,7 +188,6 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                                 JSONObject resultJson = JSONObject.parseObject(result);
                                 if (!Check.isNull(resultJson)) {
                                     KuaiShouAdvertiserBaseInfo baseInfo = advertiserBaseInfoService.getBaseInfo(accountId);
-
                                     if (resultJson.getInteger("code") == 0) {
                                         JSONObject dataJson = resultJson.getJSONObject("data");
                                         if (!Check.isNull(dataJson)) {
@@ -207,19 +199,15 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                                             Project project = projectService.getById(allocation.getProjectId());
                                             String message = messageTemplate.getMaterialSyncSucessTemplate(project.getProjectName(), baseInfo.getUserId(), baseInfo.getUserName(), materialInfo.getMaterialName(), resultJson.getString("message"));
                                             sendMessageService.sendMessage(userId, message);
-
-                                            /**
-                                             * 异步获取视频信息
-                                             */
                                             Thread thread = new Thread() {
                                                 @Override
                                                 public void run() {
-                                                    try {
-                                                        Thread.sleep(2 * 1000L);
-                                                        kuaishouInterfaceService.getVideoInfo(ctopOauthToken.getAccessToken(), ctopOauthToken.getAccountId(), dataJson.getString("photo_id"));
-                                                    } catch (InterruptedException e) {
-                                                        e.printStackTrace();
-                                                    }
+                                                try {
+                                                    Thread.sleep(2 * 1000L);
+                                                    kuaishouInterfaceService.getVideoInfo(ctopOauthToken.getAccessToken(), ctopOauthToken.getAccountId(), dataJson.getString("photo_id"));
+                                                } catch (InterruptedException e) {
+                                                    e.printStackTrace();
+                                                }
                                                 }
                                             };
                                             thread.start();
@@ -239,13 +227,11 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                             }
                         }
                     });
-
                 }
             } catch (Exception e) {
                 e.printStackTrace();
             }
         }
-
     }
 
     private String exceptInfoForRestTemplate(String url, Map<String, Object> paramMap, Map<String, String> headerMap) {
@@ -276,6 +262,4 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
         }
         return null;
     }
-
-
 }

+ 0 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceReportServiceImpl.java

@@ -26,8 +26,6 @@ import java.util.*;
 @Service
 @Slf4j
 public class BytedanceReportServiceImpl implements IBytedanceReportService {
-    @Value("${jeecg.path.report-history}")
-    private String downloadPath;
     @Autowired
     private BytedanceReportMapper reportMapper;
     @Autowired

+ 18 - 12
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/utils/LinkUtils.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.toutiao.modules.report.utils;
 
+import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSONObject;
 
 import java.math.BigDecimal;
@@ -9,7 +10,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
- *  Created by JQ.bi on 2020.6.5
+ * Created by JQ.bi on 2020.6.5
  */
 public class LinkUtils {
 
@@ -17,12 +18,15 @@ public class LinkUtils {
     //数据对比,环比计算
     public static List<JSONObject> getCompareDate(List<JSONObject> beforeData, List<JSONObject> AfterData, String standard) {
         List<JSONObject> result = new ArrayList<>();
-        beforeData.forEach(before -> {
+        for (int i = 0; i < beforeData.size(); i++) {
+            JSONObject before = beforeData.get(i);
             String yesStat = String.valueOf(before.get(standard));
             //修改点记率 乱码
-            String clickRate = before.getString("clickRate");
-            before.put("clickRate",clickRate);
-
+            byte[] click = before.getBytes("clickRate");
+            if (!Check.isNull(click)) {
+                String clickRate = new String(click, Charset.forName("UTF-8"));
+                before.put("clickRate", clickRate);
+            }
             AfterData.forEach(after -> {
                 if ((String.valueOf(after.get(standard))).equals(yesStat)) {
                     //消耗较昨日环比
@@ -31,25 +35,27 @@ public class LinkUtils {
                     after.put("showProportion", countLink(BigDecimal.valueOf(after.getLong("showNum")), BigDecimal.valueOf(before.getLong("showNum"))));
                     //点击量较昨日环比
                     after.put("photoClickProportion", countLink(BigDecimal.valueOf(after.getLong("click")), BigDecimal.valueOf(before.getLong("click"))));
-                    if(after.getLong("convertNum")!=null){
+                    if (after.getLong("convertNum") != null) {
                         after.put("convertNumProportion", countLink(BigDecimal.valueOf(after.getLong("convertNum")), BigDecimal.valueOf(before.getLong("convertNum"))));
                     }
                     //修改点记率 乱码
-                    String afterCli = after.getString("clickRate");
-                    after.put("clickRate",afterCli);
-
+                    byte[] aftClick = after.getBytes("clickRate");
+                    if (!Check.isNull(aftClick)) {
+                        String afterCli = new String(aftClick, Charset.forName("UTF-8"));
+                        after.put("clickRate", afterCli);
+                    }
                     before.put("afterData", after);
                 }
             });
             result.add(before);
-        });
+        }
         return result;
     }
 
     //环比计算
     public static BigDecimal countLink(BigDecimal numA, BigDecimal numB) {
         BigDecimal link = new BigDecimal(0);
-        if (numB.compareTo(BigDecimal.ZERO)!=0) {
+        if (numB.compareTo(BigDecimal.ZERO) != 0) {
             link = (numA.subtract(numB)).divide(numB, 4, RoundingMode.HALF_UP);
         }
         return link;
@@ -58,7 +64,7 @@ public class LinkUtils {
     public static void main(String[] args) {
         BigDecimal a = BigDecimal.valueOf(5.2);
         BigDecimal b = BigDecimal.valueOf(4.2);
-        System.out.println(countLink(a,b));
+        System.out.println(countLink(a, b));
     }
 
 }

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

@@ -22,6 +22,7 @@ import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouAccessToken;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
+import cn.com.ctop.kuaishou.modules.material.service.IEtlKuaishouVideoInfoService;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouProjectData;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouProjectDataService;
@@ -141,6 +142,9 @@ public class TestController {
     private IMaterialUploadService materialUploadService;
     @Autowired
     private IKuaishouProgramCreativeService kuaishouProgramCreativeService;
+    @Autowired
+    private IEtlKuaishouVideoInfoService etlKuaishouVideoInfoService;
+
 
     @Value("${xxl-job.requestUrl}")
     private String jobUrl;
@@ -164,6 +168,17 @@ public class TestController {
 //    }
 
 
+    @GetMapping(value = "/cleanData")
+    public void cleanData() {
+        List<String> dateList = videoGetService.getDateList();
+        for (int i = 0; i < dateList.size(); i++) {
+            String s = dateList.get(i);
+            etlKuaishouVideoInfoService.etlKuaishouVideoInfo(s);
+        }
+
+    }
+
+
     @GetMapping(value = "/getProgramCreative")
     public void getProgramCreative() {
         List<Long> list = new ArrayList();
@@ -265,15 +280,6 @@ public class TestController {
         list.add(10299241L);
 
 
-
-
-
-
-
-
-
-
-
         for (int i = 0; i < list.size(); i++) {
             Long accountId = list.get(i);
             CtopOauthToken token = oauthTokenService.getTokenByAccountId(accountId);

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

@@ -438,7 +438,7 @@ public class SysDepartController {
 		LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
 		query.orderByAsc(SysDepart::getOrgCode);
 		if(oConvertUtils.isNotEmpty(id)){
-			String arr[] = id.split(",");
+			String[] arr = id.split(",");
 			query.in(SysDepart::getId,arr);
 		}
 		List<SysDepart> ls = this.sysDepartService.list(query);

+ 1 - 1
jeecg-cloud-module/jeecg-cloud-nacos/src/main/resources/application-prod.yml

@@ -6,7 +6,7 @@ db:
   password:
     '0': hcst@2021
   url:
-    '0': jdbc:mysql://139.186.27.96:4000/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
+    '0': jdbc:mysql://139.186.27.96:3390/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
   user:
     '0': data
 management:

+ 14 - 14
jeecg-cloud-module/jeecg-cloud-system-start/src/main/resources/application-prod.yml

@@ -116,7 +116,7 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          url: jdbc:mysql://139.186.27.96:3390/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
           username: data
           password: hcst@2021
           driver-class-name: com.mysql.jdbc.Driver
@@ -176,18 +176,18 @@ jeecg:
     bin: ffmpeg
   path:
     #文件上传根目录 设置
-    upload: /mnt/upload
+    upload: /data/upload
     #webapp文件路径
-    webapp: /mnt/webapp
-    video-upload: /mnt/upload/video/
-    image-upload: D://data//image//
-    kuaishou-agent-image: D://temp.png
-    kuaishou-account-captcha-image: D://captcha.png
+    webapp: /data/webapp
+    video-upload: /data/upload/video/
+    image-upload: /data/image/
+    kuaishou-agent-image: /data/image/temp.png
+    kuaishou-account-captcha-image: /data/image/captcha.png
     chrome-driver: D://chromedriver.exe
     csv-upload: /mnt/upload/csv/
     bak-database-file: /mnt/data/bak/
-    report-history: D://mnt//reportKs//
-    report-daily: D://mnt//reportKs//
+    report-history: /data/report/ks/
+    report-daily: /data/report/ks/
 kuaishou:
   api-url: https://ad.e.kuaishou.com
   auth-url: https://ad.e.kuaishou.com
@@ -198,9 +198,9 @@ kuaishou:
   third-secret: 1iFTBiMdohkyEQQs
   callback-url: http://adsp.c-top.com.cn:8080/jeecg-boot/kuaishou
   third-callback-url: http://callback.shyouteng.com.cn/kuaishou
-  apk-sava-path: /mnt/file/apk
-  image-sava-path: /mnt/file/image
-  video-sava-path: /mnt/file/video
+  apk-sava-path: /data/file/apk
+  image-sava-path: /data/file/image
+  video-sava-path: /data/file/video
   model-video-src-path: /mnt/data/src/
   model-video-fill-path: /mnt/data/fill/
   model-video-final-path: /mnt/data/final/
@@ -220,10 +220,10 @@ oss:
   replace:
     replace-value: oss-cn-beijing-internal
     replace-old-value: oss-cn-beijing
-    download: D://mnt//image//
+    download: /data/file/video/
 zip:
   local:
-    download-path: D://mnt//data//
+    download-path: /data/
 bytedance:
   appId: 1635316529903624
   secret: 0c51523e90d6166418fc8421a4896808e90e26f4

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

@@ -220,7 +220,7 @@ oss:
   replace:
     replace-value: oss-cn-beijing-internal
     replace-old-value: oss-cn-beijing
-    download: D://mnt//image//
+    download: /data/file/video/
 zip:
   local:
     download-path: D://mnt//data//

+ 0 - 1
jeecg-cloud-module/jeecg-cloud-xxljob/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java

@@ -190,7 +190,6 @@ public class XxlJobTrigger {
         jobLog.setExecutorParam(jobInfo.getExecutorParam());
         jobLog.setExecutorShardingParam(shardingParam);
         jobLog.setExecutorFailRetryCount(finalFailRetryCount);
-        //jobLog.setTriggerTime();
         jobLog.setTriggerCode(triggerResult.getCode());
         jobLog.setTriggerMsg(triggerMsgSb.toString());
         XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateTriggerInfo(jobLog);