syh 5 år sedan
förälder
incheckning
bfeff3373d
55 ändrade filer med 1383 tillägg och 1442 borttagningar
  1. 4 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/CtopAdConstant.java
  2. 2 2
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/api/ISysBaseApi.java
  3. 39 56
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  4. 26 27
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DySmsHelper.java
  5. 33 2
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MD5Util.java
  6. 2 2
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/PasswordUtil.java
  7. 5 5
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/SqlInjectionUtil.java
  8. 2 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/StatusCode.java
  9. 150 154
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/YouBianCodeUtil.java
  10. 2 2
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java
  11. 8 8
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/JsonSchemaDescrip.java
  12. 3 3
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/JsonschemaUtil.java
  13. 1 1
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/oConvertUtils.java
  14. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/JeecgOneGUI.java
  15. 210 202
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java
  16. 202 195
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AuthTaskController.java
  17. 14 19
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceAdvertiserPostController.java
  18. 70 26
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceTemplateController.java
  19. 0 242
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CTopOauthTokenController.java
  20. 7 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  21. 247 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CtopOauthTokenController.java
  22. 2 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  23. 4 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/CTopOauthToken.java
  24. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouAdvertiserCrawlerJob.java
  25. 0 20
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/CTopOauthTokenMapper.java
  26. 20 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/CtopOauthTokenMapper.java
  27. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/CTopOauthTokenMapper.xml
  28. 20 38
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/PlatformCampaignStatisticInfoMapper.xml
  29. 0 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IBytedanceDeliveryTargetTemplateService.java
  30. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ICTopOauthTokenService.java
  31. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IFileInfoService.java
  32. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BytedanceAdvertisePlanTemplateServiceImpl.java
  33. 0 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BytedanceDeliveryTargetTemplateServiceImpl.java
  34. 25 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreateInternalServiceImpl.java
  35. 9 11
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CTopOauthTokenServiceImpl.java
  36. 27 41
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/FileInfoServiceImpl.java
  37. 8 8
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ReportServiceImpl.java
  38. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/test/controller/JeecgOrderDMainController.java
  39. 2 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/fileupload/service/impl/UploadServiceImpl.java
  40. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouController.java
  41. 8 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/shiro/vo/UserBean.java
  42. 2 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserAgentController.java
  43. 6 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java
  44. 2 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java
  45. 1 1
      module-common/src/main/java/cn/com/ctop/common/utils/Base64Utils.java
  46. 11 11
      module-common/src/main/java/cn/com/ctop/common/utils/CsvUtils.java
  47. 2 2
      module-common/src/main/java/cn/com/ctop/common/utils/FileUploadTool.java
  48. 14 15
      module-common/src/main/java/cn/com/ctop/common/utils/HttpUtils.java
  49. 16 16
      module-common/src/main/java/cn/com/ctop/common/utils/ImageUtils.java
  50. 0 64
      module-common/src/main/java/cn/com/ctop/common/utils/MD5Utils.java
  51. 12 10
      module-common/src/main/java/cn/com/ctop/common/utils/TransfMediaTool.java
  52. 0 62
      module-common/src/main/java/cn/com/ctop/common/utils/WebMasterUtils.java
  53. 0 38
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/MD5Util.java
  54. 2 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/SignUtil.java
  55. 144 112
      module-toutiao/src/main/java/cn/com/ctop/toutiao/test/Test.java

+ 4 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/CtopAdConstant.java

@@ -7,4 +7,8 @@ public class CtopAdConstant {
     public static final String PLATFORM_TYPE_BYTEDANCE = "1";
     public static final String PLATFORM_TYPE_KUAISHOU = "2";
 
+    public static final String PLATFORM_TYPE_BYTEDANCE_PY = "bytedance";
+    public static final String PLATFORM_TYPE_KUAISHOU_PY = "kuaishou";
+
+
 }

+ 2 - 2
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/api/ISysBaseApi.java

