Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

xuzuoyun 5 gadi atpakaļ
vecāks
revīzija
b96c208c00
74 mainītis faili ar 715 papildinājumiem un 272 dzēšanām
  1. 2 2
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/query/QueryGenerator.java
  2. 6 6
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  3. 2 2
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MD5Util.java
  4. 1 1
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/PasswordUtil.java
  5. 1 1
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/SpringContextUtils.java
  6. 2 2
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java
  7. 5 5
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/oConvertUtils.java
  8. 5 0
      jeecg-boot-module-system/pom.xml
  9. 5 5
      jeecg-boot-module-system/src/main/java/org/jeecg/config/mybatis/MybatisInterceptor.java
  10. 10 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceTemplateController.java
  11. 9 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  12. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CrawlerController.java
  13. 4 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouAdvertiserController.java
  14. 29 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ReportController.java
  15. 4 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  16. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  17. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BindAccountAuth.java
  18. 2 8
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceAdvertisePlan.java
  19. 5 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceAdvertiser.java
  20. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceAdvertiserBudget.java
  21. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceBudgetTemplate.java
  22. 9 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceCampaign.java
  23. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceCampaignTemplate.java
  24. 3 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceCreative.java
  25. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceCreativeTemplate.java
  26. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceImageInfo.java
  27. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceUserOrientationTemplate.java
  28. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceVideoInfo.java
  29. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BytedanceAdvertisePlanTemplate.java
  30. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BytedanceDeliveryTargetTemplate.java
  31. 7 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/CTopOauthToken.java
  32. 47 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/FileInfo.java
  33. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/UserAllocation.java
  34. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IFileInfoService.java
  35. 11 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IReportService.java
  36. 4 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BindAccountAuthServiceImpl.java
  37. 5 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceAdvertisePlanServiceImpl.java
  38. 19 26
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceAdvertiserDataServiceImpl.java
  39. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceBudgetTemplateServiceImpl.java
  40. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceCampaignTemplateServiceImpl.java
  41. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BytedanceAdvertisePlanTemplateServiceImpl.java
  42. 5 63
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BytedanceDeliveryTargetTemplateServiceImpl.java
  43. 5 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BytedanceUrlInfoServiceImpl.java
  44. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreateInternalServiceImpl.java
  45. 169 29
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/FileInfoServiceImpl.java
  46. 102 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ReportServiceImpl.java
  47. 44 15
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/fileupload/service/impl/UploadServiceImpl.java
  48. 0 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouController.java
  49. 9 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaishouInterfaceServiceImpl.java
  50. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/shiro/authc/ShiroRealm.java
  51. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/aspect/DictAspect.java
  52. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysPermissionController.java
  53. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysPermissionDataRuleImpl.java
  54. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysRolePermissionServiceImpl.java
  55. 4 2
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  56. 2 0
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  57. 1 1
      jeecg-boot-module-system/src/main/resources/application.yml
  58. 6 0
      module-common/pom.xml
  59. 2 1
      module-common/src/main/java/cn/com/ctop/common/utils/Base64Utils.java
  60. 1 0
      module-common/src/main/java/cn/com/ctop/common/utils/HttpUtils.java
  61. 1 0
      module-common/src/main/java/cn/com/ctop/common/utils/HttpUtils2.java
  62. 15 14
      module-common/src/main/java/cn/com/ctop/common/utils/OSSUtils.java
  63. 5 2
      module-common/src/main/java/cn/com/ctop/common/utils/TransfMediaTool.java
  64. 6 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/account/service/impl/KuaishouAdAccountServiceImpl.java
  65. 14 7
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/service/impl/KuaishouCrawlerServiceImpl.java
  66. 25 16
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/FateadmHttpUtil.java
  67. 4 4
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/FateadmUtil.java
  68. 4 3
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/KuaishouUtil.java
  69. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/service/impl/AppAdServiceImpl.java
  70. 9 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/service/impl/KuaishouAppServiceImpl.java
  71. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/KuaishouTest.java
  72. 12 8
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java
  73. 1 1
      module-kuaishou/src/main/resources/kuaishou_config.properties
  74. 3 3
      module-toutiao/src/main/java/cn/com/ctop/toutiao/test/Test.java

+ 2 - 2
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/query/QueryGenerator.java

