Преглед на файлове

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

# Conflicts:
#	module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
syh преди 5 години
родител
ревизия
4e2d97871f
променени са 66 файла, в които са добавени 3202 реда и са изтрити 319 реда
  1. 179 179
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/util/JwtUtil.java
  2. 24 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  3. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  4. 5 13
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  5. 84 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialPartController.java
  6. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java
  7. 64 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/MergeVideoJob.java
  8. 9 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/shiro/authc/ShiroRealm.java
  9. 23 2
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  10. BIN
      lib/jave-1.0.2.jar
  11. 0 1
      module-common/pom.xml
  12. 11 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/VideoMerge.java
  13. 59 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/VideoMergeTask.java
  14. 46 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/VideoPart.java
  15. 17 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/VideoMergeTaskMapper.java
  16. 17 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/VideoPartMapper.java
  17. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/VideoMergeTaskMapper.xml
  18. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/VideoPartMapper.xml
  19. 14 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IVideoMergeTaskService.java
  20. 14 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IVideoPartService.java
  21. 11 3
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountAuthServiceImpl.java
  22. 55 52
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  23. 19 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/VideoMergeTaskServiceImpl.java
  24. 19 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/VideoPartServiceImpl.java
  25. 33 2
      module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils2.java
  26. 5 1
      module-common/src/main/java/cn/com/ctop/common/module/utils/LoadFileUtil.java
  27. 51 14
      module-common/src/main/java/cn/com/ctop/common/module/utils/MpsUtils.java
  28. 1 3
      module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java
  29. 1 0
      module-kuaishou/pom.xml
  30. 59 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  31. 248 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouGroupTargetController.java
  32. 10 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroup.java
  33. 203 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroupTarget.java
  34. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouGroupTargetMapper.java
  35. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouAppInfoMapper.xml
  36. 16 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupMapper.xml
  37. 67 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupTargetMapper.xml
  38. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouRegionListChildrenMapper.xml
  39. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouGroupTargetService.java
  40. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCreateServiceImpl.java
  41. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTargetServiceImpl.java
  42. 100 15
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  43. 228 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouReportDailyAgentController.java
  44. 202 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouReportDailyAgentSumController.java
  45. 119 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAgent.java
  46. 100 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAgentSum.java
  47. 39 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/job/KuaishouReportAgentJob.java
  48. 17 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyAgentMapper.java
  49. 17 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyAgentSumMapper.java
  50. 49 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAgentMapper.xml
  51. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAgentSumMapper.xml
  52. 17 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyAgentService.java
  53. 14 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyAgentSumService.java
  54. 185 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAgentServiceImpl.java
  55. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAgentSumServiceImpl.java
  56. 21 2
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/AccountReportMapper.java
  57. 213 0
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/AccountReportMapper.xml
  58. 56 1
      module-report/src/main/java/cn/com/ctop/bytedance/service/impl/AccountReportServiceImpl.java
  59. 1 3
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceAdvertiserDataServiceImpl.java
  60. 3 2
      module-toutiao/src/main/resources/bytedance_config.properties
  61. 243 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/controller/UserEfficientVideoMapController.java
  62. 65 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/UserEfficientVideoMap.java
  63. 17 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/UserEfficientVideoMapMapper.java
  64. 5 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml
  65. 14 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/service/IUserEfficientVideoMapService.java
  66. 19 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/service/impl/UserEfficientVideoMapServiceImpl.java

+ 179 - 179
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/util/JwtUtil.java

@@ -6,15 +6,6 @@ import com.auth0.jwt.algorithms.Algorithm;
 import com.auth0.jwt.exceptions.JWTDecodeException;
 import com.auth0.jwt.interfaces.DecodedJWT;
 import com.google.common.base.Joiner;
-
-import java.util.Date;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-
-import org.jeecg.common.constant.DataBaseConstant;
-import org.jeecg.common.exception.JeecgBootException;
-
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.constant.DataBaseConstant;
 import org.jeecg.common.exception.JeecgBootException;
@@ -23,6 +14,10 @@ import org.jeecg.common.system.vo.SysUserCacheInfo;
 import org.jeecg.common.util.SpringContextUtils;
 import org.jeecg.common.util.oConvertUtils;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.util.Date;
+
 /**
  * @Author Scott
  * @Date 2018-07-12 14:23
@@ -33,174 +28,179 @@ public class JwtUtil {
     /**
      * 过期时间30分钟
      */
-	public static final long EXPIRE_TIME = 30 * 60 * 1000;
-
-	/**
-	 * 校验token是否正确
-	 *
-	 * @param token  密钥
-	 * @param secret 用户的密码
-	 * @return 是否正确
-	 */
-	public static boolean verify(String token, String username, String secret) {
-		try {
-			// 根据密码生成JWT效验器
-			Algorithm algorithm = Algorithm.HMAC256(secret);
-			JWTVerifier verifier = JWT.require(algorithm).withClaim("username", username).build();
-			// 效验TOKEN
-			DecodedJWT jwt = verifier.verify(token);
-			return true;
-		} catch (Exception exception) {
-			return false;
-		}
-	}
-
-	/**
-	 * 获得token中的信息无需secret解密也能获得
-	 *
-	 * @return token中包含的用户名
-	 */
-	public static String getUsername(String token) {
-		try {
-			DecodedJWT jwt = JWT.decode(token);
-			return jwt.getClaim("username").asString();
-		} catch (JWTDecodeException e) {
-			return null;
-		}
-	}
-
-	/**
-	 * 生成签名,5min后过期
-	 *
-	 * @param username 用户名
-	 * @param secret   用户的密码
-	 * @return 加密的token
-	 */
-	public static String sign(String username, String secret) {
-		Date date = new Date(System.currentTimeMillis() + EXPIRE_TIME);
-		Algorithm algorithm = Algorithm.HMAC256(secret);
-		// 附带username信息
-		return JWT.create().withClaim("username", username).withExpiresAt(date).sign(algorithm);
-
-	}
-
-	/**
-	 * 根据request中的token获取用户账号
-	 * 
-	 * @param request
-	 * @return
-	 * @throws JeecgBootException
-	 */
-	public static String getUserNameByToken(HttpServletRequest request) throws JeecgBootException {
-		String accessToken = request.getHeader("X-Access-Token");
-		String username = getUsername(accessToken);
-		if (oConvertUtils.isEmpty(username)) {
-			throw new JeecgBootException("未获取到用户");
-		}
-		return username;
-	}
-	
-	/**
-	  *  从session中获取变量
-	 * @param key
-	 * @return
-	 */
-	public static String getSessionData(String key) {
-		//${myVar}%
-		//得到${} 后面的值
-		String moshi = "";
-		if(key.indexOf("}")!=-1){
-			 moshi = key.substring(key.indexOf("}")+1);
-		}
-		String returnValue = null;
-		if (key.contains("#{")) {
-			key = key.substring(2,key.indexOf("}"));
-		}
-		if (oConvertUtils.isNotEmpty(key)) {
-			HttpSession session = SpringContextUtils.getHttpServletRequest().getSession();
-			returnValue = (String) session.getAttribute(key);
-		}
-		//结果加上${} 后面的值
-		if(returnValue!=null){returnValue = returnValue + moshi;}
-		return returnValue;
-	}
-	
-	/**
-	  * 从当前用户中获取变量
-	 * @param key
-	 * @param user
-	 * @return
-	 */
-
-	//TODO 急待改造 sckjkdsjsfjdk
-
-	public static String getUserSystemData(String key,SysUserCacheInfo user) {
-		if(user==null) {
-			user = JeecgDataAutorUtils.loadUserInfo();
-		}
-		//#{sys_user_code}%
-
-		// 获取登录用户信息
-		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-
-		String moshi = "";
-		if(key.indexOf("}")!=-1){
-			 moshi = key.substring(key.indexOf("}")+1);
-		}
-		String returnValue = null;
-		//针对特殊标示处理#{sysOrgCode},判断替换
-		if (key.contains("#{")) {
-			key = key.substring(2,key.indexOf("}"));
-		} else {
-			key = key;
-		}
-		//替换为系统登录用户帐号
-		if (key.equals(DataBaseConstant.SYS_USER_CODE)|| key.equals(DataBaseConstant.SYS_USER_CODE_TABLE)) {
-			if(user==null) {
-				returnValue = sysUser.getUsername();
-			}else {
-				returnValue = user.getSysUserCode();
-			}
-		}
-		//替换为系统登录用户真实名字
-		if (key.equals(DataBaseConstant.SYS_USER_NAME)|| key.equals(DataBaseConstant.SYS_USER_NAME_TABLE)) {
-			if(user==null) {
-				returnValue = sysUser.getRealname();
-			}else {
-				returnValue = user.getSysUserName();
-			}
-		}
-		
-		//替换为系统用户登录所使用的机构编码
-		if (key.equals(DataBaseConstant.SYS_ORG_CODE)|| key.equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) {
-			if(user==null) {
-				returnValue = sysUser.getOrgCode();
-			}else {
-				returnValue = user.getSysOrgCode();
-			}
-
-		}
-		//替换为系统用户所拥有的所有机构编码
-		if (key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)|| key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)) {
-			if(user.isOneDepart()) {
-				returnValue = user.getSysMultiOrgCode().get(0);
-			}else {
-				returnValue = Joiner.on(",").join(user.getSysMultiOrgCode());
-			}
-		}
-		//替换为当前系统时间(年月日)
-		if (key.equals(DataBaseConstant.SYS_DATE)|| key.equals(DataBaseConstant.SYS_DATE_TABLE)) {
-			returnValue = user.getSysDate();
-		}
-		//替换为当前系统时间(年月日时分秒)
-		if (key.equals(DataBaseConstant.SYS_TIME)|| key.equals(DataBaseConstant.SYS_TIME_TABLE)) {
-			returnValue = user.getSysTime();
-		}
-		//流程状态默认值(默认未发起)
-		if (key.equals(DataBaseConstant.BPM_STATUS_TABLE)|| key.equals(DataBaseConstant.BPM_STATUS_TABLE)) {
-			returnValue = "1";
-		}
-		if(returnValue!=null){returnValue = returnValue + moshi;}
-		return returnValue;
-	}
+    public static final long EXPIRE_TIME = 30 * 60 * 1000;
+
+    /**
+     * 校验token是否正确
+     *
+     * @param token  密钥
+     * @param secret 用户的密码
+     * @return 是否正确
+     */
+    public static boolean verify(String token, String username, String secret) {
+        try {
+            // 根据密码生成JWT效验器
+            Algorithm algorithm = Algorithm.HMAC256(secret);
+            JWTVerifier verifier = JWT.require(algorithm).withClaim("username", username).build();
+            // 效验TOKEN
+            DecodedJWT jwt = verifier.verify(token);
+            return true;
+        } catch (Exception exception) {
+            return false;
+        }
+    }
+
+    /**
+     * 获得token中的信息无需secret解密也能获得
+     *
+     * @return token中包含的用户名
+     */
+    public static String getUsername(String token) {
+        try {
+            DecodedJWT jwt = JWT.decode(token);
+            return jwt.getClaim("username").asString();
+        } catch (JWTDecodeException e) {
+            return null;
+        }
+    }
+
+    /**
+     * 生成签名,5min后过期
+     *
+     * @param username 用户名
+     * @param secret   用户的密码
+     * @return 加密的token
+     */
+    public static String sign(String username, String secret) {
+        Date date = new Date(System.currentTimeMillis() + EXPIRE_TIME);
+        Algorithm algorithm = Algorithm.HMAC256(secret);
+        // 附带username信息
+        return JWT.create().withClaim("username", username).withExpiresAt(date).sign(algorithm);
+
+    }
+
+    /**
+     * 根据request中的token获取用户账号
+     *
+     * @param request
+     * @return
+     * @throws JeecgBootException
+     */
+    public static String getUserNameByToken(HttpServletRequest request) throws JeecgBootException {
+        String accessToken = request.getHeader("X-Access-Token");
+        String username = getUsername(accessToken);
+        if (oConvertUtils.isEmpty(username)) {
+            throw new JeecgBootException("未获取到用户");
+        }
+        return username;
+    }
+
+    /**
+     * 从session中获取变量
+     *
+     * @param key
+     * @return
+     */
+    public static String getSessionData(String key) {
+        //${myVar}%
+        //得到${} 后面的值
+        String moshi = "";
+        if (key.indexOf("}") != -1) {
+            moshi = key.substring(key.indexOf("}") + 1);
+        }
+        String returnValue = null;
+        if (key.contains("#{")) {
+            key = key.substring(2, key.indexOf("}"));
+        }
+        if (oConvertUtils.isNotEmpty(key)) {
+            HttpSession session = SpringContextUtils.getHttpServletRequest().getSession();
+            returnValue = (String) session.getAttribute(key);
+        }
+        //结果加上${} 后面的值
+        if (returnValue != null) {
+            returnValue = returnValue + moshi;
+        }
+        return returnValue;
+    }
+
+    /**
+     * 从当前用户中获取变量
+     *
+     * @param key
+     * @param user
+     * @return
+     */
+
+    //TODO 急待改造 sckjkdsjsfjdk
+    public static String getUserSystemData(String key, SysUserCacheInfo user) {
+        if (user == null) {
+            user = JeecgDataAutorUtils.loadUserInfo();
+        }
+        //#{sys_user_code}%
+
+        // 获取登录用户信息
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        String moshi = "";
+        if (key.indexOf("}") != -1) {
+            moshi = key.substring(key.indexOf("}") + 1);
+        }
+        String returnValue = null;
+        //针对特殊标示处理#{sysOrgCode},判断替换
+        if (key.contains("#{")) {
+            key = key.substring(2, key.indexOf("}"));
+        } else {
+            key = key;
+        }
+        //替换为系统登录用户帐号
+        if (key.equals(DataBaseConstant.SYS_USER_CODE) || key.equals(DataBaseConstant.SYS_USER_CODE_TABLE)) {
+            if (user == null) {
+                returnValue = sysUser.getUsername();
+            } else {
+                returnValue = user.getSysUserCode();
+            }
+        }
+        //替换为系统登录用户真实名字
+        if (key.equals(DataBaseConstant.SYS_USER_NAME) || key.equals(DataBaseConstant.SYS_USER_NAME_TABLE)) {
+            if (user == null) {
+                returnValue = sysUser.getRealname();
+            } else {
+                returnValue = user.getSysUserName();
+            }
+        }
+
+        //替换为系统用户登录所使用的机构编码
+        if (key.equals(DataBaseConstant.SYS_ORG_CODE) || key.equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) {
+            if (user == null) {
+                returnValue = sysUser.getOrgCode();
+            } else {
+                returnValue = user.getSysOrgCode();
+            }
+
+        }
+        //替换为系统用户所拥有的所有机构编码
+        if (key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE) || key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)) {
+            if (user.isOneDepart()) {
+                returnValue = user.getSysMultiOrgCode().get(0);
+            } else {
+                returnValue = Joiner.on(",").join(user.getSysMultiOrgCode());
+            }
+        }
+        //替换为当前系统时间(年月日)
+        if (key.equals(DataBaseConstant.SYS_DATE) || key.equals(DataBaseConstant.SYS_DATE_TABLE)) {
+            returnValue = user.getSysDate();
+        }
+        //替换为当前系统时间(年月日时分秒)
+        if (key.equals(DataBaseConstant.SYS_TIME) || key.equals(DataBaseConstant.SYS_TIME_TABLE)) {
+            returnValue = user.getSysTime();
+        }
+        //流程状态默认值(默认未发起)
+        if (key.equals(DataBaseConstant.BPM_STATUS_TABLE) || key.equals(DataBaseConstant.BPM_STATUS_TABLE)) {
+            returnValue = "1";
+        }
+        if (returnValue != null) {
+            returnValue = returnValue + moshi;
+        }
+        return returnValue;
+    }
 }

+ 24 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -915,5 +915,29 @@ public class DateUtils extends PropertyEditorSupport {
         return String.format("%td", parse);
     }
 
+    /**
+     * 根据时间获取季度
+     * 1即Q1(1,2,3月),以此类推
+     * @param date
+     * @return
+     */
+    public static int getQuarter(Date date){
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        //获取当前月份
+        int month = cal.get(Calendar.MONDAY+1);
+        if(month<=3){
+            return 1;
+        }else if(month <=6){
+            return 2;
+        }else if(month<=9){
+            return 3;
+        }else if(month<=12){
+            return 4;
+        }
+
+        return 0;
+    }
+
 
 }

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