@@ -16,11 +16,11 @@ public interface ISysBaseApi {
 
 	/**
 	 * 日志添加
-	 * @param LogContent 内容
+     * @param logContent 内容
 	 * @param logType 日志类型(0:操作日志;1:登录日志;2:定时任务)
 	 * @param operatetype 操作类型(1:添加;2:修改;3:删除;)
 	 */
-	void addLog(String LogContent, Integer logType, Integer operatetype);
+    void addLog(String logContent, Integer logType, Integer operatetype);
 	
 	/**
 	  * 根据用户账号查询登录用户信息

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

@@ -18,15 +18,15 @@ import org.springframework.util.StringUtils;
  */
 public class DateUtils extends PropertyEditorSupport {
     // 各种时间格式
-    public static final SimpleDateFormat date_sdf = new SimpleDateFormat("yyyy-MM-dd");
+//    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
     // 各种时间格式
-    public static final SimpleDateFormat yyyyMMdd = new SimpleDateFormat("yyyyMMdd");
+//    public static final SimpleDateFormat yyyyMMdd = new SimpleDateFormat("yyyyMMdd");
     // 各种时间格式
-    public static final SimpleDateFormat date_sdf_wz = new SimpleDateFormat("yyyy年MM月dd日");
-    public static final SimpleDateFormat time_sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
-    public static final SimpleDateFormat yyyymmddhhmmss = new SimpleDateFormat("yyyyMMddHHmmss");
-    public static final SimpleDateFormat short_time_sdf = new SimpleDateFormat("HH:mm");
-    public static final SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//    public static final SimpleDateFormat date_sdf_wz = new SimpleDateFormat("yyyy年MM月dd日");
+//    public static final SimpleDateFormat time_sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+//    public static final SimpleDateFormat yyyymmddhhmmss = new SimpleDateFormat("yyyyMMddHHmmss");
+//    public static final SimpleDateFormat short_time_sdf = new SimpleDateFormat("HH:mm");
+//    public static final SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
     // 以毫秒表示的时间
     private static final long DAY_IN_MILLIS = 24 * 3600 * 1000;
     private static final long HOUR_IN_MILLIS = 3600 * 1000;
@@ -74,40 +74,6 @@ public class DateUtils extends PropertyEditorSupport {
         return new Date();
     }
 
-    /**
-     * 指定毫秒数表示的日期
-     *
-     * @param millis 毫秒数
-     * @return 指定毫秒数表示的日期
-     */
-    public static Date getDate(long millis) {
-        return new Date(millis);
-    }
-
-    /**
-     * 时间戳转换为字符串
-     *
-     * @param time
-     * @return
-     */
-    public static String timestamptoStr(Timestamp time) {
-        Date date = null;
-        if (null != time) {
-            date = new Date(time.getTime());
-        }
-        return date2Str(date_sdf);
-    }
-
-    /**
-     * 字符串转换时间戳
-     *
-     * @param str
-     * @return
-     */
-    public static Timestamp str2Timestamp(String str) {
-        Date date = str2Date(str, date_sdf);
-        return new Timestamp(date.getTime());
-    }
 
     /**
      * 字符串转换成日期
@@ -134,12 +100,13 @@ public class DateUtils extends PropertyEditorSupport {
      * 日期转换为字符串
      * @return 字符串
      */
-    public static String date2Str(SimpleDateFormat dateSdf) {
+    public static String date2Str() {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
         Date date = getDate();
         if (null == date) {
             return null;
         }
-        return date_sdf.format(date);
+        return format.format(date);
     }
 
     /**
@@ -223,6 +190,7 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 当前时间的标准形式字符串
      */
     public static String now() {
+        SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         return datetimeFormat.format(getCalendar().getTime());
     }
 
@@ -311,7 +279,8 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 默认日期按“年-月-日“格式显示
      */
     public static String formatDate() {
-        return date_sdf.format(getCalendar().getTime());
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        return format.format(getCalendar().getTime());
     }
 
     /**
@@ -320,6 +289,7 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 默认日期按“yyyy-MM-dd HH:mm:ss“格式显示
      */
     public static String formatDateTime() {
+        SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         return datetimeFormat.format(getCalendar().getTime());
     }
 
@@ -337,7 +307,8 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 指定日期按“年-月-日“格式显示
      */
     public static String formatDate(Calendar cal) {
-        return date_sdf.format(cal.getTime());
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        return format.format(cal.getTime());
     }
 
     /**
@@ -347,7 +318,8 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 指定日期按“年-月-日“格式显示
      */
     public static String formatDate(Date date) {
-        return date_sdf.format(date);
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        return format.format(date);
     }
 
     /**
@@ -357,7 +329,8 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 指定毫秒数表示日期按“年-月-日“格式显示
      */
     public static String formatDate(long millis) {
-        return date_sdf.format(new Date(millis));
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        return format.format(new Date(millis));
     }
 
     /**
@@ -403,7 +376,8 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 默认日期按“年-月-日 时:分“格式显示
      */
     public static String formatTime() {
-        return time_sdf.format(getCalendar().getTime());
+        SimpleDateFormat timeSdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+        return timeSdf.format(getCalendar().getTime());
     }
 
     /**
@@ -413,7 +387,8 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 指定毫秒数表示日期按“年-月-日 时:分“格式显示
      */
     public static String formatTime(long millis) {
-        return time_sdf.format(new Date(millis));
+        SimpleDateFormat timeSdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+        return timeSdf.format(new Date(millis));
     }
 
     /**
@@ -423,7 +398,8 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 指定日期按“年-月-日 时:分“格式显示
      */
     public static String formatTime(Calendar cal) {
-        return time_sdf.format(cal.getTime());
+        SimpleDateFormat timeSdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+        return timeSdf.format(cal.getTime());
     }
 
     /**
@@ -433,7 +409,8 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 指定日期按“年-月-日 时:分“格式显示
      */
     public static String formatTime(Date date) {
-        return time_sdf.format(date);
+        SimpleDateFormat timeSdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+        return timeSdf.format(date);
     }
 
     // ////////////////////////////////////////////////////////////////////////////
@@ -447,7 +424,8 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 默认日期按“时:分“格式显示
      */
     public static String formatShortTime() {
-        return short_time_sdf.format(getCalendar().getTime());
+        SimpleDateFormat shortTimeSdf = new SimpleDateFormat("HH:mm");
+        return shortTimeSdf.format(getCalendar().getTime());
     }
 
     /**
@@ -457,7 +435,8 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 指定毫秒数表示日期按“时:分“格式显示
      */
     public static String formatShortTime(long millis) {
-        return short_time_sdf.format(new Date(millis));
+        SimpleDateFormat shortTimeSdf = new SimpleDateFormat("HH:mm");
+        return shortTimeSdf.format(new Date(millis));
     }
 
     /**
@@ -467,7 +446,8 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 指定日期按“时:分“格式显示
      */
     public static String formatShortTime(Calendar cal) {
-        return short_time_sdf.format(cal.getTime());
+        SimpleDateFormat shortTimeSdf = new SimpleDateFormat("HH:mm");
+        return shortTimeSdf.format(cal.getTime());
     }
 
     /**
@@ -477,7 +457,8 @@ public class DateUtils extends PropertyEditorSupport {
      * @return 指定日期按“时:分“格式显示
      */
     public static String formatShortTime(Date date) {
-        return short_time_sdf.format(date);
+        SimpleDateFormat shortTimeSdf = new SimpleDateFormat("HH:mm");
+        return shortTimeSdf.format(date);
     }
 
     // ////////////////////////////////////////////////////////////////////////////
@@ -585,10 +566,12 @@ public class DateUtils extends PropertyEditorSupport {
      */
     @Override
     public void setAsText(String text) throws IllegalArgumentException {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         if (StringUtils.hasText(text)) {
             try {
                 if (text.indexOf(":") == -1 && text.length() == 10) {
-                    setValue(date_sdf.parse(text));
+                    setValue(format.parse(text));
                 } else if (text.indexOf(":") > 0 && text.length() == 19) {
                     setValue(datetimeFormat.parse(text));
                 } else {

+ 26 - 27
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DySmsHelper.java

@@ -17,53 +17,57 @@ import com.aliyuncs.profile.IClientProfile;
  * 工程依赖了2个jar包(存放在工程的libs目录下)
  * 1:aliyun-java-sdk-core.jar
  * 2:aliyun-java-sdk-dysmsapi.jar
- *
+ * <p>
  * 备注:Demo工程编码采用UTF-8
  * 国际短信发送请勿参照此DEMO
  */
 public class DySmsHelper {
 
-	private final static Logger logger=LoggerFactory.getLogger(DySmsHelper.class);
+    private final static Logger logger = LoggerFactory.getLogger(DySmsHelper.class);
 
-    //产品名称:云通信短信API产品,开发者无需替换
-    static final String product = "Dysmsapi";
-    //产品域名,开发者无需替换
-    static final String domain = "dysmsapi.aliyuncs.com";
+    /**
+     * 产品名称:云通信短信API产品,开发者无需替换
+     */
+    static final String PRODUCT = "Dysmsapi";
+    /**
+     * 产品域名,开发者无需替换
+     */
+    static final String DOMAIN = "dysmsapi.aliyuncs.com";
 
     // TODO 此处需要替换成开发者自己的AK(在阿里云访问控制台寻找)
-    static final String accessKeyId = "?";
-    static final String accessKeySecret = "?";
+    static final String ACCESS_KEY_ID = "?";
+    static final String ACCESS_KEY_SECRET = "?";
 
     /**
-         * 登陆时采用的短信发送模板编码
+     * 登陆时采用的短信发送模板编码
      */
-    public static final String LOGIN_TEMPLATE_CODE="SMS_167040816";
+    public static final String LOGIN_TEMPLATE_CODE = "SMS_167040816";
 
     /**
      * 忘记密码时采用的短信发送模板编码
      */
-    public static final String FORGET_PASSWORD_TEMPLATE_CODE="SMS_167040816";
+    public static final String FORGET_PASSWORD_TEMPLATE_CODE = "SMS_167040816";
 
 
     /**
      * 注册时采用的短信发送模板编码
      */
-    public static final String REGISTER_TEMPLATE_CODE="SMS_144146309";
+    public static final String REGISTER_TEMPLATE_CODE = "SMS_144146309";
 
     /**
-         * 必填:短信签名-可在短信控制台中找到
+     * 必填:短信签名-可在短信控制台中找到
      */
-    public static final String signName="JEECG";
+    public static final String SIGN_NAME = "JEECG";
 
 
-    public static boolean sendSms(String phone,String code,String templateCode) throws ClientException {
-    	//可自助调整超时时间
+    public static boolean sendSms(String phone, String code, String templateCode) throws ClientException {
+        //可自助调整超时时间
         System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
         System.setProperty("sun.net.client.defaultReadTimeout", "10000");
 
         //初始化acsClient,暂不支持region化
-        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
-        DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
+        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", ACCESS_KEY_ID, ACCESS_KEY_SECRET);
+        DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", PRODUCT, DOMAIN);
         IAcsClient acsClient = new DefaultAcsClient(profile);
 
         //组装请求对象-具体描述见控制台-文档部分内容
@@ -71,11 +75,11 @@ public class DySmsHelper {
         //必填:待发送手机号
         request.setPhoneNumbers(phone);
         //必填:短信签名-可在短信控制台中找到
-        request.setSignName(signName);
+        request.setSignName(SIGN_NAME);
         //必填:短信模板-可在短信控制台中找到
         request.setTemplateCode("SMS_167040816");
         //可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
-        request.setTemplateParam("{\"code\":\""+code+"\"}");
+        request.setTemplateParam("{\"code\":\"" + code + "\"}");
 
         //选填-上行短信扩展码(无特殊需求用户请忽略此字段)
         //request.setSmsUpExtendCode("90997");
@@ -84,22 +88,17 @@ public class DySmsHelper {
         //request.setOutId("yourOutId");
 
         boolean result = false;
-
         //hint 此处可能会抛出异常,注意catch
         SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
         logger.info("短信接口返回的数据----------------");
-        logger.info("{Code:" + sendSmsResponse.getCode()+",Message:" + sendSmsResponse.getMessage()+",RequestId:"+ sendSmsResponse.getRequestId()+",BizId:"+sendSmsResponse.getBizId()+"}");
+        logger.info("{Code:" + sendSmsResponse.getCode() + ",Message:" + sendSmsResponse.getMessage() + ",RequestId:" + sendSmsResponse.getRequestId() + ",BizId:" + sendSmsResponse.getBizId() + "}");
         if ("OK".equals(sendSmsResponse.getCode())) {
             result = true;
         }
         return result;
-
     }
 
-
     public static void main(String[] args) throws ClientException, InterruptedException {
-
-    	sendSms("13800138000", "123456", FORGET_PASSWORD_TEMPLATE_CODE);
-
+        sendSms("13800138000", "123456", FORGET_PASSWORD_TEMPLATE_CODE);
     }
 }

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

@@ -1,9 +1,39 @@
 package org.jeecg.common.util;
 
 import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
 
 public class MD5Util {
 
+    private static ThreadLocal<MessageDigest> MD5 = new ThreadLocal<MessageDigest>() {
+        @Override
+        protected MessageDigest initialValue() {
+            try {
+                return MessageDigest.getInstance("MD5");
+            } catch (NoSuchAlgorithmException e) {
+                throw new IllegalStateException("No md5 algorithm found");
+            }
+        }
+    };
+
+    public static String toHexStr(byte[] bytes) {
+        int j = bytes.length;
+        char[] str = new char[j * 2];
+        int k = 0;
+        for (int i = 0; i < j; i++) {
+            byte byte0 = bytes[i];
+            str[k++] = HEX_DIGITS_CHAR[byte0 >>> 4 & 0xf];
+            str[k++] = HEX_DIGITS_CHAR[byte0 & 0xf];
+        }
+        return String.valueOf(str);
+    }
+
+    public static String getMd5(String msg) {
+        MessageDigest md5 = MD5.get();
+        md5.reset();
+        return toHexStr(md5.digest(msg.getBytes()));
+    }
+
     public static String byteArrayToHexString(byte[] b) {
 		StringBuffer resultSb = new StringBuffer();
 		for (int i = 0; i < b.length; i++){
@@ -19,7 +49,7 @@ public class MD5Util {
 		}
 		int d1 = n / 16;
 		int d2 = n % 16;
-		return hexDigits[d1] + hexDigits[d2];
+        return HEX_DIGITS[d1] + HEX_DIGITS[d2];
 	}
 
     public static String Md5Encode(String origin, String charsetname) {
@@ -37,7 +67,8 @@ public class MD5Util {
 		return resultString;
 	}
 
-    private static final String[] hexDigits = {"0", "1", "2", "3", "4", "5",
+    private static final String[] HEX_DIGITS = {"0", "1", "2", "3", "4", "5",
 			"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
+    private static final char[] HEX_DIGITS_CHAR = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
 
 }

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

@@ -18,7 +18,7 @@ public class PasswordUtil {
 	 * 定义使用的算法为:PBEWITHMD5andDES算法
 	 */
 	public static final String ALGORITHM = "PBEWithMD5AndDES";//加密算法
-	public static final String Salt = "63293188";//密钥
+    public static final String SALT = "63293188";//密钥
 
 	/**
 	 * 定义迭代次数为1000次
@@ -39,7 +39,7 @@ public class PasswordUtil {
 
 	public static byte[] getStaticSalt() {
 		// 产出盐
-		return Salt.getBytes();
+        return SALT.getBytes();
 	}
 
 	/**

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

@@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j;
  */
 @Slf4j
 public class SqlInjectionUtil {
-	final static String xssStr = "'|and |exec |insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |;|or |+|,";
+    final static String XSS_STR = "'|and |exec |insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |;|or |+|,";
 
 	/**
 	 * sql注入过滤处理,遇到注入关键字抛异常
@@ -22,7 +22,7 @@ public class SqlInjectionUtil {
 			return;
 		}
 		value = value.toLowerCase();// 统一转为小写
-		String[] xssArr = xssStr.split("\\|");
+        String[] xssArr = XSS_STR.split("\\|");
 		for (int i = 0; i < xssArr.length; i++) {
 			if (value.indexOf(xssArr[i]) > -1) {
 				log.error("请注意,值可能存在SQL注入风险!---> {}", value);
@@ -34,12 +34,12 @@ public class SqlInjectionUtil {
 
 	/**
 	 * sql注入过滤处理,遇到注入关键字抛异常
-	 * 
-	 * @param value
+	 *
+     * @param values
 	 * @return
 	 */
 	public static void filterContent(String[] values) {
-		String[] xssArr = xssStr.split("\\|");
+        String[] xssArr = XSS_STR.split("\\|");
 		for (String value : values) {
 			if (value == null || "".equals(value)) {
 				return;

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

@@ -22,6 +22,8 @@ public enum StatusCode {
     TEMPLATE_NAME_HAS_EXIST("模板名称已存在", -204, false),
     TEMPLATE_NAME_IS_NULL("模板名称为空", -205, false),
     FILE_HAS_NOT_UPLOAD("文件尚未上传", -206, false),
+    ACCOUNT_HAS_NOT_EXIST("改用户信息不存在", -207, false),
+    USERNAME_OR_PASSWORD_ERROR("登录用户名或密码错误", -208, false),
     FILE_HAS_UPLOAD("文件已经上传过", 0, false),
     COMMON_SERVER_ERROR("服务器内部错误", -102, false);
     private String desc;

+ 150 - 154
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/YouBianCodeUtil.java

@@ -6,168 +6,164 @@ import io.netty.util.internal.StringUtil;
  * 流水号生成规则(按默认规则递增,数字从1-99开始递增,数字到99,递增字母;位数不够增加位数)
  * A001
  * A001A002
- * @Author zhangdaihao
  *
+ * @Author zhangdaihao
  */
 public class YouBianCodeUtil {
 
-	// 数字位数(默认生成3位的数字)
-
-	private static final int numLength = 2;//代表数字位数
-
-	public static final int zhanweiLength = 1+numLength;
-
-	/**
-	 * 根据前一个code,获取同级下一个code
-	 * 例如:当前最大code为D01A04,下一个code为:D01A05
-	 * 
-	 * @param code
-	 * @return
-	 */
-	public static synchronized String getNextYouBianCode(String code) {
-		String newcode = "";
-		if (code == null || code =="") {
-			String zimu = "A";
-			String num = getStrNum(1);
-			newcode = zimu + num;
-		} else {
-			String before_code = code.substring(0, code.length() - 1- numLength);
-			String after_code = code.substring(code.length() - 1 - numLength,code.length());
-			char after_code_zimu = after_code.substring(0, 1).charAt(0);
-			Integer after_code_num = Integer.parseInt(after_code.substring(1));
+    // 数字位数(默认生成3位的数字)
+    //代表数字位数
+    private static final int NUM_LENGTH = 2;
+
+    public static final int ZHANWEI_LENGTH = 1 + NUM_LENGTH;
+
+    /**
+     * 根据前一个code,获取同级下一个code
+     * 例如:当前最大code为D01A04,下一个code为:D01A05
+     *
+     * @param code
+     * @return
+     */
+    public static synchronized String getNextYouBianCode(String code) {
+        String newcode = "";
+        if (code == null || code == "") {
+            String zimu = "A";
+            String num = getStrNum(1);
+            newcode = zimu + num;
+        } else {
+            String before_code = code.substring(0, code.length() - 1 - NUM_LENGTH);
+            String after_code = code.substring(code.length() - 1 - NUM_LENGTH, code.length());
+            char after_code_zimu = after_code.substring(0, 1).charAt(0);
+            Integer after_code_num = Integer.parseInt(after_code.substring(1));
 //			org.jeecgframework.core.util.LogUtil.info(after_code);
 //			org.jeecgframework.core.util.LogUtil.info(after_code_zimu);
 //			org.jeecgframework.core.util.LogUtil.info(after_code_num);
 
-			String nextNum = "";
-			char nextZimu = 'A';
-			// 先判断数字等于999*,则计数从1重新开始,递增
-			if (after_code_num == getMaxNumByLength(numLength)) {
-				nextNum = getNextStrNum(0);
-			} else {
-				nextNum = getNextStrNum(after_code_num);
-			}
-			// 先判断数字等于999*,则字母从A重新开始,递增
-			if(after_code_num == getMaxNumByLength(numLength)) {
-				nextZimu = getNextZiMu(after_code_zimu);
-			}else{
-				nextZimu = after_code_zimu;
-			}
-
-			// 例如Z99,下一个code就是Z99A01
-			if ('Z' == after_code_zimu && getMaxNumByLength(numLength) == after_code_num) {
-				newcode = code + (nextZimu + nextNum);
-			} else {
-				newcode = before_code + (nextZimu + nextNum);
-			}
-		}
-		return newcode;
-
-	}
-
-	/**
-	 * 根据父亲code,获取下级的下一个code
-	 * 
-	 * 例如:父亲CODE:A01
-	 *       当前CODE:A01B03
-	 *       获取的code:A01B04
-	 *       
-	 * @param parentCode   上级code
-	 * @param localCode    同级code
-	 * @return
-	 */
-	public static synchronized String getSubYouBianCode(String parentCode,String localCode) {
-		if(localCode!=null && localCode!=""){
+            String nextNum = "";
+            char nextZimu = 'A';
+            // 先判断数字等于999*,则计数从1重新开始,递增
+            if (after_code_num == getMaxNumByLength(NUM_LENGTH)) {
+                nextNum = getNextStrNum(0);
+            } else {
+                nextNum = getNextStrNum(after_code_num);
+            }
+            // 先判断数字等于999*,则字母从A重新开始,递增
+            if (after_code_num == getMaxNumByLength(NUM_LENGTH)) {
+                nextZimu = getNextZiMu(after_code_zimu);
+            } else {
+                nextZimu = after_code_zimu;
+            }
+
+            // 例如Z99,下一个code就是Z99A01
+            if ('Z' == after_code_zimu && getMaxNumByLength(NUM_LENGTH) == after_code_num) {
+                newcode = code + (nextZimu + nextNum);
+            } else {
+                newcode = before_code + (nextZimu + nextNum);
+            }
+        }
+        return newcode;
+
+    }
+
+    /**
+     * 根据父亲code,获取下级的下一个code
+     * <p>
+     * 例如:父亲CODE:A01
+     * 当前CODE:A01B03
+     * 获取的code:A01B04
+     *
+     * @param parentCode 上级code
+     * @param localCode  同级code
+     * @return
+     */
+    public static synchronized String getSubYouBianCode(String parentCode, String localCode) {
+        if (localCode != null && localCode != "") {
 
 //			return parentCode + getNextYouBianCode(localCode);
-			return getNextYouBianCode(localCode);
-
-		}else{
-			parentCode = parentCode + "A"+ getNextStrNum(0);
-		}
-		return parentCode;
-	}
-
-	
-
-	/**
-	 * 将数字前面位数补零
-	 * 
-	 * @param num
-	 * @return
-	 */
-	private static String getNextStrNum(int num) {
-		return getStrNum(getNextNum(num));
-	}
-
-	/**
-	 * 将数字前面位数补零
-	 * 
-	 * @param num
-	 * @return
-	 */
-	private static String getStrNum(int num) {
-		String s = String.format("%0" + numLength + "d", num);
-		return s;
-	}
-
-	/**
-	 * 递增获取下个数字
-	 * 
-	 * @param num
-	 * @return
-	 */
-	private static int getNextNum(int num) {
-		num++;
-		return num;
-	}
-
-	/**
-	 * 递增获取下个字母
-	 * 
-	 * @param num
-	 * @return
-	 */
-	private static char getNextZiMu(char zimu) {
-		if (zimu == 'Z') {
-			return 'A';
-		}
-		zimu++;
-		return zimu;
-	}
-	
-	/**
-	 * 根据数字位数获取最大值
-	 * @param length
-	 * @return
-	 */
-	private static int getMaxNumByLength(int length){
-		if(length==0){
-			return 0;
-		}
-		String max_num = "";
-		for (int i=0;i<length;i++){
-			max_num = max_num + "9";
-		}
-		return Integer.parseInt(max_num);
-	}
-	public static String[] cutYouBianCode(String code){
-		if(code==null || StringUtil.isNullOrEmpty(code)){
-			return null;
-		}else{
-			//获取标准长度为numLength+1,截取的数量为code.length/numLength+1
-			int c = code.length()/(numLength+1);
-			String[] cutcode = new String[c];
-			for(int i =0 ; i <c;i++){
-				cutcode[i] = code.substring(0,(i+1)*(numLength+1));
-			}
-			return cutcode;
-		}
-		
-	}
-	public static void main(String[] args) {
-		// org.jeecgframework.core.util.LogUtil.info(getNextZiMu('C'));
-		// org.jeecgframework.core.util.LogUtil.info(getNextNum(8));
-	    // org.jeecgframework.core.util.LogUtil.info(cutYouBianCode("C99A01B01")[2]);
-	}
+            return getNextYouBianCode(localCode);
+
+        } else {
+            parentCode = parentCode + "A" + getNextStrNum(0);
+        }
+        return parentCode;
+    }
+
+
+    /**
+     * 将数字前面位数补零
+     *
+     * @param num
+     * @return
+     */
+    private static String getNextStrNum(int num) {
+        return getStrNum(getNextNum(num));
+    }
+
+    /**
+     * 将数字前面位数补零
+     *
+     * @param num
+     * @return
+     */
+    private static String getStrNum(int num) {
+        String s = String.format("%0" + NUM_LENGTH + "d", num);
+        return s;
+    }
+
+    /**
+     * 递增获取下个数字
+     *
+     * @param num
+     * @return
+     */
+    private static int getNextNum(int num) {
+        num++;
+        return num;
+    }
+
+    /**
+     * 递增获取下个字母
+     *
+     * @param zimu
+     * @return
+     */
+    private static char getNextZiMu(char zimu) {
+        if (zimu == 'Z') {
+            return 'A';
+        }
+        zimu++;
+        return zimu;
+    }
+
+    /**
+     * 根据数字位数获取最大值
+     *
+     * @param length
+     * @return
+     */
+    private static int getMaxNumByLength(int length) {
+        if (length == 0) {
+            return 0;
+        }
+        String max_num = "";
+        for (int i = 0; i < length; i++) {
+            max_num = max_num + "9";
+        }
+        return Integer.parseInt(max_num);
+    }
+
+    public static String[] cutYouBianCode(String code) {
+        if (code == null || StringUtil.isNullOrEmpty(code)) {
+            return null;
+        } else {
+            //获取标准长度为numLength+1,截取的数量为code.length/numLength+1
+            int c = code.length() / (NUM_LENGTH + 1);
+            String[] cutcode = new String[c];
+            for (int i = 0; i < c; i++) {
+                cutcode[i] = code.substring(0, (i + 1) * (NUM_LENGTH + 1));
+            }
+            return cutcode;
+        }
+
+    }
 }

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

@@ -28,8 +28,8 @@ public class AesEncryptUtil {
      */
     public static String encrypt(String data, String key, String iv) throws Exception {
         try {
-
-            Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");//"算法/模式/补码方式"NoPadding PkcsPadding
+            //"算法/模式/补码方式"NoPadding PkcsPadding
+            Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
             int blockSize = cipher.getBlockSize();
 
             byte[] dataBytes = data.getBytes();

+ 8 - 8
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/JsonSchemaDescrip.java

@@ -13,9 +13,9 @@ public class JsonSchemaDescrip implements Serializable{
 	 * 
 	 */
 	private static final long serialVersionUID = 7682073117441544718L;
-	
-	
-	private String $schema = "http://json-schema.org/draft-07/schema#";
+
+
+    private String SCHEMA = "http://json-schema.org/draft-07/schema#";
 	
 	/**
 	 * 用它给我们的模式提供了标题。
@@ -43,12 +43,12 @@ public class JsonSchemaDescrip implements Serializable{
 		this.required = required;
 	}
 
-	public String get$schema() {
-		return $schema;
-	}
+    public String getSchema() {
+        return SCHEMA;
+    }
 
-	public void set$schema(String $schema) {
-		this.$schema = $schema;
+    public void setSchema(String schema) {
+        this.SCHEMA = schema;
 	}
 
 	public String getTitle() {

+ 3 - 3
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/jsonschema/JsonschemaUtil.java

@@ -21,7 +21,7 @@ public class JsonschemaUtil {
 	 */
 	public static JSONObject getJsonSchema(JsonSchemaDescrip descrip, List<CommonProperty> propertyList) {
 		JSONObject obj = new JSONObject();
-		obj.put("$schema", descrip.get$schema());
+        obj.put("$schema", descrip.getSchema());
 		obj.put("type", descrip.getType());
 		obj.put("title", descrip.getTitle());
 
@@ -35,7 +35,7 @@ public class JsonschemaUtil {
 		}
 		obj.put("properties", properties);
 		//鬼知道这里为什么报错 org.jeecg.modules.system.model.DictModel cannot be cast to org.jeecg.modules.system.model.DictModel
-		//log.info("---JSONSchema--->"+obj.toJSONString());
+        log.info("---JSONSchema--->" + obj.toJSONString());
 		return obj;
 	}
 	
@@ -63,7 +63,7 @@ public class JsonschemaUtil {
 			properties.put(map.get("key").toString(), map.get("prop"));
 		}
 		obj.put("properties", properties);
-		//log.info("---JSONSchema--->"+obj.toString());
+        log.info("---JSONSchema--->" + obj.toString());
 		return obj;
 	}
 

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

@@ -503,7 +503,7 @@ public class oConvertUtils {
 			return name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase();
 		}
 		// 用下划线将原始字符串分割
-		String camels[] = name.split("_");
+        String[] camels = name.split("_");
 		for (String camel : camels) {
 			// 跳过原始字符串中开头、结尾的下换线或双重下划线
 			if (camel.isEmpty()) {

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/JeecgOneGUI.java

@@ -8,7 +8,7 @@ import org.jeecgframework.codegenerate.window.CodeWindow;
  * @site www.jeecg.org
  * @Version:V1.0.1
  */
-public class JeecgOneGUI {
+public class JeecgOneGui {
 
 	/** 详细使用手册: http://jeecg-boot.mydoc.io/?t=338140 */
     public static void main(String[] args) {

+ 210 - 202
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java

@@ -6,6 +6,7 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.aspect.annotation.AutoLog;
@@ -34,40 +35,42 @@ import com.alibaba.fastjson.JSON;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
- /**
+/**
  * @Description: 广告主信息表
  * @Author: jeecg-boot
- * @Date:   2019-06-11
+ * @Date: 2019-06-11
  * @Version: V1.0
  */
 @Slf4j
-@Api(tags="广告主信息表")
+@Api(tags = "广告主信息表")
 @RestController
 @RequestMapping("/ctop/advertiser")
 public class AdvertiserController {
-	@Autowired
-	private IAdvertiserService advertiserService;
-     @Autowired
-     private ISysCategoryService sysCategoryService;
-	/**
-	  * 分页列表查询
-	 * @param advertiser
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	@AutoLog(value = "广告主信息表-分页列表查询")
-	@ApiOperation(value="广告主信息表-分页列表查询", notes="广告主信息表-分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<Advertiser>> queryPageList(Advertiser advertiser,
-									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-									  HttpServletRequest req) {
-		Result<IPage<Advertiser>> result = new Result<IPage<Advertiser>>();
-		QueryWrapper<Advertiser> queryWrapper = QueryGenerator.initQueryWrapper(advertiser, req.getParameterMap());
-		Page<Advertiser> page = new Page<Advertiser>(pageNo, pageSize);
-		IPage<Advertiser> pageList = advertiserService.page(page, queryWrapper);
+    @Autowired
+    private IAdvertiserService advertiserService;
+    @Autowired
+    private ISysCategoryService sysCategoryService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param advertiser
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "广告主信息表-分页列表查询")
+    @ApiOperation(value = "广告主信息表-分页列表查询", notes = "广告主信息表-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<Advertiser>> queryPageList(Advertiser advertiser,
+                                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                   HttpServletRequest req) {
+        Result<IPage<Advertiser>> result = new Result<IPage<Advertiser>>();
+        QueryWrapper<Advertiser> queryWrapper = QueryGenerator.initQueryWrapper(advertiser, req.getParameterMap());
+        Page<Advertiser> page = new Page<Advertiser>(pageNo, pageSize);
+        IPage<Advertiser> pageList = advertiserService.page(page, queryWrapper);
         if (pageList != null && pageList.getRecords() != null && pageList.getRecords().size() > 0) {
             List<Advertiser> list = new ArrayList<>();
             for (int i = 0; i < pageList.getRecords().size(); i++) {
@@ -81,184 +84,189 @@ public class AdvertiserController {
             }
             pageList.setRecords(list);
         }
-		result.setSuccess(true);
-		result.setResult(pageList);
-		return result;
-	}
-	
-	/**
-	  *   添加
-	 * @param advertiser
-	 * @return
-	 */
-	@AutoLog(value = "广告主信息表-添加")
-	@ApiOperation(value="广告主信息表-添加", notes="广告主信息表-添加")
-	@PostMapping(value = "/add")
-	public Result<Advertiser> add(@RequestBody Advertiser advertiser) {
-		Result<Advertiser> result = new Result<Advertiser>();
-		try {
-			advertiserService.save(advertiser);
-			result.success("添加成功!");
-		} catch (Exception e) {
-			log.error(e.getMessage(),e);
-			result.error500("操作失败");
-		}
-		return result;
-	}
-	
-	/**
-	  *  编辑
-	 * @param advertiser
-	 * @return
-	 */
-	@AutoLog(value = "广告主信息表-编辑")
-	@ApiOperation(value="广告主信息表-编辑", notes="广告主信息表-编辑")
-	@PutMapping(value = "/edit")
-	public Result<Advertiser> edit(@RequestBody Advertiser advertiser) {
-		Result<Advertiser> result = new Result<Advertiser>();
-		Advertiser advertiserEntity = advertiserService.getById(advertiser.getId());
-		if(advertiserEntity==null) {
-			result.error500("未找到对应实体");
-		}else {
-			boolean ok = advertiserService.updateById(advertiser);
-			//TODO 返回false说明什么?
-			if(ok) {
-				result.success("修改成功!");
-			}
-		}
-		
-		return result;
-	}
-	
-	/**
-	  *   通过id删除
-	 * @param id
-	 * @return
-	 */
-	@AutoLog(value = "广告主信息表-通过id删除")
-	@ApiOperation(value="广告主信息表-通过id删除", notes="广告主信息表-通过id删除")
-	@DeleteMapping(value = "/delete")
-	public Result<Advertiser> delete(@RequestParam(name="id",required=true) String id) {
-		Result<Advertiser> result = new Result<Advertiser>();
-		Advertiser advertiser = advertiserService.getById(id);
-		if(advertiser==null) {
-			result.error500("未找到对应实体");
-		}else {
-			boolean ok = advertiserService.removeById(id);
-			if(ok) {
-				result.success("删除成功!");
-			}
-		}
-		
-		return result;
-	}
-	
-	/**
-	  *  批量删除
-	 * @param ids
-	 * @return
-	 */
-	@AutoLog(value = "广告主信息表-批量删除")
-	@ApiOperation(value="广告主信息表-批量删除", notes="广告主信息表-批量删除")
-	@DeleteMapping(value = "/deleteBatch")
-	public Result<Advertiser> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<Advertiser> result = new Result<Advertiser>();
-		if(ids==null || "".equals(ids.trim())) {
-			result.error500("参数不识别!");
-		}else {
-			this.advertiserService.removeByIds(Arrays.asList(ids.split(",")));
-			result.success("删除成功!");
-		}
-		return result;
-	}
-	
-	/**
-	  * 通过id查询
-	 * @param id
-	 * @return
-	 */
-	@AutoLog(value = "广告主信息表-通过id查询")
-	@ApiOperation(value="广告主信息表-通过id查询", notes="广告主信息表-通过id查询")
-	@GetMapping(value = "/queryById")
-	public Result<Advertiser> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<Advertiser> result = new Result<Advertiser>();
-		Advertiser advertiser = advertiserService.getById(id);
-		if(advertiser==null) {
-			result.error500("未找到对应实体");
-		}else {
-			result.setResult(advertiser);
-			result.setSuccess(true);
-		}
-		return result;
-	}
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param advertiser
+     * @return
+     */
+    @AutoLog(value = "广告主信息表-添加")
+    @ApiOperation(value = "广告主信息表-添加", notes = "广告主信息表-添加")
+    @PostMapping(value = "/add")
+    public Result<Advertiser> add(@RequestBody Advertiser advertiser) {
+        Result<Advertiser> result = new Result<Advertiser>();
+        try {
+            advertiserService.save(advertiser);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
 
-  /**
-      * 导出excel
-   *
-   * @param request
-   * @param response
-   */
-  @RequestMapping(value = "/exportXls")
-  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-      // Step.1 组装查询条件
-      QueryWrapper<Advertiser> queryWrapper = null;
-      try {
-          String paramsStr = request.getParameter("paramsStr");
-          if (oConvertUtils.isNotEmpty(paramsStr)) {
-              String deString = URLDecoder.decode(paramsStr, "UTF-8");
-              Advertiser advertiser = JSON.parseObject(deString, Advertiser.class);
-              queryWrapper = QueryGenerator.initQueryWrapper(advertiser, request.getParameterMap());
-          }
-      } catch (UnsupportedEncodingException e) {
-          e.printStackTrace();
-      }
+    /**
+     * 编辑
+     *
+     * @param advertiser
+     * @return
+     */
+    @AutoLog(value = "广告主信息表-编辑")
+    @ApiOperation(value = "广告主信息表-编辑", notes = "广告主信息表-编辑")
+    @PutMapping(value = "/edit")
+    public Result<Advertiser> edit(@RequestBody Advertiser advertiser) {
+        Result<Advertiser> result = new Result<Advertiser>();
+        Advertiser advertiserEntity = advertiserService.getById(advertiser.getId());
+        if (advertiserEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = advertiserService.updateById(advertiser);
+            //TODO 返回false说明什么?
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
 
-      //Step.2 AutoPoi 导出Excel
-      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-      List<Advertiser> pageList = advertiserService.list(queryWrapper);
-      //导出文件名称
-      mv.addObject(NormalExcelConstants.FILE_NAME, "广告主信息表列表");
-      mv.addObject(NormalExcelConstants.CLASS, Advertiser.class);
-      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("广告主信息表列表数据", "导出人:Jeecg", "导出信息"));
-      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-      return mv;
-  }
+        return result;
+    }
 
-  /**
-      * 通过excel导入数据
-   *
-   * @param request
-   * @param response
-   * @return
-   */
-  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-          MultipartFile file = entity.getValue();// 获取上传文件对象
-          ImportParams params = new ImportParams();
-          params.setTitleRows(2);
-          params.setHeadRows(1);
-          params.setNeedSave(true);
-          try {
-              List<Advertiser> listAdvertisers = ExcelImportUtil.importExcel(file.getInputStream(), Advertiser.class, params);
-              for (Advertiser advertiserExcel : listAdvertisers) {
-                  advertiserService.save(advertiserExcel);
-              }
-              return Result.ok("文件导入成功!数据行数:" + listAdvertisers.size());
-          } catch (Exception e) {
-              log.error(e.getMessage(),e);
-              return Result.error("文件导入失败:"+e.getMessage());
-          } finally {
-              try {
-                  file.getInputStream().close();
-              } catch (IOException e) {
-                  e.printStackTrace();
-              }
-          }
-      }
-      return Result.ok("文件导入失败!");
-  }
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "广告主信息表-通过id删除")
+    @ApiOperation(value = "广告主信息表-通过id删除", notes = "广告主信息表-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<Advertiser> delete(@RequestParam(name = "id", required = true) String id) {
+        Result<Advertiser> result = new Result<Advertiser>();
+        Advertiser advertiser = advertiserService.getById(id);
+        if (advertiser == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = advertiserService.removeById(id);
+            if (ok) {
+                result.success("删除成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "广告主信息表-批量删除")
+    @ApiOperation(value = "广告主信息表-批量删除", notes = "广告主信息表-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<Advertiser> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<Advertiser> result = new Result<Advertiser>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.advertiserService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
 
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "广告主信息表-通过id查询")
+    @ApiOperation(value = "广告主信息表-通过id查询", notes = "广告主信息表-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<Advertiser> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<Advertiser> result = new Result<Advertiser>();
+        Advertiser advertiser = advertiserService.getById(id);
+        if (advertiser == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(advertiser);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<Advertiser> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                Advertiser advertiser = JSON.parseObject(deString, Advertiser.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(advertiser, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<Advertiser> pageList = advertiserService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "广告主信息表列表");
+        mv.addObject(NormalExcelConstants.CLASS, Advertiser.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("广告主信息表列表数据", "导出人:Jeecg", "导出信息"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            // 获取上传文件对象
+            MultipartFile file = entity.getValue();
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<Advertiser> listAdvertisers = ExcelImportUtil.importExcel(file.getInputStream(), Advertiser.class, params);
+                for (Advertiser advertiserExcel : listAdvertisers) {
+                    advertiserService.save(advertiserExcel);
+                }
+                return Result.ok("文件导入成功!数据行数:" + listAdvertisers.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
 }

+ 202 - 195
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AuthTaskController.java

@@ -33,211 +33,218 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 
- /**
-  * TODO 相关AuthTask 需要删除
+/**
+ * TODO 相关AuthTask 需要删除
+ *
  * @Description: 关联用户分配
  * @Author: jeecg-boot
- * @Date:   2019-07-31
+ * @Date: 2019-07-31
  * @Version: V1.0
  */
 @Slf4j
-@Api(tags="关联用户分配")
+@Api(tags = "关联用户分配")
 @RestController
 @RequestMapping("/ctop/authTask")
 public class AuthTaskController {
-	@Autowired
-	private IAuthTaskService authTaskService;
-	
-	/**
-	  * 分页列表查询
-	 * @param authTask
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	@AutoLog(value = "关联用户分配-分页列表查询")
-	@ApiOperation(value="关联用户分配-分页列表查询", notes="关联用户分配-分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<AuthTask>> queryPageList(AuthTask authTask,
-									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-									  HttpServletRequest req) {
-		Result<IPage<AuthTask>> result = new Result<IPage<AuthTask>>();
-		QueryWrapper<AuthTask> queryWrapper = QueryGenerator.initQueryWrapper(authTask, req.getParameterMap());
-		Page<AuthTask> page = new Page<AuthTask>(pageNo, pageSize);
-		IPage<AuthTask> pageList = authTaskService.page(page, queryWrapper);
-		result.setSuccess(true);
-		result.setResult(pageList);
-		return result;
-	}
-	
-	/**
-	  *   添加
-	 * @param authTask
-	 * @return
-	 */
-	@AutoLog(value = "关联用户分配-添加")
-	@ApiOperation(value="关联用户分配-添加", notes="关联用户分配-添加")
-	@PostMapping(value = "/add")
-	public Result<AuthTask> add(@RequestBody AuthTask authTask) {
-		Result<AuthTask> result = new Result<AuthTask>();
-		try {
-			authTaskService.save(authTask);
-			result.success("添加成功!");
-		} catch (Exception e) {
-			log.error(e.getMessage(),e);
-			result.error500("操作失败");
-		}
-		return result;
-	}
-	
-	/**
-	  *  编辑
-	 * @param authTask
-	 * @return
-	 */
-	@AutoLog(value = "关联用户分配-编辑")
-	@ApiOperation(value="关联用户分配-编辑", notes="关联用户分配-编辑")
-	@PutMapping(value = "/edit")
-	public Result<AuthTask> edit(@RequestBody AuthTask authTask) {
-		Result<AuthTask> result = new Result<AuthTask>();
-		AuthTask authTaskEntity = authTaskService.getById(authTask.getId());
-		if(authTaskEntity==null) {
-			result.error500("未找到对应实体");
-		}else {
-			boolean ok = authTaskService.updateById(authTask);
-			//TODO 返回false说明什么?
-			if(ok) {
-				result.success("修改成功!");
-			}
-		}
-		
-		return result;
-	}
-	
-	/**
-	  *   通过id删除
-	 * @param id
-	 * @return
-	 */
-	@AutoLog(value = "关联用户分配-通过id删除")
-	@ApiOperation(value="关联用户分配-通过id删除", notes="关联用户分配-通过id删除")
-	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
-		try {
-			authTaskService.removeById(id);
-		} catch (Exception e) {
-			log.error("删除失败",e.getMessage());
-			return Result.error("删除失败!");
-		}
-		return Result.ok("删除成功!");
-	}
-	
-	/**
-	  *  批量删除
-	 * @param ids
-	 * @return
-	 */
-	@AutoLog(value = "关联用户分配-批量删除")
-	@ApiOperation(value="关联用户分配-批量删除", notes="关联用户分配-批量删除")
-	@DeleteMapping(value = "/deleteBatch")
-	public Result<AuthTask> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<AuthTask> result = new Result<AuthTask>();
-		if(ids==null || "".equals(ids.trim())) {
-			result.error500("参数不识别!");
-		}else {
-			this.authTaskService.removeByIds(Arrays.asList(ids.split(",")));
-			result.success("删除成功!");
-		}
-		return result;
-	}
-	
-	/**
-	  * 通过id查询
-	 * @param id
-	 * @return
-	 */
-	@AutoLog(value = "关联用户分配-通过id查询")
-	@ApiOperation(value="关联用户分配-通过id查询", notes="关联用户分配-通过id查询")
-	@GetMapping(value = "/queryById")
-	public Result<AuthTask> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<AuthTask> result = new Result<AuthTask>();
-		AuthTask authTask = authTaskService.getById(id);
-		if(authTask==null) {
-			result.error500("未找到对应实体");
-		}else {
-			result.setResult(authTask);
-			result.setSuccess(true);
-		}
-		return result;
-	}
+    @Autowired
+    private IAuthTaskService authTaskService;
 
-  /**
-      * 导出excel
-   *
-   * @param request
-   * @param response
-   */
-  @RequestMapping(value = "/exportXls")
-  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-      // Step.1 组装查询条件
-      QueryWrapper<AuthTask> queryWrapper = null;
-      try {
-          String paramsStr = request.getParameter("paramsStr");
-          if (oConvertUtils.isNotEmpty(paramsStr)) {
-              String deString = URLDecoder.decode(paramsStr, "UTF-8");
-              AuthTask authTask = JSON.parseObject(deString, AuthTask.class);
-              queryWrapper = QueryGenerator.initQueryWrapper(authTask, request.getParameterMap());
-          }
-      } catch (UnsupportedEncodingException e) {
-          e.printStackTrace();
-      }
+    /**
+     * 分页列表查询
+     *
+     * @param authTask
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "关联用户分配-分页列表查询")
+    @ApiOperation(value = "关联用户分配-分页列表查询", notes = "关联用户分配-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<AuthTask>> queryPageList(AuthTask authTask,
+                                                 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                 HttpServletRequest req) {
+        Result<IPage<AuthTask>> result = new Result<IPage<AuthTask>>();
+        QueryWrapper<AuthTask> queryWrapper = QueryGenerator.initQueryWrapper(authTask, req.getParameterMap());
+        Page<AuthTask> page = new Page<AuthTask>(pageNo, pageSize);
+        IPage<AuthTask> pageList = authTaskService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
 
-      //Step.2 AutoPoi 导出Excel
-      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-      List<AuthTask> pageList = authTaskService.list(queryWrapper);
-      //导出文件名称
-      mv.addObject(NormalExcelConstants.FILE_NAME, "关联用户分配列表");
-      mv.addObject(NormalExcelConstants.CLASS, AuthTask.class);
-      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("关联用户分配列表数据", "导出人:Jeecg", "导出信息"));
-      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-      return mv;
-  }
+    /**
+     * 添加
+     *
+     * @param authTask
+     * @return
+     */
+    @AutoLog(value = "关联用户分配-添加")
+    @ApiOperation(value = "关联用户分配-添加", notes = "关联用户分配-添加")
+    @PostMapping(value = "/add")
+    public Result<AuthTask> add(@RequestBody AuthTask authTask) {
+        Result<AuthTask> result = new Result<AuthTask>();
+        try {
+            authTaskService.save(authTask);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
 
-  /**
-      * 通过excel导入数据
-   *
-   * @param request
-   * @param response
-   * @return
-   */
-  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-          MultipartFile file = entity.getValue();// 获取上传文件对象
-          ImportParams params = new ImportParams();
-          params.setTitleRows(2);
-          params.setHeadRows(1);
-          params.setNeedSave(true);
-          try {
-              List<AuthTask> listAuthTasks = ExcelImportUtil.importExcel(file.getInputStream(), AuthTask.class, params);
-              authTaskService.saveBatch(listAuthTasks);
-              return Result.ok("文件导入成功!数据行数:" + listAuthTasks.size());
-          } catch (Exception e) {
-              log.error(e.getMessage(),e);
-              return Result.error("文件导入失败:"+e.getMessage());
-          } finally {
-              try {
-                  file.getInputStream().close();
-              } catch (IOException e) {
-                  e.printStackTrace();
-              }
-          }
-      }
-      return Result.ok("文件导入失败!");
-  }
+    /**
+     * 编辑
+     *
+     * @param authTask
+     * @return
+     */
+    @AutoLog(value = "关联用户分配-编辑")
+    @ApiOperation(value = "关联用户分配-编辑", notes = "关联用户分配-编辑")
+    @PutMapping(value = "/edit")
+    public Result<AuthTask> edit(@RequestBody AuthTask authTask) {
+        Result<AuthTask> result = new Result<AuthTask>();
+        AuthTask authTaskEntity = authTaskService.getById(authTask.getId());
+        if (authTaskEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = authTaskService.updateById(authTask);
+            //TODO 返回false说明什么?
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
 
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "关联用户分配-通过id删除")
+    @ApiOperation(value = "关联用户分配-通过id删除", notes = "关联用户分配-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            authTaskService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "关联用户分配-批量删除")
+    @ApiOperation(value = "关联用户分配-批量删除", notes = "关联用户分配-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<AuthTask> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<AuthTask> result = new Result<AuthTask>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.authTaskService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "关联用户分配-通过id查询")
+    @ApiOperation(value = "关联用户分配-通过id查询", notes = "关联用户分配-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<AuthTask> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<AuthTask> result = new Result<AuthTask>();
+        AuthTask authTask = authTaskService.getById(id);
+        if (authTask == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(authTask);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<AuthTask> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                AuthTask authTask = JSON.parseObject(deString, AuthTask.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(authTask, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<AuthTask> pageList = authTaskService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "关联用户分配列表");
+        mv.addObject(NormalExcelConstants.CLASS, AuthTask.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("关联用户分配列表数据", "导出人:Jeecg", "导出信息"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            // 获取上传文件对象
+            MultipartFile file = entity.getValue();
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<AuthTask> listAuthTasks = ExcelImportUtil.importExcel(file.getInputStream(), AuthTask.class, params);
+                authTaskService.saveBatch(listAuthTasks);
+                return Result.ok("文件导入成功!数据行数:" + listAuthTasks.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
 }

+ 14 - 19
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceAdvertiserPostController.java

@@ -1,7 +1,5 @@
 package org.jeecg.modules.ctop.controller;
 
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -9,12 +7,17 @@ import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
-import org.jeecg.modules.ctop.entity.*;
-import org.jeecg.modules.ctop.service.*;
+import org.jeecg.modules.ctop.entity.ByteDanceCustomAudience;
+import org.jeecg.modules.ctop.service.IByteDanceAdvertiserDataService;
+import org.jeecg.modules.ctop.service.IByteDanceCustomAudienceService;
+import org.jeecg.modules.ctop.service.IFileInfoService;
 import org.jeecg.modules.system.entity.SysDictItem;
 import org.jeecg.modules.system.service.ISysDictItemService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.Map;
@@ -29,6 +32,12 @@ import java.util.Map;
 public class ByteDanceAdvertiserPostController {
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
+    @Autowired
+    private IFileInfoService fileInfoService;
+    @Autowired
+    private IByteDanceCustomAudienceService audienceService;
+    @Autowired
+    private ISysDictItemService sysDictItemService;
 
     /**
      * 1:获取广告主信息
@@ -121,8 +130,6 @@ public class ByteDanceAdvertiserPostController {
         return advertiserDataService.getAdvertiserCreativeMaterial(accountId, creativeIds);
     }
 
-    @Autowired
-    private IByteDanceCreativeService creativeService;
     /**
      * 12:广告组更新状态信息 @param accountId 本平台广告主id
      */
@@ -174,9 +181,6 @@ public class ByteDanceAdvertiserPostController {
         return fileInfoService.getIndustryList(accountId, level);
     }
 
-    @Autowired
-    private IFileInfoService fileInfoService;
-
     /**
      * @param audience
      * @param pageNo
@@ -200,10 +204,6 @@ public class ByteDanceAdvertiserPostController {
         return result;
     }
 
-    @Autowired
-    private IByteDanceCustomAudienceService audienceService;
-
-
     /**
      * @param sysDictItem
      * @param pageNo
@@ -224,9 +224,4 @@ public class ByteDanceAdvertiserPostController {
         result.setResult(pageList);
         return result;
     }
-
-    @Autowired
-    private ISysDictItemService sysDictItemService;
-    @Autowired
-    private IByteDanceAdvertisePlanService advertisePlanService;
 }

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

@@ -5,8 +5,10 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.CtopAdConstant;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.modules.ctop.entity.*;
@@ -20,9 +22,33 @@ import javax.servlet.http.HttpServletResponse;
 import java.util.HashMap;
 import java.util.Map;
 
+@Slf4j
 @RestController
 @RequestMapping("template")
 public class ByteDanceTemplateController {
+    @Autowired
+    private IByteDanceCreativeService creativeService;
+    @Autowired
+    private IUserAllocationService userAllocationService;
+    @Autowired
+    private IBytedanceUrlInfoService urlInfoService;
+    @Autowired
+    private IFileInfoService fileInfoService;
+    @Autowired
+    private IByteDanceAdvertisePlanService planService;
+    @Autowired
+    private IByteDanceCampaignService campaignService;
+    @Autowired
+    private IByteDanceUserOrientationTemplateService orientationTemplateService;
+    @Autowired
+    private IByteDanceCampaignTemplateService campaignTemplateService;
+    @Autowired
+    private IByteDanceBudgetTemplateService budgetTemplateService;
+    @Autowired
+    private IBytedanceDeliveryTargetTemplateService deliveryTargetTemplateService;
+    @Autowired
+    private IBytedanceAdvertisePlanTemplateService advertisePlanTemplateService;
+
     /**
      * 广告组模板
      *
@@ -76,6 +102,7 @@ public class ByteDanceTemplateController {
     public Map<String, Object> diliverytargetTemplateGet(Long targetId) {
         return deliveryTargetTemplateService.get(targetId);
     }
+
     /**
      * 广告创意创建
      *
@@ -87,9 +114,15 @@ public class ByteDanceTemplateController {
         return creativeService.insertBatch(template);
     }
 
-    @Autowired
-    private IByteDanceCreativeService creativeService;
-
+    /**
+     * 获取快手授权用户信息列表
+     *
+     * @param userAllocation
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
     @PostMapping(value = "allocation/list")
     public Result<IPage<UserAllocation>> queryPageList(@RequestBody UserAllocation userAllocation,
                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@@ -107,7 +140,32 @@ public class ByteDanceTemplateController {
     }
 
     @Autowired
-    private IUserAllocationService userAllocationService;
+    private IBindAccountLoginService bindAccountLoginService;
+
+    /**
+     * 获取头条授权用户信息列表
+     *
+     * @param accountLogin
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @PostMapping(value = "bind/login/list")
+    public Result<IPage<BindAccountLogin>> queryBindLoginList(@RequestBody BindAccountLogin accountLogin,
+                                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                              @RequestParam(name = "pageSize", defaultValue = "100") Integer pageSize,
+                                                              HttpServletRequest req) {
+        Result<IPage<BindAccountLogin>> result = new Result<>();
+        QueryWrapper<BindAccountLogin> queryWrapper = QueryGenerator.initQueryWrapper(accountLogin, req.getParameterMap());
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        queryWrapper.eq("user_id", user.getId()).eq("login_type", CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_PY);
+        Page<BindAccountLogin> page = new Page<>(pageNo, pageSize);
+        IPage<BindAccountLogin> pageList = bindAccountLoginService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
 
     /**
      * 用户定向
@@ -133,11 +191,10 @@ public class ByteDanceTemplateController {
         return urlInfoService.insertLink(urlInfo);
     }
 
-    @Autowired
-    private IBytedanceUrlInfoService urlInfoService;
     /**
      * 广告计划模板
-     *  方法废弃
+     * 方法废弃
+     *
      * @param template
      * @param req
      * @return
@@ -231,9 +288,6 @@ public class ByteDanceTemplateController {
         return fileInfoService.getByteDanceIndustryList(req);
     }
 
-    @Autowired
-    private IFileInfoService fileInfoService;
-
     /**
      * @param pageNo
      * @param pageSize
@@ -254,11 +308,6 @@ public class ByteDanceTemplateController {
         return result;
     }
 
-    @Autowired
-    private IByteDanceAdvertisePlanService planService;
-    @Autowired
-    private IByteDanceCampaignService campaignService;
-
     /**
      * 投放目标
      *
@@ -281,17 +330,12 @@ public class ByteDanceTemplateController {
      */
     @GetMapping("site/list")
     public JSONObject getSiteList(Long accountId) {
-        return deliveryTargetTemplateService.getSiteList(accountId);
+        return fileInfoService.getSiteList(accountId);
+    }
+
+    @GetMapping("creative/words/get")
+    public Map<String, Object> getCreativeWords(Long accountId) {
+        return fileInfoService.getCreativeWords(accountId);
     }
-    @Autowired
-    private IByteDanceUserOrientationTemplateService orientationTemplateService;
-    @Autowired
-    private IByteDanceCampaignTemplateService campaignTemplateService;
-    @Autowired
-    private IByteDanceBudgetTemplateService budgetTemplateService;
-    @Autowired
-    private IBytedanceDeliveryTargetTemplateService deliveryTargetTemplateService;
-    @Autowired
-    private IBytedanceAdvertisePlanTemplateService advertisePlanTemplateService;
 
 }

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

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

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

@@ -155,7 +155,7 @@ public class CallbackController {
     private IByteDanceAdvertiserDataService advertiserDataService;
 
     public Map<String, Object> getByteDanceAccessToken(String authCode, String state) {
-        Map<String, Object> param = new HashMap<String, Object>();
+        Map<String, Object> param = new HashMap<>();
         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");
@@ -175,7 +175,7 @@ public class CallbackController {
                 logger.error("获取token失败,state:{},message:{}", state, message);
                 throw new Exception("token返回码异常");
             }
-            String advertiser_id = json.getString("advertiserId");//广告主id
+            String advertiserId = json.getString("advertiserId");//广告主id
             String mediaId = json.getString("mediaId"); // 媒体类型: 1 头条 2 快手
             String realName = json.getString("realName");
             String departmentId = json.getString("departmentId"); //部门id
@@ -184,9 +184,9 @@ public class CallbackController {
             String userId = json.getString("userId"); //创建人
 
             JSONObject data = resultObject.getJSONObject("data");
-            CTopOauthToken token = new CTopOauthToken(advertiser_id, data);
+            CTopOauthToken token = new CTopOauthToken(advertiserId, data);
             Map<String, Object> deleteMap = new HashMap<>();
-            deleteMap.put("advertiser_id", advertiser_id);
+            deleteMap.put("advertiser_id", advertiserId);
             deleteMap.put("account_id", token.getAccountId());
             cTopOauthTokenMapper.deleteByMap(deleteMap); //删除 广告主id下的相关授权信息
             cTopOauthTokenMapper.insert(token);
@@ -207,12 +207,12 @@ public class CallbackController {
             userAllocation.setAdvertiserName(advertiserName);
             userAllocation.setMediaId(mediaId);
             userAllocation.setAuthName(advertiserData.getName());
-            userAllocation.setAdvertiserId(advertiser_id);
+            userAllocation.setAdvertiserId(advertiserId);
             userAllocation.setCreateTime(new Date());
             userAllocation.setUpdateTime(new Date());
             allocationMapper.deleteById(userAllocation.getId());
             Map<String, Object> deleteUserMap = new HashMap<>();
-            deleteUserMap.put("advertiser_id", advertiser_id);
+            deleteUserMap.put("advertiser_id", advertiserId);
             deleteUserMap.put("account_id", token.getAccountId());
             allocationMapper.deleteByMap(deleteUserMap);
             int i = allocationMapper.insert(userAllocation);
@@ -220,7 +220,7 @@ public class CallbackController {
                 logger.info("同步分配用户表完成,task_id:{},accountId:{}", state, token.getAccountId());
 
             }
-            bindAccountAuthService.addBindAccount(token.getAccountId(), KuaishouInterfaceConstant.LOGIN_TYPE_BYTEDANCE, advertiser_id); //账号绑定
+            bindAccountAuthService.addBindAccount(token.getAccountId(), KuaishouInterfaceConstant.LOGIN_TYPE_BYTEDANCE, advertiserId); //账号绑定
             returnMap.put("code", 0);
             returnMap.put("desc", "success");
         } catch (Exception e) {

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

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

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

@@ -226,7 +226,8 @@ public class UserAllocationController {
         MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
         Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
         for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();// 获取上传文件对象
+            // 获取上传文件对象
+            MultipartFile file = entity.getValue();
             ImportParams params = new ImportParams();
             params.setTitleRows(2);
             params.setHeadRows(1);

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

@@ -27,7 +27,7 @@ import java.util.Date;
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
 @ApiModel(value = "ctop_oauth_token对象", description = "oauth授权码")
-public class CTopOauthToken {
+public class CtopOauthToken {
 
     /**
      * 主键ID
@@ -98,7 +98,7 @@ public class CTopOauthToken {
     @ApiModelProperty(value = "修改时间")
     private Date updateTime;
 
-    public CTopOauthToken(String userId, JSONObject data) {
+    public CtopOauthToken(String userId, JSONObject data) {
         this.advertiserId = userId;
         this.mediaId = "1";
         this.accountId = data.getLong("advertiser_id");
@@ -115,10 +115,10 @@ public class CTopOauthToken {
         this.updateTime = now;
     }
 
-    public CTopOauthToken() {
+    public CtopOauthToken() {
     }
 
-    public CTopOauthToken(CTopOauthToken token, JSONObject data) {
+    public CtopOauthToken(CtopOauthToken token, JSONObject data) {
         this.advertiserId = token.getAdvertiserId();
         this.mediaId = "1";
         this.accountId = token.getAccountId();

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouAdvertiserCrawlerJob.java

@@ -12,14 +12,14 @@ import java.util.List;
 
 public class KuaishouAdvertiserCrawlerJob implements Job {
     @Autowired
-    private IKuaishouAdAccountService KuaishouAdAccountService;
+    private IKuaishouAdAccountService kuaishouAdAccountService;
     @Autowired
     private IKuaishouAppService kuaishouAppService;
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
         try{
 
-            List<KuaishouAdAccount> list = KuaishouAdAccountService.querySyncAccount();
+            List<KuaishouAdAccount> list = kuaishouAdAccountService.querySyncAccount();
             if (list != null){
                 for(KuaishouAdAccount account : list){
                     kuaishouAppService.adAccountFetch(account,"");

+ 0 - 20
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/CTopOauthTokenMapper.java

@@ -1,20 +0,0 @@
-package org.jeecg.modules.ctop.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.jeecg.modules.ctop.entity.CTopOauthToken;
-
-import java.util.List;
-
-/**
- * @Description: oauth授权码
- * @Author: jeecg-boot
- * @Date: 2019-07-09
- * @Version: V1.0
- */
-public interface CTopOauthTokenMapper extends BaseMapper<CTopOauthToken> {
-    List<CTopOauthToken> selectAll();
-
-    int updateByPrimaryKeySelective(CTopOauthToken oauthToken);
-
-    CTopOauthToken selectByAccountId(Long accountId);
-}

+ 20 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/CtopOauthTokenMapper.java

@@ -0,0 +1,20 @@
+package org.jeecg.modules.ctop.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.ctop.entity.CtopOauthToken;
+
+import java.util.List;
+
+/**
+ * @Description: oauth授权码
+ * @Author: jeecg-boot
+ * @Date: 2019-07-09
+ * @Version: V1.0
+ */
+public interface CtopOauthTokenMapper extends BaseMapper<CtopOauthToken> {
+    List<CtopOauthToken> selectAll();
+
+    int updateByPrimaryKeySelective(CtopOauthToken oauthToken);
+
+    CtopOauthToken selectByAccountId(Long accountId);
+}

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

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="org.jeecg.modules.ctop.mapper.CTopOauthTokenMapper">
+<mapper namespace="org.jeecg.modules.ctop.mapper.CtopOauthTokenMapper">
 
-    <resultMap id="BaseResultMap" type="org.jeecg.modules.ctop.entity.CTopOauthToken">
+    <resultMap id="BaseResultMap" type="org.jeecg.modules.ctop.entity.CtopOauthToken">
         <result column="id" property="id" jdbcType="BIGINT"/>
         <result column="media_id" property="mediaId" jdbcType="VARCHAR"/>
         <result column="advertiser_id" property="advertiserId" jdbcType="VARCHAR"/>
@@ -26,7 +26,7 @@
     </select>
 
 
-    <update id="updateByPrimaryKeySelective" parameterType="org.jeecg.modules.ctop.entity.CTopOauthToken">
+    <update id="updateByPrimaryKeySelective" parameterType="org.jeecg.modules.ctop.entity.CtopOauthToken">
         update ctop_oauth_token
         <set>
 

+ 20 - 38
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/PlatformCampaignStatisticInfoMapper.xml

@@ -124,8 +124,7 @@ FROM
 				FROM
 					ctop_kuaishou_customer_plan_statistic_info a1
 				WHERE
-					a1.statistic_date = #{statisticDate}
-				AND a1.campaign_code = c.campaign_code
+				    a1.campaign_code = c.campaign_code
 			) AS 'registUserNum',
 			(
 				SELECT
@@ -133,8 +132,7 @@ FROM
 				FROM
 					ctop_kuaishou_customer_plan_statistic_info a2
 				WHERE
-					a2.statistic_date = #{statisticDate}
-				AND a2.campaign_code = c.campaign_code
+				    a2.campaign_code = c.campaign_code
 			) AS 'complateUserNum',
 			(
 				SELECT
@@ -142,8 +140,7 @@ FROM
 				FROM
 					ctop_kuaishou_customer_plan_statistic_info a3
 				WHERE
-					a3.statistic_date = #{statisticDate}
-				AND a3.campaign_code = c.campaign_code
+					a3.campaign_code = c.campaign_code
 			) AS 'creditUserNum',
 			(
 				SELECT
@@ -151,8 +148,7 @@ FROM
 				FROM
 					ctop_kuaishou_customer_plan_statistic_info a4
 				WHERE
-					a4.statistic_date = #{statisticDate}
-				AND a4.campaign_code = c.campaign_code
+					a4.campaign_code = c.campaign_code
 			) AS 'registCompleteNum',
 			(
 				SELECT
@@ -162,14 +158,12 @@ FROM
 				FROM
 					ctop_kuaishou_customer_plan_statistic_info a5
 				WHERE
-					a5.statistic_date = #{statisticDate}
-				AND a5.campaign_code = c.campaign_code
+				  a5.campaign_code = c.campaign_code
 			) AS 'registCreditNum'
 		FROM
 			ctop_kuaishou_platform_campaign_statistic_info AS c
 		WHERE
 			c.account_id = #{accountId}
-			and c.statistic_date = #{statisticDate}
 		ORDER BY
 			c.campaign_info
 	) AS h) AS a
@@ -201,8 +195,7 @@ FROM
 				FROM
 					ctop_kuaishou_customer_plan_statistic_info a
 				WHERE
-					a.statistic_date = #{statisticDate}
-				AND a.campaign_code = c.campaign_code
+				 a.campaign_code = c.campaign_code
 				ORDER BY
 					a.id DESC
 				LIMIT 1
@@ -224,8 +217,7 @@ FROM
 				FROM
 					ctop_kuaishou_customer_plan_statistic_info a1
 				WHERE
-					a1.statistic_date = #{statisticDate}
-				AND a1.campaign_code = c.campaign_code
+					a1.campaign_code = c.campaign_code
 			) AS 'registUserNum',
 			(
 				SELECT
@@ -233,8 +225,7 @@ FROM
 				FROM
 					ctop_kuaishou_customer_plan_statistic_info a2
 				WHERE
-					a2.statistic_date = #{statisticDate}
-				AND a2.campaign_code = c.campaign_code
+					a2.campaign_code = c.campaign_code
 			) AS 'complateUserNum',
 			(
 				SELECT
@@ -242,8 +233,7 @@ FROM
 				FROM
 					ctop_kuaishou_customer_plan_statistic_info a3
 				WHERE
-					a3.statistic_date = #{statisticDate}
-				AND a3.campaign_code = c.campaign_code
+					a3.campaign_code = c.campaign_code
 			) AS 'creditUserNum',
 			(
 				SELECT
@@ -251,8 +241,7 @@ FROM
 				FROM
 					ctop_kuaishou_customer_plan_statistic_info a4
 				WHERE
-					a4.statistic_date = #{statisticDate}
-				AND a4.campaign_code = c.campaign_code
+					a4.campaign_code = c.campaign_code
 			) AS 'registCompleteNum',
 			(
 				SELECT
@@ -262,14 +251,13 @@ FROM
 				FROM
 					ctop_kuaishou_customer_plan_statistic_info a5
 				WHERE
-					a5.statistic_date = #{statisticDate}
-				AND a5.campaign_code = c.campaign_code
+					a5.campaign_code = c.campaign_code
 			) AS 'registCreditNum'
 		FROM
 			ctop_kuaishou_platform_campaign_statistic_info AS c
 		WHERE
 			c.account_id = #{accountId}
-			and c.statistic_date = #{statisticDate} and c.cost!=0
+			and c.cost!=0
 		ORDER BY
 			c.campaign_info
 	) AS h
@@ -338,8 +326,7 @@ FROM
 				FROM
 					ctop_kuaishou_customer_plan_statistic_info a44
 				WHERE
-					a44.statistic_date = #{statisticDate}
-				AND a44.campaign_code = c.campaign_code
+					a44.campaign_code = c.campaign_code
 				ORDER BY
 					a44.id DESC
 				LIMIT 1
@@ -361,8 +348,7 @@ FROM
 				FROM
 					ctop_kuaishou_customer_plan_statistic_info a1
 				WHERE
-					a1.statistic_date = #{statisticDate}
-				AND a1.campaign_code = c.campaign_code
+					a1.campaign_code = c.campaign_code
 			) AS 'registUserNum',
 			(
 				SELECT
@@ -370,8 +356,7 @@ FROM
 				FROM
 					ctop_kuaishou_customer_plan_statistic_info a2
 				WHERE
-					a2.statistic_date = #{statisticDate}
-				AND a2.campaign_code = c.campaign_code
+					a2.campaign_code = c.campaign_code
 			) AS 'complateUserNum',
 			(
 				SELECT
@@ -379,8 +364,7 @@ FROM
 				FROM
 					ctop_kuaishou_customer_plan_statistic_info a3
 				WHERE
-					a3.statistic_date = #{statisticDate}
-				AND a3.campaign_code = c.campaign_code
+					a3.campaign_code = c.campaign_code
 			) AS 'creditUserNum',
 			(
 				SELECT
@@ -388,8 +372,7 @@ FROM
 				FROM
 					ctop_kuaishou_customer_plan_statistic_info a4
 				WHERE
-					a4.statistic_date = #{statisticDate}
-				AND a4.campaign_code = c.campaign_code
+					a4.campaign_code = c.campaign_code
 			) AS 'registCompleteNum',
 			(
 				SELECT
@@ -399,14 +382,13 @@ FROM
 				FROM
 					ctop_kuaishou_customer_plan_statistic_info a5
 				WHERE
-					a5.statistic_date = #{statisticDate}
-				AND a5.campaign_code = c.campaign_code
+					a5.campaign_code = c.campaign_code
 			) AS 'registCreditNum'
 		FROM
 			ctop_kuaishou_platform_campaign_statistic_info AS c
 		WHERE
-			c.account_id = #{accountId} AND c.cost = 0
-			and c.statistic_date = #{statisticDate}
+			c.account_id = #{accountId}
+			AND c.cost = 0
 		ORDER BY
 			c.campaign_info
 	) AS h) AS a

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

@@ -21,7 +21,5 @@ public interface IBytedanceDeliveryTargetTemplateService extends IService<Byteda
 
     Result<IPage<BytedanceDeliveryTargetTemplate>> getList(BytedanceDeliveryTargetTemplate template, Integer pageNo, Integer pageSize, HttpServletRequest req);
 
-    JSONObject getSiteList(Long accountId);
-
     Map<String, Object> get(Long targetId);
 }

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

@@ -1,7 +1,7 @@
 package org.jeecg.modules.ctop.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import org.jeecg.modules.ctop.entity.CTopOauthToken;
+import org.jeecg.modules.ctop.entity.CtopOauthToken;
 
 import java.util.Map;
 
@@ -11,9 +11,9 @@ import java.util.Map;
  * @Date: 2019-07-09
  * @Version: V1.0
  */
-public interface ICTopOauthTokenService extends IService<CTopOauthToken> {
+public interface ICtopOauthTokenService extends IService<CtopOauthToken> {
 
-    CTopOauthToken getOauthTokenByAccountId(String accountId);
+    CtopOauthToken getOauthTokenByAccountId(String accountId);
 
     Map<String, Object> getByteDanceAccessToken(String accountId);
 

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

@@ -1,6 +1,7 @@
 package org.jeecg.modules.ctop.service;
 
 import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import io.swagger.models.auth.In;
 import org.jeecg.modules.ctop.entity.FileInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -30,4 +31,8 @@ public interface IFileInfoService extends IService<FileInfo> {
     List<FileInfo> getFileInfoByMd5(String md5);
 
     Map<String, Object> checkFile(String code);
+
+    Map<String, Object> getCreativeWords(Long accountId);
+
+    public JSONObject getSiteList(Long accountId);
 }

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

@@ -112,8 +112,8 @@ public class BytedanceAdvertisePlanTemplateServiceImpl extends ServiceImpl<Byted
         /**
          * 广告投放指定时间段
          * 广告投放时段,默认全时段投放,格式是48*7位字符串,且都是0或1。也就是以半个小时为最小粒度,周一至周日每天分为48个区段,0为不投放,1为投放,不传、全传0、全传1均代表全时段投放。
+         * data.put("schedule_time", "2019-07-31 01:00");
          */
-//        data.put("schedule_time", "2019-07-31 01:00");
         //付费方式
         data.put("pricing", budgetTemplate.getPriceType());
         //广告投放速度类型 (投放方式) 优先跑量,均衡投放,优先低成本

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

@@ -88,11 +88,6 @@ public class BytedanceDeliveryTargetTemplateServiceImpl extends ServiceImpl<Byte
     }
 
     @Override
-    public JSONObject getSiteList(Long accountId) {
-        return null;
-    }
-
-    @Override
     public Map<String, Object> get(Long targetId) {
         Map<String, Object> result = new HashMap<>();
         if (null == targetId || targetId == 0) {

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

@@ -11,8 +11,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.http.impl.cookie.BasicClientCookie;
 import org.jeecg.common.util.ResultMapUtils;
 import org.jeecg.common.util.StatusCode;
+import org.jeecg.modules.ctop.entity.BindAccountLogin;
 import org.jeecg.modules.ctop.entity.BytedanceUrlInfo;
+import org.jeecg.modules.ctop.mapper.BindAccountLoginMapper;
 import org.jeecg.modules.ctop.mapper.BytedanceUrlInfoMapper;
+import org.jeecg.modules.ctop.service.IBindAccountLoginService;
 import org.jeecg.modules.ctop.service.ICreateInternalService;
 import org.openqa.selenium.Cookie;
 import org.openqa.selenium.WebDriver;
@@ -31,17 +34,29 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
     @Value("${jeecg.path.chrome-driver}")
     private String chromeDriver;
     @Autowired
+    private BindAccountLoginMapper bindAccountLoginMapper;
+
+    @Autowired
     private BytedanceUrlInfoMapper urlInfoMapper;
     @Override
     public Map<String, Object> createInternal(JSONObject requestJson) {
         Map<String, Object> resultMap = new HashMap<>();
+        //1:获取用户名密码
+        Long accountId = requestJson.getLong("accountId");
+        BindAccountLogin bindAccountLogin = bindAccountLoginMapper.selectById(accountId);
+        if (null == bindAccountLogin) {
+            ResultMapUtils.setResultMap(resultMap, StatusCode.ACCOUNT_HAS_NOT_EXIST.getCode());
+            return resultMap;
+        }
         String url = "https://ad.oceanengine.com/pages/login/index.html";
         System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
         ChromeOptions chromeOptions = new ChromeOptions();
         chromeOptions.addArguments("--headless");
-//        chromeOptions.addArguments("--incognito");
+        /**
+         * chromeOptions.addArguments("--incognito");
+         * chromeOptions.addArguments("--disable-gpu");
+         */
         chromeOptions.addArguments("--no-sandbox");
-//        chromeOptions.addArguments("--disable-gpu");
         chromeOptions.addArguments("--window-size=1920,1080");
         chromeOptions.addArguments("--user-agent=" + HttpUtils2.USER_AGENT);
         chromeOptions.setAcceptInsecureCerts(true);
@@ -66,8 +81,8 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
             Map<String, Object> param = new HashMap<>();
             param.put("mobile", "");
             param.put("code", "");
-            param.put("account", "dcd_ad@bytedance.com");
-            param.put("password", "typdDCD@2018");
+            param.put("account", bindAccountLogin.getAccountName());
+            param.put("password", bindAccountLogin.getPassword());
             param.put("captcha", "hqde");
             param.put("is_30_days_no_login", "true");
             param.put("service", "https://ad.oceanengine.com");
@@ -76,11 +91,15 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
             ObjectMapper mapper = new ObjectMapper();
             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
             JsonNode jsonNode = mapper.readTree(res);
-            //errorcode == 1009 表示用户名或者密码错误
             //errorcode == 1102 验证码错误,请重新输入验证码
             //errorcode == 1101 验证码为空
 
             Integer errorCode = jsonNode.get("error_code").asInt();
+            //用户名或者密码错误
+            if (null != errorCode && errorCode == 1009) {
+                ResultMapUtils.setResultMap(resultMap, StatusCode.USERNAME_OR_PASSWORD_ERROR.getCode());
+                return resultMap;
+            }
             String orderId = null;
             while (errorCode != 0) {
                 FateadmUtil fateadmUtil = new FateadmUtil();
@@ -231,7 +250,7 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
                         System.out.println(result.toJSONString());
                         String status = result.getString("status");
                         String msg = result.getString("msg");
-                        if (null != status && !status.equals("success")) {
+                        if (null != status && !"success".equals(status)) {
                             resultMap.put("code", -1);
                             resultMap.put("message", msg);
                             resultMap.put("success", false);

+ 9 - 11
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CTopOauthTokenServiceImpl.java

@@ -9,11 +9,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import constant.KuaishouInterfaceConstant;
 import lombok.extern.slf4j.Slf4j;
-import org.jeecg.modules.ctop.entity.CTopOauthToken;
+import org.jeecg.modules.ctop.entity.CtopOauthToken;
 import org.jeecg.modules.ctop.mapper.CTopOauthTokenMapper;
-import org.jeecg.modules.ctop.service.ICTopOauthTokenService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.jeecg.modules.ctop.service.ICtopOauthTokenService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -29,16 +27,16 @@ import java.util.Map;
  */
 @Slf4j
 @Service
-public class CTopOauthTokenServiceImpl extends ServiceImpl<CTopOauthTokenMapper, CTopOauthToken> implements ICTopOauthTokenService {
+public class CtopOauthTokenServiceImpl extends ServiceImpl<CTopOauthTokenMapper, CtopOauthToken> implements ICtopOauthTokenService {
     @Autowired
     private CTopOauthTokenMapper cTopOauthTokenMapper;
 
     @Override
-    public CTopOauthToken getOauthTokenByAccountId(String accountId) {
-        QueryWrapper<CTopOauthToken> queryWrapper = new QueryWrapper<>();
+    public CtopOauthToken getOauthTokenByAccountId(String accountId) {
+        QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("account_id", accountId).orderByDesc("create_time");
         queryWrapper.last("limit 1");
-        CTopOauthToken cTopOauthToken = cTopOauthTokenMapper.selectOne(queryWrapper);
+        CtopOauthToken cTopOauthToken = cTopOauthTokenMapper.selectOne(queryWrapper);
         return cTopOauthToken;
     }
 
@@ -50,7 +48,7 @@ public class CTopOauthTokenServiceImpl extends ServiceImpl<CTopOauthTokenMapper,
     @Override
     public Map<String, Object> getByteDanceAccessToken(String accountId) {
         Map<String, Object> resultMap = new HashMap<>();
-        CTopOauthToken token = this.getOauthTokenByAccountId(accountId);
+        CtopOauthToken token = this.getOauthTokenByAccountId(accountId);
         if (null == token) {
             resultMap.put("message", "token信息不存在");
             resultMap.put("code", -1);
@@ -72,7 +70,7 @@ public class CTopOauthTokenServiceImpl extends ServiceImpl<CTopOauthTokenMapper,
             return resultMap;
         }
         JSONObject data = resultObject.getJSONObject("data");
-        CTopOauthToken refreshToken = new CTopOauthToken(token, data);
+        CtopOauthToken refreshToken = new CtopOauthToken(token, data);
         cTopOauthTokenMapper.deleteById(token.getId());
         cTopOauthTokenMapper.insert(refreshToken);
         log.info("头条刷新token成功:accountId:{}", accountId);
@@ -102,7 +100,7 @@ public class CTopOauthTokenServiceImpl extends ServiceImpl<CTopOauthTokenMapper,
             if (!Check.isNull(resultJson)) {
                 Integer code = resultJson.getInteger("code");
                 if (code == 0) {
-                    CTopOauthToken oauthToken = cTopOauthTokenMapper.selectByAccountId(accountId);
+                    CtopOauthToken oauthToken = cTopOauthTokenMapper.selectByAccountId(accountId);
                     if (!Check.isNull(oauthToken)) {
                         JSONObject dataJson = resultJson.getJSONObject("data");
                         if (!Check.isNull(dataJson)) {

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

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ctop.service.impl;
 
+import cn.com.ctop.common.utils.HttpUtils;
 import cn.com.ctop.common.utils.PropertiesUtils;
 import cn.com.ctop.toutiao.common.BytedanceInterfaceConstant;
 import com.alibaba.fastjson.JSONArray;
@@ -229,52 +230,38 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
         }
     }
 
+    @Override
+    public Map<String, Object> getCreativeWords(Long accountId) {
+        CTopOauthToken token = tokenService.getOauthTokenByAccountId(accountId + "");
+        return getCreativeWord(token, accountId);
+    }
+
+    @Override
+    public JSONObject getSiteList(Long accountId) {
+        return null;
+    }
+
+    public JSONObject getCreativeWord(CTopOauthToken token, Long accountId) {
+        // 请求地址
+        String url = "https://ad.toutiao.com/open_api/2/tools/creative_word/select/";
+        // 请求参数
+        Map data = new HashMap() {
+            {
+                put("advertiser_id", accountId);
+            }
+        };
+        JSONObject resultObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, data);
+        return resultObject;
+    }
+
     public JSONObject searchIndustry(CTopOauthToken token, Integer level) {
         // 请求地址
         String url = "https://ad.toutiao.com/open_api/2/tools/industry/get/";
         if (null != level) {
             url += "?level=" + level;
         }
-        // 构造请求
-        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(new JSONObject().toJSONString(), 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 (ClientProtocolException e) {
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
-        } finally {
-            try {
-                if (response != null) {
-                    response.close();
-                }
-                client.close();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-        return null;
+        JSONObject resultObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, new HashMap<>());
+        return resultObject;
     }
 
     public JSONObject uploadAdImage(CTopOauthToken token, String imageUrl, String advertiserId) {
@@ -452,7 +439,6 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
         httpPost.setHeader("Access-Token", token.getAccessToken());
         // 文件参数
         try {
-
             FileBody file = new FileBody(new File(videoPath));
             MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create()
                     .addPart("video_file", file);

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

@@ -220,11 +220,11 @@ public class ReportServiceImpl implements IReportService {
         //2:文件入库
         //2.1 清除数据库原始数据
         QueryWrapper<CustomerPlanStatisticInfo> planWrapper = new QueryWrapper<>();
-        planWrapper.eq("statistic_date", simpleDateFormat.format(new Date()));
+        planWrapper.isNotNull("id");
         customerPlanStatisticInfoService.remove(planWrapper);
 
         QueryWrapper<PlatformCampaignStatisticInfo> campaignWrapper = new QueryWrapper<>();
-        campaignWrapper.eq("statistic_date", simpleDateFormat.format(new Date()));
+        campaignWrapper.isNotNull("id");
         platformCampaignStatisticInfoService.remove(campaignWrapper);
 
         this.insertPlatformInfo(accountOneKsDataPath, "gb2312", 1L);
@@ -267,12 +267,12 @@ public class ReportServiceImpl implements IReportService {
         List<StatisticCampaignVo> zero1Vos = statisticInfoMapper.sumZeroVoByParams(date, accountId1);
         if (null != zero1Vos && zero1Vos.size() > 0) {
             for (int z = 0; z < zero1Vos.size(); z++) {
-                index++;
-                StatisticCampaignVo vo = statisticCampaign1Vos.get(z);
+                StatisticCampaignVo vo = zero1Vos.get(z);
                 Row row = xssfSheet.getRow(index);
                 String content = vo.getContent();
                 String[] contents = content.split("-");
                 setExcelRow(numbericCellStyle, vo, contents, row, "single");
+                index++;
             }
         }
         Row totalRow1 = xssfSheet.getRow(index);
@@ -291,9 +291,9 @@ public class ReportServiceImpl implements IReportService {
         }
         List<StatisticCampaignVo> zero4Vos = statisticInfoMapper.sumZeroVoByParams(date, accountId4);
         if (null != zero4Vos && zero4Vos.size() > 0) {
-            for (int z = 0; z < zero1Vos.size(); z++) {
+            for (int z = 0; z < zero4Vos.size(); z++) {
                 index++;
-                StatisticCampaignVo vo = statisticCampaign1Vos.get(z);
+                StatisticCampaignVo vo = zero4Vos.get(z);
                 Row row = xssfSheet.getRow(index);
                 String content = vo.getContent();
                 String[] contents = content.split("-");
@@ -320,9 +320,9 @@ public class ReportServiceImpl implements IReportService {
             Cell cell = row.createCell(j);
             if (j == 0) {
                 //日期
-                if (null != type && type.equals("single")) {
+                if (null != type && "single".equals(type)) {
                     cell.setCellValue(vo.getStatisticDate());
-                } else if (null != type && type.equals("total1")) {
+                } else if (null != type && "total1".equals(type)) {
                     cell.setCellValue("户一总计");
                 } else {
                     cell.setCellValue("户四总计");

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/test/controller/JeecgOrderDMainController.java

@@ -41,7 +41,7 @@ import lombok.extern.slf4j.Slf4j;
 @Slf4j
 @RestController
 @RequestMapping("/test/order")
-public class JeecgOrderDMainController {
+public class JeecgOrderDmainController {
     @Autowired
     private IJeecgOrderMainService jeecgOrderMainService;
     @Autowired

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

@@ -45,7 +45,8 @@ public class UploadServiceImpl implements IUploadService {
         }
         //3: 根据MD5值查询是否已经上传过服务器
         List<FileInfo> getFileInfo = fileInfoService.getFileInfoByMd5(md5Hex);
-        if (null != getFileInfo && getFileInfo.size() > 0) {//表示已经上传过服务器
+        if (null != getFileInfo && getFileInfo.size() > 0) {
+            //表示已经上传过服务器
             resultMap.put("message", "文件上传成功");
             resultMap.put("success", true);
             resultMap.put("fileInfo", getFileInfo.get(0));

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

@@ -141,7 +141,7 @@ public class KuaiShouController {
 
         String accessToken = "360d43b49553684a011d6607322582b1";
         Long advertiserId = 23212L;
-        String image_token = "market825e095b83eb4456a31ce95704d03238.jpg";
+        String imageToken = "market825e095b83eb4456a31ce95704d03238.jpg";
         /*FileUploadTool fileUploadTool = new FileUploadTool();
         FileEntity entity = new FileEntity();
 
@@ -149,7 +149,7 @@ public class KuaiShouController {
         System.err.println(entity);*/
 
 
-        kuaishouInterfaceService.imageGet(advertiserId, accessToken, image_token);
+        kuaishouInterfaceService.imageGet(advertiserId, accessToken, imageToken);
 
 
     }
@@ -160,7 +160,7 @@ public class KuaiShouController {
 
         String accessToken = "360d43b49553684a011d6607322582b1";
         Long advertiserId = 23212L;
-        String image_token = "market825e095b83eb4456a31ce95704d03238.jpg";
+        String imageToken = "market825e095b83eb4456a31ce95704d03238.jpg";
         /*FileUploadTool fileUploadTool = new FileUploadTool();
         FileEntity entity = new FileEntity();
 

+ 8 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/shiro/vo/UserBean.java

@@ -8,6 +8,12 @@ import lombok.Data;
 public class UserBean {
     private String username;
     private String password;
-    private Set<String> roles = new HashSet<>();    //用户所有角色值,用于shiro做角色权限的判断
-    private Set<String> perms = new HashSet<>();    //用户所有权限值,用于shiro做资源权限的判断
+    /**
+     * 用户所有角色值,用于shiro做角色权限的判断
+     */
+    private Set<String> roles = new HashSet<>();
+    /**
+     * 用户所有权限值,用于shiro做资源权限的判断
+     */
+    private Set<String> perms = new HashSet<>();
 }

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

@@ -234,7 +234,8 @@ public class SysUserAgentController {
       MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
       Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
       for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-          MultipartFile file = entity.getValue();// 获取上传文件对象
+		  // 获取上传文件对象
+		  MultipartFile file = entity.getValue();
           ImportParams params = new ImportParams();
           params.setTitleRows(2);
           params.setHeadRows(1);

+ 6 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java

@@ -129,7 +129,8 @@ public class SysUserController {
 		String selectedDeparts = jsonObject.getString("selecteddeparts");
 		try {
 			SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class);
-			user.setCreateTime(new Date());//设置创建时间
+            //设置创建时间
+            user.setCreateTime(new Date());
 			String salt = oConvertUtils.randomGen(8);
 			user.setSalt(salt);
 			String passwordEncode = PasswordUtil.encrypt(user.getUsername(), user.getPassword(), salt);
@@ -494,7 +495,8 @@ public class SysUserController {
         MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
         Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
         for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();// 获取上传文件对象
+            // 获取上传文件对象
+            MultipartFile file = entity.getValue();
             ImportParams params = new ImportParams();
             params.setTitleRows(2);
             params.setHeadRows(1);
@@ -816,7 +818,8 @@ public class SysUserController {
 		}
 
 		try {
-			user.setCreateTime(new Date());// 设置创建时间
+            // 设置创建时间
+            user.setCreateTime(new Date());
 			String salt = oConvertUtils.randomGen(8);
 			String passwordEncode = PasswordUtil.encrypt(username, password, salt);
 			user.setSalt(salt);

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

@@ -229,7 +229,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
 	@Transactional
 	@CacheEvict(value="loginUser_cacheRules", allEntries=true)
 	public void editUserWithDepart(SysUser user, String departs) {
-		this.updateById(user);  //更新角色的时候已经更新了一次了,可以再跟新一次
+        //更新角色的时候已经更新了一次了,可以再跟新一次
+        this.updateById(user);
 		//先删后加
 		sysUserDepartMapper.delete(new QueryWrapper<SysUserDepart>().lambda().eq(SysUserDepart::getUserId, user.getId()));
 		if(oConvertUtils.isNotEmpty(departs)) {

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

@@ -40,7 +40,7 @@ public class Base64Utils {
         }
     }
     public static String decode1(String s) {
-        final Pattern reUnicode = Pattern.compile("\\\\u([0-9a-zA-Z]{4})");
+        Pattern reUnicode = Pattern.compile("\\\\u([0-9a-zA-Z]{4})");
         Matcher m = reUnicode.matcher(s);
         StringBuffer sb = new StringBuffer(s.length());
         while (m.find()) {

+ 11 - 11
module-common/src/main/java/cn/com/ctop/common/utils/CsvUtils.java

@@ -10,7 +10,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 public class CsvUtils {
-    public static void CheckandCreateFile(String outPath) {
+    public static void checkandCreateFile(String outPath) {
         File file = new File(outPath);
         try {
             if (!file.exists()) {
@@ -24,7 +24,7 @@ public class CsvUtils {
         }
     }
 
-    public static List<String[]> ReadCSV(String inPath, String charset) throws IOException {
+    public static List<String[]> readCSV(String inPath, String charset) throws IOException {
         List<String[]> list = new ArrayList<>();
         CsvReader reader = new CsvReader(inPath, ',', Charset.forName(charset));
         reader.readHeaders();
@@ -33,9 +33,9 @@ public class CsvUtils {
         }
         reader.close();
         for (int row = 0; row < list.size(); row++) {
-            int Length = list.get(row).length;
-            if (Length > 0) {
-                for (int i = 0; i < Length; i++) {
+            int length = list.get(row).length;
+            if (length > 0) {
+                for (int i = 0; i < length; i++) {
                     System.out.print(list.get(row)[i] + ",");
                 }
 
@@ -45,14 +45,14 @@ public class CsvUtils {
         return list;
     }
 
-    public static void WriteCSV(String outPath, List<String[]> data) throws IOException {
-        CsvUtils.CheckandCreateFile(outPath);
+    public static void writeCSV(String outPath, List<String[]> data) throws IOException {
+        CsvUtils.checkandCreateFile(outPath);
         CsvWriter wr = new CsvWriter(outPath, ',', Charset.forName("gb2312"));
         String[] header = {"Name", "Province", "City", "Address", "Tel", "Website", "Server_content", "Jigou_cengji", "Type", "Parent_level1", "Parent_level2", "Branch_level"};
         wr.writeRecord(header);
         for (int i = 0; i < data.size(); i++) {
-            String[] Data = data.get(i);
-            wr.writeRecord(Data);
+            String[] dataString = data.get(i);
+            wr.writeRecord(dataString);
         }
         wr.close();
     }
@@ -61,8 +61,8 @@ public class CsvUtils {
         String[] header = new String[]{"日期", "plan", "广告组", "花费", "曝光数", "点击数", "行为数", "点击率", "行为率", "平均千次曝光花费", "平均点击单价", "平均行为单价", "提交按钮点击", "表单提交率", "表单提交单价"};
         String inPath = "D:\\工作文件\\360借条\\effect_unit_2019-08-02-00_2019-08-02-00.csv";
         String outPath = "D:\\工作文件\\360借条\\effect_unit_2019-08-02-00_2019-08-02-00_bak.csv";
-        List<String[]> list = CsvUtils.ReadCSV(inPath, "utf8");
-        CsvUtils.WriteCSV(outPath, list);
+        List<String[]> list = CsvUtils.readCSV(inPath, "utf8");
+        CsvUtils.writeCSV(outPath, list);
 
     }
 }

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

@@ -91,7 +91,7 @@ public class FileUploadTool {
             String aviPath = filedirs.getAbsolutePath();
             // 转码Avi
 //            boolean flag = false;
-            if (this.checkAVIType(fileEnd)) {
+            if (this.checkAviType(fileEnd)) {
                 // 设置转换为AVI格式后文件的保存路径
                 String codcAviPath = savaPath + File.separator + newFileName + ".avi";
                 // 获取配置的转换工具(mencoder.exe)的存放路径
@@ -171,7 +171,7 @@ public class FileUploadTool {
      * @param
      * @return
      */
-    private boolean checkAVIType(String fileEnd) {
+    private boolean checkAviType(String fileEnd) {
         Iterator<String> type = Arrays.asList(allowAVI).iterator();
         while (type.hasNext()) {
             String ext = type.next();

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

@@ -2,6 +2,7 @@ package cn.com.ctop.common.utils;
 
 import com.alibaba.fastjson.JSONObject;
 import com.google.gson.Gson;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.fontbox.ttf.CmapSubtable;
 import org.apache.fontbox.ttf.GlyphData;
 import org.apache.fontbox.ttf.TTFParser;
@@ -33,9 +34,6 @@ import org.apache.http.message.BasicNameValuePair;
 import org.apache.http.ssl.SSLContextBuilder;
 import org.apache.http.util.EntityUtils;
 import org.eclipse.jetty.util.UrlEncoded;
-import org.omg.CORBA.OBJ_ADAPTER;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import javax.net.ssl.SSLContext;
 import java.io.BufferedReader;
@@ -50,6 +48,7 @@ import java.security.cert.CertificateException;
 import java.security.cert.X509Certificate;
 import java.util.*;
 
+@Slf4j
 public class HttpUtils {
 
     public static JSONObject bytedanceGetRequest(String accessToken, String url, Map<String, Object> params) {
@@ -99,7 +98,7 @@ public class HttpUtils {
         }
         return null;
     }
-    private static final Logger logger = LoggerFactory.getLogger(HttpUtils.class);
+
     public static CookieStore cookieStore = new BasicCookieStore();
     //.setProxy(new HttpHost("106.125.239.179", 4245))
     public static Map<String, Map<String, String>> fontsMap = new HashMap<String, Map<String, String>>();
@@ -118,7 +117,7 @@ public class HttpUtils {
             SSLConnectionSocketFactory sslFactory = new SSLConnectionSocketFactory(sslContext);
             return HttpClients.custom().setDefaultCookieStore(cookieStore).setDefaultRequestConfig(globalConfig).setConnectionReuseStrategy((response, context) -> false).setSSLSocketFactory(sslFactory).build();
         } catch (Exception e) {
-            logger.error("处理Https证书异常", e);
+            log.error("处理Https证书异常", e);
         }
         return HttpClients.createDefault();
     }
@@ -165,7 +164,7 @@ public class HttpUtils {
             }
         } catch (Exception e) {
             e.printStackTrace();
-            logger.error(e.getMessage());
+            log.error(e.getMessage());
         }
         return strReturn;
     }
@@ -201,7 +200,7 @@ public class HttpUtils {
             }
         } catch (Exception e) {
             e.printStackTrace();
-            logger.error(e.getMessage());
+            log.error(e.getMessage());
         }
         return strReturn;
     }
@@ -238,7 +237,7 @@ public class HttpUtils {
             }
         } catch (Exception e) {
             e.printStackTrace();
-            logger.error(e.getMessage());
+            log.error(e.getMessage());
         }
         return strReturn;
     }
@@ -270,7 +269,7 @@ public class HttpUtils {
             }
         } catch (Exception e) {
             e.printStackTrace();
-            logger.error(e.getMessage());
+            log.error(e.getMessage());
         }
         return strReturn;
     }
@@ -307,7 +306,7 @@ public class HttpUtils {
             }
         } catch (Exception e) {
             e.printStackTrace();
-            logger.error(e.getMessage());
+            log.error(e.getMessage());
         }
         return strReturn;
     }
@@ -366,7 +365,7 @@ public class HttpUtils {
             strReturn = EntityUtils.toString(respentity);
         } catch (Exception e) {
             e.printStackTrace();
-            logger.error(e.getMessage());
+            log.error(e.getMessage());
         }
         return strReturn;
     }
@@ -387,7 +386,7 @@ public class HttpUtils {
             strReturn = EntityUtils.toString(respentity);
         } catch (Exception e) {
             e.printStackTrace();
-            logger.error(e.getMessage());
+            log.error(e.getMessage());
         }
         return strReturn;
     }
@@ -564,7 +563,7 @@ public class HttpUtils {
             strReturn = EntityUtils.toString(respentity);
         } catch (Exception e) {
             e.printStackTrace();
-            logger.error(e.getMessage());
+            log.error(e.getMessage());
         }
         return strReturn;
     }
@@ -590,7 +589,7 @@ public class HttpUtils {
             strReturn = EntityUtils.toString(respentity);
         } catch (Exception e) {
             e.printStackTrace();
-            logger.error(e.getMessage());
+            log.error(e.getMessage());
         }
         return strReturn;
     }
@@ -635,7 +634,7 @@ public class HttpUtils {
             respEntity = response.getEntity();
             result = EntityUtils.toString(respEntity);
         } catch (Exception e) {
-            logger.error("http get请求异常");
+            log.error("http get请求异常");
             e.printStackTrace();
         }
         return result;

+ 16 - 16
module-common/src/main/java/cn/com/ctop/common/utils/ImageUtils.java

@@ -99,24 +99,24 @@ public class ImageUtils {
         int width = image.getWidth(null);
         int height = image.getHeight(null);
         BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
-        Graphics2D graphics2D = bufferedImage.createGraphics();
-        graphics2D.drawImage(image, 0, 0, width, height, null);
-        graphics2D.setColor(color);
-        graphics2D.setFont(font);
+        Graphics2D graphics = bufferedImage.createGraphics();
+        graphics.drawImage(image, 0, 0, width, height, null);
+        graphics.setColor(color);
+        graphics.setFont(font);
 
         Image borderImage = ImageIO.read(new File("D:/border/images/white01.png"));
 //        BufferedImage bufferedImage2 = new BufferedImage(borderImage.getWidth(null),borderImage.getHeight(null),BufferedImage.TYPE_INT_RGB);
-        graphics2D.drawImage(borderImage, 50, height / 2 + 100, null);
+        graphics.drawImage(borderImage, 50, height / 2 + 100, null);
 
 //        graphics2D.setColor(Color.BLUE.darker().darker());
 //        graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
-        graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
-        graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
-        graphics2D.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
-        graphics2D.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+        graphics.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
+        graphics.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
 //        graphics2D.setStroke(new BasicStroke(5.0f ,
 //                BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 15.0f, new float[] {10.0f,10.0f}, 5.0f));
-        FontRenderContext frc = graphics2D.getFontRenderContext();
+        FontRenderContext frc = graphics.getFontRenderContext();
         int x = 150;
         int y = height / 2 + 220;
         if (content.length() < 9) {
@@ -128,10 +128,10 @@ public class ImageUtils {
 //            graphics2D.setColor(Color.white);
 //            graphics2D.fill(sha);
 //            graphics2D.dispose();
-            graphics2D.drawString(content, x, y);
+            graphics.drawString(content, x, y);
         } else {
-            graphics2D.drawString(content.substring(0, 8), x, y);
-            graphics2D.drawString(content.substring(8), x, y + 60);
+            graphics.drawString(content.substring(0, 8), x, y);
+            graphics.drawString(content.substring(8), x, y + 60);
 //            TextLayout tl = new TextLayout(content.substring(0,8), font, frc);
 //            Shape sha = tl.getOutline(AffineTransform.getTranslateInstance(5,25));
 //            graphics2D.setStroke(new BasicStroke(3.0f));
@@ -151,14 +151,14 @@ public class ImageUtils {
 ////            graphics2D.dispose();
         }
 
-        graphics2D.dispose();
+        graphics.dispose();
         FileOutputStream fileOutputStream = new FileOutputStream("D:/image/cover/" + UUID.randomUUID() + ".jpg");
         ImageIO.write(bufferedImage, "jpg", fileOutputStream);
 
     }
 
-    public int getContentLength(String content, Graphics2D graphics2D) {
-        return graphics2D.getFontMetrics(graphics2D.getFont()).charsWidth(content.toCharArray(), 0, content.length());
+    public int getContentLength(String content, Graphics2D graphics) {
+        return graphics.getFontMetrics(graphics.getFont()).charsWidth(content.toCharArray(), 0, content.length());
     }
 
     public static void main(String[] args) {

+ 0 - 64
module-common/src/main/java/cn/com/ctop/common/utils/MD5Utils.java

@@ -1,64 +0,0 @@
-package cn.com.ctop.common.utils;
-
-import org.apache.commons.io.FileUtils;
-
-import java.io.File;
-import java.io.IOException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-public class MD5Utils {
-    private static final char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
-
-	private static ThreadLocal<MessageDigest> MD5 = new ThreadLocal<MessageDigest>() {
-		@Override
-		protected MessageDigest initialValue() {
-			try {
-				return MessageDigest.getInstance( "MD5" );
-			}
-			catch ( NoSuchAlgorithmException e ) {
-				throw new IllegalStateException( "No md5 algorithm found");
-			}
-		}
-	};
-
-    public static String getMd5(String msg) {
-		MessageDigest md5 = MD5.get();
-		md5.reset();
-		return toHexStr(md5.digest(msg.getBytes()));
-	}
-
-	public static String toHexStr(byte[] bytes) {
-		int j = bytes.length;
-		char[] str = new char[j * 2];
-		int k = 0;
-		for (int i = 0; i < j; i++) {
-			byte byte0 = bytes[i];
-			str[k++] = hexDigits[byte0 >>> 4 & 0xf];
-			str[k++] = hexDigits[byte0 & 0xf];
-		}
-		return String.valueOf(str);
-	}
-
-    public static String getFileMd5(String path) {
-        StringBuffer sb = new StringBuffer();
-        try {
-            MessageDigest md = MessageDigest.getInstance("MD5");
-            byte[] b = md.digest(FileUtils.readFileToByteArray(new File(path)));
-            for (int i = 0; i < b.length; i++) {
-                int d = b[i];
-                if (d < 0) {
-                    d += 256;
-                }
-                int d1 = d / 16;
-                int d2 = d % 16;
-                sb.append(hexDigits[d1] + hexDigits[d2]);
-            }
-        } catch (NoSuchAlgorithmException e) {
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        return sb.toString();
-    }
-}

+ 12 - 10
module-common/src/main/java/cn/com/ctop/common/utils/TransfMediaTool.java

@@ -23,10 +23,13 @@ public class TransfMediaTool {
      */
     public void processFlv(String ffmpegPath, String upFilePath, String codcFilePath) {
         // 创建一个List集合来保存转换视频文件为flv格式的命令
-        List<String> convert = new ArrayList<String>();
-        convert.add(ffmpegPath); // 添加转换工具路径
-        convert.add("-i"); // 添加参数"-i",该参数指定要转换的文件
-        convert.add(upFilePath); // 添加要转换格式的视频文件的路径
+        List<String> convert = new ArrayList<>();
+        // 添加转换工具路径
+        convert.add(ffmpegPath);
+        // 添加参数"-i",该参数指定要转换的文件
+        convert.add("-i");
+        // 添加要转换格式的视频文件的路径
+        convert.add(upFilePath);
         convert.add("-ab");
         convert.add("56");
         convert.add("-ar");
@@ -108,20 +111,19 @@ public class TransfMediaTool {
 }
 
 class PrintStream extends Thread {
-    java.io.InputStream __is = null;
-    java.io.InputStream ___is = null;
+    java.io.InputStream stream = null;
 
     public PrintStream(java.io.InputStream is) {
-        __is = is;
+        stream = is;
     }
 
     @Override
     public void run() {
         try {
             while (this != null) {
-                int _ch = __is.read();
-                if (_ch != -1) {
-                    System.out.print((char) _ch);
+                int streamChar = stream.read();
+                if (streamChar != -1) {
+                    System.out.print((char) streamChar);
                 } else {
                     break;
                 }

+ 0 - 62
module-common/src/main/java/cn/com/ctop/common/utils/WebMasterUtils.java

@@ -1,62 +0,0 @@
-//package cn.com.ctop.common.utils;
-//
-//import us.codecraft.webmagic.Page;
-//import us.codecraft.webmagic.ResultItems;
-//import us.codecraft.webmagic.Site;
-//import us.codecraft.webmagic.Spider;
-//import us.codecraft.webmagic.downloader.PhantomJSDownloader;
-//import us.codecraft.webmagic.pipeline.CollectorPipeline;
-//import us.codecraft.webmagic.pipeline.ResultItemsCollectorPipeline;
-//import us.codecraft.webmagic.processor.PageProcessor;
-//
-//import java.util.List;
-//
-//public class WebMasterUtils implements PageProcessor {
-//    private Site site = Site.me()
-//            .setDomain("live.kuaishou.com")
-//            .setCharset("UTF-8")
-//            .addHeader("Referer","https://live.kuaishou.com")
-//            .setRetryTimes(1).setSleepTime(1000);
-//
-//    public static void main(String[] args){
-//        PhantomJSDownloader phantomDownloader = new PhantomJSDownloader("D:/phantomjs-2.1.1-windows/bin/phantomjs.exe","D:/phantomjs-2.1.1-windows/bin/crawler.js").setRetryNum(3);
-//
-//        CollectorPipeline<ResultItems> collectorPipeline = new ResultItemsCollectorPipeline();
-//
-//        Spider.create(new WebMasterUtils())
-//                .addUrl("https://live.kuaishou.com/profile/mumu6666668")
-//                .setDownloader(phantomDownloader)
-//                .addPipeline(collectorPipeline)
-//                .thread((Runtime.getRuntime().availableProcessors() - 1) << 1)
-//                .run();
-//
-//        List<ResultItems> resultItemsList = collectorPipeline.getCollected();
-//        System.out.println(resultItemsList.get(0).get("html").toString());
-//
-//        Spider.create(new WebMasterUtils())
-//                .addUrl("https://live.kuaishou.com/profile/mumu6666668")
-//                .setDownloader(phantomDownloader)
-//                .addPipeline(collectorPipeline)
-//                .thread((Runtime.getRuntime().availableProcessors() - 1) << 1)
-//                .run();
-//
-//        resultItemsList = collectorPipeline.getCollected();
-//        ResultItems item = resultItemsList.get(0);
-//
-//        System.out.println(resultItemsList.get(0).get("html").toString());
-////        System.out.println(resultItemsList.get(1).get("html").toString());
-//
-//    }
-//
-//    @Override
-//    public void process(Page page) {
-//        if(page.getRawText() != null) {
-//            page.putField("html", page.getRawText());
-//        }
-//    }
-//
-//    @Override
-//    public Site getSite() {
-//        return site;
-//    }
-//}

+ 0 - 38
module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/MD5Util.java

@@ -1,38 +0,0 @@
-package cn.com.ctop.crawler.modules.core.util;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-public class MD5Util {
-    private static final char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
-
-    private static ThreadLocal<MessageDigest> MD5 = new ThreadLocal<MessageDigest>() {
-        @Override
-        protected MessageDigest initialValue() {
-            try {
-                return MessageDigest.getInstance( "MD5" );
-            }
-            catch ( NoSuchAlgorithmException e ) {
-                throw new IllegalStateException( "No md5 algorithm found");
-            }
-        }
-    };
-
-    public static String getMd5(String msg) {
-        MessageDigest md5 = MD5.get();
-        md5.reset();
-        return toHexStr(md5.digest(msg.getBytes()));
-    }
-
-    public static String toHexStr(byte[] bytes) {
-        int j = bytes.length;
-        char[] str = new char[j * 2];
-        int k = 0;
-        for (int i = 0; i < j; i++) {
-            byte byte0 = bytes[i];
-            str[k++] = hexDigits[byte0 >>> 4 & 0xf];
-            str[k++] = hexDigits[byte0 & 0xf];
-        }
-        return String.valueOf(str);
-    }
-}

+ 2 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/SignUtil.java

@@ -1,5 +1,7 @@
 package cn.com.ctop.crawler.modules.core.util;
 
+import org.jeecg.common.util.MD5Util;
+
 public class SignUtil {
     public static String getMd5Sign(String source, String signKey) {
         return MD5Util.getMd5(source + signKey);

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

@@ -35,13 +35,14 @@ public class Test {
             chromeOptions.addArguments("--no-sandbox");
             chromeOptions.addArguments("--disable-gpu");
             chromeOptions.addArguments("--window-size=1290,1080");
-            chromeOptions.addArguments("--user-agent="+HttpUtils.USER_AGENT);
+            chromeOptions.addArguments("--user-agent=" + HttpUtils.USER_AGENT);
             chromeOptions.setAcceptInsecureCerts(true);
-            webDriver.get(url);  //获取登录页面
+            //获取登录页面
+            webDriver.get(url);
 
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-            for (Cookie cookie : webDriver.manage().getCookies()){
-                BasicClientCookie ck = new BasicClientCookie(cookie.getName(),cookie.getValue());
+            for (Cookie cookie : webDriver.manage().getCookies()) {
+                BasicClientCookie ck = new BasicClientCookie(cookie.getName(), cookie.getValue());
                 ck.setDomain("ad.oceanengine.com");
 //                if (cookie.getDomain().startsWith(".")){
 //                    ck.setDomain(cookie.getDomain().substring(1));
@@ -52,89 +53,89 @@ public class Test {
                 ck.setExpiryDate(cookie.getExpiry());
                 ck.setPath(cookie.getPath());
                 HttpUtils.cookieStore.addCookie(ck);
-                System.out.println(cookie.getName()+","+cookie.getValue()+","+cookie.getDomain());
+                System.out.println(cookie.getName() + "," + cookie.getValue() + "," + cookie.getDomain());
 //                ck.setDomain(".sso.toutiao.com");
 //                HttpUtils.cookieStore.addCookie(ck);
             }
 
             String html = webDriver.getPageSource();
-            Map<String,String> header = new HashMap<String,String>();
-            header.put("Accept","*/*");
-            header.put("Connection","keep-alive");
-            header.put("Host","sso.toutiao.com");
-            header.put("Content-Type","application/x-www-form-urlencoded");
-            header.put("Origin","https://ad.oceanengine.com");
-            header.put("Referer","https://ad.oceanengine.com/pages/login/index.html");
-            Map<String,Object> param = new HashMap<String,Object>();
-            param.put("mobile","");
-            param.put("code","");
-//            param.put("account","guoyanling@c-top.com.cn");
-//            param.put("password","Hcstad-567");
-            param.put("account","dcd_ad@bytedance.com");
-            param.put("password","typdDCD@2018");
-            param.put("captcha","hqde");
-            param.put("is_30_days_no_login","true");
-            param.put("service","https://ad.oceanengine.com");
-            String res = HttpUtils.httpPostParamRequest("https://sso.toutiao.com/account_login/",param,header);
-//            System.out.println(res);
-//            Scanner scanner = new Scanner(System.in);
-//            String code = scanner.nextLine();
-//            param.put("captcha",code);
-//            res = HttpUtils.httpPostParamRequest("https://sso.toutiao.com/account_login/",param,header);
-//            System.out.println(res);
+            Map<String, String> header = new HashMap<String, String>();
+            header.put("Accept", "*/*");
+            header.put("Connection", "keep-alive");
+            header.put("Host", "sso.toutiao.com");
+            header.put("Content-Type", "application/x-www-form-urlencoded");
+            header.put("Origin", "https://ad.oceanengine.com");
+            header.put("Referer", "https://ad.oceanengine.com/pages/login/index.html");
+            Map<String, Object> param = new HashMap<String, Object>();
+            param.put("mobile", "");
+            param.put("code", "");
+/*           param.put("account","guoyanling@c-top.com.cn");
+             param.put("password","Hcstad-567");*/
+            param.put("account", "dcd_ad@bytedance.com");
+            param.put("password", "typdDCD@2018");
+            param.put("captcha", "hqde");
+            param.put("is_30_days_no_login", "true");
+            param.put("service", "https://ad.oceanengine.com");
+            String res = HttpUtils.httpPostParamRequest("https://sso.toutiao.com/account_login/", param, header);
+/*           System.out.println(res);
+            Scanner scanner = new Scanner(System.in);
+            String code = scanner.nextLine();
+            param.put("captcha",code);
+            res = HttpUtils.httpPostParamRequest("https://sso.toutiao.com/account_login/",param,header);
+            System.out.println(res);*/
             ObjectMapper mapper = new ObjectMapper();
             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
             JsonNode jsonNode = mapper.readTree(res);
             Integer errorCode = jsonNode.get("error_code").asInt();
             String orderId = null;
-            while(errorCode != 0){
+            while (errorCode != 0) {
                 FateadmUtil fateadmUtil = new FateadmUtil();
                 fateadmUtil.init();
-                if(orderId != null){
+                if (orderId != null) {
                     fateadmUtil.Justice(orderId);
                 }
                 String captcha = jsonNode.get("captcha").asText();
-                BASE64Decoder decoder =new BASE64Decoder();
-                FateadmHttpUtil.HttpResp resp = fateadmUtil.Predict("30400",decoder.decodeBuffer(captcha));
-                param.put("captcha",resp.pred_resl);
+                BASE64Decoder decoder = new BASE64Decoder();
+                FateadmHttpUtil.HttpResp resp = fateadmUtil.Predict("30400", decoder.decodeBuffer(captcha));
+                param.put("captcha", resp.pred_resl);
                 orderId = resp.req_id;
-                res = HttpUtils.httpPostParamRequest("https://sso.toutiao.com/account_login/",param,header);
+                res = HttpUtils.httpPostParamRequest("https://sso.toutiao.com/account_login/", param, header);
                 System.out.println(res);
                 jsonNode = mapper.readTree(res);
                 errorCode = jsonNode.get("error_code").asInt();
             }
-            if(errorCode == 0){
+            if (errorCode == 0) {
 //                String redirectUrl = jsonNode.get("redirect_url").asText();
 //                webDriver.get(redirectUrl);
                 String csrftoken = "";
                 List<org.apache.http.cookie.Cookie> cookies = HttpUtils.cookieStore.getCookies();
-                for(org.apache.http.cookie.Cookie ck : cookies){
-                    Cookie cookie = new Cookie(ck.getName(),ck.getValue(),"."+ck.getDomain(),ck.getPath(),ck.getExpiryDate());
+                for (org.apache.http.cookie.Cookie ck : cookies) {
+                    Cookie cookie = new Cookie(ck.getName(), ck.getValue(), "." + ck.getDomain(), ck.getPath(), ck.getExpiryDate());
                     webDriver.manage().addCookie(cookie);
                 }
-
-                webDriver.get("https://ad.oceanengine.com/pages/promotion.html#/ad");//登录成功 进入推广页面
-
-                webDriver.get("https://ad.oceanengine.com/pages/campaign/create.html");//创建广告组页面
+                //登录成功 进入推广页面
+                webDriver.get("https://ad.oceanengine.com/pages/promotion.html#/ad");
+                //创建广告组页面
+                webDriver.get("https://ad.oceanengine.com/pages/campaign/create.html");
 //                HttpUtils.httpGetRequest("https://ad.toutiao.com/pages/promotion.html#/ad");
 //                HttpUtils.httpGetRequest("https://ad.toutiao.com/pages/campaign/create.html");
 
-                Map<String,Object> param2 = new HashMap<String,Object>();
-                Map<String,Object> param3 = new HashMap<String,Object>();
-                param3.put("budget",0);
-                param3.put("budget_mode",-1);
-                param2.put("campaign_id","");
-                param2.put("campaign_name","自动创建测试444444");
-                param2.put("landing_type",3);
-                param2.put("campaign_type",1);
-                param2.put("budget",param3);
+                Map<String, Object> param2 = new HashMap<>();
+                Map<String, Object> param3 = new HashMap<>();
+                param3.put("budget", 0);
+                param3.put("budget_mode", -1);
+                param2.put("campaign_id", "");
+                param2.put("campaign_name", "自动创建测试444444");
+                param2.put("landing_type", 3);
+                param2.put("campaign_type", 1);
+                param2.put("budget", param3);
 
 //                webDriver.get("https://ad.toutiao.com/pages/campaign/create.html");
-                for (Cookie cookie : webDriver.manage().getCookies()){
+                for (Cookie cookie : webDriver.manage().getCookies()) {
                     if ("csrftoken".equals(cookie.getName())) {
                         csrftoken = cookie.getValue();
                     }
-                    BasicClientCookie ck = new BasicClientCookie(cookie.getName(),cookie.getValue());
+                    BasicClientCookie ck = new BasicClientCookie(cookie.getName(), cookie.getValue());
 //                    if (cookie.getDomain().startsWith(".")){
 //                        ck.setDomain(URLDecoder.decode(cookie.getDomain().substring(1),"utf-8"));
 //                    }else {
@@ -144,85 +145,116 @@ public class Test {
                     ck.setExpiryDate(cookie.getExpiry());
                     ck.setPath(cookie.getPath());
                     HttpUtils.cookieStore.addCookie(ck);
-                    System.out.println(cookie.getName()+","+cookie.getValue()+","+cookie.getDomain());
+                    System.out.println(cookie.getName() + "," + cookie.getValue() + "," + cookie.getDomain());
                 }
-                header.put("Accept","application/json, text/javascript, */*; q=0.01");
-                header.put("Connection","keep-alive");
-                header.put("Host","ad.oceanengine.com");
-                header.put("Content-Type","application/json");
-                header.put("Origin","https://ad.oceanengine.com");
-                header.put("X-CSRFToken",csrftoken);
-                header.put("X-Requested-With","XMLHttpRequest");
-                header.put("Referer","https://ad.oceanengine.com/pages/campaign/create.html");
-                res = HttpUtils.httpPostRequest("https://ad.oceanengine.com/overture/campaign/create/",param2,header);// 创建广告组返回信息
+                header.put("Accept", "application/json, text/javascript, */*; q=0.01");
+                header.put("Connection", "keep-alive");
+                header.put("Host", "ad.oceanengine.com");
+                header.put("Content-Type", "application/json");
+                header.put("Origin", "https://ad.oceanengine.com");
+                header.put("X-CSRFToken", csrftoken);
+                header.put("X-Requested-With", "XMLHttpRequest");
+                header.put("Referer", "https://ad.oceanengine.com/pages/campaign/create.html");
+                // 创建广告组返回信息
+                res = HttpUtils.httpPostRequest("https://ad.oceanengine.com/overture/campaign/create/", param2, header);
                 System.out.println(res);
                 JsonNode node = mapper.readTree(res);
                 //{"status": "fail", "msg": "\u5e7f\u544a\u7ec4\u4e0d\u80fd\u91cd\u590d", "type": "form_error", "name": "campaign_name"}
-                String campaignId = node.get("data").get("campaign_id").asText();  //广告组id
-                String url2 = "https://ad.oceanengine.com/pages/ad/create.html?campaign_id="+campaignId+"&landing_type=3&temp_id=ADvQb";
+                //广告组id
+                String campaignId = node.get("data").get("campaign_id").asText();
+                String url2 = "https://ad.oceanengine.com/pages/ad/create.html?campaign_id=" + campaignId + "&landing_type=3&temp_id=ADvQb";
                 webDriver.get(url2);
 //                webDriver.get("https://ad.toutiao.com/agent/get_agency/?advertiser_id=1634948959249411");
-                header.put("Referer",url2);
-                for (Cookie cookie : webDriver.manage().getCookies()){
-                    BasicClientCookie ck = new BasicClientCookie(cookie.getName(),cookie.getValue());
+                header.put("Referer", url2);
+                for (Cookie cookie : webDriver.manage().getCookies()) {
+                    BasicClientCookie ck = new BasicClientCookie(cookie.getName(), cookie.getValue());
                     ck.setDomain("ad.oceanengine.com");
                     ck.setExpiryDate(cookie.getExpiry());
                     ck.setPath(cookie.getPath());
                     HttpUtils.cookieStore.addCookie(ck);
-                    System.out.println(cookie.getName()+","+cookie.getValue()+","+cookie.getDomain());
+                    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(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);
 
-                Map<String,Object> param4 = new HashMap<String,Object>();
-                param4.put("location_type",4);
-                param4.put("aweme_account_fans",0);
-                String tokenStr = HttpUtils.httpPostRequest("https://ad.oceanengine.com/api/v1/hl/ad/audience/estimate/",param4,header);
+                Map<String, Object> param4 = new HashMap<String, Object>();
+                param4.put("location_type", 4);
+                param4.put("aweme_account_fans", 0);
+                String tokenStr = HttpUtils.httpPostRequest("https://ad.oceanengine.com/api/v1/hl/ad/audience/estimate/", param4, header);
                 System.out.println(siteStr);
                 System.out.println(convStr);
                 System.out.println(tokenStr);
                 JsonNode tokenNode = mapper.readTree(tokenStr);
-                Map<String,Object> param5 = new HashMap<String,Object>();
-                param5.put("delivery_range",1);  // 投放范围
-                param5.put("classify",5);  //广告类别  5 内广
-                param5.put("projectid","");
-                param5.put("download_type",2);  //下载方式    1下载链接 2包含下载链接的落地页
-                param5.put("localGeolocation",new ArrayList<String>());
-                param5.put("external_url","https://ad.oceanengine.com/tetris/page/"+siteNode.get("data").get(0).get("siteId").asText());  // 落地页链接
-                param5.put("convert_id",convNode.get("action_data").get(0).get("id").asLong()); // 转换id
-                param5.put("open_url",""); //  应用直达链接
-                param5.put("style_type",0);
-                param5.put("location_type",4); //受众位置类型
-                param5.put("hide_if_exists",0); // 过滤已安装,当推广目标为安卓应用下载时可填,0表示不过滤,1表示过滤,默认为不过滤
-                param5.put("interest_tag_mode",0); //兴趣分类
-                param5.put("token",tokenNode.get("data").get("token").asText());
-                param5.put("toutiao",100000005);  //头条预估数据
-                param5.put("aweme",150000005); //抖音预估数据
-                param5.put("video_app",40000005);//西瓜预估数据
-                param5.put("hotsoon",40000005); //火山预估数据
-                param5.put("aweme_account_fans",0); //账号粉丝相似人群
-                param5.put("auto_extend_enabled",0);// 智能放量????
-                param5.put("budget_mode",0);  // 广告预算类型  0 日预算  1 总预算
-                param5.put("budget",300); //广告预算
-                param5.put("schedule_type",1); //广告投放时间类型   默认1 1:不限  2:按时间???
-                param5.put("start_time","2019-07-02 00:00"); //广告投放起始时间
-                param5.put("end_time","2019-07-03 23:59");//广告投放结束时间
-                param5.put("week_schedule",new ArrayList<String>());  //投放时段
-                param5.put("week_time",new ArrayList<ArrayList<Integer>>());//投放时段
-                param5.put("pricing",9); //计划出价类型  9 按展示付费  7 按点击付费 8 按转化付费
-                param5.put("cpa_phrase",2); //出价为OCPC时,计划处于哪个阶段??
-                param5.put("is_union_slot","");
-                param5.put("hide_if_converted",1); //过滤已转化用户类型字段,只有转化为目标时可填 优化目标为转化才展示
-                param5.put("flow_control_mode",0); //投放速度/投放方式使用字段
-                param5.put("cpa_bid",1);
-                param5.put("smart_bid_type",0); //自动出价类型,OCPM支持
-                param5.put("adjust_cpa",0); //是否调整自动出价   允许值: "0", "1"  默认值: 0
-                param5.put("app_bid_ratio",new Object());
-                param5.put("name","自动创建测试4");  //广计划名称
-                param5.put("campaign_id",campaignId);
-                String createResult = HttpUtils.httpPostRequest("https://ad.oceanengine.com/overture/ad/create/",param5,header);
+                Map<String, Object> param5 = new HashMap<String, Object>();
+                // 投放范围
+                param5.put("delivery_range", 1);
+                //广告类别  5 内广
+                param5.put("classify", 5);
+                param5.put("projectid", "");
+                //下载方式    1下载链接 2包含下载链接的落地页
+                param5.put("download_type", 2);
+                param5.put("localGeolocation", new ArrayList<String>());
+                // 落地页链接
+                param5.put("external_url", "https://ad.oceanengine.com/tetris/page/" + siteNode.get("data").get(0).get("siteId").asText());
+                // 转换id
+                param5.put("convert_id", convNode.get("action_data").get(0).get("id").asLong());
+                //  应用直达链接
+                param5.put("open_url", "");
+                param5.put("style_type", 0);
+                //受众位置类型
+                param5.put("location_type", 4);
+                // 过滤已安装,当推广目标为安卓应用下载时可填,0表示不过滤,1表示过滤,默认为不过滤
+                param5.put("hide_if_exists", 0);
+                //兴趣分类
+                param5.put("interest_tag_mode", 0);
+                param5.put("token", tokenNode.get("data").get("token").asText());
+                //头条预估数据
+                param5.put("toutiao", 100000005);
+                //抖音预估数据
+                param5.put("aweme", 150000005);
+                //西瓜预估数据
+                param5.put("video_app", 40000005);
+                //火山预估数据
+                param5.put("hotsoon", 40000005);
+                //账号粉丝相似人群
+                param5.put("aweme_account_fans", 0);
+                // 智能放量????
+                param5.put("auto_extend_enabled", 0);
+                // 广告预算类型  0 日预算  1 总预算
+                param5.put("budget_mode", 0);
+                //广告预算
+                param5.put("budget", 300);
+                //广告投放时间类型   默认1 1:不限  2:按时间???
+                param5.put("schedule_type", 1);
+                //广告投放起始时间
+                param5.put("start_time", "2019-07-02 00:00");
+                //广告投放结束时间
+                param5.put("end_time", "2019-07-03 23:59");
+                //投放时段
+                param5.put("week_schedule", new ArrayList<String>());
+                //投放时段
+                param5.put("week_time", new ArrayList<ArrayList<Integer>>());
+                //计划出价类型  9 按展示付费  7 按点击付费 8 按转化付费
+                param5.put("pricing", 9);
+                //出价为OCPC时,计划处于哪个阶段??
+                param5.put("cpa_phrase", 2);
+                param5.put("is_union_slot", "");
+                //过滤已转化用户类型字段,只有转化为目标时可填 优化目标为转化才展示
+                param5.put("hide_if_converted", 1);
+                //投放速度/投放方式使用字段
+                param5.put("flow_control_mode", 0);
+                param5.put("cpa_bid", 1);
+                //自动出价类型,OCPM支持
+                param5.put("smart_bid_type", 0);
+                //是否调整自动出价   允许值: "0", "1"  默认值: 0
+                param5.put("adjust_cpa", 0);
+                param5.put("app_bid_ratio", new Object());
+                //广计划名称
+                param5.put("name", "自动创建测试4");
+                param5.put("campaign_id", campaignId);
+                String createResult = HttpUtils.httpPostRequest("https://ad.oceanengine.com/overture/ad/create/", param5, header);
                 System.out.println(createResult);
             }
 //            webDriver.close();