@@ -84,7 +84,7 @@ public class QueryGenerator {
 		*/
 		
 		//区间条件组装 模糊查询 高级查询组装 简单排序 权限查询
-		PropertyDescriptor origDescriptors[] = PropertyUtils.getPropertyDescriptors(searchObj);
+		PropertyDescriptor[] origDescriptors = PropertyUtils.getPropertyDescriptors(searchObj);
 		Map<String,SysPermissionDataRule> ruleMap = getRuleMap();
 		
 		//权限规则自定义SQL表达式
@@ -564,7 +564,7 @@ public class QueryGenerator {
 	
 	private static String getInConditionValue(Object value,boolean isString) {
 		if(isString) {
-			String temp[] = value.toString().split(",");
+			String[] temp = value.toString().split(",");
 			String res="";
 			for (String string : temp) {
 				res+=",'"+string+"'";

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

@@ -156,14 +156,14 @@ public class DateUtils extends PropertyEditorSupport {
      */
     public static String dateformat(String date, String format) {
         SimpleDateFormat sformat = new SimpleDateFormat(format);
-        Date _date = null;
+        Date getDate = null;
         try {
-            _date = sformat.parse(date);
+            getDate = sformat.parse(date);
         } catch (ParseException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         }
-        return sformat.format(_date);
+        return sformat.format(getDate);
     }
 
     /**
@@ -565,7 +565,7 @@ public class DateUtils extends PropertyEditorSupport {
         long millisDiff = getMillis(calSrc) - getMillis(calDes);
 
         if (flag == 'y') {
-            return (calSrc.get(calSrc.YEAR) - calDes.get(calDes.YEAR));
+            return (calSrc.get(Calendar.YEAR) - calDes.get(Calendar.YEAR));
         }
 
         if (flag == 'd') {
@@ -596,9 +596,9 @@ public class DateUtils extends PropertyEditorSupport {
         if (StringUtils.hasText(text)) {
             try {
                 if (text.indexOf(":") == -1 && text.length() == 10) {
-                    setValue(this.date_sdf.parse(text));
+                    setValue(date_sdf.parse(text));
                 } else if (text.indexOf(":") > 0 && text.length() == 19) {
-                    setValue(this.datetimeFormat.parse(text));
+                    setValue(datetimeFormat.parse(text));
                 } else {
                     throw new IllegalArgumentException("Could not parse date, date format is error ");
                 }

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

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

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

@@ -157,7 +157,7 @@ public class PasswordUtil {
 	 * @return
 	 */
 	public static byte[] hexStringToBytes(String hexString) {
-		if (hexString == null || hexString.equals("")) {
+        if (hexString == null || "".equals(hexString)) {
 			return null;
 		}
 		hexString = hexString.toUpperCase();

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

@@ -19,7 +19,7 @@ public class SpringContextUtils implements ApplicationContextAware {
 
 	@Override
 	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
-		this.applicationContext = applicationContext;
+        SpringContextUtils.applicationContext = applicationContext;
 	}
 
 	/**

+ 2 - 2
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java

@@ -47,7 +47,7 @@ public class AesEncryptUtil {
             cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec);
             byte[] encrypted = cipher.doFinal(plaintext);
 
-            return new Base64().encodeToString(encrypted);
+            return Base64.encodeToString(encrypted);
 
         } catch (Exception e) {
             e.printStackTrace();
@@ -66,7 +66,7 @@ public class AesEncryptUtil {
      */
     public static String desEncrypt(String data, String key, String iv) throws Exception {
         try {
-            byte[] encrypted1 = new Base64().decode(data);
+            byte[] encrypted1 = Base64.decode(data);
 
             Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
             SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");

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

@@ -43,7 +43,7 @@ public class oConvertUtils {
 	}
 	
 	public static boolean isNotEmpty(Object object) {
-		if (object != null && !object.equals("") && !object.equals("null")) {
+        if (object != null && !"".equals(object) && !"null".equals(object)) {
 			return (true);
 		}
 		return (false);
@@ -68,7 +68,7 @@ public class oConvertUtils {
 
 	private static String code2code(String strIn, String sourceCode, String targetCode) {
 		String strOut = null;
-		if (strIn == null || (strIn.trim()).equals("")) {
+        if (strIn == null || "".equals(strIn.trim())) {
 			return strIn;
 		}
 		try {
@@ -398,7 +398,7 @@ public class oConvertUtils {
 		long bEnd = getIpNum("172.31.255.255");
 		long cBegin = getIpNum("192.168.0.0");
 		long cEnd = getIpNum("192.168.255.255");
-		isInnerIp = isInner(ipNum, aBegin, aEnd) || isInner(ipNum, bBegin, bEnd) || isInner(ipNum, cBegin, cEnd) || ipAddress.equals("127.0.0.1");
+        isInnerIp = isInner(ipNum, aBegin, aEnd) || isInner(ipNum, bBegin, bEnd) || isInner(ipNum, cBegin, cEnd) || "127.0.0.1".equals(ipAddress);
 		return isInnerIp;
 	}
 
@@ -440,7 +440,7 @@ public class oConvertUtils {
 			//update-end--Author:zhoujf  Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
 		}
 		// 用下划线将原始字符串分割
-		String camels[] = name.split("_");
+        String[] camels = name.split("_");
 		for (String camel : camels) {
 			// 跳过原始字符串中开头、结尾的下换线或双重下划线
 			if (camel.isEmpty()) {
@@ -469,7 +469,7 @@ public class oConvertUtils {
 	 * @return 转换后的驼峰式命名的字符串
 	 */
 	public static String camelNames(String names) {
-		if(names==null||names.equals("")){
+        if (names == null || "".equals(names)) {
 			return null;
 		}
 		StringBuffer sf = new StringBuffer();

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

@@ -53,6 +53,11 @@
             <version>2.0.2</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>com.aliyun.oss</groupId>
+            <artifactId>aliyun-sdk-oss</artifactId>
+            <version>3.5.0</version>
+        </dependency>
     </dependencies>
 
     <build>

+ 5 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/config/mybatis/MybatisInterceptor.java

@@ -55,7 +55,7 @@ public class MybatisInterceptor implements Interceptor {
 						field.setAccessible(true);
 						Object local_createBy = field.get(parameter);
 						field.setAccessible(false);
-						if (local_createBy == null || local_createBy.equals("")) {
+                        if (local_createBy == null || "".equals(local_createBy)) {
 							String createBy = "jeecg";
 							if (sysUser != null) {
 								// 登录账号
@@ -73,7 +73,7 @@ public class MybatisInterceptor implements Interceptor {
 						field.setAccessible(true);
 						Object local_createDate = field.get(parameter);
 						field.setAccessible(false);
-						if (local_createDate == null || local_createDate.equals("")) {
+                        if (local_createDate == null || "".equals(local_createDate)) {
 							field.setAccessible(true);
 							field.set(parameter, new Date());
 							field.setAccessible(false);
@@ -84,7 +84,7 @@ public class MybatisInterceptor implements Interceptor {
 						field.setAccessible(true);
 						Object local_sysOrgCode = field.get(parameter);
 						field.setAccessible(false);
-						if (local_sysOrgCode == null || local_sysOrgCode.equals("")) {
+                        if (local_sysOrgCode == null || "".equals(local_sysOrgCode)) {
 							String sysOrgCode = "";
 							// 获取登录用户信息
 							if (sysUser != null) {
@@ -119,7 +119,7 @@ public class MybatisInterceptor implements Interceptor {
 						field.setAccessible(true);
 						Object local_updateBy = field.get(parameter);
 						field.setAccessible(false);
-						if (local_updateBy == null || local_updateBy.equals("")) {
+                        if (local_updateBy == null || "".equals(local_updateBy)) {
 							String updateBy = "jeecg";
 							// 获取登录用户信息
 							LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
@@ -138,7 +138,7 @@ public class MybatisInterceptor implements Interceptor {
 						field.setAccessible(true);
 						Object local_updateDate = field.get(parameter);
 						field.setAccessible(false);
-						if (local_updateDate == null || local_updateDate.equals("")) {
+                        if (local_updateDate == null || "".equals(local_updateDate)) {
 							field.setAccessible(true);
 							field.set(parameter, new Date());
 							field.setAccessible(false);

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 10 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceTemplateController.java


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

@@ -84,6 +84,8 @@ public class CallbackController {
                     userAllocation.setDepartmentId(departmentId);
                     userAllocation.setOperationName(realName);
                     userAllocation.setAccountId(accountId);
+                    userAllocation.setCreateTime(new Date());
+                    userAllocation.setUpdateTime(new Date());
                     allocationMapper.deleteById(userAllocation.getId());
                     Map<String, Object> deleteUserMap = new HashMap<>();
                     deleteUserMap.put("advertiser_id", advertiser_id);
@@ -110,6 +112,7 @@ public class CallbackController {
                     long refreshTokenExpireIn = token.getRefreshTokenExpiresIn() * 1000L;
                     Date refreshTokenExpireInDate = new Date(now + refreshTokenExpireIn);
                     topOauthToken.setRefreshTokenExpiresIn(refreshTokenExpireInDate);
+                    topOauthToken.setUpdateTime(new Date());
                     cTopOauthTokenMapper.insert(topOauthToken);
                     bindAccountAuthService.addBindAccount(accountId, KuaishouInterfaceConstant.LOGIN_TYPE_KUAISHOU, advertiser_id); //账号绑定
                 }
@@ -141,13 +144,14 @@ public class CallbackController {
 
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
+
     public Map<String, Object> getByteDanceAccessToken(String authCode, String state) {
         Map<String, Object> param = new HashMap<String, Object>();
         param.put("app_id", PropertiesUtils.getValue("bytedance_config", "bytedance_appid"));
         param.put("secret", PropertiesUtils.getValue("bytedance_config", "bytedance_secret"));
         param.put("grant_type", "auth_code");
         param.put("auth_code", authCode);
-
+        logger.info("state:{}", state);
         Map<String, Object> returnMap = new HashMap<>();
         try {
             JSONObject json = JSONObject.parseObject(state);
@@ -162,7 +166,7 @@ public class CallbackController {
                 logger.info("获取token失败,state:{},message:{}", state, message);
                 throw new Exception("token返回码异常");
             }
-            String advertiser_id = json.getString("advertiserId");
+            String advertiser_id = json.getString("advertiserId");//广告主id
             String mediaId = json.getString("mediaId"); // 媒体类型: 1 头条 2 快手
             String realName = json.getString("realName");
             String departmentId = json.getString("departmentId"); //部门id
@@ -171,12 +175,11 @@ public class CallbackController {
             String userId = json.getString("userId"); //创建人
 
             JSONObject data = resultObject.getJSONObject("data");
-            CTopOauthToken token = new CTopOauthToken(data.getString("advertiser_id"), data);
+            CTopOauthToken token = new CTopOauthToken(advertiser_id, data);
             Map<String, Object> deleteMap = new HashMap<>();
             deleteMap.put("advertiser_id", advertiser_id);
             deleteMap.put("account_id", token.getAccountId());
             cTopOauthTokenMapper.deleteByMap(deleteMap); //删除 广告主id下的相关授权信息
-            token.setAdvertiserId(advertiser_id);
             cTopOauthTokenMapper.insert(token);
             //获取广告主信息
             Map<String, Object> advertiserDataMap = advertiserDataService.getAdvertiserInfo(token.getAccountId() + "");
@@ -196,6 +199,8 @@ public class CallbackController {
             userAllocation.setMediaId(mediaId);
             userAllocation.setAuthName(advertiserData.getName());
             userAllocation.setAdvertiserId(advertiser_id);
+            userAllocation.setCreateTime(new Date());
+            userAllocation.setUpdateTime(new Date());
             allocationMapper.deleteById(userAllocation.getId());
             Map<String, Object> deleteUserMap = new HashMap<>();
             deleteUserMap.put("advertiser_id", advertiser_id);

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

@@ -0,0 +1,4 @@
+package org.jeecg.modules.ctop.controller;
+
+public class CrawlerController {
+}

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

@@ -81,13 +81,13 @@ public class KuaishouAdvertiserController {
                     .eq("second_industry", sysCategory.getName());
         }
         if (dataProcess != null) {
-            if (dataProcess.equals("industry")) {
+            if ("industry".equals(dataProcess)) {
                 queryWrapper.isNull("industry_category").or().isNull("first_industry").or().isNull("second_industry").isNull("industry_category").or().isNull("first_industry").or().isNull("second_industry").or().eq("second_industry", "").or().eq("second_industry", "").or().eq("second_industry", "");
-            } else if (dataProcess.equals("company")) {
+            } else if ("company".equals(dataProcess)) {
                 queryWrapper.isNull("company").or().eq("company", "");
-            } else if (dataProcess.equals("product")) {
+            } else if ("product".equals(dataProcess)) {
                 queryWrapper.isNull("product").or().eq("product", "");
-            } else if (dataProcess.equals("full")) {
+            } else if ("full".equals(dataProcess)) {
                 queryWrapper.isNotNull("industry_category");
                 queryWrapper.ne("industry_category", "");
                 queryWrapper.isNotNull("first_industry");

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

@@ -0,0 +1,29 @@
+package org.jeecg.modules.ctop.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.modules.ctop.service.IReportService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+@RestController
+@RequestMapping("report")
+public class ReportController {
+    @GetMapping("advertiser")
+    public Map<String, Object> advertiserReport(String accountId, String startDate, String endDate, String timeGranularity) {
+        return reportService.getAdvertiserReport(accountId, startDate, endDate, timeGranularity);
+    }
+
+    @GetMapping("campaign")
+    public Map<String, Object> campaignReport(@RequestBody JSONObject conditions) {
+        return reportService.getCampaignReport(conditions);
+    }
+
+    @Autowired
+    private IReportService reportService;
+}

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

@@ -6,10 +6,10 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.ctop.entity.BindAccountAuth;
 import org.jeecg.modules.ctop.service.ICreateInternalService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.Map;
 
 @RestController
 @RequestMapping("/test")
@@ -21,8 +21,5 @@ public class TestController {
     public void authorization(@RequestBody JSONObject json) {
         System.err.println(json);
         createInternalService.createInternal(json);
-
-
     }
-
 }

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

@@ -7,9 +7,11 @@ 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.apache.shiro.SecurityUtils;
 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.system.vo.LoginUser;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.UserAllocation;
 import org.jeecg.modules.ctop.service.IUserAllocationService;
@@ -64,7 +66,9 @@ public class UserAllocationController {
                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                        HttpServletRequest req) {
         Result<IPage<UserAllocation>> result = new Result<IPage<UserAllocation>>();
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         QueryWrapper<UserAllocation> queryWrapper = QueryGenerator.initQueryWrapper(userAllocation, req.getParameterMap());
+        queryWrapper.eq("user_id", user.getId());
         Page<UserAllocation> page = new Page<UserAllocation>(pageNo, pageSize);
         IPage<UserAllocation> pageList = userAllocationService.page(page, queryWrapper);
         result.setSuccess(true);

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

@@ -67,4 +67,8 @@ public class BindAccountAuth {
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "修改时间")
     private Date updateTime;
+
+
+    public BindAccountAuth() {
+    }
 }

+ 2 - 8
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceAdvertisePlan.java

@@ -1,23 +1,17 @@
 package org.jeecg.modules.ctop.entity;
 
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.Date;
-
 import com.alibaba.fastjson.JSONObject;
-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;
 
+import java.math.BigDecimal;
+
 /**
  * @Description: 今日头条广告计划信息
  * @Author: jeecg-boot

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

@@ -236,8 +236,12 @@ public class ByteDanceAdvertiser {
 		if (null!=createTime &&!"".equals(createTime .trim())){
 			this.toutiaoCreateTime = createTime;
 		}
+		Date now = new Date();
+		this.createTime = now;
+		this.updateTime = now;
 	}
 
-    public ByteDanceAdvertiser() {
+	public ByteDanceAdvertiser() {
+
 	}
 }

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

@@ -12,6 +12,7 @@ import lombok.experimental.Accessors;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
 import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  * @Description: 今日头条广告主预算信息
@@ -61,5 +62,8 @@ public class ByteDanceAdvertiserBudget {
 		if (null!=budget){
 			this.budget =budget;
 		}
+		Date now = new Date();
+		this.createTime = now;
+		this.updateTime = now;
 	}
 }

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

@@ -139,4 +139,7 @@ public class ByteDanceBudgetTemplate {
 
     private String createBy;
     private String updateBy;
+
+    public ByteDanceBudgetTemplate() {
+    }
 }

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

@@ -157,6 +157,9 @@ public class ByteDanceCampaign {
 		if (null!=campaign_modify_time&&!"".equals(campaign_modify_time.trim())){
 			this.campaignModifyTime =campaign_modify_time;
         }
+		Date now = new Date();
+		this.createTime = now;
+		this.updateTime = now;
     }
 
 	public ByteDanceCampaign(Long id, CTopOauthToken oauthToken, String campaignName, String budgetMode, Integer budget, String landingType) {
@@ -167,6 +170,9 @@ public class ByteDanceCampaign {
 		this.budget = BigDecimal.valueOf(budget);
 		this.landingType = landingType;
 		this.toutiaoId = oauthToken.getAccountId();
+		Date now = new Date();
+		this.createTime = now;
+		this.updateTime = now;
 	}
 
 	public ByteDanceCampaign(Long id, CTopOauthToken token, ByteDanceCampaignTemplate template) {
@@ -178,5 +184,8 @@ public class ByteDanceCampaign {
         this.landingType = template.getPromotionPurpose();
 		this.toutiaoId = token.getAccountId();
 		this.templateId = template.getId();
+		Date now = new Date();
+		this.createTime = now;
+		this.updateTime = now;
 	}
 }

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

@@ -84,4 +84,7 @@ public class ByteDanceCampaignTemplate {
      */
     @ApiModelProperty(value = "updateTime")
     private Date updateTime;
+
+    public ByteDanceCampaignTemplate() {
+    }
 }

+ 3 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceCreative.java

@@ -158,8 +158,9 @@ public class ByteDanceCreative {
 //		if (null!=materials&&!"".equals(materials.trim())){
 //			this.materials = materials;
 //		}
+		Date now = new Date();
+		this.createTime = now;
+		this.updateTime = now;
 	}
 
-    public ByteDanceCreative() {
-	}
 }

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

@@ -141,4 +141,7 @@ public class ByteDanceCreativeTemplate {
      */
     @ApiModelProperty(value = "updateTime")
     private Date updateTime;
+
+    public ByteDanceCreativeTemplate() {
+    }
 }

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

@@ -117,6 +117,9 @@ public class ByteDanceImageInfo {
         this.format = data.getString("format");
         this.signature = data.getString("signature");
         this.status = 1;
+        Date now = new Date();
+        this.createTime = now;
+        this.updateTime = now;
     }
 
     public ByteDanceImageInfo() {

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

@@ -244,4 +244,7 @@ public class ByteDanceUserOrientationTemplate {
      */
     @ApiModelProperty(value = "updateTime")
     private Date updateTime;
+
+    public ByteDanceUserOrientationTemplate() {
+    }
 }

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

@@ -112,6 +112,9 @@ public class ByteDanceVideoInfo {
         this.duration = data.getDouble("duration");
         this.videoUrl = data.getString("video_url");
         this.status = 1;
+        Date now = new Date();
+        this.createTime = now;
+        this.updateTime = now;
     }
 
     public ByteDanceVideoInfo() {

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

@@ -93,4 +93,8 @@ public class BytedanceAdvertisePlanTemplate {
      */
     @ApiModelProperty(value = "updateTime")
     private Date updateTime;
+
+
+    public BytedanceAdvertisePlanTemplate() {
+    }
 }

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

@@ -137,4 +137,7 @@ public class BytedanceDeliveryTargetTemplate {
 
     @TableField(exist = false)
     private Long urlId;
+
+    public BytedanceDeliveryTargetTemplate() {
+    }
 }

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

@@ -98,11 +98,10 @@ public class CTopOauthToken {
     @ApiModelProperty(value = "修改时间")
     private Date updateTime;
 
-    public CTopOauthToken(String accountId, JSONObject data) {
-        this.advertiserId = accountId;
-        this.mediaId = "toutiao";
+    public CTopOauthToken(String userId, JSONObject data) {
+        this.advertiserId = userId;
+        this.mediaId = "1";
         this.accountId = data.getLong("advertiser_id");
-        ;
         String accessToken = data.getString("access_token");
         Integer refreshTokenExpiresIn = data.getInteger("refresh_token_expires_in");
         Integer expiresIn = data.getInteger("expires_in");
@@ -112,6 +111,8 @@ public class CTopOauthToken {
         Date now = new Date();
         this.accessTokenExpiresIn = DateUtils.addSecond(now, expiresIn);
         this.refreshTokenExpiresIn = DateUtils.addSecond(now, refreshTokenExpiresIn);
+        this.createTime = now;
+        this.updateTime = now;
     }
 
     public CTopOauthToken() {
@@ -130,5 +131,7 @@ public class CTopOauthToken {
         Date now = new Date();
         this.accessTokenExpiresIn = DateUtils.addSecond(now, expiresIn);
         this.refreshTokenExpiresIn = DateUtils.addSecond(now, refreshTokenExpiresIn);
+        this.createTime = now;
+        this.updateTime = now;
     }
 }

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

@@ -3,6 +3,7 @@ package org.jeecg.modules.ctop.entity;
 import java.io.Serializable;
 import java.util.Date;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -41,6 +42,21 @@ public class FileInfo {
     @Excel(name = "文件名称", width = 15)
     @ApiModelProperty(value = "文件名称")
     private String fileName;
+
+    /**
+     * md5
+     */
+    @Excel(name = "md5", width = 15)
+    @ApiModelProperty(value = "文件MD5值")
+    private String md5;
+
+    /**
+     * 平台文件id
+     */
+    @Excel(name = "平台文件id")
+    @ApiModelProperty(value = "平台文件id")
+    private String fileId;
+
     /**
      * 文件类型
      */
@@ -61,6 +77,15 @@ public class FileInfo {
     @Excel(name = "文件地址", width = 15)
     @ApiModelProperty(value = "文件地址")
     private String path;
+
+    @Excel(name = "头条账号id", width = 15)
+    @ApiModelProperty(value = "头条账号id")
+    private Long accountId;
+
+    @Excel(name = "广告主id", width = 15)
+    @ApiModelProperty(value = "广告主id")
+    private String advertiserId;
+
     @Excel(name = "文件访问路径", width = 15)
     @ApiModelProperty(value = "文件访问路径")
     private String fileUrl;
@@ -75,6 +100,28 @@ public class FileInfo {
     @ApiModelProperty(value = "updateTime")
     private Date updateTime;
 
+    public FileInfo(String md5Hex, JSONObject data, String advertiserId, CTopOauthToken token, String imageUrl, String imagePath, String fileType, String platformType) {
+        this.type = fileType;
+        if (type.equals("IMAGE")) {
+            this.fileId = data.getString("id");
+        } else {
+            this.fileId = data.getString("video_id");
+        }
+        this.fileName = imagePath.substring(imagePath.lastIndexOf("/") + 1);
+        Date now = new Date();
+        this.createTime = now;
+        this.updateTime = now;
+        this.accountId = token.getAccountId();
+        this.advertiserId = token.getAdvertiserId();
+        this.fileUrl = imageUrl;
+        this.path = imagePath;
+        this.platformType = platformType;
+        this.md5 = md5Hex;
+    }
+
+    public FileInfo() {
+    }
+
     @Override
     public String toString() {
         return "FileInfo{" +

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

@@ -127,4 +127,5 @@ public class UserAllocation {
     @Excel(name = "平台类型 1 头条 2快手", width = 15)
     @ApiModelProperty(value = "平台类型 1 头条 2快手")
     private String mediaId;
+
 }

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

@@ -6,6 +6,7 @@ import org.jeecg.modules.ctop.entity.FileInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -25,4 +26,6 @@ public interface IFileInfoService extends IService<FileInfo> {
     Map<String, Object> getIndustryList(String accountId, Integer level);
 
     JSONArray getByteDanceIndustryList(HttpServletRequest req);
+
+    List<FileInfo> getFileInfoByMd5(String md5);
 }

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

@@ -0,0 +1,11 @@
+package org.jeecg.modules.ctop.service;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.Map;
+
+public interface IReportService {
+    Map<String, Object> getAdvertiserReport(String accountId, String startDate, String endDate, String timeGranularity);
+
+    Map<String, Object> getCampaignReport(JSONObject conditions);
+}

+ 4 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BindAccountAuthServiceImpl.java

@@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
 
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -48,6 +49,7 @@ public class BindAccountAuthServiceImpl extends ServiceImpl<BindAccountAuthMappe
         bindAccount.setAccountId(accountId);
 
         bindAccount.setAdvertiserId(state);
+        bindAccount.setUpdateTime(new Date());
         bindAccount.setAuthType(authType);
         int i = bindAccountAuthMapper.insert(bindAccount);
         if (i > 0) {
@@ -68,13 +70,13 @@ public class BindAccountAuthServiceImpl extends ServiceImpl<BindAccountAuthMappe
         return sb.toString();
     }
 
-
+    @Override
     public String getByteDanceCodeUrl(String state) throws UnsupportedEncodingException {
         StringBuffer sb = new StringBuffer();
         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(URLEncoder.encode(state)))
+                .append("&state=" + URLEncoder.encode(state))
                 .append("&redirect_uri=" + URLEncoder.encode(PropertiesUtils.getValue("bytedance_config", "bytedance_callback_url"), "UTF-8"));
         return sb.toString();
     }

+ 5 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceAdvertisePlanServiceImpl.java

@@ -59,6 +59,7 @@ public class ByteDanceAdvertisePlanServiceImpl extends ServiceImpl<ByteDanceAdve
         JSONObject dataObject = result.getJSONObject("data");
         Long adId = dataObject.getLong("ad_id");
         ByteDanceAdvertisePlan plan = new ByteDanceAdvertisePlan(token.getAdvertiserId(), adId, data);
+
         planMapper.insert(plan);
         resultMap.put("planId", adId);
         resultMap.put("code", 0);
@@ -88,14 +89,14 @@ public class ByteDanceAdvertisePlanServiceImpl extends ServiceImpl<ByteDanceAdve
                 put("advertiser_id", advertiser_id);
             }
         };
-        if (targetTemplate.getDownloadType().equals("EXTERNAL_URL")) {//落地页
+        if ("EXTERNAL_URL".equals(targetTemplate.getDownloadType())) {//落地页
             data.put("external_url", targetTemplate.getDownloadUrl());
         }
-        if (targetTemplate.getDownloadType().equals("DOWNLOAD_URL")) {//落地页
-            if (targetTemplate.getDownloadMode().equals("ios")) {
+        if ("DOWNLOAD_URL".equals(targetTemplate.getDownloadType())) {//落地页
+            if ("ios".equals(targetTemplate.getDownloadMode())) {
                 data.put("download_url", targetTemplate.getDownloadUrl());
             }
-            if (targetTemplate.getDownloadMode().equals("android")) {
+            if ("android".equals(targetTemplate.getDownloadMode())) {
                 data.put("package_name", targetTemplate.getPackageName());
             }
         }

+ 19 - 26
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceAdvertiserDataServiceImpl.java

@@ -35,20 +35,13 @@ import java.util.TreeMap;
 @Service
 public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserDataService {
     private static final Logger logger = LoggerFactory.getLogger(ByteDanceAdvertiserDataServiceImpl.class);
-    @Autowired
-    private CTopOauthTokenMapper cTopOauthTokenMapper;
-
-    private CTopOauthToken getOAuthTokenByAccountId(String accountId) {
-        QueryWrapper<CTopOauthToken> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("advertiser_id", accountId).orderByDesc("create_time");
-        CTopOauthToken cTopOauthToken = cTopOauthTokenMapper.selectOne(queryWrapper);
-        return cTopOauthToken;
-    }
 
+    @Autowired
+    private ICTopOauthTokenService tokenService;
     @Override
     public Map<String, Object> getAdvertiserInfo(String accountId) {
         Map<String, Object> resultMap = new HashMap<>();
-        CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
+        CTopOauthToken cTopOauthToken = tokenService.getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_advertiser_info");
         Map<String, String> headers = new HashMap<>();
@@ -62,13 +55,15 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
 
         if (null == code || !code.equals(0)) {
             logger.info("获取广告主信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+            resultMap.put("success", false);
             resultMap.put("code", -1);
             resultMap.put("message", "获取广告主信息接口异常");
             return resultMap;
         }
         JSONArray data = jsonObject.getJSONArray("data");
         if (null == data || data.size() <= 0) {
-            resultMap.put("code", 0);
+            resultMap.put("success", false);
+            resultMap.put("code", -1);
             resultMap.put("message", "广告主信息不存在");
             return resultMap;
         }
@@ -80,13 +75,14 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             advertiserMapper.insert(advertiser);
             resultMap.put("data", advertiser);
         }
+        resultMap.put("success", true);
         resultMap.put("code", 0);
         resultMap.put("message", "获取广告主信息成功");
         return resultMap;
     }
 
     private void getAdvertiserPlanByPageNumber(String accountId, Integer pageNumber, String ids) {
-        CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
+        CTopOauthToken cTopOauthToken = tokenService.getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_get");
         Map<String, String> headers = new HashMap<>();
@@ -155,7 +151,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     @Override
     public Map<String, Object> getAdvertiserBudget(String accountId) {
         Map<String, Object> resultMap = new HashMap<>();
-        CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
+        CTopOauthToken cTopOauthToken = tokenService.getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_get");
         Map<String, String> headers = new HashMap<>();
@@ -205,7 +201,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     @Override
     public Map<String, Object> getAdvertiserCreativeMaterial(String accountId, String creativeIds) {
         Map<String, Object> resultMap = new HashMap<>();
-        CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
+        CTopOauthToken cTopOauthToken = tokenService.getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_material_get");
         Map<String, String> headers = new HashMap<>();
@@ -254,7 +250,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
                 ids.add(Long.parseLong(getIds[i]));
             }
         }
-        CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
+        CTopOauthToken cTopOauthToken = tokenService.getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_update_status");
         Map<String, String> headers = new HashMap<>();
@@ -301,7 +297,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     @Override
     public Map<String, Object> advertiserCampaignUpdate(String accountId, Long campaignId, String budgetMode, Integer budget, String campaignName) {
         Map<String, Object> resultMap = new HashMap<>();
-        CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
+        CTopOauthToken cTopOauthToken = tokenService.getOAuthTokenByAccountId(accountId);
         ByteDanceCampaign campaign = campaignMapper.selectById(campaignId);
         //2: 根据token以及用户id获取用户信息数据
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_update");
@@ -367,7 +363,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
                 ids.add(Long.parseLong(getIds[i]));
             }
         }
-        CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
+        CTopOauthToken cTopOauthToken = tokenService.getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_update_status");
         Map<String, String> headers = new HashMap<>();
@@ -422,7 +418,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
                 data.add(object);
             }
         }
-        CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
+        CTopOauthToken cTopOauthToken = tokenService.getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_update_bid");
         Map<String, String> headers = new HashMap<>();
@@ -476,7 +472,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
                 data.add(object);
             }
         }
-        CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
+        CTopOauthToken cTopOauthToken = tokenService.getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_update_budget");
         Map<String, String> headers = new HashMap<>();
@@ -522,7 +518,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
                 ids.add(Long.parseLong(getCreativeIds[i]));
             }
         }
-        CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
+        CTopOauthToken cTopOauthToken = tokenService.getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_update_status");
         Map<String, String> headers = new HashMap<>();
@@ -568,7 +564,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     @Override
     public Map<String, Object> advertiserCustomAudienceSelect(String accountId) {
         Map<String, Object> resultMap = new HashMap<>();
-        CTopOauthToken token = getOAuthTokenByAccountId(accountId);
+        CTopOauthToken token = tokenService.getOAuthTokenByAccountId(accountId);
 
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_dmp_custom_audience_select");
         Map<String, String> headers = new HashMap<>();
@@ -620,13 +616,10 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     private ByteDanceCustomAudienceMapper audienceMapper;
 
     @Autowired
-    private ICTopOauthTokenService tokenService;
-
-    @Autowired
     private ByteDanceCreativeMaterialMapper creativeMaterialMapper;
 
     private void getAdvertiserCreativeByPageNumber(String accountId, Integer pageNumber, String ids) {
-        CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
+        CTopOauthToken cTopOauthToken = tokenService.getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_get");
         Map<String, String> headers = new HashMap<>();
@@ -676,7 +669,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     private ByteDanceAdvertiserBudgetMapper advertiserBudgetMapper;
 
     private void getAdvertiserCampaignByPageNumber(String accountId, Integer pageNumber, String ids) {
-        CTopOauthToken cTopOauthToken = getOAuthTokenByAccountId(accountId);
+        CTopOauthToken cTopOauthToken = tokenService.getOAuthTokenByAccountId(accountId);
         //2: 根据token以及用户id获取用户信息数据
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_get");
         Map<String, String> headers = new HashMap<>();

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

@@ -3,6 +3,7 @@ package org.jeecg.modules.ctop.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.commons.exec.DaemonExecutor;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.subject.Subject;
 import org.jeecg.common.api.vo.Result;
@@ -24,6 +25,7 @@ import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -65,6 +67,9 @@ public class ByteDanceBudgetTemplateServiceImpl extends ServiceImpl<ByteDanceBud
         }
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         template.setAdvertiserId(user.getId());
+        Date now = new Date();
+        template.setCreateTime(now);
+        template.setUpdateTime(now);
         this.saveOrUpdate(template);
         ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         return resultMap;

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

@@ -71,6 +71,9 @@ public class ByteDanceCampaignTemplateServiceImpl extends ServiceImpl<ByteDanceC
         template.setStatus(1);
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         template.setAdvertiserId(user.getId());
+        Date now = new Date();
+        template.setCreateTime(now);
+        template.setUpdateTime(now);
         this.saveOrUpdate(template);
         ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         return resultMap;

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

@@ -15,6 +15,7 @@ import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -31,6 +32,9 @@ public class BytedanceAdvertisePlanTemplateServiceImpl extends ServiceImpl<Byted
     public Map<String, Object> insertTemplate(BytedanceAdvertisePlanTemplate template, String accountId) {
         Map<String, Object> resultMap = new HashMap<>();
         template.setStatus(1);
+        Date now = new Date();
+        template.setCreateTime(now);
+        template.setUpdateTime(now);
         templateMapper.insert(template);
         ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         return resultMap;

+ 5 - 63
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BytedanceDeliveryTargetTemplateServiceImpl.java

@@ -35,6 +35,7 @@ import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.net.URI;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.ConcurrentLinkedDeque;
@@ -71,13 +72,16 @@ public class BytedanceDeliveryTargetTemplateServiceImpl extends ServiceImpl<Byte
         template.setAdvertiserId(user.getId());
         BytedanceUrlInfo urlInfo = urlInfoMapper.selectById(template.getUrlId());
         //落地页
-        if (null != urlInfo.getType() && urlInfo.getType().equals("page")) {
+        if (null != urlInfo.getType() && "page".equals(urlInfo.getType())) {
             template.setExternalUrl(urlInfo.getUrl());
         } else {
             template.setDownloadUrl(urlInfo.getUrl());
             template.setPackageName(urlInfo.getPackageName());
         }
         template.setStatus(1);
+        Date now = new Date();
+        template.setCreateTime(now);
+        template.setUpdateTime(now);
         this.saveOrUpdate(template);
         ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         return resultMap;
@@ -122,68 +126,6 @@ public class BytedanceDeliveryTargetTemplateServiceImpl extends ServiceImpl<Byte
         return result;
     }
 
-    public JSONObject getSite() {
-        String access_token = "xxx";
-        final Long advertiser_id = 0L;
-        final int page = 1;
-        final int page_size = 10;
-        // 请求地址
-        String open_api_url_prefix = "https://ad.toutiao.com/open_api/2/";
-        String uri = "tools/site/get/";
-
-        // 请求参数
-        Map data = new HashMap() {
-            {
-                put("advertiser_id", advertiser_id);
-                put("page", page);
-                put("page_size", page_size);
-            }
-        };
-
-        // 构造请求
-        HttpEntityEnclosingRequestBase httpEntity = new HttpEntityEnclosingRequestBase() {
-            @Override
-            public String getMethod() {
-                return "GET";
-            }
-        };
-
-        httpEntity.setHeader("Access-Token", access_token);
-
-        CloseableHttpResponse response = null;
-        CloseableHttpClient client = null;
-
-        try {
-            client = HttpClientBuilder.create().build();
-            httpEntity.setURI(URI.create(open_api_url_prefix + uri));
-            httpEntity.setEntity(new StringEntity(JSONObject.toJSONString(data), ContentType.APPLICATION_JSON));
-
-            response = client.execute(httpEntity);
-            if (response != null && response.getStatusLine().getStatusCode() == 200) {
-                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
-                StringBuffer result = new StringBuffer();
-                String line = "";
-                while ((line = bufferedReader.readLine()) != null) {
-                    result.append(line);
-                }
-                bufferedReader.close();
-                return JSONObject.parseObject(result.toString());
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            try {
-                if (response != null) {
-                    response.close();
-                }
-                client.close();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-        return null;
-    }
-
     @Autowired
     private ICTopOauthTokenService tokenService;
     @Autowired

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

@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -35,7 +36,7 @@ public class BytedanceUrlInfoServiceImpl extends ServiceImpl<BytedanceUrlInfoMap
             return resultMap;
         }
         String urlType = template.getType();
-        if (null != urlType && urlType.equals("落地页")) {
+        if (null != urlType && "落地页".equals(urlType)) {
             template.setPackageName(null);
         }
         QueryWrapper<BytedanceUrlInfo> queryWrapper = new QueryWrapper<>();
@@ -50,6 +51,9 @@ public class BytedanceUrlInfoServiceImpl extends ServiceImpl<BytedanceUrlInfoMap
         }
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         template.setAdvertiserId(user.getId());
+        Date now = new Date();
+        template.setCreateTime(now);
+        template.setUpdateTime(now);
 //        template.setStatus(1);
         this.saveOrUpdate(template);
         ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());

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

@@ -111,7 +111,7 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
                 param2.put("campaign_type", 1);
                 param2.put("budget", param3);
                 for (Cookie cookie : webDriver.manage().getCookies()) {
-                    if (cookie.getName().equals("csrftoken")) {
+                    if ("csrftoken".equals(cookie.getName())) {
                         csrftoken = cookie.getValue();
                     }
                     BasicClientCookie ck = new BasicClientCookie(cookie.getName(), cookie.getValue());

+ 169 - 29
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/FileInfoServiceImpl.java

@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.io.FileUtils;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.methods.CloseableHttpResponse;
@@ -37,11 +38,15 @@ import org.jeecg.modules.system.service.ISysCategoryService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.FileSystemResource;
 import org.springframework.stereotype.Service;
 
 import javax.servlet.http.HttpServletRequest;
 import java.io.*;
+import java.net.HttpURLConnection;
 import java.net.URI;
+import java.net.URL;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -56,13 +61,14 @@ import java.util.Map;
 @Service
 public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> implements IFileInfoService {
     private static final Logger logger = LoggerFactory.getLogger(FileInfoServiceImpl.class);
+    private FileInfo fileInfo;
 
     @Override
     public Map<String, Object> uploadVideoToBytedance(String accountId, String videoUrl) {
         Map<String, Object> resultMap = new HashMap<>();
         //TODO查询是否已经上传过头条平台
         CTopOauthToken token = tokenService.getOAuthTokenByAccountId(accountId);
-        JSONObject resultObject = uploadAdvideo(token.getAccessToken(), videoUrl, token.getAccountId() + "");
+        JSONObject resultObject = uploadAdvideo(token, videoUrl, token.getAccountId() + "");
         System.out.println(resultObject);
         Integer code = resultObject.getInteger("code");
         String message = resultObject.getString("message");
@@ -71,11 +77,10 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
             ResultMapUtils.setResultMap(resultMap, StatusCode.BYTEDANCE_VIDEO_UPLOAD_FAIL.getCode());
             return resultMap;
         }
-        JSONObject data = resultObject.getJSONObject("data");
-        ByteDanceVideoInfo videoInfo = new ByteDanceVideoInfo(data, token);
-        videoInfoMapper.insert(videoInfo);
+        fileInfo = (FileInfo) resultObject.get("file");
+
         ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
-        resultMap.put("videoId", videoInfo.getId());
+        resultMap.put("videoId", fileInfo.getFileId());
         return resultMap;
     }
 
@@ -90,7 +95,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
         CTopOauthToken token = tokenService.getOAuthTokenByAccountId(accountId);
         JSONArray imageIds = new JSONArray();
         for (int i = 0; i < imageUrls.length; i++) {
-            JSONObject resultObject = uploadAdImage(token.getAccessToken(), imageUrls[i], token.getAccountId() + "");
+            JSONObject resultObject = uploadAdImage(token, imageUrls[i], token.getAccountId() + "");
             System.out.println(resultObject);
             Integer code = resultObject.getInteger("code");
             String message = resultObject.getString("message");
@@ -99,10 +104,8 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
                 ResultMapUtils.setResultMap(resultMap, StatusCode.BYTEDANCE_VIDEO_UPLOAD_FAIL.getCode());
                 return resultMap;
             }
-            JSONObject data = resultObject.getJSONObject("data");
-            ByteDanceVideoInfo videoInfo = new ByteDanceVideoInfo(data, token);
-            videoInfoMapper.insert(videoInfo);
-            imageIds.add(videoInfo.getId());
+            FileInfo fileInfo = (FileInfo) resultObject.get("file");
+            imageIds.add(fileInfo.getFileId());
         }
         ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         resultMap.put("imageIds", imageIds);
@@ -118,7 +121,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
     public Map<String, Object> uploadImageToBytedance(String accountId, String imageUrl) {
         Map<String, Object> resultMap = new HashMap<>();
         CTopOauthToken token = tokenService.getOAuthTokenByAccountId(accountId);
-        JSONObject resultObject = uploadAdImage(token.getAccessToken(), imageUrl, token.getAccountId() + "");
+        JSONObject resultObject = uploadAdImage(token, imageUrl, token.getAccountId() + "");
         Integer code = resultObject.getInteger("code");
         String message = resultObject.getString("message");
         if (null == code || code != 0) {
@@ -126,19 +129,18 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
             ResultMapUtils.setResultMap(resultMap, StatusCode.BYTEDANCE_IMAGE_UPLOAD_FAIL.getCode());
             return resultMap;
         }
-        JSONObject data = resultObject.getJSONObject("data");
-        ByteDanceImageInfo imageInfo = new ByteDanceImageInfo(data, token);
-        imageInfoService.saveOrUpdate(imageInfo);
+        FileInfo fileInfo = (FileInfo) resultObject.get("file");
         ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         JSONArray array = new JSONArray();
-        array.add(imageInfo.getId());
+        array.add(fileInfo.getFileId());
         resultMap.put("imageIds", array);
         return resultMap;
     }
 
     @Autowired
     private IByteDanceImageInfoService imageInfoService;
-
+    @Autowired
+    FileInfoMapper fileInfoMapper;
     @Override
     public Map<String, Object> getIndustryList(String accountId, Integer level) {
         Map<String, Object> resultMap = new HashMap<>();
@@ -198,6 +200,13 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
         return result;
     }
 
+    @Override
+    public List<FileInfo> getFileInfoByMd5(String md5) {
+        QueryWrapper<FileInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("md5", md5).orderByDesc("create_time");
+        return fileInfoMapper.selectList(queryWrapper);
+    }
+
 
     @Autowired
     private ISysCategoryService categoryService;
@@ -253,12 +262,55 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
         return null;
     }
 
-    public JSONObject uploadAdImage(String accessToken, String imageUrl, String advertiserId) {
+    public JSONObject uploadAdImage(CTopOauthToken token, String imageUrl, String advertiserId) {
+        JSONObject result = new JSONObject();
+        //1:下载文件到本地
+        String imagePath = downLoadByURL(imageUrl);
+        //2: 获取MD5值
+        String md5Hex = null;
+        try {
+            md5Hex = DigestUtils.md5Hex(new FileInputStream(imagePath));
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        //3: 根据MD5值查询是否已经上传过服务器
+        List<FileInfo> getFileInfo = getFileInfoByMd5(md5Hex);
+        if (null != getFileInfo && getFileInfo.size() > 0) {//表示已经上传过服务器
+            result.put("code", 0);
+            result.put("file", getFileInfo.get(0));
+            result.put("message", "图片上传成功");
+            result.put("success", true);
+            return result;
+        }
+        QueryWrapper<FileInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("md5", md5Hex);
+        fileInfoMapper.delete(queryWrapper);
+
+        //文件上传
+        JSONObject bytedanceObject = imageUpload(token, advertiserId, imageUrl);
+        if (null == bytedanceObject) {
+            logger.info("今日头条图片上传失败");
+            result.put("code", -1);
+            result.put("message", "今日头条文件上传失败");
+            return result;
+        }
+        JSONObject data = bytedanceObject.getJSONObject("data");
+        FileInfo fileInfo = new FileInfo(md5Hex, data, advertiserId, token, "https:" + imageUrl, imagePath, "IMAGE", "1");
+        fileInfoMapper.insert(fileInfo);
+        result.put("code", 0);
+        result.put("file", fileInfo);
+        result.put("message", "图片上传成功");
+        result.put("success", true);
+        return result;
+    }
+
+    private JSONObject imageUpload(CTopOauthToken token, String advertiserId, String imageUrl) {
+        JSONObject result = null;
         // 请求地址
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_file_image_ad");
         // 构造请求
         HttpPost httpPost = new HttpPost(url);
-        httpPost.setHeader("Access-Token", accessToken);
+        httpPost.setHeader("Access-Token", token.getAccessToken());
         MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create();
         // 其他参数
         entityBuilder.addTextBody("advertiser_id", advertiserId);
@@ -275,13 +327,13 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
             response = client.execute(httpPost);
             if (response != null && response.getStatusLine().getStatusCode() == 200) {
                 BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
-                StringBuffer result = new StringBuffer();
+                StringBuffer buffer = new StringBuffer();
                 String line = "";
                 while ((line = bufferedReader.readLine()) != null) {
-                    result.append(line);
+                    buffer.append(line);
                 }
                 bufferedReader.close();
-                return JSONObject.parseObject(result.toString());
+                return JSONObject.parseObject(buffer.toString());
             }
         } catch (ClientProtocolException e) {
             e.printStackTrace();
@@ -300,24 +352,103 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
         return null;
     }
 
-    public JSONObject uploadAdvideo(String accessToken, String videoUrl, String advertiserId) {
+    @Value("${jeecg.path.image-upload}")
+    private String imageUploadPath;
+    @Value("${jeecg.path.video-upload}")
+    private String videoUploadPath;
+
+    public String downLoadByURL(String fileUrl) {
+        //获取文件名,文件名实际上在URL中可以找到
+        String fileName = fileUrl.substring(fileUrl.lastIndexOf("/") + 1);
+        //这里服务器上要将此图保存的路径
+        String savePath = this.imageUploadPath + fileName;
+        try {
+            URL url = new URL("https:" + fileUrl);/*将网络资源地址传给,即赋值给url*/
+            /*此为联系获得网络资源的固定格式用法,以便后面的in变量获得url截取网络资源的输入流*/
+            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+            DataInputStream in = new DataInputStream(connection.getInputStream());
+            /*此处也可用BufferedInputStream与BufferedOutputStream*/
+            DataOutputStream out = new DataOutputStream(new FileOutputStream(savePath));
+            /*将参数savePath,即将截取的图片的存储在本地地址赋值给out输出流所指定的地址*/
+            byte[] buffer = new byte[4096];
+            int count = 0;
+            /*将输入流以字节的形式读取并写入buffer中*/
+            while ((count = in.read(buffer)) > 0) {
+                out.write(buffer, 0, count);
+            }
+            out.close();/*后面三行为关闭输入输出流以及网络资源的固定格式*/
+            in.close();
+            connection.disconnect();
+            //返回内容是保存后的完整的URL
+            return savePath;/*网络资源截取并存储本地成功返回true*/
+
+        } catch (Exception e) {
+            System.out.println(e + fileUrl + savePath);
+            return null;
+        }
+    }
+
+    public JSONObject uploadAdvideo(CTopOauthToken token, String videoUrl, String advertiserId) {
+        JSONObject result = new JSONObject();
+        //1:下载文件到本地
+        String videoPath = downLoadByURL(videoUrl);
+        //2: 获取MD5值
+        String md5Hex = null;
+        try {
+            md5Hex = DigestUtils.md5Hex(new FileInputStream(videoPath));
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        //3: 根据MD5值查询是否已经上传过服务器
+        List<FileInfo> getFileInfo = getFileInfoByMd5(md5Hex);
+        if (null != getFileInfo && getFileInfo.size() > 0) {//表示已经上传过服务器
+            result.put("code", 0);
+            result.put("file", getFileInfo.get(0));
+            result.put("message", "视频上传成功");
+            result.put("success", true);
+            return result;
+        }
+
+        QueryWrapper<FileInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("md5", md5Hex);
+        fileInfoMapper.delete(queryWrapper);
+
+        //文件上传
+        JSONObject bytedanceObject = videoUpload(token, advertiserId, videoPath);
+        if (null == bytedanceObject) {
+            logger.info("今日头条视频上传失败");
+            result.put("code", -1);
+            result.put("message", "今日头条视频上传失败");
+            return result;
+        }
+        JSONObject data = bytedanceObject.getJSONObject("data");
+        FileInfo fileInfo = new FileInfo(md5Hex, data, advertiserId, token, "https:" + videoUrl, videoPath, "VIDEO", "1");
+        fileInfoMapper.insert(fileInfo);
+        result.put("code", 0);
+        result.put("file", fileInfo);
+        result.put("message", "视频上传成功");
+        result.put("success", true);
+        return result;
+
+    }
+
+    private JSONObject videoUpload(CTopOauthToken token, String advertiserId, String videoPath) {
         CloseableHttpResponse response = null;
         CloseableHttpClient client = null;
         // 请求地址
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_file_video_ad");
         // 构造请求
         HttpPost httpPost = new HttpPost(url);
-        httpPost.setHeader("Access-Token", accessToken);
+        httpPost.setHeader("Access-Token", token.getAccessToken());
         // 文件参数
         try {
-            videoUrl = "https:" + videoUrl;
-            URI uri = new URI(videoUrl);
-            FileBody file = new FileBody(new File(uri));
-            MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create().addPart("video_file", file);
+
+            FileBody file = new FileBody(new File(videoPath));
+            MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create()
+                    .addPart("video_file", file);
             // 其他参数
             entityBuilder.addTextBody("advertiser_id", advertiserId);
-            //TODO 需要后期优化修改代码逻辑
-            entityBuilder.addTextBody("image_signature", DigestUtils.md5Hex(new FileInputStream(new File(uri))));
+            entityBuilder.addTextBody("video_signature", DigestUtils.md5Hex(new FileInputStream(new File(videoPath))));
             HttpEntity entity = entityBuilder.build();
             client = HttpClientBuilder.create().build();
             httpPost.setURI(URI.create(url));
@@ -347,6 +478,15 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
         }
         return null;
     }
+
     @Autowired
     private ICTopOauthTokenService tokenService;
+
+    public static void main(String[] args) throws Exception {
+
+//        FileUtils.copyURLToFile(new URL("https://ctop-media.oss-cn-beijing.aliyuncs.com/%E9%AB%98%E6%B8%85%E7%89%882-1565344662650.mp4"),new File("D://1234.mp4"));
+//        File file = new File("https://ctop-media.oss-cn-beijing.aliyuncs.com/%E9%AB%98%E6%B8%85%E7%89%882-1565344662650.mp4");
+//        FileInputStream fis = new FileInputStream(file);
+//        fis.read();
+    }
 }

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

@@ -0,0 +1,102 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.jeecg.modules.ctop.entity.CTopOauthToken;
+import org.jeecg.modules.ctop.service.ICTopOauthTokenService;
+import org.jeecg.modules.ctop.service.IReportService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+@Service
+public class ReportServiceImpl implements IReportService {
+    @Override
+    public Map<String, Object> getAdvertiserReport(String accountId, String startDate, String endDate, String timeGranularity) {
+        CTopOauthToken token = tokenService.getOAuthTokenByAccountId(accountId);
+        JSONObject getObject = getAdvertiserStat(token, startDate, endDate, timeGranularity);
+        return null;
+    }
+
+    @Override
+    public Map<String, Object> getCampaignReport(JSONObject conditions) {
+        return null;
+    }
+
+    @Autowired
+    private ICTopOauthTokenService tokenService;
+
+    public JSONObject getAdvertiserStat(CTopOauthToken token, String startDate, String endDate, String timeGranularity) {
+        String accessToken = token.getAccessToken();
+        final Long advertiserId = token.getAccountId();
+
+        // 请求地址
+        String url = "https://ad.toutiao.com/open_api/2/report/advertiser/get/";
+
+        // 请求参数
+        Map data = new HashMap() {
+            {
+                put("advertiser_id", advertiserId);
+                put("start_date", startDate);
+                put("end_date", endDate);
+                put("time_granularity", timeGranularity);
+            }
+        };
+
+        // 构造请求
+        HttpEntityEnclosingRequestBase httpEntity = new HttpEntityEnclosingRequestBase() {
+            @Override
+            public String getMethod() {
+                return "GET";
+            }
+        };
+
+        httpEntity.setHeader("Access-Token", token.getAccessToken());
+
+        CloseableHttpResponse response = null;
+        CloseableHttpClient client = null;
+
+        try {
+            client = HttpClientBuilder.create().build();
+            httpEntity.setURI(URI.create(url));
+            httpEntity.setEntity(new StringEntity(JSONObject.toJSONString(data), ContentType.APPLICATION_JSON));
+
+            response = client.execute(httpEntity);
+            if (response != null && response.getStatusLine().getStatusCode() == 200) {
+                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+                StringBuffer result = new StringBuffer();
+                String line = "";
+                while ((line = bufferedReader.readLine()) != null) {
+                    result.append(line);
+                }
+                bufferedReader.close();
+                return JSONObject.parseObject(result.toString());
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (response != null) {
+                    response.close();
+                }
+                client.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
+}

+ 44 - 15
jeecg-boot-module-system/src/main/java/org/jeecg/modules/fileupload/service/impl/UploadServiceImpl.java

@@ -2,40 +2,69 @@ package org.jeecg.modules.fileupload.service.impl;
 
 import cn.com.ctop.common.utils.FileEntity;
 import cn.com.ctop.common.utils.FileUploadTool;
+import cn.com.ctop.common.utils.OSSUtils;
+import org.apache.commons.codec.digest.DigestUtils;
 import org.jeecg.modules.ctop.entity.FileInfo;
-import org.jeecg.modules.ctop.mapper.FileInfoMapper;
+import org.jeecg.modules.ctop.service.IFileInfoService;
 import org.jeecg.modules.fileupload.service.IUploadService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 @Service
 public class UploadServiceImpl implements IUploadService {
+    @Value("${jeecg.path.video-upload}")
+    private String videoUpLoadPath;
+    @Value("${jeecg.path.image-upload}")
+    private String imageUpLoadPath;
 
     @Autowired
-    private FileInfoMapper fileInfoMapper;
+    private IFileInfoService fileInfoService;
 
     @Override
     public Map<String, Object> imageUpload(MultipartFile multipartFile, HttpServletRequest request, String type) {
         Map<String, Object> resultMap = new HashMap<>();
-        String savaPath = "D:\\upload\\image";
+        //1: 文件上传至服务器
         FileUploadTool fileUploadTool = new FileUploadTool();
         FileEntity entity;
-        entity = fileUploadTool.createFile(multipartFile, request, savaPath);
-        FileInfo fileInfo = new FileInfo();
-        fileInfo.setFileName(entity.getTitleOrig());
-        fileInfo.setPath(entity.getPath());
-        fileInfo.setType("IMAGE");
-        fileInfo.setFileUrl("http://photocdn.sohu.com/20111207/Img328215620.jpg");
-        fileInfo.setPlatformType(type);
-        fileInfoMapper.insert(fileInfo);
-        resultMap.put("message", "文件上传成功");
-        resultMap.put("success", true);
-        resultMap.put("fileInfo", fileInfo);
+        entity = fileUploadTool.createFile(multipartFile, request, imageUpLoadPath);
+        //2:获取MD5值
+        String md5Hex = null;
+        try {
+            md5Hex = DigestUtils.md5Hex(new FileInputStream(entity.getPath()));
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        //3: 根据MD5值查询是否已经上传过服务器
+        List<FileInfo> getFileInfo = fileInfoService.getFileInfoByMd5(md5Hex);
+        if (null != getFileInfo && getFileInfo.size() > 0) {//表示已经上传过服务器
+            resultMap.put("message", "文件上传成功");
+            resultMap.put("success", true);
+            resultMap.put("fileInfo", getFileInfo.get(0));
+        } else {
+            //未上传过服务器
+            String url = OSSUtils.uploadObject2OSS(new File(entity.getPath()));
+            FileInfo fileInfo = new FileInfo();
+            fileInfo.setFileName(entity.getTitleOrig() + entity.getType());
+            fileInfo.setPath(entity.getPath());
+            fileInfo.setType("IMAGE");
+            fileInfo.setFileUrl(url);
+            fileInfo.setMd5(md5Hex);
+            fileInfo.setPlatformType(type);
+            fileInfoService.save(fileInfo);
+            resultMap.put("message", "文件上传成功");
+            resultMap.put("success", true);
+            resultMap.put("fileInfo", fileInfo);
+        }
         return resultMap;
     }
 
@@ -52,7 +81,7 @@ public class UploadServiceImpl implements IUploadService {
         fileInfo.setType("VIDEO");
         fileInfo.setFileUrl("http://photocdn.sohu.com/20111207/Img328215620.jpg");
         fileInfo.setPlatformType(type);
-        fileInfoMapper.insert(fileInfo);
+        fileInfoService.save(fileInfo);
         resultMap.put("message", "文件上传成功");
         resultMap.put("success", true);
         resultMap.put("fileInfo", fileInfo);

+ 0 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouController.java

@@ -219,7 +219,6 @@ public class KuaiShouController {
         Long advertiserId = 23212L;
         JSONObject requestJson = new JSONObject();
         kuaishouInterfaceService.appUpdate(advertiserId, accessToken, requestJson, multipartFile, request);
-
     }
 
     @Autowired

+ 9 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaishouInterfaceServiceImpl.java

@@ -46,6 +46,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     private static final Logger logger = LoggerFactory.getLogger(KuaishouInterfaceServiceImpl.class);
 
 
+    @Override
     public KuaishouResult<KuaishouReportHourlyAccount> getAccountHourlyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.ACCOUNT_REPORT;
         Map<String, String> headers = new HashMap<String, String>();
@@ -75,6 +76,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         return kuaishouResult;
     }
 
+    @Override
     public KuaishouResult<KuaishouReportDailyAccount> getAccountDailyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.ACCOUNT_REPORT;
         Map<String, String> headers = new HashMap<String, String>();
@@ -101,6 +103,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         return kuaishouResult;
     }
 
+    @Override
     public KuaishouResult<KuaishouReportDailyCampaign> getCampaignDailyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CAMPAIGN_REPORT;
         Map<String, String> headers = new HashMap<String, String>();
@@ -127,6 +130,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         return kuaishouResult;
     }
 
+    @Override
     public KuaishouResult<KuaishouReportHourlyCampaign> getCampaignHourlyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CAMPAIGN_REPORT;
         Map<String, String> headers = new HashMap<String, String>();
@@ -153,6 +157,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         return kuaishouResult;
     }
 
+    @Override
     public KuaishouResult<KuaishouReportDailyGroup> getGroupDailyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GTOUP_REPORT;
         Map<String, String> headers = new HashMap<String, String>();
@@ -179,6 +184,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         return kuaishouResult;
     }
 
+    @Override
     public KuaishouResult<KuaishouReportHourlyGroup> getGroupHourlyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GTOUP_REPORT;
         Map<String, String> headers = new HashMap<String, String>();
@@ -205,6 +211,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         return kuaishouResult;
     }
 
+    @Override
     public KuaishouResult<KuaishouReportDailyCreative> getCreativeDailyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_REPORT;
         Map<String, String> headers = new HashMap<String, String>();
@@ -231,6 +238,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         return kuaishouResult;
     }
 
+    @Override
     public KuaishouResult<KuaishouReportHourlyCreative> getCreativeHourlyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_REPORT;
         Map<String, String> headers = new HashMap<String, String>();
@@ -1342,6 +1350,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     @Autowired
     private RestTemplate rest;
 
+    @Override
     public String exceptInfoForRestTemplate(String url, Map<String, Object> paramMap, Map<String, String> headerMap, String filePath) throws ParseException {
 
         try {

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

@@ -78,8 +78,8 @@ public class ShiroRealm extends AuthorizingRealm {
 
 	/**
 	 * 功能: 用来进行身份认证,也就是说验证用户输入的账号和密码是否正确,获取身份验证信息,错误抛出异常
-	 * 
-	 * @param authenticationToken 用户身份信息 token
+	 *
+	 * @param auth 用户身份信息 token
 	 * @return 返回封装了用户信息的 AuthenticationInfo 实例
 	 */
 	@Override

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/aspect/DictAspect.java

@@ -111,7 +111,7 @@ public class DictAspect {
                             item.put(field.getName() + CommonConstant.DICT_TEXT_SUFFIX, textValue);
                         }
                         //date类型默认转换string格式化日期
-                        if (field.getType().getName().equals("java.util.Date")&&field.getAnnotation(JsonFormat.class)==null&&item.get(field.getName())!=null){
+                        if ("java.util.Date".equals(field.getType().getName()) && field.getAnnotation(JsonFormat.class) == null && item.get(field.getName()) != null) {
                             SimpleDateFormat aDate=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                             item.put(field.getName(), aDate.format(new Date((Long) item.get(field.getName()))));
                         }

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

@@ -219,7 +219,7 @@ public class SysPermissionController {
 	public Result<SysPermission> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
 		Result<SysPermission> result = new Result<>();
 		try {
-			String arr[] = ids.split(",");
+            String[] arr = ids.split(",");
 			for (String id : arr) {
 				if (oConvertUtils.isNotEmpty(id)) {
 					sysPermissionService.deletePermission(id);

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

@@ -69,7 +69,7 @@ public class SysPermissionDataRuleImpl extends ServiceImpl<SysPermissionDataRule
 			if(ids==null) {
 				continue;
 			}
-			String arr[] = ids.split(",");
+            String[] arr = ids.split(",");
 			for (String id : arr) {
 				if(oConvertUtils.isNotEmpty(id)) {
 					set.add(id);
@@ -89,7 +89,7 @@ public class SysPermissionDataRuleImpl extends ServiceImpl<SysPermissionDataRule
 		this.save(sysPermissionDataRule);
 		SysPermission permission = sysPermissionMapper.selectById(sysPermissionDataRule.getPermissionId());
 
-		if(permission!=null && (permission.getRuleFlag()==null || permission.getRuleFlag()==CommonConstant.RULE_FLAG_0)) {
+        if (permission != null && (permission.getRuleFlag() == null || permission.getRuleFlag().equals(CommonConstant.RULE_FLAG_0))) {
 			permission.setRuleFlag(CommonConstant.RULE_FLAG_1);
 			sysPermissionMapper.updateById(permission);
 		}
@@ -106,7 +106,7 @@ public class SysPermissionDataRuleImpl extends ServiceImpl<SysPermissionDataRule
 			if(count==null || count==0) {
 				SysPermission permission = sysPermissionMapper.selectById(dataRule.getPermissionId());
 
-				if(permission!=null && permission.getRuleFlag()==CommonConstant.RULE_FLAG_1) {
+                if (permission != null && permission.getRuleFlag().equals(CommonConstant.RULE_FLAG_1)) {
 					permission.setRuleFlag(CommonConstant.RULE_FLAG_0);
 					sysPermissionMapper.updateById(permission);
 				}

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

@@ -37,7 +37,7 @@ public class SysRolePermissionServiceImpl extends ServiceImpl<SysRolePermissionM
 		LambdaQueryWrapper<SysRolePermission> query = new QueryWrapper<SysRolePermission>().lambda().eq(SysRolePermission::getRoleId, roleId);
 		this.remove(query);
 		List<SysRolePermission> list = new ArrayList<SysRolePermission>();
-		String arr[] = permissionIds.split(",");
+        String[] arr = permissionIds.split(",");
 		for (String p : arr) {
 			if(oConvertUtils.isNotEmpty(p)) {
 				SysRolePermission rolepms = new SysRolePermission(roleId, p);

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

@@ -124,9 +124,9 @@ mybatis-plus:
       id-type: 4
       # 默认数据库表下划线命名
       table-underline: true
-    #configuration:
+    configuration:
     # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
-    #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 #jeecg专用配置
 jeecg:
   path:
@@ -134,3 +134,5 @@ jeecg:
     upload: D://upFiles
     #webapp文件路径
     webapp: D://webapp
+    video-upload: D://upFiles//video//
+    image-upload: D://upFiles//image//

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

@@ -136,4 +136,6 @@ jeecg:
     upload: /mnt/upload
     #webapp文件路径
     webapp: /mnt/webapp
+    video-upload: /mnt/upload/video/
+    image-upload: /mnt/upload/image/
 

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

@@ -1,6 +1,6 @@
 spring:
   profiles:
-    active: dev
+    active: prod
 swagger:
   production: false
   basic:

+ 6 - 0
module-common/pom.xml

@@ -33,6 +33,12 @@
             <groupId>com.google.code.gson</groupId>
             <artifactId>gson</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.aliyun.oss</groupId>
+            <artifactId>aliyun-sdk-oss</artifactId>
+            <version>3.5.0</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
     <build>

+ 2 - 1
module-common/src/main/java/cn/com/ctop/common/utils/Base64Utils.java

@@ -47,8 +47,9 @@ public class Base64Utils {
     }
 
     public static String decode(String s) {
-        if (s == null)
+        if (s == null) {
             return null;
+        }
         BASE64Decoder decoder = new BASE64Decoder();
         try {
             byte[] b = decoder.decodeBuffer(s);

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/utils/HttpUtils.java

@@ -53,6 +53,7 @@ public class HttpUtils {
         try {
             SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustStrategy() {
                 //信任所有证书
+                @Override
                 public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
                     return true;
                 }

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/utils/HttpUtils2.java

@@ -53,6 +53,7 @@ public class HttpUtils2 {
         try {
             SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustStrategy() {
                 //信任所有证书
+                @Override
                 public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
                     return true;
                 }

+ 15 - 14
module-common/src/main/java/cn/com/ctop/common/utils/OSSUtils.java

@@ -1,6 +1,8 @@
 package cn.com.ctop.common.utils;
 
+import com.aliyun.oss.OSS;
 import com.aliyun.oss.OSSClient;
+import com.aliyun.oss.OSSClientBuilder;
 import com.aliyun.oss.model.Bucket;
 import com.aliyun.oss.model.OSSObject;
 import com.aliyun.oss.model.ObjectMetadata;
@@ -47,20 +49,20 @@ public class OSSUtils {
      *
      * @return ossClient
      */
-    public static OSSClient getOSSClient() {
-        return new OSSClient(endpoint, accessKeyId, accessKeySecret);
+    public static OSS getOSSClient() {
+        return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
     }
 
     /**
      * 创建存储空间
      *
-     * @param ossClient  OSS连接
      * @param bucketName 存储空间
      * @return
      */
-    public static String createBucketName(OSSClient ossClient, String bucketName) {
+    public static String createBucketName(String bucketName) {
         // 存储空间
         final String bucketNames = bucketName;
+        OSS ossClient = OSSUtils.getOSSClient();
         if (!ossClient.doesBucketExist(bucketName)) {
             // 创建存储空间
             Bucket bucket = ossClient.createBucket(bucketName);
@@ -73,10 +75,10 @@ public class OSSUtils {
     /**
      * 删除存储空间buckName
      *
-     * @param ossClient  oss对象
      * @param bucketName 存储空间
      */
-    public static void deleteBucket(OSSClient ossClient, String bucketName) {
+    public static void deleteBucket(String bucketName) {
+        OSS ossClient = OSSUtils.getOSSClient();
         ossClient.deleteBucket(bucketName);
         logger.info("删除" + bucketName + "Bucket成功");
     }
@@ -84,14 +86,14 @@ public class OSSUtils {
     /**
      * 创建模拟文件夹
      *
-     * @param ossClient  oss连接
      * @param bucketName 存储空间
      * @param folder     模拟文件夹名如"qj_nanjing/"
      * @return 文件夹名
      */
-    public static String createFolder(OSSClient ossClient, String bucketName, String folder) {
+    public static String createFolder(String bucketName, String folder) {
         // 文件夹名
         final String keySuffixWithSlash = folder;
+        OSS ossClient = OSSUtils.getOSSClient();
         // 判断文件夹是否存在,不存在则创建
         if (!ossClient.doesObjectExist(bucketName, keySuffixWithSlash)) {
             // 创建文件夹
@@ -108,12 +110,12 @@ public class OSSUtils {
     /**
      * 根据key删除OSS服务器上的文件
      *
-     * @param ossClient  oss连接
      * @param bucketName 存储空间
      * @param folder     模拟文件夹名 如"qj_nanjing/"
      * @param key        Bucket下的文件的路径名+文件名 如:"upload/cake.jpg"
      */
-    public static void deleteFile(OSSClient ossClient, String bucketName, String folder, String key) {
+    public static void deleteFile(String bucketName, String folder, String key) {
+        OSS ossClient = OSSUtils.getOSSClient();
         ossClient.deleteObject(bucketName, folder + key);
         logger.info("删除" + bucketName + "下的文件" + folder + key + "成功");
     }
@@ -121,15 +123,13 @@ public class OSSUtils {
     /**
      * 上传图片至OSS
      *
-     * @param ossClient  oss连接
      * @param file       上传文件(文件全路径如:D:\\image\\cake.jpg)
-     * @param bucketName 存储空间
-     * @param folder     模拟文件夹名 如"qj_nanjing/"
      * @return String 返回的唯一MD5数字签名
      */
-    public static String uploadObject2OSS(OSSClient ossClient, File file, String bucketName, String folder) {
+    public static String uploadObject2OSS(File file) {
         String resultStr = null;
         try {
+            OSS ossClient = OSSUtils.getOSSClient();
             // 以输入流的形式上传文件
             InputStream is = new FileInputStream(file);
             // 文件名
@@ -153,6 +153,7 @@ public class OSSUtils {
             metadata.setContentDisposition("filename/filesize=" + fileName + "/" + fileSize + "Byte.");
             // 上传文件 (上传文件流的形式)
             PutObjectResult putResult = ossClient.putObject(bucketName, folder + fileName, is, metadata);
+            System.out.println(putResult.toString());
             // 解析结果
             resultStr = putResult.getETag();
         } catch (Exception e) {

+ 5 - 2
module-common/src/main/java/cn/com/ctop/common/utils/TransfMediaTool.java

@@ -109,19 +109,22 @@ public class TransfMediaTool {
 
 class PrintStream extends Thread {
     java.io.InputStream __is = null;
+    java.io.InputStream ___is = null;
 
     public PrintStream(java.io.InputStream is) {
         __is = is;
     }
 
+    @Override
     public void run() {
         try {
             while (this != null) {
                 int _ch = __is.read();
-                if (_ch != -1)
+                if (_ch != -1) {
                     System.out.print((char) _ch);
-                else
+                } else {
                     break;
+                }
             }
         } catch (Exception e) {
             e.printStackTrace();

+ 6 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/account/service/impl/KuaishouAdAccountServiceImpl.java

@@ -13,12 +13,18 @@ import java.util.List;
 public class KuaishouAdAccountServiceImpl extends ServiceImpl<KuaishouAdAccountMapper, KuaishouAdAccount> implements IKuaishouAdAccountService {
     @Autowired
     private KuaishouAdAccountMapper kuaishouAdAccountMapper;
+
+    @Override
     public List<KuaishouAdAccount> querySyncAccount(){
         return kuaishouAdAccountMapper.querySyncAccount();
     }
+
+    @Override
     public List<String> companySugest(String company){
         return kuaishouAdAccountMapper.companySugest(company);
     }
+
+    @Override
     public List<String> productSugest(String product){
         return kuaishouAdAccountMapper.productSugest(product);
     }

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 14 - 7
module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/service/impl/KuaishouCrawlerServiceImpl.java


+ 25 - 16
module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/FateadmHttpUtil.java

@@ -29,8 +29,9 @@ public class FateadmHttpUtil {
                 char c = json.charAt( next_idx);
                 if( (c<=32) || (c=='\\')){
                     next_idx ++;
-                }else
+                } else {
                     break;
+                }
             }
         }
         public String NextSToken( ) {
@@ -38,8 +39,9 @@ public class FateadmHttpUtil {
             String ret = "";
             while(next_idx < json.length()){
                 char c = json.charAt(next_idx);
-                if( c== '\"')
+                if (c == '\"') {
                     break;
+                }
                 if( (c=='\\') && (next_idx+1<json.length())){
                     if(json.charAt(next_idx+1) == '\\')
                     {
@@ -76,17 +78,17 @@ public class FateadmHttpUtil {
             return ret;
         }
         public void Key2Val(HttpResp rsp, String key, String val){
-            if ( key.equals("RetCode")){
+            if ("RetCode".equals(key)) {
                 rsp.ret_code    = Integer.parseInt( val);
-            }else if( key.equals("ErrMsg")){
+            } else if ("ErrMsg".equals(key)) {
                 rsp.err_msg     = val;
-            }else if( key.equals("RequestId")){
+            } else if ("RequestId".equals(key)) {
                 rsp.req_id      = val;
-            }else if( key.equals("RspData")){
+            } else if ("RspData".equals(key)) {
                 rsp.rsp_data    = val;
-            }else if( key.equals("result")){
+            } else if ("result".equals(key)) {
                 rsp.pred_resl   = val;
-            }else if( key.equals( "cust_val")){
+            } else if ("cust_val".equals(key)) {
                 rsp.cust_val    = Double.parseDouble(val);
             }
         }
@@ -112,8 +114,9 @@ public class FateadmHttpUtil {
                         next_idx++;
                         sval = NextSToken();
                         Skip();
-                        if (next_idx >= json.length())
+                        if (next_idx >= json.length()) {
                             break;
+                        }
                         if( json.charAt(next_idx+1) == ':'){
                             key = sval;
                             next_idx ++;
@@ -139,7 +142,7 @@ public class FateadmHttpUtil {
                     case 'n':
                     case 'N':
                         sval    = json.substring(next_idx, 4).toLowerCase();
-                        if( !sval.equals("null")){
+                        if (!"null".equals(sval)) {
                             //error
                             break;
                         }
@@ -223,24 +226,30 @@ public class FateadmHttpUtil {
             byte[] buf = new byte[1024];
             while (true) {
                 int len = dataIn.read(buf);
-                if (len < 0)
+                if (len < 0) {
                     break;
+                }
                 dos.write(buf, 0, len);
             }
             bArray = bos.toByteArray();
         }catch( Exception e){
             return bArray;
         }finally {
-            if (in != null)
+            if (in != null) {
                 in.close();
-            if (dataIn != null)
+            }
+            if (dataIn != null) {
                 dataIn.close();
-            if (buffer != null)
+            }
+            if (buffer != null) {
                 buffer.close();
-            if (bos != null)
+            }
+            if (bos != null) {
                 bos.close();
-            if (dos != null)
+            }
+            if (dos != null) {
                 dos.close();
+            }
         }
         return bArray;
     }

+ 4 - 4
module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/FateadmUtil.java

@@ -32,7 +32,7 @@ public class FateadmUtil {
      *      resp.err_msg:异常时返回异常详情
      */
     public FateadmHttpUtil.HttpResp QueryBalc() throws Exception{
-        long cur_tm     = new Date().getTime()/1000;    // 时间戳精确到秒。所以除以1000
+        long cur_tm = System.currentTimeMillis() / 1000;    // 时间戳精确到秒。所以除以1000
         String stm      = String.valueOf(cur_tm);
         String sign     = FateadmHttpUtil.CalcSign( pd_id, pd_key, stm);
         String url      = this.pred_url + "/api/custval";
@@ -60,7 +60,7 @@ public class FateadmUtil {
      *      resp.err_msg:异常时返回异常详情
      */
     public FateadmHttpUtil.HttpResp Charge(String cardid, String cardkey) throws Exception{
-        long cur_tm     = new Date().getTime()/1000;    // 时间戳精确到秒。所以除以1000
+        long cur_tm = System.currentTimeMillis() / 1000;    // 时间戳精确到秒。所以除以1000
         String stm      = String.valueOf(cur_tm);
         String sign     = FateadmHttpUtil.CalcSign( pd_id, pd_key, stm);
         String csign    = FateadmHttpUtil.CalcMd5(pd_key + stm + cardid + cardkey);
@@ -123,7 +123,7 @@ public class FateadmUtil {
      *      resp.pred_resl:识别的结果
      */
     public FateadmHttpUtil.HttpResp Predict(String pred_type, byte[] img_data) throws Exception{
-        long cur_tm     = new Date().getTime()/1000;    // 时间戳精确到秒。所以除以1000
+        long cur_tm = System.currentTimeMillis() / 1000;    // 时间戳精确到秒。所以除以1000
         String stm      = String.valueOf(cur_tm);
         String sign     = FateadmHttpUtil.CalcSign(pd_id,pd_key,stm);
         String asign 	= "";
@@ -160,7 +160,7 @@ public class FateadmUtil {
      *      退款仅在正常识别出结果后,无法通过网站验证的情况,请勿非法或者滥用,否则可能进行封号处理
      */
     public FateadmHttpUtil.HttpResp Justice(String req_id) throws Exception{
-        long cur_tm     = new Date().getTime()/1000;     // 时间戳精确到秒。所以除以1000
+        long cur_tm = System.currentTimeMillis() / 1000;     // 时间戳精确到秒。所以除以1000
         String stm      = String.valueOf(cur_tm);
         String sign     = FateadmHttpUtil.CalcSign( pd_id, pd_key, stm);
         String url      = pred_url + "/api/capjust";

+ 4 - 3
module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/KuaishouUtil.java

@@ -31,7 +31,7 @@ import java.util.*;
 
 public class KuaishouUtil {
     public static CrawlerLog requestData(HttpEntity httpEntity){
-        long beginTime = new Date().getTime();
+        long beginTime = System.currentTimeMillis();
         CrawlerLog crawlerLog = new CrawlerLog();
         String salt = "382700b563f4";
         Map<String,String> staticParams = httpEntity.getHttpBody().getStaticParams();
@@ -43,7 +43,7 @@ public class KuaishouUtil {
         Map<String,String> allMap = new HashMap<String,String>();
         allMap.putAll(staticParams);
         allMap.putAll(dynamicParams);
-        if(staticParams.get("kpf") != null && staticParams.get("kpf").equals("ANDROID_PHONE")){
+        if (staticParams.get("kpf") != null && "ANDROID_PHONE".equals(staticParams.get("kpf"))) {
             String sig = SignUtil.getMD5Sign(HttpParamUtil.mapToString(SortUtil.sortMapByKey(allMap),ignoreKeyList),salt);
             dynamicParams.put("sig",sig);
             allMap.put("sig",sig);
@@ -59,6 +59,7 @@ public class KuaishouUtil {
         try {
             SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustStrategy() {
                 //信任所有证书
+                @Override
                 public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
                     return true;
                 }
@@ -79,7 +80,7 @@ public class KuaishouUtil {
             int code = response.getStatusLine().getStatusCode();
             org.apache.http.HttpEntity respentity = response.getEntity();
             String strReturn = EntityUtils.toString(respentity);
-            long endTime = new Date().getTime();
+            long endTime = System.currentTimeMillis();
             crawlerLog.setUrl(httpEntity.getUrl());
             crawlerLog.setPath(httpEntity.getPath());
             crawlerLog.setMethod("POST");

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

@@ -15,6 +15,7 @@ public class AppAdServiceImpl extends ServiceImpl<AppAdMapper, AppAd> implements
     @Autowired
     private AppAdMapper appAdMapper;
 
+    @Override
     public List<AppAd> queryAdFeeds(String userName, String industry, String company, String product, String start, String end, String orderByColumn, String orderByType, Integer pageStart, Integer pageSize) {
         return appAdMapper.queryAdFeeds(userName, industry, company, product, start, end, orderByColumn, orderByType, pageStart, pageSize);
     }

+ 9 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/service/impl/KuaishouAppServiceImpl.java

@@ -35,7 +35,9 @@ public class KuaishouAppServiceImpl implements IKuaishouAppService {
     private IAppVideoService appVideoService;
     @Autowired
     private IKuaishouAdAccountService kuaishouAdAccountService;
-    public void adFetch(KuaishouAppAccount kuaishouAppAccount,Integer page){
+
+    @Override
+    public void adFetch(KuaishouAppAccount kuaishouAppAccount, Integer page) {
         String videoFeeds = kuaishouCrawlerService.getVideoFeeds(kuaishouAppAccount,page);
         ObjectMapper mapper = new ObjectMapper();
         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -96,7 +98,9 @@ public class KuaishouAppServiceImpl implements IKuaishouAppService {
             e.printStackTrace();
         }
     }
-    public void adAccountFetch(KuaishouAdAccount kuaishouAdAccount,String pcursor){
+
+    @Override
+    public void adAccountFetch(KuaishouAdAccount kuaishouAdAccount, String pcursor) {
         String userProfileStr = kuaishouCrawlerService.getUserProfile(kuaishouAdAccount.getKsid());
         ObjectMapper mapper = new ObjectMapper();
         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -126,13 +130,15 @@ public class KuaishouAppServiceImpl implements IKuaishouAppService {
                 }
             }
             Thread.sleep(10000);
-            if(pcursor != null && !pcursor.equals("no_more")){
+            if (pcursor != null && !"no_more".equals(pcursor)) {
                 adAccountFetch(kuaishouAdAccount,pcursor);
             }
         } catch (Exception e) {
             e.printStackTrace();
         }
     }
+
+    @Override
     public void adFetch(KuaishouIosAccount kuaishouIosAccount){
         String videoFeeds = kuaishouCrawlerService.getVideoFeeds(kuaishouIosAccount);
         ObjectMapper mapper = new ObjectMapper();

+ 2 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/KuaishouTest.java

@@ -293,7 +293,7 @@ import okhttp3.Response;
      * @return
      */
     public static Map getSigUrl(String userid) {
-        long time = new Date().getTime();
+        long time = System.currentTimeMillis();
 
         return getSigUrl(userid,time,0,0);
     }
@@ -361,7 +361,7 @@ import okhttp3.Response;
             Set<String> keySet = sortedMap.keySet();
             for (String key : keySet) {
                 //sign不参与算法
-                if (key.equals("sig") || key.equals("__NStokensig")) {
+                if ("sig".equals(key) || "__NStokensig".equals(key)) {
                     continue;
                 }
                 String value = sortedMap.get(key);

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

@@ -166,7 +166,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
                     kuaishouVideoService.saveOrUpdate(video);
                 }
             }
-            if (feeds.getPcursor() == null || !feeds.getPcursor().equals("no_more")) {
+            if (feeds.getPcursor() == null || !"no_more".equals(feeds.getPcursor())) {
                 Thread.sleep((int) Math.random() * 5000 + 10000);
                 getVedioList(principalId, feeds.getPcursor(), ttf, ++times);
             }
@@ -186,6 +186,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
         }
     }
 
+    @Override
     public void adkuaishouWebLogin(String phone, String password) {
         System.getProperties().setProperty("webdriver.chrome.driver", "D:/chromedriver.exe");
 //        System.getProperties().setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver");
@@ -243,6 +244,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
         }
     }
 
+    @Override
     public void getVideoList(String uid) {
 //        System.getProperties().setProperty("webdriver.chrome.driver", "D:/chromedriver.exe");
         System.getProperties().setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver");
@@ -295,28 +297,29 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
         BasicClientCookie cookie = new BasicClientCookie("clientid", "3");
         cookie.setDomain("live.kuaishou.com");   //设置范围
         cookie.setPath("/");
-        cookie.setExpiryDate(new Date(new Date().getTime() + 1000 * 60 * 60 * 24 * 365));
+        cookie.setExpiryDate(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 365));
         HttpUtils2.cookieStore.addCookie(cookie);
 
         BasicClientCookie cookie1 = new BasicClientCookie("did", "web_1615d3ad757d4fb8558ed4d7dbecf5fc");
         cookie1.setDomain("live.kuaishou.com");   //设置范围web_a5735c4f9f02ad9ee48677499927341c
         cookie1.setPath("/");
-        cookie1.setExpiryDate(new Date(new Date().getTime() + 1000 * 60 * 60 * 24 * 365));
+        cookie1.setExpiryDate(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 365));
         HttpUtils2.cookieStore.addCookie(cookie1);
 
         BasicClientCookie cookie2 = new BasicClientCookie("client_key", "65890b29");
         cookie2.setDomain("live.kuaishou.com");   //设置范围
         cookie2.setPath("/");
-        cookie2.setExpiryDate(new Date(new Date().getTime() + 1000 * 60 * 60 * 24 * 365));
+        cookie2.setExpiryDate(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 365));
         HttpUtils2.cookieStore.addCookie(cookie2);
 
         BasicClientCookie cookie3 = new BasicClientCookie("kuaishou.live.bfb1s", "3e261140b0cf7444a0ba411c6f227d88");
         cookie3.setDomain("live.kuaishou.com");   //设置范围
         cookie3.setPath("/");
-        cookie3.setExpiryDate(new Date(new Date().getTime() + 1000 * 60 * 60 * 24 * 365));
+        cookie3.setExpiryDate(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 365));
         HttpUtils2.cookieStore.addCookie(cookie3);
     }
 
+    @Override
     public String checkKuaishouUser(String videoUrl) {
         String html = HttpUtils2.httpGetRequest(videoUrl);
         HttpUtils2.cookieStore.clear();
@@ -326,7 +329,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
 
         while (m.find()) {
             uid = m.group().replace("/profile/", "").replace("\"", "");
-            if (uid != null && !uid.equals("") && !uid.equals("null")) {
+            if (uid != null && !"".equals(uid) && !"null".equals(uid)) {
                 return uid;
             }
         }
@@ -373,7 +376,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
                     Long commentId = commentNode.get("comment_id").asLong();
                     deleteCommentById(photoId, commentId, headers);
                 }
-                if (pcursor != null && !pcursor.equals("no_more")) {
+                if (pcursor != null && !"no_more".equals(pcursor)) {
                     deletePhotoComment(photoId, pcursor, headers);
                 }
             }
@@ -382,6 +385,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
         }
     }
 
+    @Override
     public void deleteAllComment(Map<String, String> pcursorMap) {
         try {
             Map<String, String> headers = new HashMap<>();
@@ -405,7 +409,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
                     Long photoId = photoNode.get("photoId").asLong();
                     deletePhotoComment(photoId, "", headers);
                 }
-                if (pcursor != null && !pcursor.equals("no_more")) {
+                if (pcursor != null && !"no_more".equals(pcursor)) {
                     pcursorMap = mapper.readValue(node.get("pcursorMap").toString(), new TypeReference<Map<String, String>>() {
                     });
                     deleteAllComment(pcursorMap);

+ 1 - 1
module-kuaishou/src/main/resources/kuaishou_config.properties

@@ -2,4 +2,4 @@ kuaishou_api_url=https://ad.e.kuaishou.com
 kuaishou_auth_url=https://ad.e.kuaishou.com
 kuaishou_appid=27
 kuaishou_secret=QovprB1tNhXptgDc
-kuaishou_callback_url=http://callback.c-top.com.cn/kuaishou
+kuaishou_callback_url=http://adsp.c-top.com.cn:8080/jeecg-boot/kuaishou

+ 3 - 3
module-toutiao/src/main/java/cn/com/ctop/toutiao/test/Test.java

@@ -133,7 +133,7 @@ public class Test {
 
 //                webDriver.get("https://ad.toutiao.com/pages/campaign/create.html");
                 for (Cookie cookie : webDriver.manage().getCookies()){
-                    if(cookie.getName().equals("csrftoken")){
+                    if ("csrftoken".equals(cookie.getName())) {
                         csrftoken = cookie.getValue();
                     }
                     BasicClientCookie ck = new BasicClientCookie(cookie.getName(),cookie.getValue());
@@ -173,8 +173,8 @@ public class Test {
                     HttpUtils.cookieStore.addCookie(ck);
                     System.out.println(cookie.getName()+","+cookie.getValue()+","+cookie.getDomain());
                 }
-                String siteStr = HttpUtils.httpGetRequest("https://ad.oceanengine.com/overture/api/adv_site/get_site_list/?_="+String.valueOf(new Date().getTime()));
-                String convStr = HttpUtils.httpGetRequest("https://ad.oceanengine.com/overture/api/get_tetris_action/?external_url=&type=external&pricing=9&landing_type=3&_="+String.valueOf(new Date().getTime()));
+                String siteStr = HttpUtils.httpGetRequest("https://ad.oceanengine.com/overture/api/adv_site/get_site_list/?_=" + String.valueOf(System.currentTimeMillis()));
+                String convStr = HttpUtils.httpGetRequest("https://ad.oceanengine.com/overture/api/get_tetris_action/?external_url=&type=external&pricing=9&landing_type=3&_=" + String.valueOf(System.currentTimeMillis()));
                 JsonNode siteNode = mapper.readTree(siteStr);
                 JsonNode convNode = mapper.readTree(convStr);