Browse Source

格式化代码

luoguangyi 3 years ago
parent
commit
80e92431a6

+ 0 - 1
README.md

@@ -8,7 +8,6 @@
 
 
 ### iot工程解读
 ### iot工程解读
 
 
-
 # 延伸阅读
 # 延伸阅读
 
 
 ### 延伸阅读
 ### 延伸阅读

+ 3 - 3
iot-admin-server/src/main/resources/codegen/vue/views/index.vue.vm

@@ -202,9 +202,9 @@
 
 
 <script>
 <script>
     import {create${simpleClassName}, delete${simpleClassName}, get${simpleClassName}, update${simpleClassName}} from "@/api/";
     import {create${simpleClassName}, delete${simpleClassName}, get${simpleClassName}, update${simpleClassName}} from "@/api/";
-import ImageUpload from '@/components/ImageUpload';
-import FileUpload from '@/components/FileUpload';
-import Editor from '@/components/Editor';
+    import ImageUpload from '@/components/ImageUpload';
+    import FileUpload from '@/components/FileUpload';
+    import Editor from '@/components/Editor';
         #if ($hasImageUploadColumn)
         #if ($hasImageUploadColumn)
         #end
         #end
         #if ($hasFileUploadColumn)
         #if ($hasFileUploadColumn)

+ 1 - 3
iot-common/src/main/java/com/yushu/framework/common/util/date/DateUtils.java

@@ -1,6 +1,5 @@
 package com.yushu.framework.common.util.date;
 package com.yushu.framework.common.util.date;
 
 
-import cn.hutool.core.date.DateUtil;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 
 
 import java.time.LocalDate;
 import java.time.LocalDate;
@@ -15,6 +14,7 @@ import java.util.Date;
 /**
 /**
  * Description: 基于Java8的时间工具类 Company: yushu
  * Description: 基于Java8的时间工具类 Company: yushu
  * 配合hutool的DateUtil工具类实现各种时间转换需求
  * 配合hutool的DateUtil工具类实现各种时间转换需求
+ *
  * @author luoguangyi
  * @author luoguangyi
  * @version 1.0
  * @version 1.0
  * @since: 2019年8月5日: 下午4:44:21 Update By luoguangyi 2019年8月5日: 下午4:44:21
  * @since: 2019年8月5日: 下午4:44:21 Update By luoguangyi 2019年8月5日: 下午4:44:21
@@ -300,6 +300,4 @@ public class DateUtils {
     }
     }
 
 
 
 
-
-
 }
 }

+ 1 - 1
iot-dependencies/pom.xml

@@ -15,7 +15,7 @@
     <properties>
     <properties>
         <revision>1.0.0</revision>
         <revision>1.0.0</revision>
         <!-- 统一依赖管理 -->
         <!-- 统一依赖管理 -->
-<!--        https://github.com/alibaba/spring-cloud-alibaba/wiki/版本说明-->
+        <!--        https://github.com/alibaba/spring-cloud-alibaba/wiki/版本说明-->
         <spring-boot.version>2.4.2</spring-boot.version>
         <spring-boot.version>2.4.2</spring-boot.version>
         <spring-cloud-alibaba.version>2021.1</spring-cloud-alibaba.version>
         <spring-cloud-alibaba.version>2021.1</spring-cloud-alibaba.version>
         <spring-cloud.version>2020.0.1</spring-cloud.version>
         <spring-cloud.version>2020.0.1</spring-cloud.version>

+ 2 - 0
iot-spring-boot-starter-redis/src/main/java/com/yushu/framework/redis/core/RedisKeyDefine.java

@@ -41,6 +41,7 @@ public class RedisKeyDefine {
      * 备注
      * 备注
      */
      */
     private final String memo;
     private final String memo;