@@ -128,13 +128,13 @@ public class ShiroConfig {
         //文件上传接口
 		filterChainDefinitionMap.put("/upload/**", "anon");
         filterChainDefinitionMap.put("/appium/appiumTask/run", "anon");
-
+		filterChainDefinitionMap.put("/ctop/materialpart/merge","anon");
 
         filterChainDefinitionMap.put("/system/userCompany/**", "anon");
         filterChainDefinitionMap.put("/qywexin", "anon");
         filterChainDefinitionMap.put("/test/getGroupData/**", "anon");
 
-
+		filterChainDefinitionMap.put("/report/kuaishouReportDailyAgent/get","anon");
 
 		filterChainDefinitionMap.put("/appium/appiumTask/run/login", "anon");
 		//爬虫接口

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

@@ -9,20 +9,9 @@ import cn.com.ctop.common.module.utils.*;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouAccessToken;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
-import cn.com.ctop.toutiao.entity.ByteDanceAdvertiser;
 import cn.com.ctop.toutiao.service.IByteDanceAdvertiserDataService;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import lombok.val;
-import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.cp.api.WxCpOAuth2Service;
-import me.chanjar.weixin.cp.api.WxCpUserService;
-import me.chanjar.weixin.cp.api.impl.WxCpOAuth2ServiceImpl;
-import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
-import me.chanjar.weixin.cp.api.impl.WxCpUserServiceImpl;
-import me.chanjar.weixin.cp.bean.WxCpOauth2UserInfo;
-import me.chanjar.weixin.cp.bean.WxCpUser;
-import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.CommonConstant;
@@ -119,6 +108,7 @@ public class CallbackController {
         result.success("登录成功");
         return result;
     }
+
     /**
      * TODO 授权绑定成功/失败 需要跳转特定页面
      *
@@ -255,6 +245,7 @@ public class CallbackController {
         param.put("secret", PropertiesUtils.getValue("bytedance_config", "bytedance_secret"));
         param.put("grant_type", "auth_code");
         param.put("auth_code", authCode);
+        logger.info("authCode:{}", authCode);
         logger.info("state:{}", state);
         Map<String, Object> returnMap = new HashMap<>();
         try {
@@ -264,6 +255,7 @@ public class CallbackController {
             }
             String result = HttpUtils.httpPostRequest(PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + BytedanceInterfaceConstant.AUTH_TOKEN, param, new HashMap<>());
             JSONObject resultObject = JSONObject.parseObject(result);
+            logger.info("返回信息:{}", resultObject);
             Integer code = resultObject.getInteger("code");
             String message = resultObject.getString("message");
             if (null == code || code != 0) {
@@ -294,7 +286,7 @@ public class CallbackController {
                 logger.info("获取广告主信息失败,accountId:{},message:{}", token.getAccountId(), (String) advertiserDataMap.get("message"));
                 throw new Exception("获取广告主信息失败");
             }
-            ByteDanceAdvertiser advertiserData = (ByteDanceAdvertiser) advertiserDataMap.get("data");
+
             Long accountId = token.getAccountId();
             QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
             userAllocationQueryWrapper.eq("account_id", accountId);
@@ -315,7 +307,7 @@ public class CallbackController {
             userAllocation.setMediaId(mediaId);
             userAllocation.setProjectId(projectId);
             userAllocation.setProjectName(projectName);
-            userAllocation.setAuthName(advertiserData.getName());
+            userAllocation.setAuthName((String) advertiserDataMap.get("name"));
             userAllocation.setAdvertiserId(advertiserId);
             userAllocation.setCreateTime(new Date());
             userAllocation.setUpdateTime(new Date());

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

@@ -0,0 +1,84 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.entity.*;
+import cn.com.ctop.common.module.service.IMaterialInfoService;
+import cn.com.ctop.common.module.service.IVideoMergeTaskService;
+import cn.com.ctop.common.module.service.IVideoPartService;
+import cn.com.ctop.common.module.utils.MpsUtils;
+import com.aliyuncs.mts.model.v20140618.QueryJobListResponse;
+import com.google.gson.Gson;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.vo.LoginUser;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Slf4j
+@Api(tags = "视频片段")
+@RestController
+@RequestMapping("/ctop/materialpart")
+public class MaterialPartController {
+    @Autowired
+    private IVideoMergeTaskService videoMergeTaskService;
+    @Autowired
+    private IVideoPartService videoPartService;
+    @Autowired
+    private IMaterialInfoService materialInfoService;
+    @AutoLog(value = "片段合成")
+    @ApiOperation(value = "片段合成", notes = "片段合成")
+    @PostMapping(value = "/merge")
+    public Result<Object> add(@RequestBody List<VideoMerge> videoMergeList) {
+        Result<Object> result = new Result<Object>();
+        List<String> jobIdList = new ArrayList<>();
+        try {
+            MpsUtils mpsUtils = new MpsUtils();
+            for (VideoMerge videoMerge:videoMergeList){
+                MaterialInfo start = materialInfoService.getMaterialInfoByCode(videoMerge.getStartPart());
+                MaterialInfo end = materialInfoService.getMaterialInfoByCode(videoMerge.getEndPart());
+                List<String> partUrlList = new ArrayList<>();
+                List<String> parts = videoMerge.getParts();
+                for (String part :parts){
+                    MaterialInfo materialInfo = materialInfoService.getMaterialInfoByCode(part);
+                    String url = materialInfo.getUrl();
+                    int i = url.indexOf("/",10);
+                    System.out.println(url.substring(i+1,url.length()));
+                    partUrlList.add(url.substring(i+1,url.length()));
+                }
+                String startUrl = start.getUrl();
+                String startPath = startUrl.substring(startUrl.indexOf("/",10)+1,startUrl.length());
+                String endUrl = end.getUrl();
+                String endPath = endUrl.substring(endUrl.indexOf("/",10)+1,endUrl.length());
+                String jobId = mpsUtils.mergeOneVideo(startPath,partUrlList,endPath);
+                QueryJobListResponse.Job job = mpsUtils.getJobStatus(jobId);
+                VideoMergeTask videoMergeTask = new VideoMergeTask();
+                LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+                videoMergeTask.setUserId(sysUser.getId());
+//                videoMergeTask.setUserId("1");
+                videoMergeTask.setJobId(jobId);
+                videoMergeTask.setStatus(job.getState());
+                videoMergeTaskService.save(videoMergeTask);
+                parts.add(0,videoMerge.getStartPart());
+                parts.add(videoMerge.getStartPart());
+                for(String part :parts){
+                    VideoPart videoPart = new VideoPart();
+                    videoPart.setJobId(jobId);
+                    videoPart.setPartId(part);
+                    videoPartService.save(videoPart);
+                }
+                jobIdList.add(jobId);
+            }
+            result.success("合成中,可在任务列表中查询状态,任务ID:"+new Gson().toJson(jobIdList));
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+}

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

@@ -132,7 +132,7 @@ public class ProjectController {
 
         String roleCode = materialReportMapper.getRoleCodeByUserId(sysUser.getId());
         if (!"admin".equals(roleCode)) {
-            queryWrapper.eq("responsible_id", sysUser.getId());
+            queryWrapper.eq("user_id", sysUser.getId());
             queryWrapper.orderByDesc("create_time");
         }
         IPage<Project> pageList = projectService.page(page, queryWrapper);

+ 64 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/MergeVideoJob.java

@@ -0,0 +1,64 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.entity.MaterialInfo;
+import cn.com.ctop.common.module.entity.VideoMergeTask;
+import cn.com.ctop.common.module.service.IMaterialInfoService;
+import cn.com.ctop.common.module.service.IVideoMergeTaskService;
+import cn.com.ctop.common.module.utils.LoadFileUtil;
+import cn.com.ctop.common.module.utils.MpsUtils;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import com.aliyuncs.mts.model.v20140618.QueryJobListResponse;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.jeecg.common.util.DateUtils;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.UUID;
+
+public class MergeVideoJob implements Job {
+    @Autowired
+    private IVideoMergeTaskService videoMergeTaskService;
+    @Autowired
+    private IMaterialInfoService materialInfoService;
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        QueryWrapper<VideoMergeTask> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("status","Submitted","Transcoding");
+        List<VideoMergeTask> list = videoMergeTaskService.list(queryWrapper);
+        if(list != null && list.size() > 0){
+            for (VideoMergeTask videoMergeTask : list){
+                MpsUtils mpsUtils = new MpsUtils();
+                QueryJobListResponse.Job job = mpsUtils.getJobStatus(videoMergeTask.getJobId());
+                if (job.getState().equals("TranscodeSuccess")){
+                    String url = "https://ctop-part.oss-cn-beijing.aliyuncs.com/"+job.getOutput().getOutputFile().getObject();
+
+                    try {
+                        String localPath = LoadFileUtil.downLoadFromUrl(url, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
+//                        String localPath = LoadFileUtil.downLoadFromUrl(url,"D:/video/");
+                        String md5 = LoadFileUtil.getMD5(localPath);
+                        LoadFileUtil.delFile(localPath);
+                        MaterialInfo materialInfo = new MaterialInfo();
+                        materialInfo.setCode(md5);
+                        materialInfo.setId(md5);
+                        materialInfo.setUrl(url);
+                        materialInfo.setUserId(videoMergeTask.getUserId());
+                        materialInfo.setStatus(0);
+                        materialInfo.setType("VIDEO");
+                        materialInfo.setMaterialName("合成"+ DateUtils.getMillis());
+                        materialInfoService.saveOrUpdate(materialInfo);
+                        videoMergeTask.setVideoUrl(url);
+                        videoMergeTask.setStatus(job.getState());
+                        videoMergeTask.setVideoId(materialInfo.getId());
+                        videoMergeTaskService.updateById(videoMergeTask);
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                }
+            }
+        }
+    }
+}

+ 9 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/shiro/authc/ShiroRealm.java

@@ -1,7 +1,7 @@
 package org.jeecg.modules.shiro.authc;
 
-import java.util.Set;
-
+import cn.com.ctop.common.module.utils.Check;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.shiro.authc.AuthenticationException;
 import org.apache.shiro.authc.AuthenticationInfo;
 import org.apache.shiro.authc.AuthenticationToken;
@@ -22,7 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Component;
 
-import lombok.extern.slf4j.Slf4j;
+import java.util.Set;
 
 /**
  * @Description: 用户登录鉴权和获取用户授权
@@ -99,13 +99,18 @@ public class ShiroRealm extends AuthorizingRealm {
      * @param token
      */
     public LoginUser checkUserTokenIsEffect(String token) throws AuthenticationException {
+        if (Check.isNull(token)) {
+            log.error("token为空");
+            return null;
+
+        }
+
         // 解密获得username,用于和数据库进行对比
         String username = JwtUtil.getUsername(token);
         if (username == null) {
             log.error("token非法无效!");
             // throw new AuthenticationException("token非法无效!");
         }
-
         // 查询用户信息
         LoginUser loginUser = new LoginUser();
         SysUser sysUser = sysUserService.getUserByName(username);

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

@@ -1,8 +1,12 @@
 package org.jeecg;
 
+import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.HttpUtils2;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
 import cn.com.ctop.crawler.modules.appium.service.IAppiumJobService;
 import cn.com.ctop.crawler.modules.appium.service.IAppiumTaskService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.http.impl.client.BasicCookieStore;
 import org.jeecg.modules.ctop.service.IBidWarningService;
@@ -21,7 +25,10 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest
@@ -133,9 +140,13 @@ public class SampleTest {
 
     }
 
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+
     @Test
     public void testMail() throws Exception {
-
+        // String accessToken, Long advertiserId, Date startDate, Date endDate, Integer page
+        kuaishouInterfaceService.getGroupList("adf659b9b43e8952f9a3f0c5269505ca", 35675L, null, null, 1);
     }
 
 
@@ -144,7 +155,17 @@ public class SampleTest {
 
     @Test
     public void testMa() throws Exception {
-        bidWarningService.BidWarning();
+        //String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_advertiser_info");
+        String url = "https://ad.oceanengine.com/open_api/2/advertiser/public_info/";
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", "7827db33fe53348e935706250a991461e7cffda2");
+        TreeMap<String, Object> params = new TreeMap<>();
+        //TODO jsonArray
+        params.put("advertiser_ids", "[" + 111463131228L+ "]");
+        String result = HttpUtils.httpGetRequest(url, headers, params);
+        JSONObject jsonObject = JSONObject.parseObject(result);
+        System.err.println(jsonObject);
     }
 
 

BIN
lib/jave-1.0.2.jar


+ 0 - 1
module-common/pom.xml

@@ -83,6 +83,5 @@
                 <directory>src/main/resources</directory>
             </resource>
         </resources>
-
     </build>
 </project>

+ 11 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/VideoMerge.java

@@ -0,0 +1,11 @@
+package cn.com.ctop.common.module.entity;
+
+import lombok.Data;
+
+import java.util.List;
+@Data
+public class VideoMerge {
+    private String startPart;
+    private String endPart;
+    private List<String> parts;
+}

+ 59 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/VideoMergeTask.java

@@ -0,0 +1,59 @@
+package cn.com.ctop.common.module.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 视频合成任务
+ * @author jeecg-boot
+ * @date   2019-12-16
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_video_merge_task")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_video_merge_task对象", description="视频合成任务")
+public class VideoMergeTask {
+    
+	/**id*/
+	@TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+	private String id;
+	/**jobId*/
+	@Excel(name = "jobId", width = 15)
+    @ApiModelProperty(value = "jobId")
+	private String jobId;
+	@Excel(name = "userId", width = 15)
+	@ApiModelProperty(value = "userId")
+	private String userId;
+	/**videoId*/
+	@Excel(name = "videoId", width = 15)
+    @ApiModelProperty(value = "videoId")
+	private String videoId;
+	@Excel(name = "videoUrl", width = 15)
+	@ApiModelProperty(value = "videoUrl")
+	private String videoUrl;
+	/**status*/
+	@Excel(name = "status", width = 15)
+    @ApiModelProperty(value = "status")
+	private String status;
+	/**createTime*/
+    @ApiModelProperty(value = "createTime")
+	private Date createTime;
+	/**updateTime*/
+    @ApiModelProperty(value = "updateTime")
+	private Date updateTime;
+}

+ 46 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/VideoPart.java

@@ -0,0 +1,46 @@
+package cn.com.ctop.common.module.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 视频片段
+ * @author jeecg-boot
+ * @date   2019-12-16
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_video_part")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_video_part对象", description="视频片段")
+public class VideoPart {
+    
+	/**id*/
+	@TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+	private String id;
+	/**videoId*/
+	@Excel(name = "jobId", width = 15)
+    @ApiModelProperty(value = "jobId")
+	private String jobId;
+	/**partId*/
+	@Excel(name = "partId", width = 15)
+    @ApiModelProperty(value = "partId")
+	private String partId;
+	/**createTime*/
+    @ApiModelProperty(value = "createTime")
+	private Date createTime;
+}

+ 17 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/VideoMergeTaskMapper.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.common.module.mapper;
+
+import java.util.List;
+
+import cn.com.ctop.common.module.entity.VideoMergeTask;
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 视频合成任务
+ * @author: jeecg-boot
+ * @date:   2019-12-16
+ * @cersion: V1.0
+ */
+public interface VideoMergeTaskMapper extends BaseMapper<VideoMergeTask> {
+
+}

+ 17 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/VideoPartMapper.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.common.module.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import cn.com.ctop.common.module.entity.VideoPart;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 视频片段
+ * @author: jeecg-boot
+ * @date:   2019-12-16
+ * @cersion: V1.0
+ */
+public interface VideoPartMapper extends BaseMapper<VideoPart> {
+
+}

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

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

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

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

+ 14 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IVideoMergeTaskService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.common.module.service;
+
+import cn.com.ctop.common.module.entity.VideoMergeTask;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 视频合成任务
+ * @author jeecg-boot
+ * @date   2019-12-16
+ * @version V1.0
+ */
+public interface IVideoMergeTaskService extends IService<VideoMergeTask> {
+
+}

+ 14 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IVideoPartService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.common.module.service;
+
+import cn.com.ctop.common.module.entity.VideoPart;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 视频片段
+ * @author jeecg-boot
+ * @date   2019-12-16
+ * @version V1.0
+ */
+public interface IVideoPartService extends IService<VideoPart> {
+
+}

+ 11 - 3
module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountAuthServiceImpl.java

@@ -1,11 +1,12 @@
 package cn.com.ctop.common.module.service.impl;
 
-import cn.com.ctop.common.module.utils.BytedanceInterfaceConstant;
-import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
-import cn.com.ctop.common.module.utils.PropertiesUtils;
 import cn.com.ctop.common.module.entity.BindAccountAuth;
 import cn.com.ctop.common.module.mapper.BindAccountAuthMapper;
 import cn.com.ctop.common.module.service.IBindAccountAuthService;
+import cn.com.ctop.common.module.utils.BytedanceInterfaceConstant;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -70,10 +71,17 @@ public class BindAccountAuthServiceImpl extends ServiceImpl<BindAccountAuthMappe
     @Override
     public String getByteDanceCodeUrl(String state) throws UnsupportedEncodingException {
         StringBuffer sb = new StringBuffer();
+        JSONArray jsonArray = new JSONArray();
+        jsonArray.add("100");
+        jsonArray.add("2");
+        jsonArray.add("3");
+        jsonArray.add("4");
+        jsonArray.add("5");
         sb.append(PropertiesUtils.getValue("bytedance_config", "bytedance_auth_url"))
                 .append(BytedanceInterfaceConstant.AUTH_PATH)
                 .append("?app_id=" + PropertiesUtils.getValue("bytedance_config", "bytedance_appid"))
                 .append("&state=" + URLEncoder.encode(state))
+              //  .append("&scope=" + jsonArray)
                 .append("&redirect_uri=" + URLEncoder.encode(PropertiesUtils.getValue("bytedance_config", "bytedance_callback_url"), "UTF-8"));
         return sb.toString();
     }

+ 55 - 52
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -9,18 +9,22 @@ import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
 import cn.com.ctop.common.module.mapper.MaterialParameterMapper;
 import cn.com.ctop.common.module.mapper.MaterialTagMapper;
 import cn.com.ctop.common.module.service.IMaterialInfoService;
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.common.module.utils.ResultMapUtils;
-import cn.com.ctop.common.module.utils.StatusCode;
+import cn.com.ctop.common.module.utils.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+ // import it.sauronsoftware.jave.Encoder;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.nio.channels.FileChannel;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -29,8 +33,6 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.regex.Pattern;
 
-// import it.sauronsoftware.jave.Encoder;
-
 /**
  * 素材信息
  *
@@ -251,60 +253,61 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     private MaterialParameterMapper materialParameterMapper;
 
    /* public void getFile(MaterialInfo materialInfo) {
-        uploadExecutorService.submit(new Runnable() {
+       *//* uploadExecutorService.submit(new Runnable() {
             @Override
-            public void run() {
-                try {
-                    System.err.println("开始获取素材基本信息");
-                    System.err.println(materialInfo);
-                    if (!Check.isNull(materialInfo)) {
-                        String url = materialInfo.getUrl();
-                        long l = System.currentTimeMillis();
-                        //PropertiesUtils.getValue("kuaishou_config", "video_sava_path")
-                        String localUrl = LoadFileUtil.downLoadFromUrl(url, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
-                        File file = new File(localUrl);
-                        it.sauronsoftware.jave.Encoder encoder = new Encoder();
-                        *//*try {*//*
-                        it.sauronsoftware.jave.MultimediaInfo m = encoder.getInfo(file);
-                        long duration = m.getDuration();
-                        long secondDuration = duration / 1000;
-                        MaterialParameter materialParameter = new MaterialParameter();
-                        materialParameter.setMaterialId(materialInfo.getId());
-                        // 视频秒数
-                        materialParameter.setSecond(secondDuration);
-                        // 视频格式
-                        materialParameter.setFormat(m.getFormat());
-                        // 视频宽
-                        materialParameter.setWidth(String.valueOf(m.getVideo().getSize().getWidth()));
-                        // 视频高
-                        materialParameter.setHeight(String.valueOf(m.getVideo().getSize().getHeight()));
-
-                        FileInputStream 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);
-
-                        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);
-
-                        }
+            public void run() {*//*
+        try {
+            System.err.println("开始获取素材基本信息");
+            System.err.println(materialInfo);
+            if (!Check.isNull(materialInfo)) {
+                String url = materialInfo.getUrl();
+                long l = System.currentTimeMillis();
+                //PropertiesUtils.getValue("kuaishou_config", "video_sava_path")
+                String localUrl = LoadFileUtil.downLoadFromUrl(url, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
+                File file = new File(localUrl);
+                it.sauronsoftware.jave.Encoder encoder = new Encoder();
+                *//*try {*//*
+                it.sauronsoftware.jave.MultimediaInfo m = encoder.getInfo(file);
+                long duration = m.getDuration();
+                long secondDuration = duration / 1000;
+                MaterialParameter materialParameter = new MaterialParameter();
+                materialParameter.setMaterialId(materialInfo.getId());
+                // 视频秒数
+                materialParameter.setSecond(secondDuration);
+                // 视频格式
+                materialParameter.setFormat(m.getFormat());
+                // 视频宽
+                materialParameter.setWidth(String.valueOf(m.getVideo().getSize().getWidth()));
+                // 视频高
+                materialParameter.setHeight(String.valueOf(m.getVideo().getSize().getHeight()));
+
+                FileInputStream 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);
+
+                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);
+
+                }
+                System.err.println(2222222);
                *//* } catch (Exception e) {
                     e.printStackTrace();
                 } *//**//*finally {
                     file.delete();
                 }*//*
-                    }
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
             }
-        });
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+       *//*     }
+        });*//*
     }*/
 
 

+ 19 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/VideoMergeTaskServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.VideoMergeTask;
+import cn.com.ctop.common.module.mapper.VideoMergeTaskMapper;
+import cn.com.ctop.common.module.service.IVideoMergeTaskService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * 视频合成任务
+ * @author jeecg-boot
+ * @date   2019-12-16
+ * @version V1.0
+ */
+@Service
+public class VideoMergeTaskServiceImpl extends ServiceImpl<VideoMergeTaskMapper, VideoMergeTask> implements IVideoMergeTaskService {
+
+}

+ 19 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/VideoPartServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.VideoPart;
+import cn.com.ctop.common.module.mapper.VideoPartMapper;
+import cn.com.ctop.common.module.service.IVideoPartService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * 视频片段
+ * @author jeecg-boot
+ * @date   2019-12-16
+ * @version V1.0
+ */
+@Service
+public class VideoPartServiceImpl extends ServiceImpl<VideoPartMapper, VideoPart> implements IVideoPartService {
+
+}

+ 33 - 2
module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils2.java

@@ -30,8 +30,7 @@ import org.apache.http.util.EntityUtils;
 import org.eclipse.jetty.util.UrlEncoded;
 
 import javax.net.ssl.SSLContext;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
+import java.io.*;
 import java.net.URL;
 import java.net.URLConnection;
 import java.net.URLEncoder;
@@ -106,6 +105,38 @@ public class HttpUtils2 {
         return strReturn;
     }
 
+    public static void getFile(String url,Map<String,String> headerMap,String filePath){
+        HttpClient httpClient = createSSLClientDefault();
+        HttpResponse response = null;
+        HttpGet httpGet = new HttpGet(url);
+        String result = null;
+        try {
+            httpGet.setHeader("User-Agent", USER_AGENT);
+            response = httpClient.execute(httpGet);
+            HttpEntity entity = response.getEntity();
+            InputStream in = entity.getContent();
+            File file = new File(filePath);
+            try {
+                FileOutputStream fout = new FileOutputStream(file);
+                int l = -1;
+                byte[] tmp = new byte[1024];
+                while ((l = in.read(tmp)) != -1) {
+                    fout.write(tmp, 0, l);
+                }
+                fout.flush();
+                fout.close();
+            } catch (Exception e){
+                e.printStackTrace();
+            }
+            finally{
+                // 关闭低层流。
+                in.close();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
     public static String httpPostRequest(String url, Map<String, Object> param, Map<String, String> headers) {
         HttpClient httpClient = createSSLClientDefault();
         String strReturn = "";

+ 5 - 1
module-common/src/main/java/cn/com/ctop/common/module/utils/LoadFileUtil.java

@@ -33,10 +33,14 @@ public class LoadFileUtil {
         //文件保存位置
         File saveDir = new File(savePath);
         if (!saveDir.exists()) {
-            saveDir.mkdir();
+//            saveDir.mkdir();
+            saveDir.mkdirs();
         }
         String localPath = saveDir + File.separator + fileName;
         File file = new File(localPath);
+        if (!file.exists()){
+            file.getParentFile().mkdirs();
+        }
         FileOutputStream fos = new FileOutputStream(file);
         fos.write(getData);
         if (fos != null) {

+ 51 - 14
module-common/src/main/java/cn/com/ctop/common/module/utils/MpsUtils.java

@@ -8,6 +8,7 @@ import com.aliyuncs.exceptions.ClientException;
 import com.aliyuncs.exceptions.ServerException;
 import com.aliyuncs.mts.model.v20140618.*;
 import com.aliyuncs.profile.DefaultProfile;
+import com.google.gson.Gson;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.PropertySource;
 
@@ -22,9 +23,43 @@ public class MpsUtils {
     public static final String ossLocation = "oss-cn-beijing";
     public static final String ossBucket = "ctop-part";
     public static void main(String[] args){
-        String[] a = {"1","2","3","4","5"};
-        combinationSelect(a,3);
-        arrangementSelect(a,3);
+//        String[] a = {"1","2","3","4","5"};
+//        combinationSelect(a,3);
+//        arrangementSelect(a,3);
+        String t = "https://ctop-part.oss-cn-beijing.aliyuncs.com/input/VIDEO_HEAD/2019-12-11/25-1576044510677.mp4";
+        int i = t.indexOf("/",10);
+        System.out.println(t.substring(i+1,t.length()-1));
+
+//        MpsUtils mpsUtils = new MpsUtils();
+//        List<String> list = new ArrayList<>();
+//        list.add("v1.mp4");
+//        String jobId = mpsUtils.mergeOneVideo("v1.mp4",list,"v1.mp4");
+//        try {
+//            while (true){
+//                QueryJobListResponse.Job job = mpsUtils.getJobStatus(jobId);
+//                job.getOutput().getOutputFile().getObject();
+//                System.out.println(new Gson().toJson(job));
+//                Thread.sleep(5000L);
+//            }
+//        } catch (InterruptedException e) {
+//            e.printStackTrace();
+//        }
+
+    }
+
+    public QueryJobListResponse.Job getJobStatus(String jobId){
+        QueryJobListResponse.Job job = null;
+        IAcsClient client = getClient();
+        QueryJobListRequest request = new QueryJobListRequest();
+        request.setJobIds(jobId);
+        try {
+            QueryJobListResponse response = client.getAcsResponse(request);
+            System.out.println(new Gson().toJson(response.getJobList().get(0)));
+            job = response.getJobList().get(0);
+        } catch (ClientException e) {
+            e.printStackTrace();
+        }
+        return job;
     }
     /**
      * 排列计算公式A<sup>m</sup><sub>n</sub> = n!/(n - m)!
@@ -155,8 +190,7 @@ public class MpsUtils {
         videos.add(startPart);
         videos.addAll(videoPart);
         videos.add(endPart);
-        mergeVideo(client,pipelineId,videos,outputFilename);
-        return outputFilename;
+        return mergeVideo(client,pipelineId,videos,outputFilename);
     }
 
     public String mergeVideo(IAcsClient client, String pipelineId, List<String> videos, String outputName){
@@ -193,17 +227,18 @@ public class MpsUtils {
                 }
             }
         }
-        String outputOssObject;
-        try {
-            outputOssObject = URLEncoder.encode(outputName, "utf-8");
-        } catch (UnsupportedEncodingException e) {
-            throw new RuntimeException("output URL encode failed");
-        }
+//        String outputOssObject;
+//        try {
+//            outputOssObject = URLEncoder.encode(outputName, "utf-8");
+//            outputOssObject = outputName;
+//        } catch (UnsupportedEncodingException e) {
+//            throw new RuntimeException("output URL encode failed");
+//        }
         JSONObject output = new JSONObject();
-        output.put("OutputObject", outputOssObject);
+        output.put("OutputObject", outputName);
         JSONObject video = new JSONObject();
-        video.put("Width", "1280");
-        video.put("Height", "720");
+        video.put("Width", "720");
+        video.put("Height", "1280");
         output.put("Video", video.toJSONString());
         output.put("MergeList", mergeList.toJSONString());
         // Outputs
@@ -234,6 +269,8 @@ public class MpsUtils {
         return jobId;
     }
 
+
+
     public String getPipelineId(IAcsClient client){
         String pipelineId = null;
         // 创建API请求并设置参数

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

@@ -180,7 +180,7 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                                             }
                                         }
 
-                                        log.info("素材同步完成,accountId:{},code:{}", accountId, materialInfo.getCode());
+                                        log.info("素材同步完成,accountId:{},code:{},返回信息:{}", accountId, materialInfo.getCode(), resultJson);
                                     } else {
                                         log.error("同步素材失败,返回信息:{},请求参数:{}", resultJson, requestJson);
                                     }
@@ -209,8 +209,6 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
     }
 
 
-
-
     @Autowired
     private RestTemplate rest;
 

+ 1 - 0
module-kuaishou/pom.xml

@@ -52,4 +52,5 @@
             </resource>
         </resources>
     </build>
+
 </project>

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

@@ -5,11 +5,11 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouRegionListParent;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.SpendVo;
-import cn.com.ctop.kuaishou.modules.batch.service.IBatchService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouRegionListParentMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
+import java.util.List;
 
 @Slf4j
 @Api(tags = "快手-批量工具")
@@ -43,6 +44,11 @@ public class BatchController {
     @Autowired
     private ICtopOauthTokenService tokenService;
 
+    @Autowired
+    private IKuaiShouGroupService kuaiShouGroupService;
+    @Autowired
+    private KuaiShouRegionListParentMapper regionListParentMapper;
+
 
     /**
      * 获取花费信息
@@ -98,6 +104,7 @@ public class BatchController {
                                                            HttpServletRequest req) {
         Result<IPage<KuaiShouCampaign>> result = new Result<IPage<KuaiShouCampaign>>();
         QueryWrapper<KuaiShouCampaign> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouCampaign, req.getParameterMap());
+        queryWrapper.orderByDesc("put_create_time");
         Page<KuaiShouCampaign> page = new Page<KuaiShouCampaign>(pageNo, pageSize);
         IPage<KuaiShouCampaign> pageList = kuaiShouCampaignService.page(page, queryWrapper);
         result.setSuccess(true);
@@ -146,4 +153,52 @@ public class BatchController {
     }
 
 
+    /**
+     * 查询广告组列表
+     *
+     * @param kuaiShouGroup
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @GetMapping(value = "/getUnitList")
+    public Result<IPage<KuaiShouGroup>> getUnitList(KuaiShouGroup kuaiShouGroup,
+                                                    @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                    @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                    HttpServletRequest req) {
+        Result<IPage<KuaiShouGroup>> result = new Result<IPage<KuaiShouGroup>>();
+        QueryWrapper<KuaiShouGroup> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouGroup, req.getParameterMap());
+        Page<KuaiShouGroup> page = new Page<KuaiShouGroup>(pageNo, pageSize);
+        IPage<KuaiShouGroup> pageList = kuaiShouGroupService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+
+    /**
+     * 获取区域列表
+     *
+     * @param kuaiShouRegionListParent
+     * @return
+     */
+    @GetMapping(value = "/getRegion")
+    public Result<List<KuaiShouRegionListParent>> getRegion(KuaiShouRegionListParent kuaiShouRegionListParent, HttpServletRequest req) {
+        Result<List<KuaiShouRegionListParent>> result = new Result<>();
+
+        try {
+            QueryWrapper<KuaiShouRegionListParent> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouRegionListParent, req.getParameterMap());
+
+            List<KuaiShouRegionListParent> regionListParents = regionListParentMapper.selectList(queryWrapper);
+            result.setSuccess(true);
+            result.setResult(regionListParents);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+
+        }
+        return result;
+    }
+
 }

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

@@ -0,0 +1,248 @@
+package cn.com.ctop.kuaishou.modules.batch.controller;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTarget;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTargetService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 快手-定向信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-17
+ */
+@Slf4j
+@Api(tags = "快手-定向信息")
+@RestController
+@RequestMapping("/ctop/kuaiShouGroupTarget")
+public class KuaiShouGroupTargetController {
+    @Autowired
+    private IKuaiShouGroupTargetService kuaiShouGroupTargetService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaiShouGroupTarget
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "快手-定向信息-分页列表查询")
+    @ApiOperation(value = "快手-定向信息-分页列表查询", notes = "快手-定向信息-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaiShouGroupTarget>> queryPageList(KuaiShouGroupTarget kuaiShouGroupTarget,
+                                                            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                            HttpServletRequest req) {
+        Result<IPage<KuaiShouGroupTarget>> result = new Result<IPage<KuaiShouGroupTarget>>();
+        QueryWrapper<KuaiShouGroupTarget> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouGroupTarget, req.getParameterMap());
+        Page<KuaiShouGroupTarget> page = new Page<KuaiShouGroupTarget>(pageNo, pageSize);
+        IPage<KuaiShouGroupTarget> pageList = kuaiShouGroupTargetService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaiShouGroupTarget
+     * @return
+     */
+    @AutoLog(value = "快手-定向信息-添加")
+    @ApiOperation(value = "快手-定向信息-添加", notes = "快手-定向信息-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaiShouGroupTarget> add(@RequestBody KuaiShouGroupTarget kuaiShouGroupTarget) {
+        Result<KuaiShouGroupTarget> result = new Result<KuaiShouGroupTarget>();
+        try {
+            kuaiShouGroupTargetService.save(kuaiShouGroupTarget);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouGroupTarget
+     * @return
+     */
+    @AutoLog(value = "快手-定向信息-编辑")
+    @ApiOperation(value = "快手-定向信息-编辑", notes = "快手-定向信息-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaiShouGroupTarget> edit(@RequestBody KuaiShouGroupTarget kuaiShouGroupTarget) {
+        Result<KuaiShouGroupTarget> result = new Result<KuaiShouGroupTarget>();
+        KuaiShouGroupTarget kuaiShouGroupTargetEntity = kuaiShouGroupTargetService.getById(kuaiShouGroupTarget.getId());
+        if (kuaiShouGroupTargetEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouGroupTargetService.updateById(kuaiShouGroupTarget);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "快手-定向信息-通过id删除")
+    @ApiOperation(value = "快手-定向信息-通过id删除", notes = "快手-定向信息-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            kuaiShouGroupTargetService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "快手-定向信息-批量删除")
+    @ApiOperation(value = "快手-定向信息-批量删除", notes = "快手-定向信息-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<KuaiShouGroupTarget> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<KuaiShouGroupTarget> result = new Result<KuaiShouGroupTarget>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaiShouGroupTargetService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "快手-定向信息-通过id查询")
+    @ApiOperation(value = "快手-定向信息-通过id查询", notes = "快手-定向信息-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaiShouGroupTarget> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaiShouGroupTarget> result = new Result<KuaiShouGroupTarget>();
+        KuaiShouGroupTarget kuaiShouGroupTarget = kuaiShouGroupTargetService.getById(id);
+        if (kuaiShouGroupTarget == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouGroupTarget);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouGroupTarget> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouGroupTarget kuaiShouGroupTarget = JSON.parseObject(deString, KuaiShouGroupTarget.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouGroupTarget, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouGroupTarget> pageList = kuaiShouGroupTargetService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "快手-定向信息列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouGroupTarget.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("快手-定向信息列表数据", "导出人:Jeecg", "导出信息"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            MultipartFile file = entity.getValue();
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<KuaiShouGroupTarget> listKuaiShouGroupTargets = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouGroupTarget.class, params);
+                kuaiShouGroupTargetService.saveBatch(listKuaiShouGroupTargets);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouGroupTargets.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
+
+}

+ 10 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroup.java

@@ -62,6 +62,8 @@ public class KuaiShouGroup {
     @Excel(name = "广告组状态", width = 15)
     @ApiModelProperty(value = "广告组状态")
     private Integer status;
+    private Integer putStatus;
+    private Integer createChannel;
     /**
      * 审核拒绝理由
      */
@@ -86,6 +88,10 @@ public class KuaiShouGroup {
     @Excel(name = "OCPC出价", width = 15)
     @ApiModelProperty(value = "OCPC出价")
     private Long cpaBid;
+
+    private Integer deepConversionType;
+    private Long deepConversionBid;
+
     /**
      * OCPX行为类型   1: CPM, 2: CPC,
      */
@@ -116,18 +122,16 @@ public class KuaiShouGroup {
     @Excel(name = "投放结束时间", width = 15)
     @ApiModelProperty(value = "投放结束时间")
     private String endTime;
-    /**
-     * 投放时段
-     */
-    @Excel(name = "投放时段", width = 15)
-    @ApiModelProperty(value = "投放时段")
-    private String schedule;
+    private String scheduleTime;
+    private String sceneId;
+
     /**
      * 创意展现方式  0:未知, 1:轮播,
      */
     @Excel(name = "创意展现方式  0:未知, 1:轮播,", width = 15)
     @ApiModelProperty(value = "创意展现方式  0:未知, 1:轮播,")
     private Integer showModel;
+    private Integer unitType;
     /**
      * url类型
      */

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

@@ -0,0 +1,203 @@
+package cn.com.ctop.kuaishou.modules.batch.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 快手-定向信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-17
+ */
+@Data
+@TableName("ctop_kuaishou_group_target")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_group_target对象", description = "快手-定向信息")
+public class KuaiShouGroupTarget {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 广告组ID
+     */
+    @Excel(name = "广告组ID", width = 15)
+    @ApiModelProperty(value = "广告组ID")
+    private Long unitId;
+    /**
+     * 地域
+     */
+    @Excel(name = "地域", width = 15)
+    @ApiModelProperty(value = "地域")
+    private String region;
+    /**
+     * 年龄最小限制
+     */
+    @Excel(name = "年龄最小限制", width = 15)
+    @ApiModelProperty(value = "年龄最小限制")
+    private Integer ageMin;
+    /**
+     * 年龄最大限制
+     */
+    @Excel(name = "年龄最大限制", width = 15)
+    @ApiModelProperty(value = "年龄最大限制")
+    private Integer ageMax;
+    /**
+     * 固定年龄段 【0:表示0-11岁】【12:表示12-17岁】【18:表示18-23岁】【24:表示24-30岁】【31:表示31-40岁】【41:表示41-49岁】【50:表示50-100岁】
+     */
+    @Excel(name = "固定年龄段 【0:表示0-11岁】【12:表示12-17岁】【18:表示18-23岁】【24:表示24-30岁】【31:表示31-40岁】【41:表示41-49岁】【50:表示50-100岁】", width = 15)
+    @ApiModelProperty(value = "固定年龄段 【0:表示0-11岁】【12:表示12-17岁】【18:表示18-23岁】【24:表示24-30岁】【31:表示31-40岁】【41:表示41-49岁】【50:表示50-100岁】")
+    private String agesRange;
+    /**
+     * 性别 1:女性, 2:男性, 0:不限
+     */
+    @Excel(name = "性别 1:女性, 2:男性, 0:不限", width = 15)
+    @ApiModelProperty(value = "性别 1:女性, 2:男性, 0:不限")
+    private Integer gender;
+    /**
+     * 操作系统 1: Android, 2: iOS, 0:不限
+     */
+    @Excel(name = "操作系统 1: Android, 2: iOS, 0:不限", width = 15)
+    @ApiModelProperty(value = "操作系统 1: Android, 2: iOS, 0:不限")
+    private Integer platformOs;
+    /**
+     * 安卓版本  3:不限, 4: 4.x+, 5: 5.x+, 6: 6.x+, 7: 7.x+;
+     */
+    @Excel(name = "安卓版本  3:不限, 4: 4.x+, 5: 5.x+, 6: 6.x+, 7: 7.x+;", width = 15)
+    @ApiModelProperty(value = "安卓版本  3:不限, 4: 4.x+, 5: 5.x+, 6: 6.x+, 7: 7.x+;")
+    private Integer androidOsv;
+    /**
+     * ios版本  6:不限, 7: 7.x+, 8: 8.x+,9: 9.x+, 10: 10.x+
+     */
+    @Excel(name = "ios版本  6:不限, 7: 7.x+, 8: 8.x+,9: 9.x+, 10: 10.x+", width = 15)
+    @ApiModelProperty(value = "ios版本  6:不限, 7: 7.x+, 8: 8.x+,9: 9.x+, 10: 10.x+")
+    private Integer iosOsv;
+    /**
+     * 网络环境 1: Wi-Fi, 2:移动网络,0:表示不限
+     */
+    @Excel(name = "网络环境 1: Wi-Fi, 2:移动网络,0:表示不限", width = 15)
+    @ApiModelProperty(value = "网络环境 1: Wi-Fi, 2:移动网络,0:表示不限")
+    private Integer network;
+    /**
+     * 设备品牌 1: OPPO, 2: VIVO,3:华为, 4:小米,5:荣耀, 6:三星,7:金立, 8:魅族,9:乐视, 10:其他,11 : 苹 果
+     */
+    @Excel(name = "设备品牌 1: OPPO, 2: VIVO,3:华为, 4:小米,5:荣耀, 6:三星,7:金立, 8:魅族,9:乐视, 10:其他,11 : 苹 果", width = 15)
+    @ApiModelProperty(value = "设备品牌 1: OPPO, 2: VIVO,3:华为, 4:小米,5:荣耀, 6:三星,7:金立, 8:魅族,9:乐视, 10:其他,11 : 苹 果")
+    private String deviceBrand;
+    /**
+     * 设备价格 1: 1500 元以下,2: 1501~2000,3: 2001~2500,4: 2501~3000,5: 3001~3500,6: 3501~4000,7: 4001~4500,8: 4501~5000,9: 5001~5500,10: 5500 元以上
+     */
+    @Excel(name = "设备价格 1: 1500 元以下,2: 1501~2000,3: 2001~2500,4: 2501~3000,5: 3001~3500,6: 3501~4000,7: 4001~4500,8: 4501~5000,9: 5001~5500,10: 5500 元以上", width = 15)
+    @ApiModelProperty(value = "设备价格 1: 1500 元以下,2: 1501~2000,3: 2001~2500,4: 2501~3000,5: 3001~3500,6: 3501~4000,7: 4001~4500,8: 4501~5000,9: 5001~5500,10: 5500 元以上")
+    private String devicePrice;
+    /**
+     * 商业兴趣类型 0:不限,2:按照兴趣标签
+     */
+    @Excel(name = "商业兴趣类型 0:不限,2:按照兴趣标签", width = 15)
+    @ApiModelProperty(value = "商业兴趣类型 0:不限,2:按照兴趣标签")
+    private Integer businessInterestType;
+    /**
+     * 商业兴趣
+     */
+    @Excel(name = "商业兴趣", width = 15)
+    @ApiModelProperty(value = "商业兴趣")
+    private String businessInterest;
+    /**
+     * 网红粉丝
+     */
+    @Excel(name = "网红粉丝", width = 15)
+    @ApiModelProperty(value = "网红粉丝")
+    private String fansStar;
+    /**
+     * 兴趣视频用户
+     */
+    @Excel(name = "兴趣视频用户", width = 15)
+    @ApiModelProperty(value = "兴趣视频用户")
+    private String interestVideo;
+    /**
+     * APP行为-按分类
+     */
+    @Excel(name = "APP行为-按分类", width = 15)
+    @ApiModelProperty(value = "APP行为-按分类")
+    private String appInterest;
+    /**
+     * APP行为-按APP名称
+     */
+    @Excel(name = "APP行为-按APP名称", width = 15)
+    @ApiModelProperty(value = "APP行为-按APP名称")
+    private String appIds;
+    /**
+     * 人群包定向
+     */
+    @Excel(name = "人群包定向", width = 15)
+    @ApiModelProperty(value = "人群包定向")
+    private String population;
+    /**
+     * 人群包排除
+     */
+    @Excel(name = "人群包排除", width = 15)
+    @ApiModelProperty(value = "人群包排除")
+    private String excludePopulation;
+    /**
+     * 0:关闭智能扩量,1:打开智能扩量
+     */
+    @Excel(name = "0:关闭智能扩量,1:打开智能扩量", width = 15)
+    @ApiModelProperty(value = "0:关闭智能扩量,1:打开智能扩量")
+    private Integer isOpen;
+    /**
+     * 不可突破年龄 0:可突破/无需控制,1:不可突破
+     */
+    @Excel(name = "不可突破年龄 0:可突破/无需控制,1:不可突破", width = 15)
+    @ApiModelProperty(value = "不可突破年龄 0:可突破/无需控制,1:不可突破")
+    private Integer noAgeBreak;
+    /**
+     * 不可突破性别 0:可突破/无需控制,1:不可突破
+     */
+    @Excel(name = "不可突破性别 0:可突破/无需控制,1:不可突破", width = 15)
+    @ApiModelProperty(value = "不可突破性别 0:可突破/无需控制,1:不可突破")
+    private Integer noGenderBreak;
+    /**
+     * 不可突破地域 0:可突破/无需控制,1:不可突破
+     */
+    @Excel(name = "不可突破地域 0:可突破/无需控制,1:不可突破", width = 15)
+    @ApiModelProperty(value = "不可突破地域 0:可突破/无需控制,1:不可突破")
+    private Integer noAreaBreak;
+    /**
+     * 创建时间
+     */
+    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+}

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.batch.mapper;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTarget;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 快手-定向信息
+ *
+ * @author: jeecg-boot
+ * @date: 2019-12-17
+ * @cersion: V1.0
+ */
+public interface KuaiShouGroupTargetMapper extends BaseMapper<KuaiShouGroupTarget> {
+
+    void replaceBatch(@Param("targets") List<KuaiShouGroupTarget> targets);
+}

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

@@ -3,7 +3,7 @@
 <mapper namespace="cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAppInfoMapper">
     <insert id="replaceBatch">
         replace into ctop_kuaishou_app_info(
-        account_id ,
+        account_id,
         unit_id,
         app_package_name,
         app_name,

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

@@ -9,17 +9,23 @@
         unit_id,
         unit_name,
         status,
+        put_status,
+        create_channel,
         review_detail,
         bid_type,
         bid,
         cpa_bid,
         ocpx_action_type,
+        deep_conversion_type,
+        deep_conversion_bid,
         day_budget,
         speed,
         begin_time,
         end_time,
-        schedule,
+        schedule_time,
+        scene_id,
         show_model,
+        unit_type,
         url_type,
         url,
         app_id,
@@ -28,23 +34,30 @@
         update_time)
         values
         <foreach collection="groups" item="getGroup" separator=",">
-            (#{getGroup.id},
+            (
+            #{getGroup.id},
             #{getGroup.accountId},
             #{getGroup.campaignId},
             #{getGroup.unitId},
             #{getGroup.unitName},
             #{getGroup.status},
+            #{getGroup.putStatus},
+            #{getGroup.createChannel},
             #{getGroup.reviewDetail},
             #{getGroup.bidType},
             #{getGroup.bid},
             #{getGroup.cpaBid},
             #{getGroup.ocpxActionType},
+            #{getGroup.deepConversionType},
+            #{getGroup.deepConversionBid},
             #{getGroup.dayBudget},
             #{getGroup.speed},
             #{getGroup.beginTime},
             #{getGroup.endTime},
-            #{getGroup.schedule},
+            #{getGroup.scheduleTime},
+            #{getGroup.sceneId},
             #{getGroup.showModel},
+            #{getGroup.unitType},
             #{getGroup.urlType},
             #{getGroup.url},
             #{getGroup.appId},
@@ -56,8 +69,6 @@
 
 
     <select id="selectWarningGroup" resultType="java.lang.String">
-
-
    SELECT
    unit_name
    FROM ctop_kuaishou_group

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

@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupTargetMapper">
+
+
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_group_target(
+        account_id ,
+        unit_id,
+        region,
+        age_min,
+        age_max,
+        ages_range,
+        gender,
+        platform_os,
+        android_osv,
+        ios_osv,
+        network,
+        device_brand,
+        device_price,
+        business_interest_type,
+        business_interest,
+        fans_star,
+        interest_video,
+        app_interest,
+        app_ids,
+        population,
+        exclude_population,
+        is_open,
+        no_age_break,
+        no_gender_break,
+        no_area_break
+        )
+        values
+        <foreach collection="targets" item="targets" separator=",">
+            (
+
+            #{targets.accountId},
+            #{targets.unitId},
+            #{targets.region},
+            #{targets.ageMin},
+            #{targets.ageMax},
+            #{targets.agesRange},
+            #{targets.gender},
+            #{targets.platformOs},
+            #{targets.androidOsv},
+            #{targets.iosOsv},
+            #{targets.network},
+            #{targets.deviceBrand},
+            #{targets.devicePrice},
+            #{targets.businessInterestType},
+            #{targets.businessInterest},
+            #{targets.fansStar},
+            #{targets.interestVideo},
+            #{targets.appInterest},
+            #{targets.appIds},
+            #{targets.population},
+            #{targets.excludePopulation},
+            #{targets.isOpen},
+            #{targets.noAgeBreak},
+            #{targets.noGenderBreak},
+            #{targets.noAreaBreak}
+            )
+        </foreach>
+    </insert>
+
+</mapper>

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

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouRegionListChildrenMapper">
     <delete id="deleteAll">
-        delete from ctop_kuaishou_region_list_children;
+        delete from ctop_kuaishou_region_list_parent;
     </delete>
 
 </mapper>

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTarget;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 快手-定向信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-17
+ */
+public interface IKuaiShouGroupTargetService extends IService<KuaiShouGroupTarget> {
+
+}

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

@@ -381,7 +381,7 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
                     imageJson.put("positionType", requestJson.getString("positionType"));
                     String imagePath = imageService.localInsert(imageJson);
 
-                    Map<String, Object> imageMap = kuaishouInterfaceService.imageUpload(accountId, accessToken, imagePath, 0);
+                    Map<String, Object> imageMap = kuaishouInterfaceService.imageUpload(accountId, accessToken, imagePath, 2);
                     if ((Integer) imageMap.get("code") != 0) {
                         return imageMap;
                     }
@@ -479,7 +479,7 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
                         imageJson.put("loginId", requestJson.getString("loginId"));
                         imageJson.put("videoUploadType", requestJson.getString("singlePicTiepianType"));
                         String imagePath = imageService.localInsert(imageJson);
-                        Map<String, Object> imageMap = kuaishouInterfaceService.imageUpload(accountId, accessToken, imagePath, 0);
+                        Map<String, Object> imageMap = kuaishouInterfaceService.imageUpload(accountId, accessToken, imagePath, 3);
                         if ((Integer) imageMap.get("code") != 0) {
                             log.error("上传后贴片单张图片素材失败,accountId:{}", accountId);
                             return imageMap;

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTarget;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupTargetMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTargetService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 快手-定向信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-17
+ */
+@Service
+public class KuaiShouGroupTargetServiceImpl extends ServiceImpl<KuaiShouGroupTargetMapper, KuaiShouGroupTarget> implements IKuaiShouGroupTargetService {
+
+}

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

@@ -361,11 +361,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         if (!Check.isNull(startDate)) {
             param.put("start_date", DateUtils.formatDate(startDate));
         }
-        if (Check.isNull(endDate)) {
+        if (!Check.isNull(endDate)) {
             param.put("end_date", DateUtils.formatDate(endDate));
         }
-
-
         param.put("advertiser_id", token.getAccountId());
         param.put("temporal_granularity", "DAILY");
         param.put("page_size", 500);
@@ -1445,41 +1443,52 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
     }
 
+    @Autowired
+    private KuaiShouGroupTargetMapper groupTargetMapper;
+
     private void addGroup(Long advertiserId, JSONArray details) {
         if (!Check.isNull(details)) {
             List<KuaiShouGroup> groups = new ArrayList<>();
             List<KuaiShouAppInfo> appInfos = new ArrayList<>();
-            List<KuaiShouSchedule> shouSchedules = new ArrayList<>();
+            List<KuaiShouSchedule> schedules = new ArrayList<>();
+            List<KuaiShouGroupTarget> targets = new ArrayList<>();
             for (int i = 0; i < details.size(); i++) {
                 JSONObject detail = JSONObject.parseObject(details.get(i).toString());
                 if (!Check.isNull(detail)) {
                     KuaiShouGroup group = new KuaiShouGroup();
+                    Long unitId = detail.getLong("unit_id");
+                    group.setId("" + advertiserId + unitId);
                     group.setAccountId(advertiserId);
-                    group.setStatus(detail.getInteger("status"));
-                    group.setBid(detail.getLong("bid"));
-                    group.setSpeed(detail.getInteger("speed"));
-                    group.setSchedule(detail.getString("schedule"));
-                    group.setUrl(detail.getString("url"));
                     group.setCampaignId(detail.getLong("campaign_id"));
-                    Long unitId = detail.getLong("unit_id");
                     group.setUnitId(unitId);
-                    group.setId("" + advertiserId + unitId);
                     group.setUnitName(detail.getString("unit_name"));
-                    group.setBidType(detail.getInteger("bid_type"));
+                    group.setStatus(detail.getInteger("status"));
+                    group.setPutStatus(detail.getInteger("put_status"));
+                    group.setCreateChannel(detail.getInteger("create_channel"));
                     group.setReviewDetail(detail.getString("review_detail"));
+                    group.setBidType(detail.getInteger("bid_type"));
+                    group.setBid(detail.getLong("bid"));
                     group.setCpaBid(detail.getLong("cpa_bid"));
                     group.setOcpxActionType(detail.getInteger("ocpx_action_type"));
+                    group.setDeepConversionType(detail.getInteger("deep_conversion_type"));
+                    group.setDeepConversionBid(detail.getLong("deep_conversion_bid"));
                     group.setDayBudget(detail.getLong("day_budget"));
+                    group.setSpeed(detail.getInteger("speed"));
                     group.setBeginTime(detail.getString("begin_time"));
                     group.setEndTime(detail.getString("end_time"));
+                    group.setScheduleTime(detail.getString("schedule_time"));
+                    group.setSceneId(detail.getJSONArray("scene_id") + "");
                     group.setShowModel(detail.getInteger("show_mode"));
+                    group.setUnitType(detail.getInteger("unit_type"));
                     group.setUrlType(detail.getInteger("url_type"));
+                    group.setUrl(detail.getString("url"));
                     group.setAppId(detail.getLong("app_id"));
                     group.setAppIconUrl(detail.getString("app_icon_url"));
                     group.setCreateTime(new Date());
                     group.setUpdateTime(new Date());
                     groups.add(group);
                     // 添加应用信息
+
                     JSONObject diverseJson = detail.getJSONObject("diverse_data");
                     if (!Check.isNull(diverseJson)) {
                         KuaiShouAppInfo appInfo = new KuaiShouAppInfo();
@@ -1507,19 +1516,94 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                         schedule.setSun(scheduleJson.getJSONArray("sun").toJSONString());
                         schedule.setCreateTime(new Date());
                         schedule.setUpdateTime(new Date());
-                        shouSchedules.add(schedule);
+                        schedules.add(schedule);
+                    }
+
+                    JSONObject targetJson = detail.getJSONObject("target");
+                    if (!Check.isNull(targetJson)) {
+                        KuaiShouGroupTarget groupTarget = new KuaiShouGroupTarget();
+                        groupTarget.setAccountId(advertiserId);
+                        groupTarget.setUnitId(unitId);
+
+                        if (!Check.isNull(targetJson.getJSONArray("region"))) {
+                            groupTarget.setRegion(targetJson.getJSONArray("region").toJSONString());
+                        }
+
+                        JSONObject age = targetJson.getJSONObject("age");
+                        if (!Check.isNull(age)) {
+                            groupTarget.setAgeMin(age.getInteger("min"));
+                            groupTarget.setAgeMax(age.getInteger("max"));
+                        }
+                        if (!Check.isNull(targetJson.getJSONArray("ages_range"))) {
+                            groupTarget.setAgesRange(targetJson.getJSONArray("ages_range").toJSONString());
+                        }
+
+                        groupTarget.setGender(targetJson.getInteger("gender"));
+                        groupTarget.setPlatformOs(targetJson.getInteger("platform_os"));
+                        groupTarget.setAndroidOsv(targetJson.getInteger("android_osv"));
+                        groupTarget.setIosOsv(targetJson.getInteger("ios_osv"));
+                        groupTarget.setNetwork(targetJson.getInteger("network"));
+                        if (!Check.isNull(targetJson.getJSONArray("device_brand"))) {
+                            groupTarget.setDeviceBrand(targetJson.getJSONArray("device_brand").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("device_price"))) {
+                            groupTarget.setDevicePrice(targetJson.getJSONArray("device_price").toJSONString());
+                        }
+
+                        groupTarget.setBusinessInterestType(targetJson.getInteger("business_interest_type"));
+                        if (!Check.isNull(targetJson.getJSONArray("business_interest"))) {
+                            groupTarget.setBusinessInterest(targetJson.getJSONArray("business_interest").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("fans_star"))) {
+                            groupTarget.setFansStar(targetJson.getJSONArray("fans_star").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("interest_video"))) {
+                            groupTarget.setInterestVideo(targetJson.getJSONArray("interest_video").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("app_interest"))) {
+                            groupTarget.setAppInterest(targetJson.getJSONArray("app_interest").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("app_ids"))) {
+                            groupTarget.setAppIds(targetJson.getJSONArray("app_ids").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("population"))) {
+                            groupTarget.setPopulation(targetJson.getJSONArray("population").toJSONString());
+                        }
+
+                        if (!Check.isNull(targetJson.getJSONArray("exclude_population"))) {
+                            groupTarget.setExcludePopulation(targetJson.getJSONArray("exclude_population").toJSONString());
+                        }
+
+                        JSONObject intelliExtend = targetJson.getJSONObject("intelli_extend");
+                        if (!Check.isNull(intelliExtend)) {
+                            groupTarget.setIsOpen(intelliExtend.getInteger("is_open"));
+                            groupTarget.setNoAgeBreak(intelliExtend.getInteger("no_age_break"));
+                            groupTarget.setNoGenderBreak(intelliExtend.getInteger("no_gender_break"));
+                            groupTarget.setNoAreaBreak(intelliExtend.getInteger("no_area_break"));
+
+                        }
+                        targets.add(groupTarget);
                     }
                 }
             }
             if (!Check.isNull(groups)) {
                 groupMapper.replaceBatch(groups);
             }
-            if (!Check.isNull(shouSchedules)) {
-                shouScheduleMapper.replaceBatch(shouSchedules);
+            if (!Check.isNull(schedules)) {
+                shouScheduleMapper.replaceBatch(schedules);
             }
             if (!Check.isNull(appInfos)) {
                 appInfoMapper.replaceBatch(appInfos);
             }
+            if (!Check.isNull(targets)) {
+                groupTargetMapper.replaceBatch(targets);
+            }
         }
     }
 
@@ -2043,6 +2127,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                             }
                         }
                     }
+                    log.info("获取视频信息完成,advertiserId:{},返回信息:{}", advertiserId, resultJson);
                 } else {
                     log.error("获取广告视频失败,advertiser_id:{},返回信息:{}", advertiserId, resultJson);
                 }

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

@@ -0,0 +1,228 @@
+package cn.com.ctop.kuaishou.modules.report.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.util.oConvertUtils;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
+import java.util.Date;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 代理商报表
+ * @author jeecg-boot
+ * @date   2019-12-13
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="代理商报表")
+@RestController
+@RequestMapping("/report/kuaishouReportDailyAgent")
+public class KuaishouReportDailyAgentController {
+    @Autowired
+    private IKuaishouReportDailyAgentService kuaishouReportDailyAgentService;
+    @GetMapping(value = "/get")
+    @ResponseBody
+    public String getReport(@RequestParam(name="start")String start,@RequestParam(name="end")String end){
+        kuaishouReportDailyAgentService.getReport(start,end);
+        return "ok";
+    }
+    /**
+     * 分页列表查询
+     * @param kuaishouReportDailyAgent
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "代理商报表-分页列表查询")
+    @ApiOperation(value="代理商报表-分页列表查询", notes="代理商报表-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaishouReportDailyAgent>> queryPageList(KuaishouReportDailyAgent kuaishouReportDailyAgent,
+                                                                 @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+                                                                 @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+                                                                 HttpServletRequest req) {
+        Result<IPage<KuaishouReportDailyAgent>> result = new Result<IPage<KuaishouReportDailyAgent>>();
+        QueryWrapper<KuaishouReportDailyAgent> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouReportDailyAgent, req.getParameterMap());
+        Page<KuaishouReportDailyAgent> page = new Page<KuaishouReportDailyAgent>(pageNo, pageSize);
+        IPage<KuaishouReportDailyAgent> pageList = kuaishouReportDailyAgentService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     *   添加
+     * @param kuaishouReportDailyAgent
+     * @return
+     */
+    @AutoLog(value = "代理商报表-添加")
+    @ApiOperation(value="代理商报表-添加", notes="代理商报表-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaishouReportDailyAgent> add(@RequestBody KuaishouReportDailyAgent kuaishouReportDailyAgent) {
+        Result<KuaishouReportDailyAgent> result = new Result<KuaishouReportDailyAgent>();
+        try {
+            kuaishouReportDailyAgentService.save(kuaishouReportDailyAgent);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(),e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+
+    /**
+     *   通过id删除
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "代理商报表-通过id删除")
+    @ApiOperation(value="代理商报表-通过id删除", notes="代理商报表-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+        try {
+            kuaishouReportDailyAgentService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败",e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     *  批量删除
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "代理商报表-批量删除")
+    @ApiOperation(value="代理商报表-批量删除", notes="代理商报表-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<KuaishouReportDailyAgent> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+        Result<KuaishouReportDailyAgent> result = new Result<KuaishouReportDailyAgent>();
+        if(ids==null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        }else {
+            this.kuaishouReportDailyAgentService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "代理商报表-通过id查询")
+    @ApiOperation(value="代理商报表-通过id查询", notes="代理商报表-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaishouReportDailyAgent> queryById(@RequestParam(name="id",required=true) String id) {
+        Result<KuaishouReportDailyAgent> result = new Result<KuaishouReportDailyAgent>();
+        KuaishouReportDailyAgent kuaishouReportDailyAgent = kuaishouReportDailyAgentService.getById(id);
+        if(kuaishouReportDailyAgent==null) {
+            result.error500("未找到对应实体");
+        }else {
+            result.setResult(kuaishouReportDailyAgent);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaishouReportDailyAgent> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaishouReportDailyAgent kuaishouReportDailyAgent = JSON.parseObject(deString, KuaishouReportDailyAgent.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaishouReportDailyAgent, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaishouReportDailyAgent> pageList = kuaishouReportDailyAgentService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "代理商报表列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaishouReportDailyAgent.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("代理商报表列表数据", "导出人:Jeecg", "导出信息"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            MultipartFile file = entity.getValue();
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<KuaishouReportDailyAgent> listKuaishouReportDailyAgents = ExcelImportUtil.importExcel(file.getInputStream(), KuaishouReportDailyAgent.class, params);
+                kuaishouReportDailyAgentService.saveBatch(listKuaishouReportDailyAgents);
+                return Result.ok("文件导入成功!数据行数:" + listKuaishouReportDailyAgents.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(),e);
+                return Result.error("文件导入失败:"+e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
+
+}

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

@@ -0,0 +1,202 @@
+package cn.com.ctop.kuaishou.modules.report.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.util.oConvertUtils;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgentSum;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentSumService;
+import java.util.Date;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+ /**
+ * 代理商日汇总表
+ * @author jeecg-boot
+ * @date   2019-12-13
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="代理商日汇总表")
+@RestController
+@RequestMapping("/report/kuaishouReportDailyAgentSum")
+public class KuaishouReportDailyAgentSumController {
+	@Autowired
+	private IKuaishouReportDailyAgentSumService kuaishouReportDailyAgentSumService;
+	
+	/**
+	  * 分页列表查询
+	 * @param kuaishouReportDailyAgentSum
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@AutoLog(value = "代理商日汇总表-分页列表查询")
+	@ApiOperation(value="代理商日汇总表-分页列表查询", notes="代理商日汇总表-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<KuaishouReportDailyAgentSum>> queryPageList(KuaishouReportDailyAgentSum kuaishouReportDailyAgentSum,
+									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+									  HttpServletRequest req) {
+		Result<IPage<KuaishouReportDailyAgentSum>> result = new Result<IPage<KuaishouReportDailyAgentSum>>();
+		QueryWrapper<KuaishouReportDailyAgentSum> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouReportDailyAgentSum, req.getParameterMap());
+		Page<KuaishouReportDailyAgentSum> page = new Page<KuaishouReportDailyAgentSum>(pageNo, pageSize);
+		IPage<KuaishouReportDailyAgentSum> pageList = kuaishouReportDailyAgentSumService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+	
+	/**
+	  *   添加
+	 * @param kuaishouReportDailyAgentSum
+	 * @return
+	 */
+	@AutoLog(value = "代理商日汇总表-添加")
+	@ApiOperation(value="代理商日汇总表-添加", notes="代理商日汇总表-添加")
+	@PostMapping(value = "/add")
+	public Result<KuaishouReportDailyAgentSum> add(@RequestBody KuaishouReportDailyAgentSum kuaishouReportDailyAgentSum) {
+		Result<KuaishouReportDailyAgentSum> result = new Result<KuaishouReportDailyAgentSum>();
+		try {
+			kuaishouReportDailyAgentSumService.save(kuaishouReportDailyAgentSum);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+	
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "代理商日汇总表-批量删除")
+	@ApiOperation(value="代理商日汇总表-批量删除", notes="代理商日汇总表-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<KuaishouReportDailyAgentSum> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<KuaishouReportDailyAgentSum> result = new Result<KuaishouReportDailyAgentSum>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.kuaishouReportDailyAgentSumService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+	
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "代理商日汇总表-通过id查询")
+	@ApiOperation(value="代理商日汇总表-通过id查询", notes="代理商日汇总表-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<KuaishouReportDailyAgentSum> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<KuaishouReportDailyAgentSum> result = new Result<KuaishouReportDailyAgentSum>();
+		KuaishouReportDailyAgentSum kuaishouReportDailyAgentSum = kuaishouReportDailyAgentSumService.getById(id);
+		if(kuaishouReportDailyAgentSum==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(kuaishouReportDailyAgentSum);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<KuaishouReportDailyAgentSum> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              KuaishouReportDailyAgentSum kuaishouReportDailyAgentSum = JSON.parseObject(deString, KuaishouReportDailyAgentSum.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(kuaishouReportDailyAgentSum, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<KuaishouReportDailyAgentSum> pageList = kuaishouReportDailyAgentSumService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "代理商日汇总表列表");
+      mv.addObject(NormalExcelConstants.CLASS, KuaishouReportDailyAgentSum.class);
+      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("代理商日汇总表列表数据", "导出人:Jeecg", "导出信息"));
+      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+      return mv;
+  }
+
+  /**
+      * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+          MultipartFile file = entity.getValue();
+          ImportParams params = new ImportParams();
+          params.setTitleRows(2);
+          params.setHeadRows(1);
+          params.setNeedSave(true);
+          try {
+              List<KuaishouReportDailyAgentSum> listKuaishouReportDailyAgentSums = ExcelImportUtil.importExcel(file.getInputStream(), KuaishouReportDailyAgentSum.class, params);
+              kuaishouReportDailyAgentSumService.saveBatch(listKuaishouReportDailyAgentSums);
+              return Result.ok("文件导入成功!数据行数:" + listKuaishouReportDailyAgentSums.size());
+          } catch (Exception e) {
+              log.error(e.getMessage(),e);
+              return Result.error("文件导入失败:"+e.getMessage());
+          } finally {
+              try {
+                  file.getInputStream().close();
+              } catch (IOException e) {
+                  e.printStackTrace();
+              }
+          }
+      }
+      return Result.ok("文件导入失败!");
+  }
+
+}

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

@@ -0,0 +1,119 @@
+package cn.com.ctop.kuaishou.modules.report.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 代理商报表
+ * @author jeecg-boot
+ * @date   2019-12-13
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_kuaishou_report_daily_agent")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_kuaishou_report_daily_agent对象", description="代理商报表")
+public class KuaishouReportDailyAgent {
+
+	/**日期*/
+	@Excel(name = "日期", width = 15, format = "yyyy-MM-dd")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+	@DateTimeFormat(pattern="yyyy-MM-dd")
+	@ApiModelProperty(value = "日期")
+	@TableId(type = IdType.INPUT)
+	private java.util.Date date;
+	/**账户ID*/
+	@Excel(name = "账户ID", width = 15)
+	@ApiModelProperty(value = "账户ID")
+	@TableId(type = IdType.INPUT)
+	private java.lang.Integer accountId;
+	/**快手ID*/
+	@Excel(name = "快手ID", width = 15)
+	@ApiModelProperty(value = "快手ID")
+	private java.lang.Integer kid;
+	/**广告主名称*/
+	@Excel(name = "广告主名称", width = 15)
+	@ApiModelProperty(value = "广告主名称")
+	private java.lang.String advertiserName;
+	/**广告主创建时间*/
+	@Excel(name = "广告主创建时间", width = 15, format = "yyyy-MM-dd")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+	@DateTimeFormat(pattern="yyyy-MM-dd")
+	@ApiModelProperty(value = "广告主创建时间")
+	private java.util.Date advertiserCreateTime;
+	/**有消费计划数*/
+	@Excel(name = "有消费计划数", width = 15)
+	@ApiModelProperty(value = "有消费计划数")
+	private java.lang.Integer costCampaignCount;
+	/**总余额*/
+	@Excel(name = "总余额", width = 15)
+	@ApiModelProperty(value = "总余额")
+	private java.math.BigDecimal balance;
+	/**总消耗*/
+	@Excel(name = "总消耗", width = 15)
+	@ApiModelProperty(value = "总消耗")
+	private java.math.BigDecimal cost;
+	/**现金消耗*/
+	@Excel(name = "现金消耗", width = 15)
+	@ApiModelProperty(value = "现金消耗")
+	private java.math.BigDecimal xianjinCost;
+	/**后返消耗*/
+	@Excel(name = "后返消耗", width = 15)
+	@ApiModelProperty(value = "后返消耗")
+	private java.math.BigDecimal fandianCost;
+	/**框返消耗*/
+	@Excel(name = "框返消耗", width = 15)
+	@ApiModelProperty(value = "框返消耗")
+	private java.math.BigDecimal kuangfanCost;
+	/**激励账户消耗*/
+	@Excel(name = "激励账户消耗", width = 15)
+	@ApiModelProperty(value = "激励账户消耗")
+	private java.math.BigDecimal jiliCost;
+	/**信用账户消耗*/
+	@Excel(name = "信用账户消耗", width = 15)
+	@ApiModelProperty(value = "信用账户消耗")
+	private java.math.BigDecimal xinyongCost;
+	/**封面曝光数*/
+	@Excel(name = "封面曝光数", width = 15)
+	@ApiModelProperty(value = "封面曝光数")
+	private java.lang.Integer fengmianShowCount;
+	/**封面点击数*/
+	@Excel(name = "封面点击数", width = 15)
+	@ApiModelProperty(value = "封面点击数")
+	private java.lang.Integer fengmianClickCount;
+	/**素材曝光数*/
+	@Excel(name = "素材曝光数", width = 15)
+	@ApiModelProperty(value = "素材曝光数")
+	private java.lang.Integer sucaiShowCount;
+	/**行为数*/
+	@Excel(name = "行为数", width = 15)
+	@ApiModelProperty(value = "行为数")
+	private java.lang.Integer convertCount;
+	/**封面点击率*/
+	@Excel(name = "封面点击率", width = 15)
+	@ApiModelProperty(value = "封面点击率")
+	private java.math.BigDecimal fengmianClickRate;
+	/**转化点击率*/
+	@Excel(name = "转化点击率", width = 15)
+	@ApiModelProperty(value = "转化点击率")
+	private java.math.BigDecimal convertClickRate;
+	/**创建时间*/
+	@ApiModelProperty(value = "创建时间")
+	private java.util.Date createTime;
+	/**修改时间*/
+	@ApiModelProperty(value = "修改时间")
+	private java.util.Date updateTime;
+}

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

@@ -0,0 +1,100 @@
+package cn.com.ctop.kuaishou.modules.report.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 代理商日汇总表
+ * @author jeecg-boot
+ * @date   2019-12-13
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_kuaishou_report_daily_agent_sum")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_kuaishou_report_daily_agent对象", description="代理商日汇总表")
+public class KuaishouReportDailyAgentSum {
+    
+	/**日期*/
+	@Excel(name = "日期", width = 15, format = "yyyy-MM-dd")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @ApiModelProperty(value = "日期")
+	@TableId(type = IdType.INPUT)
+	private Date date;
+	/**有消费计划数*/
+	@Excel(name = "有消费计划数", width = 15)
+    @ApiModelProperty(value = "有消费计划数")
+	private Integer costCampaignCount;
+	/**总余额*/
+	@Excel(name = "总余额", width = 15)
+    @ApiModelProperty(value = "总余额")
+	private java.math.BigDecimal balance;
+	/**总消耗*/
+	@Excel(name = "总消耗", width = 15)
+    @ApiModelProperty(value = "总消耗")
+	private java.math.BigDecimal cost;
+	/**现金消耗*/
+	@Excel(name = "现金消耗", width = 15)
+    @ApiModelProperty(value = "现金消耗")
+	private java.math.BigDecimal xianjinCost;
+	/**后返消耗*/
+	@Excel(name = "后返消耗", width = 15)
+    @ApiModelProperty(value = "后返消耗")
+	private java.math.BigDecimal fandianCost;
+	/**框返消耗*/
+	@Excel(name = "框返消耗", width = 15)
+    @ApiModelProperty(value = "框返消耗")
+	private java.math.BigDecimal kuangfanCost;
+	/**激励账户消耗*/
+	@Excel(name = "激励账户消耗", width = 15)
+    @ApiModelProperty(value = "激励账户消耗")
+	private java.math.BigDecimal jiliCost;
+	/**信用账户消耗*/
+	@Excel(name = "信用账户消耗", width = 15)
+    @ApiModelProperty(value = "信用账户消耗")
+	private java.math.BigDecimal xinyongCost;
+	/**封面曝光数*/
+	@Excel(name = "封面曝光数", width = 15)
+    @ApiModelProperty(value = "封面曝光数")
+	private Integer fengmianShowCount;
+	/**封面点击数*/
+	@Excel(name = "封面点击数", width = 15)
+    @ApiModelProperty(value = "封面点击数")
+	private Integer fengmianClickCount;
+	/**素材曝光数*/
+	@Excel(name = "素材曝光数", width = 15)
+    @ApiModelProperty(value = "素材曝光数")
+	private Integer sucaiShowCount;
+	/**行为数*/
+	@Excel(name = "行为数", width = 15)
+    @ApiModelProperty(value = "行为数")
+	private Integer convertCount;
+	/**封面点击率*/
+	@Excel(name = "封面点击率", width = 15)
+    @ApiModelProperty(value = "封面点击率")
+	private java.math.BigDecimal fengmianClickRate;
+	/**转化点击率*/
+	@Excel(name = "转化点击率", width = 15)
+    @ApiModelProperty(value = "转化点击率")
+	private java.math.BigDecimal convertClickRate;
+	/**创建时间*/
+    @ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**修改时间*/
+    @ApiModelProperty(value = "修改时间")
+	private Date updateTime;
+}

+ 39 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/job/KuaishouReportAgentJob.java

@@ -0,0 +1,39 @@
+package cn.com.ctop.kuaishou.modules.report.job;
+import cn.com.ctop.common.module.utils.HttpUtils2;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.http.client.CookieStore;
+import org.apache.http.impl.client.BasicCookieStore;
+import org.apache.http.impl.cookie.BasicClientCookie;
+import org.jeecg.common.util.DateUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Cookie;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.chrome.ChromeDriver;
+import org.openqa.selenium.chrome.ChromeOptions;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+public class KuaishouReportAgentJob implements Job {
+
+    @Autowired
+    private IKuaishouReportDailyAgentService kuaishouReportDailyAgentService;
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+//        String currentDate = DateUtils.formatDate(DateUtils.addDay(new Date(),-1));
+//        kuaishouReportDailyAgentService.getReport(currentDate,currentDate);
+
+        kuaishouReportDailyAgentService.getReport("2019-01-01","2019-12-12");
+
+    }
+}

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

@@ -0,0 +1,17 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import java.util.List;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent;
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 代理商日报
+ * @author: jeecg-boot
+ * @date:   2019-12-13
+ * @cersion: V1.0
+ */
+public interface KuaishouReportDailyAgentMapper extends BaseMapper<KuaishouReportDailyAgent> {
+    public void replaceBatch(List<KuaishouReportDailyAgent> list);
+}

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

@@ -0,0 +1,17 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import java.util.List;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgentSum;
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 代理商日汇总表
+ * @author: jeecg-boot
+ * @date:   2019-12-13
+ * @cersion: V1.0
+ */
+public interface KuaishouReportDailyAgentSumMapper extends BaseMapper<KuaishouReportDailyAgentSum> {
+
+}

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

@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAgentMapper">
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_report_daily_agent(
+        `date`,
+        `account_id`,
+        `kid`,
+        `advertiser_name`,
+        `advertiser_create_time`,
+        `cost_campaign_count`,
+        `balance`,
+        `cost`,
+        `xianjin_cost`,
+        `fandian_cost`,
+        `kuangfan_cost`,
+        `jili_cost`,
+        `xinyong_cost`,
+        `fengmian_show_count`,
+        `fengmian_click_count`,
+        `sucai_show_count`,
+        `convert_count`,
+        `fengmian_click_rate`,
+        `convert_click_rate`
+        )
+        values
+        <foreach collection="list" item="agent" separator=",">
+            (#{agent.date},
+            #{agent.accountId},
+            #{agent.kid},
+            #{agent.advertiserName},
+            #{agent.advertiserCreateTime},
+            #{agent.costCampaignCount},
+            #{agent.balance},
+            #{agent.cost},
+            #{agent.xianjinCost},
+            #{agent.fandianCost},
+            #{agent.kuangfanCost},
+            #{agent.jiliCost},
+            #{agent.xinyongCost},
+            #{agent.fengmianShowCount},
+            #{agent.fengmianClickCount},
+            #{agent.sucaiShowCount},
+            #{agent.convertCount},
+            #{agent.fengmianClickRate},
+            #{agent.convertClickRate})
+        </foreach>
+    </insert>
+</mapper>

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

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

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

@@ -0,0 +1,17 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 代理商日报
+ * @author jeecg-boot
+ * @date   2019-12-13
+ * @version V1.0
+ */
+public interface IKuaishouReportDailyAgentService extends IService<KuaishouReportDailyAgent> {
+    public void replaceBatch(List<KuaishouReportDailyAgent> list);
+    public void getReport(String startDate,String endDate);
+}

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

@@ -0,0 +1,14 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgentSum;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 代理商日汇总表
+ * @author jeecg-boot
+ * @date   2019-12-13
+ * @version V1.0
+ */
+public interface IKuaishouReportDailyAgentSumService extends IService<KuaishouReportDailyAgentSum> {
+
+}

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

@@ -0,0 +1,185 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+import cn.com.ctop.common.module.utils.HttpUtils2;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgentSum;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAgentMapper;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAgentSumMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.http.client.CookieStore;
+import org.apache.http.impl.client.BasicCookieStore;
+import org.apache.http.impl.cookie.BasicClientCookie;
+import org.jeecg.common.util.DateUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Cookie;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.chrome.ChromeDriver;
+import org.openqa.selenium.chrome.ChromeOptions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * 代理商日报
+ * @author jeecg-boot
+ * @date   2019-12-13
+ * @version V1.0
+ */
+@Service
+public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouReportDailyAgentMapper, KuaishouReportDailyAgent> implements IKuaishouReportDailyAgentService {
+    @Autowired
+    private KuaishouReportDailyAgentMapper kuaishouReportDailyAgentMapper;
+    @Autowired
+    private KuaishouReportDailyAgentSumMapper kuaishouReportDailyAgentSumMapper;
+    @Value("${jeecg.path.chrome-driver}")
+    private String chromeDriver;
+    @Override
+    public void replaceBatch(List<KuaishouReportDailyAgent> list) {
+        kuaishouReportDailyAgentMapper.replaceBatch(list);
+    }
+
+    public void getReport(String startDate,String endDate){
+        System.getProperties().setProperty("webdriver.chrome.driver", "D:/chromedriver.exe");
+        String url = "https://agent.e.kuaishou.com";
+        ChromeOptions chromeOptions = new ChromeOptions();
+        chromeOptions.addArguments("--headless");
+        chromeOptions.addArguments("--incognito");
+        chromeOptions.addArguments("--disable-gpu");
+        chromeOptions.addArguments("--window-size=1920,1080");
+        chromeOptions.addArguments("--user-agent=" + HttpUtils2.USER_AGENT);
+        chromeOptions.setAcceptInsecureCerts(true);
+        WebDriver webDriver = new ChromeDriver(chromeOptions);
+        try {
+            Thread.sleep(3000L);
+            HttpUtils2.cookieStore = new BasicCookieStore();
+            webDriver.manage().deleteAllCookies();
+            //获取登录页面
+            webDriver.get(url);
+            Thread.sleep(3000L);
+            WebElement accountElement = webDriver.findElement(By.xpath("//div[@class='phone ']/input[@type='text']"));
+            accountElement.sendKeys("17718376864");
+            Thread.sleep(3000L);
+            WebElement passwordElement = webDriver.findElement(By.xpath("//div[@class='password ']/input[@type='password']"));
+            passwordElement.sendKeys("hcstbaoliang567");
+            WebElement loginElement = webDriver.findElement(By.xpath("//div[@class='foot']"));
+            Thread.sleep(3000L);
+            //点击登录
+            loginElement.click();
+            Thread.sleep(3000L);
+            Map<String,String> headerMap = new HashMap<String,String>();
+            headerMap.put("Accept","application/json");
+            headerMap.put("Accept-Encoding","gzip, deflate, br");
+            headerMap.put("Accept-Language","zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
+            headerMap.put("Connection","keep-alive");
+            headerMap.put("Host","agent.e.kuaishou.com");
+            headerMap.put("Referer","https://agent.e.kuaishou.com/");
+            headerMap.put("Content-Type","application/json;charset=utf-8");
+            headerMap.put("User-Agent",HttpUtils2.USER_AGENT);
+            Set<Cookie> cookies = webDriver.manage().getCookies();
+            Iterator iterator = cookies.iterator();
+            CookieStore cookieStore = new BasicCookieStore();
+            while (iterator.hasNext()) {
+                String cookieStr = iterator.next().toString();
+                String[] cookieArray = cookieStr.split(";");
+                Map<String, String> cookieMap = new HashMap<String, String>();
+                for (String cookie : cookieArray) {
+                    String[] kv = cookie.split("=");
+                    if (kv.length > 1) {
+                        cookieMap.put(kv[0].trim(), kv[1].trim());
+                    }
+                }
+                BasicClientCookie clientCookie = new BasicClientCookie(cookieArray[0].split("=")[0],
+                        cookieArray[0].split("=")[1]);
+                clientCookie.setDomain("agent.e.kuaishou.com");
+                clientCookie.setPath(cookieMap.get("path"));
+                HttpUtils2.cookieStore.addCookie(clientCookie);
+            }
+            String currentDate = startDate;
+
+            while(DateUtils.compareDate(currentDate,endDate)<=0){
+                String listUrl = "https://agent.e.kuaishou.com/rest/dsp/agent/account/data/list";
+                String postData = "{\"agentId\":403756224,\"date\":\""+currentDate+"\",\"sortKey\":\"totalCharge\",\"isAscending\":false,\"pageInfo\":{\"totalCount\":1616,\"currentPage\":1,\"pageSize\":999999}}";
+                String result = HttpUtils2.httpPostRequestTest(listUrl,postData,headerMap);
+                ObjectMapper mapper = new ObjectMapper();
+                JsonNode resultNode = mapper.readTree(result);
+                Integer code = resultNode.get("result").intValue();
+                if(code == 1){
+                    Iterator<JsonNode> iterator1 = resultNode.get("data").elements();
+                    int i = 0;
+                    List<KuaishouReportDailyAgent> reportList = new ArrayList<>();
+                    while (iterator1.hasNext()){
+                        JsonNode dataNode = iterator1.next();
+                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                        if(i == 0){
+                            KuaishouReportDailyAgentSum kuaishouReportDailyAgentSum = new KuaishouReportDailyAgentSum();
+                            kuaishouReportDailyAgentSum.setBalance(dataNode.get("totalBalanceDouble").decimalValue());
+                            kuaishouReportDailyAgentSum.setConvertClickRate(dataNode.get("actionbarClickRatio").decimalValue());
+                            kuaishouReportDailyAgentSum.setConvertCount(dataNode.get("actionbarClick").asInt());
+                            kuaishouReportDailyAgentSum.setCost(dataNode.get("totalChargedInYuan").decimalValue());
+                            kuaishouReportDailyAgentSum.setCostCampaignCount(dataNode.get("chargedCampaignCount").asInt());
+                            kuaishouReportDailyAgentSum.setDate(sdf.parse(currentDate));
+                            kuaishouReportDailyAgentSum.setFengmianClickCount(dataNode.get("adPhotoClick").asInt());
+                            kuaishouReportDailyAgentSum.setFengmianClickRate(dataNode.get("clickRatio").decimalValue());
+                            kuaishouReportDailyAgentSum.setFengmianShowCount(dataNode.get("impression").asInt());
+                            kuaishouReportDailyAgentSum.setFandianCost(dataNode.get("rebateRealChargedInYuan").decimalValue());
+                            kuaishouReportDailyAgentSum.setJiliCost(dataNode.get("directRebateRealChargedInYuan").decimalValue());
+                            kuaishouReportDailyAgentSum.setKuangfanCost(dataNode.get("contractRebateRealChargedInYuan").decimalValue());
+                            kuaishouReportDailyAgentSum.setSucaiShowCount(dataNode.get("click").asInt());
+                            kuaishouReportDailyAgentSum.setXianjinCost(dataNode.get("realChargedInYuan").decimalValue());
+                            kuaishouReportDailyAgentSum.setXinyongCost(dataNode.get("creditRealChargedInYuan").decimalValue());
+                            QueryWrapper<KuaishouReportDailyAgentSum> queryWrapper = new QueryWrapper<>();
+                            queryWrapper.eq("date",currentDate);
+                            kuaishouReportDailyAgentSumMapper.delete(queryWrapper);
+                            kuaishouReportDailyAgentSumMapper.insert(kuaishouReportDailyAgentSum);
+                        }else {
+                            KuaishouReportDailyAgent kuaishouReportDailyAgent = new KuaishouReportDailyAgent();
+                            kuaishouReportDailyAgent.setAccountId(dataNode.get("accountId").asInt());
+                            kuaishouReportDailyAgent.setAdvertiserCreateTime(new Date(dataNode.get("createTime").asLong()));
+                            kuaishouReportDailyAgent.setAdvertiserName(dataNode.get("accountName").asText());
+                            kuaishouReportDailyAgent.setBalance(dataNode.get("totalBalanceDouble").decimalValue());
+                            kuaishouReportDailyAgent.setConvertClickRate(dataNode.get("actionbarClickRatio").decimalValue());
+                            kuaishouReportDailyAgent.setConvertCount(dataNode.get("actionbarClick").asInt());
+                            kuaishouReportDailyAgent.setCost(dataNode.get("totalChargedInYuan").decimalValue());
+                            kuaishouReportDailyAgent.setCostCampaignCount(dataNode.get("chargedCampaignCount").asInt());
+                            kuaishouReportDailyAgent.setDate(sdf.parse(dataNode.get("dateTime").asText()));
+                            kuaishouReportDailyAgent.setFengmianClickCount(dataNode.get("adPhotoClick").asInt());
+                            kuaishouReportDailyAgent.setFengmianClickRate(dataNode.get("clickRatio").decimalValue());
+                            kuaishouReportDailyAgent.setFengmianShowCount(dataNode.get("impression").asInt());
+                            kuaishouReportDailyAgent.setFandianCost(dataNode.get("rebateRealChargedInYuan").decimalValue());
+                            kuaishouReportDailyAgent.setJiliCost(dataNode.get("directRebateRealChargedInYuan").decimalValue());
+                            kuaishouReportDailyAgent.setKid(dataNode.get("userId").asInt());
+                            kuaishouReportDailyAgent.setKuangfanCost(dataNode.get("contractRebateRealChargedInYuan").decimalValue());
+                            kuaishouReportDailyAgent.setSucaiShowCount(dataNode.get("click").asInt());
+                            kuaishouReportDailyAgent.setXianjinCost(dataNode.get("realChargedInYuan").decimalValue());
+                            kuaishouReportDailyAgent.setXinyongCost(dataNode.get("creditRealChargedInYuan").decimalValue());
+                            reportList.add(kuaishouReportDailyAgent);
+                        }
+                        i++;
+                    }
+                    if(reportList != null && reportList.size() > 0){
+                        replaceBatch(reportList);
+                    }
+                }
+                System.out.println("代理商日报"+currentDate+"入库完成");
+                currentDate = DateUtils.addDay(currentDate,1);
+            }
+
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            webDriver.manage().deleteAllCookies();
+//            webDriver.close();
+            webDriver.quit();
+        }
+    }
+}

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgentSum;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAgentSumMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentSumService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * 代理商日汇总表
+ * @author jeecg-boot
+ * @date   2019-12-13
+ * @version V1.0
+ */
+@Service
+public class KuaishouReportDailyAgentSumServiceImpl extends ServiceImpl<KuaishouReportDailyAgentSumMapper, KuaishouReportDailyAgentSum> implements IKuaishouReportDailyAgentSumService {
+
+}

+ 21 - 2
module-report/src/main/java/cn/com/ctop/bytedance/mapper/AccountReportMapper.java

@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author jeecg-boot
@@ -26,7 +27,7 @@ public interface AccountReportMapper {
     /**
      * 今日消耗
      *
-     * @param date 日期
+     * @param date       日期
      * @param accountIds
      * @return 今日消耗
      */
@@ -36,7 +37,7 @@ public interface AccountReportMapper {
     /**
      * 查询明细
      *
-     * @param date 日期
+     * @param date       日期
      * @param accountIds
      * @return 查询明细
      */
@@ -54,6 +55,7 @@ public interface AccountReportMapper {
 
     /**
      * 查询全部消耗 包括今日消耗
+     *
      * @param accountIds
      * @return
      */
@@ -94,6 +96,7 @@ public interface AccountReportMapper {
 
     /**
      * 查询所有按月统计数据
+     *
      * @param accountIds
      * @return
      */
@@ -124,6 +127,7 @@ public interface AccountReportMapper {
 
     /**
      * 用户报表信息
+     *
      * @param accountIds
      * @param discount
      * @return
@@ -145,10 +149,25 @@ public interface AccountReportMapper {
 
     /**
      * 按月统计
+     *
      * @param startDate
      * @param endDate
      * @param accountIds
      * @return
      */
     List<JSONObject> selectDayDetailByMonth(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("accountIds") JSONArray accountIds);
+
+
+    /**
+     * 查询分天汇总
+     *
+     * @param queryMap
+     * @return
+     */
+
+    JSONObject selectSummaryByMap(Map<String, Object> queryMap);
+
+    List<JSONObject> selectReportDetailGroupAccountIdByDate(@Param("statDate") String anotherDay,@Param("accountIds") JSONArray accountIds);
+
+    JSONObject selectHourSummaryByMap(Map<String, Object> queryMap);
 }

+ 213 - 0
module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/AccountReportMapper.xml

@@ -120,6 +120,34 @@
     </select>
 
 
+    <select id="selectReportDetailGroupAccountIdByDate" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        sum(charge) cost, -- 消耗
+        sum(photo_show) photoShow, -- 封面展示
+        sum(photo_click) photoClick, -- 封面点击
+        sum(aclick) aclick, -- 素材曝光数
+        (sum(photo_click) / sum(photo_show)) photoClickRatio, -- 封面点击率
+        (sum(form_count) / sum(bclick)) cvr,
+        ((sum(charge) / (sum(photo_show)) * 1000)) cpm,
+        sum(bclick) bClick,-- 行为数
+        sum(form_count) formCount,
+        (sum(charge) / sum(form_count)) formPrice, -- 表单提交单价
+        sum(activation) activationCount, -- 激活数
+        (sum(charge) / sum(activation)) activationPrice, -- 激活单价
+        account_id accountId,
+        (select auth_name from ctop_user_allocation where account_id = accountId limit 1) accountName
+        from
+        ctop_kuaishou_report_daily_account
+        where stat_date = #{statDate}
+        and account_id in
+        <foreach item="item" index="index" collection="accountIds"
+                 open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        group by account_id;
+    </select>
+
+
     <select id="selectMaxHourByDate" resultType="java.lang.Integer">
         select
         max(stat_hour)
@@ -298,4 +326,189 @@
     </select>
 
 
+    <select id="selectSummaryByMap" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        sum(charge) cost, -- 消耗
+        (case
+        when sum(charge) != 0
+        then (sum(charge) / #{discount})
+        else 0
+        end
+        ) discountCost, -- 封面点击率
+
+        sum(photo_show) photoShow, -- 封面展示
+        sum(photo_click) photoClick, -- 封面点击
+        sum(aclick) aclick, -- 素材曝光数
+
+        (case
+        when sum(photo_show) != 0
+        then (sum(photo_click) / sum(photo_show))
+        else 0
+        end
+        ) photoClickRatio, -- 封面点击率
+
+        (case
+        when sum(bclick) != 0
+        then (sum(form_count) / sum(bclick))
+        else 0
+        end
+        ) cvr,
+
+        (case
+        when sum(photo_show) != 0
+        then ((sum(charge) / (sum(photo_show)) * 1000))
+        else 0
+        end
+        ) cpm,
+
+        sum(bclick) bClick,-- 行为数
+        (
+        CASE
+        WHEN sum(form_count) != 0 THEN
+        sum(form_count)
+        WHEN sum(activation) != 0 THEN
+        sum(activation)
+        ELSE
+        0
+        END
+        ) conversions, -- 转化数
+        (
+        CASE
+        WHEN sum(form_count) != 0 THEN
+        sum(charge) / sum(form_count)
+        WHEN sum(activation) != 0 THEN
+        sum(charge) / sum(activation)
+        ELSE
+        0
+        END
+        ) conversionPrice, -- 转化单价
+        (
+        CASE
+        WHEN sum(form_count) != 0 THEN
+        (sum(charge) / sum(form_count)) / #{discount}
+        WHEN sum(activation) != 0 THEN
+        (sum(charge) / sum(activation)) / #{discount}
+        ELSE
+        0
+        END
+        ) discountConversionPrice
+
+        from
+        ctop_kuaishou_report_daily_account
+
+        <where>
+            <if test="statDate != null">
+                and stat_date = #{statDate}
+            </if>
+            <if test="startDate != null">
+                and stat_date &gt;= #{startDate}
+            </if>
+            <if test="endDate != null">
+                and stat_date &lt;= #{endDate}
+            </if>
+
+            <if test="accountIds != null">
+                and account_id in
+                <foreach collection="accountIds" item="item" separator=","
+                         open="(" close=")">
+                    #{item}
+                </foreach>
+
+            </if>
+        </where>
+    </select>
+
+
+    <select id="selectHourSummaryByMap" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
+
+        select
+        sum(charge) cost, -- 消耗
+        (case
+        when sum(charge) != 0
+        then (sum(charge) / #{discount})
+        else 0
+        end
+        ) discountCost, -- 封面点击率
+
+        sum(photo_show) photoShow, -- 封面展示
+        sum(photo_click) photoClick, -- 封面点击
+        sum(aclick) aclick, -- 素材曝光数
+
+        (case
+        when sum(photo_show) != 0
+        then (sum(photo_click) / sum(photo_show))
+        else 0
+        end
+        ) photoClickRatio, -- 封面点击率
+
+        (case
+        when sum(bclick) != 0
+        then (sum(form_count) / sum(bclick))
+        else 0
+        end
+        ) cvr,
+
+        (case
+        when sum(photo_show) != 0
+        then ((sum(charge) / (sum(photo_show)) * 1000))
+        else 0
+        end
+        ) cpm,
+
+        sum(bclick) bClick,-- 行为数
+        (
+        CASE
+        WHEN sum(form_count) != 0 THEN
+        sum(form_count)
+        WHEN sum(activation) != 0 THEN
+        sum(activation)
+        ELSE
+        0
+        END
+        ) conversions, -- 转化数
+        (
+        CASE
+        WHEN sum(form_count) != 0 THEN
+        sum(charge) / sum(form_count)
+        WHEN sum(activation) != 0 THEN
+        sum(charge) / sum(activation)
+        ELSE
+        0
+        END
+        ) conversionPrice, -- 转化单价
+        (
+        CASE
+        WHEN sum(form_count) != 0 THEN
+        (sum(charge) / sum(form_count)) / #{discount}
+        WHEN sum(activation) != 0 THEN
+        (sum(charge) / sum(activation)) / #{discount}
+        ELSE
+        0
+        END
+        ) discountConversionPrice
+
+        from
+        ctop_kuaishou_report_hourly_account
+
+        <where>
+            <if test="statDate != null">
+                and stat_date = #{statDate}
+            </if>
+            <if test="statHour != null">
+                and stat_hour &lt;= #{statHour}
+            </if>
+
+            <if test="accountIds != null">
+                and account_id in
+                <foreach collection="accountIds" item="item" separator=","
+                         open="(" close=")">
+                    #{item}
+                </foreach>
+
+            </if>
+        </where>
+
+
+    </select>
+
 </mapper>

+ 56 - 1
module-report/src/main/java/cn/com/ctop/bytedance/service/impl/AccountReportServiceImpl.java

@@ -12,7 +12,9 @@ import org.springframework.stereotype.Service;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author yumeng
@@ -257,6 +259,9 @@ public class AccountReportServiceImpl implements IAccountReportService {
                 return null;
             }
 
+            Map<String, Object> queryMap = new HashMap<>();
+            queryMap.put("discount", discount);
+            String statDate = "";
             List<JSONObject> accountDetail = new ArrayList<>();
             Integer statHour = json.getInteger("statHour");
             Integer hour;
@@ -270,6 +275,7 @@ public class AccountReportServiceImpl implements IAccountReportService {
                 }
                 JSONObject chainRatioJson = new JSONObject();
                 accountDetail = accountReportMapper.selectReportDetailGroupAccountId(nowDate, accountIds, hour);
+                statDate = nowDate;
                 JSONObject nowAccountSummary = accountReportMapper.selectSummaryByAccountId(nowDate, accountIds, hour, discount);
                 if (!Check.isNull(nowAccountSummary)) {
                     returnJson.put("now", nowAccountSummary);
@@ -493,33 +499,82 @@ public class AccountReportServiceImpl implements IAccountReportService {
                     }
                 }
             } else if (type == 2) {
+                queryMap.put("statDate", anotherDay);
+                queryMap.put("accountIds", accountIds);
+                JSONObject ratioJson;
                 if (Check.isNull(statHour)) {
-                    accountDetail = accountReportMapper.selectReportDetailGroupAccountId(anotherDay, accountIds, 23);
+                    accountDetail = accountReportMapper.selectReportDetailGroupAccountIdByDate(anotherDay, accountIds);
+                    statDate = anotherDay;
+                    ratioJson = accountReportMapper.selectSummaryByMap(queryMap);
+
                 } else {
                     accountDetail = accountReportMapper.selectReportDetailGroupAccountId(anotherDay, accountIds, statHour);
+                    queryMap.put("statHour", statHour);
+                    statDate = anotherDay;
+                    ratioJson = accountReportMapper.selectHourSummaryByMap(queryMap);
                 }
+
+                returnJson.put("ratioJson", ratioJson);
             } else if (type == 3) {
                 String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", anotherDay, -7);
                 accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
+                statDate = endDate + " ~ " + anotherDay;
+
+
+                queryMap.put("startDate", endDate);
+                queryMap.put("endDate", anotherDay);
+                queryMap.put("accountIds", accountIds);
+
+
             } else if (type == 4) {
                 String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", anotherDay, -15);
                 accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
+                statDate = endDate + " ~ " + anotherDay;
+                queryMap.put("startDate", endDate);
+                queryMap.put("endDate", anotherDay);
+                queryMap.put("accountIds", accountIds);
+
             } else if (type == 5) {
                 String endDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -1);
                 accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
+                statDate = endDate + " ~ " + anotherDay;
+                queryMap.put("startDate", endDate);
+                queryMap.put("endDate", anotherDay);
+                queryMap.put("accountIds", accountIds);
             } else if (type == 6) {
                 String endDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -3);
                 accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
+                statDate = endDate + " ~ " + anotherDay;
+                queryMap.put("startDate", endDate);
+                queryMap.put("endDate", anotherDay);
+                queryMap.put("accountIds", accountIds);
             } else if (type == 7) {
                 String endDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -6);
                 accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
+                statDate = endDate + " ~ " + anotherDay;
+                queryMap.put("startDate", endDate);
+                queryMap.put("endDate", anotherDay);
+                queryMap.put("accountIds", accountIds);
             } else if (type == 8) {
                 accountDetail = accountReportMapper.selectAccountReport(accountIds, discount);
+                statDate = "合计";
+                queryMap.put("accountIds", accountIds);
             } else if (type == 9) {
                 String startDate = json.getString("startDate");
                 String endDate = json.getString("endDate");
                 accountDetail = accountReportMapper.selectAccountReportByDate(startDate, endDate, accountIds, discount);
+                statDate = endDate + " ~ " + startDate;
+                queryMap.put("startDate", endDate);
+                queryMap.put("endDate", startDate);
+                queryMap.put("accountIds", accountIds);
             }
+
+            if ((type != 1 && type != 2) && type != null) {
+                JSONObject ratioJson = accountReportMapper.selectSummaryByMap(queryMap);
+                returnJson.put("ratioJson", ratioJson);
+            }
+
+            returnJson.put("statDate", statDate);
             returnJson.put("accountDetail", accountDetail);
         } catch (Exception e) {
             e.printStackTrace();

+ 1 - 3
module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceAdvertiserDataServiceImpl.java

@@ -71,9 +71,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         }
         for (int i = 0; i < data.size(); i++) {
             JSONObject dataObject = data.getJSONObject(i);
-            ByteDanceAdvertiser advertiser = new ByteDanceAdvertiser(dataObject, accountId);
-            advertiserService.saveOrUpdate(advertiser);
-            resultMap.put("data", advertiser);
+            resultMap.put("name", dataObject.getString("name"));
         }
         resultMap.put("success", true);
         resultMap.put("code", 0);

+ 3 - 2
module-toutiao/src/main/resources/bytedance_config.properties

@@ -1,6 +1,8 @@
 #release
 bytedance_appid=1635316529903624
+# bytedance_appid=1634953881401358
 bytedance_secret=0c51523e90d6166418fc8421a4896808e90e26f4
+# bytedance_secret=34bc59f53955c66871ce111a1f15a6051cfa3f12
 #release
 bytedance_api_url=https://ad.oceanengine.com/open_api
 bytedance_auth_url=https://ad.oceanengine.com/openapi
@@ -9,7 +11,7 @@ bytedance_auth_url=https://ad.oceanengine.com/openapi
 #bytedance_auth_url=https://test-ad.toutiao.com/open_api
 #bytedance_callback_url=http://callback.c-top.com.cn/bytedance
 bytedance_callback_url=http://adsp.c-top.com.cn:8080/jeecg-boot/bytedance
-bytedance_v2_advertiser_info=/2/advertiser/info
+bytedance_v2_advertiser_info=/2/advertiser/public_info/
 bytedance_v2_ad_get=/2/ad/get
 bytedance_v2_ad_create=/2/ad/create/
 bytedance_v2_ad_update_status=/2/ad/update/status
@@ -22,7 +24,6 @@ bytedance_v2_campaign_update=/2/campaign/update
 bytedance_v2_dmp_custom_audience_select=/2/dmp/custom_audience/select/
 bytedance_v2_file_video_ad=/2/file/video/ad/
 bytedance_v2_file_image_ad=/2/file/image/ad/
-
 bytedance_v2_creative_update_status=/2/creative/update/status/
 bytedance_v2_creative_material_get=/2/creative/material/read
 bytedance_v2_creative_create_v2=/2/creative/create_v2/

+ 243 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/controller/UserEfficientVideoMapController.java

@@ -0,0 +1,243 @@
+package cn.com.ctop.userefficientvideomap.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.util.oConvertUtils;
+import cn.com.ctop.userefficientvideomap.entity.UserEfficientVideoMap;
+import cn.com.ctop.userefficientvideomap.service.IUserEfficientVideoMapService;
+import java.util.Date;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+ /**
+ * 有效视频与角色对应表
+ * @author jeecg-boot
+ * @date   2019-12-16
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="有效视频与角色对应表")
+@RestController
+@RequestMapping("/userefficientvideomap/userEfficientVideoMap")
+public class UserEfficientVideoMapController {
+	@Autowired
+	private IUserEfficientVideoMapService userEfficientVideoMapService;
+	
+	/**
+	  * 分页列表查询
+	 * @param userEfficientVideoMap
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@AutoLog(value = "有效视频与角色对应表-分页列表查询")
+	@ApiOperation(value="有效视频与角色对应表-分页列表查询", notes="有效视频与角色对应表-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<UserEfficientVideoMap>> queryPageList(UserEfficientVideoMap userEfficientVideoMap,
+									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+									  HttpServletRequest req) {
+		Result<IPage<UserEfficientVideoMap>> result = new Result<IPage<UserEfficientVideoMap>>();
+		QueryWrapper<UserEfficientVideoMap> queryWrapper = QueryGenerator.initQueryWrapper(userEfficientVideoMap, req.getParameterMap());
+		Page<UserEfficientVideoMap> page = new Page<UserEfficientVideoMap>(pageNo, pageSize);
+		IPage<UserEfficientVideoMap> pageList = userEfficientVideoMapService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+	
+	/**
+	  *   添加
+	 * @param userEfficientVideoMap
+	 * @return
+	 */
+	@AutoLog(value = "有效视频与角色对应表-添加")
+	@ApiOperation(value="有效视频与角色对应表-添加", notes="有效视频与角色对应表-添加")
+	@PostMapping(value = "/add")
+	public Result<UserEfficientVideoMap> add(@RequestBody UserEfficientVideoMap userEfficientVideoMap) {
+		Result<UserEfficientVideoMap> result = new Result<UserEfficientVideoMap>();
+		try {
+			userEfficientVideoMapService.save(userEfficientVideoMap);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+	
+	/**
+	  *  编辑
+	 * @param userEfficientVideoMap
+	 * @return
+	 */
+	@AutoLog(value = "有效视频与角色对应表-编辑")
+	@ApiOperation(value="有效视频与角色对应表-编辑", notes="有效视频与角色对应表-编辑")
+	@PutMapping(value = "/edit")
+	public Result<UserEfficientVideoMap> edit(@RequestBody UserEfficientVideoMap userEfficientVideoMap) {
+		Result<UserEfficientVideoMap> result = new Result<UserEfficientVideoMap>();
+		UserEfficientVideoMap userEfficientVideoMapEntity = userEfficientVideoMapService.getById(userEfficientVideoMap.getId());
+		if(userEfficientVideoMapEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = userEfficientVideoMapService.updateById(userEfficientVideoMap);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+		
+		return result;
+	}
+	
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "有效视频与角色对应表-通过id删除")
+	@ApiOperation(value="有效视频与角色对应表-通过id删除", notes="有效视频与角色对应表-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			userEfficientVideoMapService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+	
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "有效视频与角色对应表-批量删除")
+	@ApiOperation(value="有效视频与角色对应表-批量删除", notes="有效视频与角色对应表-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<UserEfficientVideoMap> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<UserEfficientVideoMap> result = new Result<UserEfficientVideoMap>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.userEfficientVideoMapService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+	
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "有效视频与角色对应表-通过id查询")
+	@ApiOperation(value="有效视频与角色对应表-通过id查询", notes="有效视频与角色对应表-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<UserEfficientVideoMap> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<UserEfficientVideoMap> result = new Result<UserEfficientVideoMap>();
+		UserEfficientVideoMap userEfficientVideoMap = userEfficientVideoMapService.getById(id);
+		if(userEfficientVideoMap==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(userEfficientVideoMap);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<UserEfficientVideoMap> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              UserEfficientVideoMap userEfficientVideoMap = JSON.parseObject(deString, UserEfficientVideoMap.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(userEfficientVideoMap, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<UserEfficientVideoMap> pageList = userEfficientVideoMapService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "有效视频与角色对应表列表");
+      mv.addObject(NormalExcelConstants.CLASS, UserEfficientVideoMap.class);
+      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("有效视频与角色对应表列表数据", "导出人:Jeecg", "导出信息"));
+      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+      return mv;
+  }
+
+  /**
+      * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+          MultipartFile file = entity.getValue();
+          ImportParams params = new ImportParams();
+          params.setTitleRows(2);
+          params.setHeadRows(1);
+          params.setNeedSave(true);
+          try {
+              List<UserEfficientVideoMap> listUserEfficientVideoMaps = ExcelImportUtil.importExcel(file.getInputStream(), UserEfficientVideoMap.class, params);
+              userEfficientVideoMapService.saveBatch(listUserEfficientVideoMaps);
+              return Result.ok("文件导入成功!数据行数:" + listUserEfficientVideoMaps.size());
+          } catch (Exception e) {
+              log.error(e.getMessage(),e);
+              return Result.error("文件导入失败:"+e.getMessage());
+          } finally {
+              try {
+                  file.getInputStream().close();
+              } catch (IOException e) {
+                  e.printStackTrace();
+              }
+          }
+      }
+      return Result.ok("文件导入失败!");
+  }
+
+}

+ 65 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/UserEfficientVideoMap.java

@@ -0,0 +1,65 @@
+package cn.com.ctop.userefficientvideomap.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 有效视频与角色对应表
+ * @author jeecg-boot
+ * @date   2019-12-16
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_user_efficient_video_map")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_user_efficient_video_map对象", description="有效视频与角色对应表")
+public class UserEfficientVideoMap {
+
+	/**id*/
+	@TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+	private Integer id;
+	/**有效视频md5*/
+	@Excel(name = "有效视频md5", width = 15)
+    @ApiModelProperty(value = "有效视频md5")
+	private String efficientVideoSignature;
+	/**角色id*/
+	@Excel(name = "角色id", width = 15)
+    @ApiModelProperty(value = "角色id")
+	private String roleId;
+	/**用户id*/
+	@Excel(name = "用户id", width = 15)
+    @ApiModelProperty(value = "用户id")
+	private String userId;
+	/**季度*/
+	@Excel(name = "季度", width = 15)
+    @ApiModelProperty(value = "季度")
+	private Integer quarter;
+	/**年*/
+	@Excel(name = "年", width = 15)
+    @ApiModelProperty(value = "年")
+	private Integer year;
+	/**媒体类型1_快手2_头条*/
+	@Excel(name = "媒体类型1_快手2_头条", width = 15)
+    @ApiModelProperty(value = "媒体类型1_快手2_头条")
+	private Integer appType;
+	/**createTime*/
+    @ApiModelProperty(value = "createTime")
+	private Date createTime;
+	/**updateTime*/
+    @ApiModelProperty(value = "updateTime")
+	private Date updateTime;
+}

+ 17 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/UserEfficientVideoMapMapper.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.userefficientvideomap.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import cn.com.ctop.userefficientvideomap.entity.UserEfficientVideoMap;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 有效视频与角色对应表
+ * @author: jeecg-boot
+ * @date:   2019-12-16
+ * @cersion: V1.0
+ */
+public interface UserEfficientVideoMapMapper extends BaseMapper<UserEfficientVideoMap> {
+
+}

+ 5 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml

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

+ 14 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/service/IUserEfficientVideoMapService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.userefficientvideomap.service;
+
+import cn.com.ctop.userefficientvideomap.entity.UserEfficientVideoMap;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 有效视频与角色对应表
+ * @author jeecg-boot
+ * @date   2019-12-16
+ * @version V1.0
+ */
+public interface IUserEfficientVideoMapService extends IService<UserEfficientVideoMap> {
+
+}

+ 19 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/service/impl/UserEfficientVideoMapServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.userefficientvideomap.service.impl;
+
+import cn.com.ctop.userefficientvideomap.entity.UserEfficientVideoMap;
+import cn.com.ctop.userefficientvideomap.mapper.UserEfficientVideoMapMapper;
+import cn.com.ctop.userefficientvideomap.service.IUserEfficientVideoMapService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * 有效视频与角色对应表
+ * @author jeecg-boot
+ * @date   2019-12-16
+ * @version V1.0
+ */
+@Service
+public class UserEfficientVideoMapServiceImpl extends ServiceImpl<UserEfficientVideoMapMapper, UserEfficientVideoMap> implements IUserEfficientVideoMapService {
+
+}