diff --git a/aos-common/src/main/java/com/aos/common/copy/AosBeanUtils.java b/aos-common/src/main/java/com/aos/common/copy/AosBeanUtils.java index b365040..4c9f44b 100644 --- a/aos-common/src/main/java/com/aos/common/copy/AosBeanUtils.java +++ b/aos-common/src/main/java/com/aos/common/copy/AosBeanUtils.java @@ -9,9 +9,17 @@ import java.util.function.BiConsumer; import java.util.function.Supplier; /** + *
Company: 成都返空汇网络技术有限公司
+ *Description:
+ * + * @author yangjiyu + * @version 1.0.0 + * @email "mailto:yangjiyu@fkhwl.com" + * @date 2022.11.17 17:08 * @author: wangyl - * @date: 2022/11/6 + * @date: 2022 /11/6 * @description: 拷贝 + * @since 1.0 */ @SuppressWarnings("unchecked") public class AosBeanUtils extends BeanUtils { @@ -19,12 +27,15 @@ public class AosBeanUtils extends BeanUtils { /** * list拷贝 * + * @paramCompany: 成都返空汇网络技术有限公司
+ *Description:
+ * + * @author yangjiyu + * @version 1.0.0 + * @email "mailto:yangjiyu@fkhwl.com" + * @date 2022.11.17 17:08 * @author: wangyl - * @date: 2022/11/16 + * @date: 2022 /11/16 * @description: 枚举基础接口 + * @since 1.0 */ public interface AosBaseEnum { /** * 获取枚举值 * * @param - * @return java.lang.Integer - * @Date 2022/11/16 + * @return java.lang.Integer value + * @Date 2022 /11/16 * @Author wangyl + * @since 1.0 */ Integer getValue(); @@ -20,9 +29,10 @@ public interface AosBaseEnum { * 获取枚举描述 * * @param - * @return java.lang.String - * @Date 2022/11/16 + * @return java.lang.String desc + * @Date 2022 /11/16 * @Author wangyl + * @since 1.0 */ String getDesc(); } diff --git a/aos-common/src/main/java/com/aos/common/model/ResultCodeInterface.java b/aos-common/src/main/java/com/aos/common/model/ResultCodeInterface.java index acce994..0f21e60 100644 --- a/aos-common/src/main/java/com/aos/common/model/ResultCodeInterface.java +++ b/aos-common/src/main/java/com/aos/common/model/ResultCodeInterface.java @@ -5,25 +5,34 @@ package com.aos.common.model; * * @author wangyl * @version V1.0 + * @email "mailto:yangjiyu@fkhwl.com" + * @date 2022.11.17 17:08 * @ClassName: ResultCodeInterface - * @Date: 2022/1/6 16:26 + * @Date: 2022 /1/6 16:26 + * @since 1.0 */ public interface ResultCodeInterface { /** - * @return java.lang.String + * Gets code * + * + * @return java.lang.String code * @Description 获取错误码 - * @Date 2020/11/8 15:37 + * @Date 2020 /11/8 15:37 * @Author wangyl * @Version V1.0 + * @since 1.0 */ String getCode(); /** - * @return java.lang.String + * Gets msg * + * + * @return java.lang.String msg * @Description 获取错误信息 - * @Date 2020/11/8 15:38 + * @Date 2020 /11/8 15:38 * @Author wangyl * @Version V1.0 + * @since 1.0 */ String getMsg(); } diff --git a/aos-common/src/main/java/com/aos/common/model/context/CurrentUserContextHolder.java b/aos-common/src/main/java/com/aos/common/model/context/CurrentUserContextHolder.java index e2e1d86..1b64836 100644 --- a/aos-common/src/main/java/com/aos/common/model/context/CurrentUserContextHolder.java +++ b/aos-common/src/main/java/com/aos/common/model/context/CurrentUserContextHolder.java @@ -21,15 +21,26 @@ import com.alibaba.ttl.TransmittableThreadLocal; import java.util.Objects; /** + *Company: 成都返空汇网络技术有限公司
+ *Description:
+ * + * @author yangjiyu + * @version 1.0.0 + * @email "mailto:yangjiyu@fkhwl.com" + * @date 2022.11.17 17:08 * @author: wangyl - * @date: 2022/11/3 + * @date: 2022 /11/3 * @description: 用户信息上下文 + * @since 1.0 */ public class CurrentUserContextHolder { + /** userHolder */ private static ThreadLocalCompany: 成都返空汇网络技术有限公司
+ *Description:
+ * * @author wangyl * @version V1.0 + * @email "mailto:yangjiyu@fkhwl.com" + * @date 2022.11.17 17:08 * @ClassName: SecurityUserInfo * @Function: 认证的用户信息 - * @Date: 2019/12/17 21:24 + * @Date: 2019 /12/17 21:24 + * @since 1.0 */ @Data public class SecurityUserInfo { diff --git a/aos-common/src/main/java/com/aos/common/model/exception/AosBaseBizException.java b/aos-common/src/main/java/com/aos/common/model/exception/AosBaseBizException.java index b58dc78..768c765 100644 --- a/aos-common/src/main/java/com/aos/common/model/exception/AosBaseBizException.java +++ b/aos-common/src/main/java/com/aos/common/model/exception/AosBaseBizException.java @@ -8,12 +8,16 @@ import lombok.Data; * * @author wyl * @version V1.0 + * @email "mailto:yangjiyu@fkhwl.com" + * @date 2022.11.17 17:08 * @ClassName: BizException - * @Date: 2020/4/12 20:13 + * @Date: 2020 /4/12 20:13 + * @since 1.0 */ @Data public class AosBaseBizException extends RuntimeException { + /** serialVersionUID */ private static final long serialVersionUID = 1L; /** @@ -21,34 +25,79 @@ public class AosBaseBizException extends RuntimeException { */ protected String errorCode; + /** + * Aos base biz exception + * + * @since 1.0 + */ public AosBaseBizException() { super(); } + /** + * Aos base biz exception + * + * @param resultCode result code + * @since 1.0 + */ public AosBaseBizException(ResultCodeInterface resultCode) { super(resultCode.getMsg()); this.errorCode = resultCode.getCode(); } + /** + * Aos base biz exception + * + * @param resultCode result code + * @param cause cause + * @since 1.0 + */ public AosBaseBizException(ResultCodeInterface resultCode, Throwable cause) { super(resultCode.getMsg(), cause); this.errorCode = resultCode.getCode(); } + /** + * Aos base biz exception + * + * @param errorMsg error msg + * @since 1.0 + */ public AosBaseBizException(String errorMsg) { super(errorMsg); } + /** + * Aos base biz exception + * + * @param errorCode error code + * @param errorMsg error msg + * @since 1.0 + */ public AosBaseBizException(String errorCode, String errorMsg) { super(errorMsg); this.errorCode = errorCode; } + /** + * Aos base biz exception + * + * @param errorCode error code + * @param errorMsg error msg + * @param cause cause + * @since 1.0 + */ public AosBaseBizException(String errorCode, String errorMsg, Throwable cause) { super(errorMsg, cause); this.errorCode = errorCode; } + /** + * Fill in stack trace + * + * @return the throwable + * @since 1.0 + */ @Override public Throwable fillInStackTrace() { return this; diff --git a/aos-common/src/main/java/com/aos/common/model/result/ResultCode.java b/aos-common/src/main/java/com/aos/common/model/result/ResultCode.java index 757d123..903302f 100644 --- a/aos-common/src/main/java/com/aos/common/model/result/ResultCode.java +++ b/aos-common/src/main/java/com/aos/common/model/result/ResultCode.java @@ -3,29 +3,57 @@ package com.aos.common.model.result; import com.aos.common.model.ResultCodeInterface; /** + *Company: 成都返空汇网络技术有限公司
+ *Description:
+ * + * @author yangjiyu + * @version 1.0.0 + * @email "mailto:yangjiyu@fkhwl.com" + * @date 2022.11.17 17:07 * @author: wangyl - * @date: 2022/11/13 + * @date: 2022 /11/13 * @description: 基础返回结果 + * @since 1.0 */ public enum ResultCode implements ResultCodeInterface { - /** - * - */ + /** Succeed result code */ SUCCEED("000000", "成功"), + /** Failed result code */ FAILED("000001", "系统异常"); + /** Code */ private String code; + /** Msg */ private String msg; + /** + * Result code + * + * @param code code + * @param msg msg + * @since 1.0 + */ ResultCode(String code, String msg) { this.code = code; this.msg = msg; } + /** + * Gets code * + * + * @return the code + * @since 1.0 + */ @Override public String getCode() { return code; } + /** + * Gets msg * + * + * @return the msg + * @since 1.0 + */ @Override public String getMsg() { return msg; diff --git a/aos-common/src/main/java/com/aos/common/model/result/WebResponse.java b/aos-common/src/main/java/com/aos/common/model/result/WebResponse.java index 72387b6..ee7bbfb 100644 --- a/aos-common/src/main/java/com/aos/common/model/result/WebResponse.java +++ b/aos-common/src/main/java/com/aos/common/model/result/WebResponse.java @@ -3,51 +3,143 @@ package com.aos.common.model.result; import com.aos.common.model.ResultCodeInterface; import lombok.AllArgsConstructor; +/** + *Company: 成都返空汇网络技术有限公司
+ *Description:
+ * + * @author yangjiyu + * @version 1.0.0 + * @email "mailto:yangjiyu@fkhwl.com" + * @date 2022.11.17 17:08 + * @since 1.0 + */ @AllArgsConstructor @SuppressWarnings("unchecked") public enum WebResponse { - /** - * - */ + /** Web response web response */ WebResponse; + /** + * Ok + * + * @paramCompany: 成都返空汇网络技术有限公司
+ *Description:
+ * + * @paramCompany: 成都返空汇网络技术有限公司
+ *Description:
+ * + * @author yangjiyu + * @version 1.0.0 + * @email "mailto:yangjiyu@fkhwl.com" + * @date 2022.11.17 17:08 * @author: wangyl - * @date: 2022/11/12 + * @date: 2022 /11/12 * @description: 请求工具类 + * @since 1.0 */ @Slf4j public class RequestUtils { + /** + * Gets request * + * + * @return the request + * @since 1.0 + */ public static HttpServletRequest getRequest() { RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes(); HttpServletRequest request = ((ServletRequestAttributes) requestAttributes).getRequest(); return request; } + /** + * Gets response * + * + * @return the response + * @since 1.0 + */ public static HttpServletResponse getResponse() { RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes(); HttpServletResponse response = ((ServletRequestAttributes) requestAttributes).getResponse(); return response; } + /** + * Gets value from request * + * + * @param key key + * @return the value from request + * @since 1.0 + */ public static String getValueFromRequest(String key) { HttpServletRequest request = getRequest(); String value = getValue(request, key); return value; } + /** + * Gets cookie * + * + * @param key key + * @return the cookie + * @since 1.0 + */ public static Cookie getCookie(String key) { return getCookie(getRequest(), key); } + /** + * Clean cookie + * + * @param key key + * @since 1.0 + */ public static void cleanCookie(String key) { HttpServletResponse response = getResponse(); HttpServletRequest request = getRequest(); @@ -56,6 +96,14 @@ public class RequestUtils { } + /** + * Gets value * + * + * @param request request + * @param key key + * @return the value + * @since 1.0 + */ private static String getValue(HttpServletRequest request, String key) { String value = null; try { @@ -74,6 +122,14 @@ public class RequestUtils { return value; } + /** + * Gets cookie * + * + * @param request request + * @param key key + * @return the cookie + * @since 1.0 + */ private static Cookie getCookie(HttpServletRequest request, String key) { Cookie[] cookies = request.getCookies(); if (!Objects.isNull(cookies)) { diff --git a/aos-common/src/main/java/com/aos/common/thread/AosThreadUtil.java b/aos-common/src/main/java/com/aos/common/thread/AosThreadUtil.java index d47b83f..ae9fe08 100644 --- a/aos-common/src/main/java/com/aos/common/thread/AosThreadUtil.java +++ b/aos-common/src/main/java/com/aos/common/thread/AosThreadUtil.java @@ -13,6 +13,10 @@ import java.util.function.Supplier; * 线程池工具 * * @author luxiaolei + * @version 1.0.0 + * @email "mailto:yangjiyu@fkhwl.com" + * @date 2022.11.17 17:08 + * @since 1.0 */ public class AosThreadUtil { @@ -25,7 +29,8 @@ public class AosThreadUtil { * * * @param corePoolSize 同时执行的线程数大小 - * @return ExecutorService + * @return ExecutorService executor service + * @since 1.0 */ public static ExecutorService newExecutor(int corePoolSize) { ExecutorBuilder builder = ExecutorBuilder.create(); @@ -44,7 +49,8 @@ public class AosThreadUtil { * 4. 任务直接提交给线程而不保持它们 * * - * @return ExecutorService + * @return ExecutorService executor service + * @since 1.0 */ public static ExecutorService newExecutor() { return TtlExecutors.getTtlExecutorService(ExecutorBuilder.create().useSynchronousQueue().build()); @@ -59,7 +65,8 @@ public class AosThreadUtil { * 4. 同时只允许一个线程工作,剩余放入队列等待,等待数超过1024报错 * * - * @return ExecutorService + * @return ExecutorService executor service + * @since 1.0 */ public static ExecutorService newSingleExecutor() { return TtlExecutors.getTtlExecutorService(ExecutorBuilder.create()// @@ -76,6 +83,7 @@ public class AosThreadUtil { * @param corePoolSize 初始线程池大小 * @param maximumPoolSize 最大线程池大小 * @return {@link ThreadPoolExecutor} + * @since 1.0 */ public static ThreadPoolExecutor newExecutor(int corePoolSize, int maximumPoolSize) { return ExecutorBuilder.create() @@ -108,7 +116,8 @@ public class AosThreadUtil { * Blocking Coefficient(阻塞系数) = 阻塞时间/(阻塞时间+使用CPU的时间)
- * see: http://blog.csdn.net/partner4java/article/details/9417663
+ * see:
+ * http://blog.csdn.net/partner4java/article/details/9417663
*
* @param blockingCoefficient 阻塞系数,阻塞因子介于0~1之间的数,阻塞因子越大,线程池中的线程数越多。
* @return {@link ThreadPoolExecutor}
@@ -135,7 +144,7 @@ public class AosThreadUtil {
* @param nThreads 线程池大小
* @param threadNamePrefix 线程名称前缀
* @param isBlocked 是否使用{@link BlockPolicy}策略
- * @return ExecutorService
+ * @return ExecutorService executor service
* @author luozongle
* @since 5.8.0
*/
@@ -155,7 +164,7 @@ public class AosThreadUtil {
* @param maximumQueueSize 队列大小
* @param threadNamePrefix 线程名称前缀
* @param isBlocked 是否使用{@link BlockPolicy}策略
- * @return ExecutorService
+ * @return ExecutorService executor service
* @author luozongle
* @since 5.8.0
*/
@@ -175,7 +184,7 @@ public class AosThreadUtil {
* @param maximumQueueSize 队列大小
* @param threadNamePrefix 线程名称前缀
* @param handler 拒绝策略
- * @return ExecutorService
+ * @return ExecutorService executor service
* @author luozongle
* @since 5.8.0
*/
@@ -195,6 +204,7 @@ public class AosThreadUtil {
* 直接在公共线程池中执行线程
*
* @param runnable 可运行对象
+ * @since 1.0
*/
public static void execute(Runnable runnable) {
GlobalThreadPool.execute(TtlRunnable.get(runnable));
@@ -205,7 +215,8 @@ public class AosThreadUtil {
*
* @param runnable 需要执行的方法体
* @param isDaemon 是否守护线程。守护线程会在主线程结束后自动结束
- * @return 执行的方法体
+ * @return 执行的方法体 runnable
+ * @since 1.0
*/
public static Runnable execAsync(Runnable runnable, boolean isDaemon) {
Thread thread = new Thread(TtlRunnable.get(runnable));
@@ -220,7 +231,8 @@ public class AosThreadUtil {
*
* @param Company: 成都返空汇网络技术有限公司 Description: Company: 成都返空汇网络技术有限公司 Description: Company: 成都返空汇网络技术有限公司 Description: Company: 成都返空汇网络技术有限公司 Description:
*
- * @return 线程对象数组
+ * @return 线程对象数组 thread [ ]
+ * @since 1.0
*/
public static Thread[] getThreads() {
return getThreads(Thread.currentThread().getThreadGroup().getParent());
@@ -521,7 +549,8 @@ public class AosThreadUtil {
* from Voovan
*
* @param group 线程组
- * @return 线程对象数组
+ * @return 线程对象数组 thread [ ]
+ * @since 1.0
*/
public static Thread[] getThreads(ThreadGroup group) {
final Thread[] slackList = new Thread[group.activeCount() * 2];
@@ -535,7 +564,8 @@ public class AosThreadUtil {
* 获取进程的主线程
* from Voovan
*
- * @return 进程的主线程
+ * @return 进程的主线程 main thread
+ * @since 1.0
*/
public static Thread getMainThread() {
for (Thread thread : getThreads()) {
@@ -549,7 +579,7 @@ public class AosThreadUtil {
/**
* 获取当前线程的线程组
*
- * @return 线程组
+ * @return 线程组 thread group
* @since 3.1.2
*/
public static ThreadGroup currentThreadGroup() {
diff --git a/aos-common/src/main/java/com/aos/common/token/TokenUtilBase.java b/aos-common/src/main/java/com/aos/common/token/TokenUtilBase.java
index 2dd9f38..22b9ae8 100644
--- a/aos-common/src/main/java/com/aos/common/token/TokenUtilBase.java
+++ b/aos-common/src/main/java/com/aos/common/token/TokenUtilBase.java
@@ -17,11 +17,17 @@ import java.util.Map;
import java.util.Objects;
/**
+ *