+
     private RedisKeyDefine(String memo, String keyTemplate, KeyTypeEnum keyType, Class<?> valueType,
     private RedisKeyDefine(String memo, String keyTemplate, KeyTypeEnum keyType, Class<?> valueType,
                            TimeoutTypeEnum timeoutType, Duration timeout) {
                            TimeoutTypeEnum timeoutType, Duration timeout) {
         this.memo = memo;
         this.memo = memo;
@@ -52,6 +53,7 @@ public class RedisKeyDefine {
         // 添加注册表
         // 添加注册表
         RedisKeyRegistry.add(this);
         RedisKeyRegistry.add(this);
     }
     }
+
     public RedisKeyDefine(String memo, String keyTemplate, KeyTypeEnum keyType, Class<?> valueType, Duration timeout) {
     public RedisKeyDefine(String memo, String keyTemplate, KeyTypeEnum keyType, Class<?> valueType, Duration timeout) {
         this(memo, keyTemplate, keyType, valueType, TimeoutTypeEnum.FIXED, timeout);
         this(memo, keyTemplate, keyType, valueType, TimeoutTypeEnum.FIXED, timeout);
     }
     }

+ 35 - 36
iot-spring-boot-starter-web/src/main/java/com/yushu/framework/apilog/RequestLogAspect.java

@@ -44,6 +44,22 @@ public class RequestLogAspect {
     private SerializeConfig serializeConfig;
     private SerializeConfig serializeConfig;
     private SerializerWrapper serializerWrapper;
     private SerializerWrapper serializerWrapper;
 
 
+    /**
+     * 获取完整的请求路径, 包含 queryString
+     *
+     * @param request 当前请求
+     * @return 完整的请求路径
+     */
+    public static String getFullRequestUrl(HttpServletRequest request) {
+        if (request == null) {
+            return "";
+        }
+        if (StrUtil.isBlank(request.getQueryString())) {
+            return request.getRequestURL().toString();
+        }
+        return request.getRequestURL().append('?').append(request.getQueryString()).toString();
+    }
+
     @Autowired
     @Autowired
     public void setSerialize(SerializeConfig serialize) {
     public void setSerialize(SerializeConfig serialize) {
         this.serializeConfig = serialize;
         this.serializeConfig = serialize;
@@ -78,8 +94,8 @@ public class RequestLogAspect {
         Object result = null;
         Object result = null;
         try {
         try {
             result = proceedingJoinPoint.proceed();
             result = proceedingJoinPoint.proceed();
-        }  catch (Throwable th) {
-            log.warn("Request warn : {}", JSON.toJSONString(requestInfo),th);
+        } catch (Throwable th) {
+            log.warn("Request warn : {}", JSON.toJSONString(requestInfo), th);
             throw th;
             throw th;
         }
         }
         // 配置明确指定为 true,才使用全返回值
         // 配置明确指定为 true,才使用全返回值
@@ -149,6 +165,23 @@ public class RequestLogAspect {
     }
     }
 
 
     @Data
     @Data
+    @Component
+    @AllArgsConstructor
+    @NoArgsConstructor
+    public static class SerializeConfig {
+        @Value("${api.access.log.serialize.result-full:false}")
+        protected volatile Boolean resultFull;
+        @Value("${api.access.log.aop.enable:true}")
+        private volatile Boolean aopLog;
+        @Value("${api.access.log.serialize.args-full:true}")
+        private volatile Boolean argsFull;
+        @Value("${api.access.log.serialize.args-max-length:2048}")
+        private volatile Integer argsMaxLength;
+        @Value("${api.access.log.serialize.result-max-length:2048}")
+        private volatile Integer resultMaxLength;
+    }
+
+    @Data
     public class RequestInfo {
     public class RequestInfo {
         private String ip;
         private String ip;
         private String url;
         private String url;
@@ -169,38 +202,4 @@ public class RequestLogAspect {
         private transient Exception exception;
         private transient Exception exception;
         private String[] stacktrace;
         private String[] stacktrace;
     }
     }
-
-
-    @Data
-    @Component
-    @AllArgsConstructor
-    @NoArgsConstructor
-    public static class SerializeConfig {
-        @Value("${api.access.log.aop.enable:true}")
-        private volatile Boolean aopLog;
-        @Value("${api.access.log.serialize.args-full:true}")
-        private volatile Boolean argsFull;
-        @Value("${api.access.log.serialize.args-max-length:2048}")
-        private volatile Integer argsMaxLength;
-        @Value("${api.access.log.serialize.result-full:false}")
-        protected volatile Boolean resultFull;
-        @Value("${api.access.log.serialize.result-max-length:2048}")
-        private volatile Integer resultMaxLength;
-    }
-
-    /**
-     * 获取完整的请求路径, 包含 queryString
-     *
-     * @param request 当前请求
-     * @return 完整的请求路径
-     */
-    public static String getFullRequestUrl(HttpServletRequest request) {
-        if (request == null) {
-            return "";
-        }
-        if (StrUtil.isBlank(request.getQueryString())) {
-            return request.getRequestURL().toString();
-        }
-        return request.getRequestURL().append('?').append(request.getQueryString()).toString();
-    }
 }
 }

+ 1 - 1
iot-spring-boot-starter-web/src/main/java/com/yushu/framework/apilog/config/ApiLogAutoConfiguration.java

@@ -16,7 +16,7 @@ import javax.servlet.Filter;
 
 
 @Configuration
 @Configuration
 @AutoConfigureAfter(WebAutoConfiguration.class)
 @AutoConfigureAfter(WebAutoConfiguration.class)
-@ConditionalOnProperty(prefix = "api.access.log.filter",name = "enable",havingValue = "true", matchIfMissing = false)
+@ConditionalOnProperty(prefix = "api.access.log.filter", name = "enable", havingValue = "true", matchIfMissing = false)
 public class ApiLogAutoConfiguration {
 public class ApiLogAutoConfiguration {
 
 
     private static <T extends Filter> FilterRegistrationBean<T> createFilterBean(T filter, Integer order) {
     private static <T extends Filter> FilterRegistrationBean<T> createFilterBean(T filter, Integer order) {

+ 1 - 1
iot-spring-boot-starter-web/src/main/java/com/yushu/framework/apilog/serializer/JsonSerializer.java

@@ -3,7 +3,7 @@ package com.yushu.framework.apilog.serializer;
 /**
 /**
  * 标识接口,Json序列化器
  * 标识接口,Json序列化器
  */
  */
-public interface JsonSerializer{
+public interface JsonSerializer {
     /**
     /**
      * 将对象序列化为字符串
      * 将对象序列化为字符串
      *
      *

+ 12 - 13
iot-spring-boot-starter-web/src/main/java/com/yushu/framework/apilog/serializer/SerializerWrapper.java

@@ -18,6 +18,11 @@ import java.util.*;
 @Setter
 @Setter
 @RequiredArgsConstructor
 @RequiredArgsConstructor
 public class SerializerWrapper {
 public class SerializerWrapper {
+    private static final Map<Class<?>, Boolean> NEED_EXCLUDE_CACHE = new ConcurrentReferenceHashMap<>(64);
+    private static Set<Class<?>> SIMPLE_TYPES = new HashSet<>(Arrays.asList(
+            Byte.class, Short.class, Integer.class, Long.class, Float.class, Double.class, Character.class,
+            Boolean.class, String.class, Enum.class, Date.class,
+            byte.class, short.class, int.class, long.class, float.class, double.class, char.class, boolean.class));
     private final JsonSerializer serializer;
     private final JsonSerializer serializer;
     private final RequestLogAspect.SerializeConfig serializeConfig;
     private final RequestLogAspect.SerializeConfig serializeConfig;
     /**
     /**
@@ -31,7 +36,6 @@ public class SerializerWrapper {
             "org.springframework.validation",
             "org.springframework.validation",
             "org.springframework.http",
             "org.springframework.http",
             "org.springframework.web.multipart"));
             "org.springframework.web.multipart"));
-
     private Set<String> includePackage = new HashSet<>(Arrays.asList(
     private Set<String> includePackage = new HashSet<>(Arrays.asList(
             "java.lang",
             "java.lang",
             "java.util",
             "java.util",
@@ -50,7 +54,13 @@ public class SerializerWrapper {
     private Set<String> includeType = new HashSet<>(Arrays.asList(
     private Set<String> includeType = new HashSet<>(Arrays.asList(
             "java.io.Serializable",
             "java.io.Serializable",
             "java.io.Closeable"));
             "java.io.Closeable"));
-    private static final Map<Class<?>, Boolean> NEED_EXCLUDE_CACHE = new ConcurrentReferenceHashMap<>(64);
+
+    public static boolean isSimpleType(Class<?> clazz) {
+        if (clazz == null) {
+            return true;
+        }
+        return SIMPLE_TYPES.contains(clazz);
+    }
 
 
     /**
     /**
      * 将入参打印成字符串
      * 将入参打印成字符串
@@ -189,15 +199,4 @@ public class SerializerWrapper {
         }
         }
         return obj.toString();
         return obj.toString();
     }
     }
-
-    public static boolean isSimpleType(Class<?> clazz) {
-        if (clazz == null) {
-            return true;
-        }
-        return SIMPLE_TYPES.contains(clazz);
-    }
-    private static Set<Class<?>> SIMPLE_TYPES = new HashSet<>(Arrays.asList(
-            Byte.class, Short.class, Integer.class, Long.class, Float.class, Double.class, Character.class,
-            Boolean.class, String.class, Enum.class, Date.class,
-            byte.class, short.class, int.class, long.class, float.class, double.class, char.class, boolean.class));
 }
 }

+ 1 - 1
iot-spring-boot-starter-web/src/main/java/com/yushu/framework/web/core/handler/GlobalResponseBodyHandler.java

@@ -1,8 +1,8 @@
 package com.yushu.framework.web.core.handler;
 package com.yushu.framework.web.core.handler;
 
 
+import com.yushu.framework.apilog.core.filter.ApiAccessLogFilter;
 import com.yushu.framework.common.pojo.CommonResult;
 import com.yushu.framework.common.pojo.CommonResult;
 import com.yushu.framework.web.core.util.WebFrameworkUtils;
 import com.yushu.framework.web.core.util.WebFrameworkUtils;
-import com.yushu.framework.apilog.core.filter.ApiAccessLogFilter;
 import org.springframework.core.MethodParameter;
 import org.springframework.core.MethodParameter;
 import org.springframework.http.MediaType;
 import org.springframework.http.MediaType;
 import org.springframework.http.server.ServerHttpRequest;
 import org.springframework.http.server.ServerHttpRequest;

+ 2 - 2
pom.xml

@@ -30,9 +30,9 @@
         <module>iot-spring-boot-starter-test</module>
         <module>iot-spring-boot-starter-test</module>
         <module>iot-spring-boot-starter-extension</module>
         <module>iot-spring-boot-starter-extension</module>
         <module>iot-admin-server</module>
         <module>iot-admin-server</module>
-<!--        <module>spring-cloud-alibaba-examples</module>-->
+        <!--        <module>spring-cloud-alibaba-examples</module>-->
 
 
-<!--        <module>demo</module>-->
+        <!--        <module>demo</module>-->
     </modules>
     </modules>
     <dependencyManagement>
     <dependencyManagement>
         <dependencies>
         <dependencies>