diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a0e57e2e..393ac809f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,22 @@ Buession Framework Changelog =========================== + +## [2.1.1](https://github.com/buession/buession-parent/releases/tag/v2.1.1) (2022-08-18) + +### 🔨依赖升级 + +- [依赖库版本升级和安全漏洞修复](https://github.com/buession/buession-parent/releases/tag/v2.1.1) + + +### ⭐ 新特性 + +- **buession-core:** DateTime 增加统计年、月天数 + + +--- + + ## [2.1.0](https://github.com/buession/buessionframework/releases/tag/v2.1.0) (2022-08-07) ### 🔨依赖升级 diff --git a/README.md b/README.md index ec4ff77d0..b22d74499 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@

- BuessionFramework + BuessionFramework

## Requirements diff --git a/buession-aop/pom.xml b/buession-aop/pom.xml index 8cef4e99a..cef21f4af 100644 --- a/buession-aop/pom.xml +++ b/buession-aop/pom.xml @@ -7,7 +7,7 @@ com.buession buession-parent ../buession-parent - 2.1.0 + 2.1.1 buession-aop https://github.com/buession/buessionframework diff --git a/buession-aop/src/main/java/com/buession/aop/aopalliance/AbstractAopAllianceAnnotationsMethodInterceptor.java b/buession-aop/src/main/java/com/buession/aop/aopalliance/AbstractAopAllianceAnnotationsMethodInterceptor.java index 2fd9f19e0..de34baa42 100644 --- a/buession-aop/src/main/java/com/buession/aop/aopalliance/AbstractAopAllianceAnnotationsMethodInterceptor.java +++ b/buession-aop/src/main/java/com/buession/aop/aopalliance/AbstractAopAllianceAnnotationsMethodInterceptor.java @@ -31,12 +31,17 @@ import java.lang.reflect.Method; /** + * Aop Alliance 方法注解拦截器抽象类 + * * @author Yong.Teng * @since 2.1.0 */ public abstract class AbstractAopAllianceAnnotationsMethodInterceptor extends AbstractAnnotationsMethodInterceptor implements AnnotationsMethodInterceptor { + /** + * 构造函数 + */ public AbstractAopAllianceAnnotationsMethodInterceptor(){ super(); } @@ -47,6 +52,14 @@ public Object invoke(MethodInvocation methodInvocation) throws Throwable{ return super.invoke(mi); } + /** + * Create instance for {@link com.buession.aop.MethodInvocation}. + * + * @param mi + * The method invocation joinpoint + * + * @return The instance of {@link com.buession.aop.MethodInvocation} + */ protected com.buession.aop.MethodInvocation createMethodInvocation(final MethodInvocation mi){ return new com.buession.aop.MethodInvocation() { diff --git a/buession-aop/src/main/java/com/buession/aop/aspectj/AbstractAspectAnnotationsMethodInterceptor.java b/buession-aop/src/main/java/com/buession/aop/aspectj/AbstractAspectAnnotationsMethodInterceptor.java index c2a0f245f..2d945de20 100644 --- a/buession-aop/src/main/java/com/buession/aop/aspectj/AbstractAspectAnnotationsMethodInterceptor.java +++ b/buession-aop/src/main/java/com/buession/aop/aspectj/AbstractAspectAnnotationsMethodInterceptor.java @@ -24,43 +24,17 @@ */ package com.buession.aop.aspectj; -import com.buession.aop.interceptor.AbstractAnnotationsMethodInterceptor; -import org.aspectj.lang.JoinPoint; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - /** + * Aspectj 方法注解拦截器抽象类 + * * @author Yong.Teng * @since 2.1.0 */ -public abstract class AbstractAspectAnnotationsMethodInterceptor extends AbstractAnnotationsMethodInterceptor { - - private final Logger logger = LoggerFactory.getLogger(getClass()); +@Deprecated +public abstract class AbstractAspectAnnotationsMethodInterceptor extends AbstractAspectjAnnotationsMethodInterceptor { public AbstractAspectAnnotationsMethodInterceptor(){ super(); } - public void performBeforeInterception(JoinPoint joinPoint) throws Throwable{ - if(logger.isDebugEnabled()){ - AspectjAnnotationsMethodInterceptorLogUtils.performBeforeInterceptionDebug(logger, joinPoint); - } - - // 1. Adapt the join point into a method invocation - BeforeAdviceMethodInvocationAdapter mi = BeforeAdviceMethodInvocationAdapter.createFromJoinPoint(joinPoint); - // 2. Delegate the authorization of the method call to the super class - super.invoke(mi); - } - - public void performAfterInterception(JoinPoint joinPoint) throws Throwable{ - if(logger.isDebugEnabled()){ - AspectjAnnotationsMethodInterceptorLogUtils.performAfterInterceptionDebug(logger, joinPoint); - } - - // 1. Adapt the join point into a method invocation - AfterAdviceMethodInvocationAdapter mi = AfterAdviceMethodInvocationAdapter.createFromJoinPoint(joinPoint); - // 2. Delegate the authorization of the method call to the super class - super.invoke(mi); - } - } diff --git a/buession-aop/src/main/java/com/buession/aop/aspectj/AbstractAspectjAnnotationsMethodInterceptor.java b/buession-aop/src/main/java/com/buession/aop/aspectj/AbstractAspectjAnnotationsMethodInterceptor.java new file mode 100644 index 000000000..707aaff2c --- /dev/null +++ b/buession-aop/src/main/java/com/buession/aop/aspectj/AbstractAspectjAnnotationsMethodInterceptor.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. + * See the NOTICE file distributed with this work for additional information regarding copyright ownership. + * The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is + * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and limitations under the License. + * + * ========================================================================================================= + * + * This software consists of voluntary contributions made by many individuals on behalf of the + * Apache Software Foundation. For more information on the Apache Software Foundation, please see + * . + * + * +-------------------------------------------------------------------------------------------------------+ + * | License: http://www.apache.org/licenses/LICENSE-2.0.txt | + * | Author: Yong.Teng | + * | Copyright @ 2013-2022 Buession.com Inc. | + * +-------------------------------------------------------------------------------------------------------+ + */ +package com.buession.aop.aspectj; + +import com.buession.aop.interceptor.AbstractAnnotationsMethodInterceptor; +import org.aspectj.lang.JoinPoint; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Aspectj 方法注解拦截器抽象类 + * + * @author Yong.Teng + * @since 2.1.0 + */ +public abstract class AbstractAspectjAnnotationsMethodInterceptor extends AbstractAnnotationsMethodInterceptor { + + private final Logger logger = LoggerFactory.getLogger(getClass()); + + public AbstractAspectjAnnotationsMethodInterceptor(){ + super(); + } + + public void performBeforeInterception(JoinPoint joinPoint) throws Throwable{ + if(logger.isDebugEnabled()){ + AspectjAnnotationsMethodInterceptorLogUtils.performBeforeInterceptionDebug(logger, joinPoint); + } + + // 1. Adapt the join point into a method invocation + BeforeAdviceMethodInvocationAdapter mi = BeforeAdviceMethodInvocationAdapter.createFromJoinPoint(joinPoint); + // 2. Delegate the authorization of the method call to the super class + super.invoke(mi); + } + + public void performAfterInterception(JoinPoint joinPoint) throws Throwable{ + if(logger.isDebugEnabled()){ + AspectjAnnotationsMethodInterceptorLogUtils.performAfterInterceptionDebug(logger, joinPoint); + } + + // 1. Adapt the join point into a method invocation + AfterAdviceMethodInvocationAdapter mi = AfterAdviceMethodInvocationAdapter.createFromJoinPoint(joinPoint); + // 2. Delegate the authorization of the method call to the super class + super.invoke(mi); + } + +} diff --git a/buession-aop/src/main/java/com/buession/aop/aspectj/AspectjAnnotationsMethodInterceptorLogUtils.java b/buession-aop/src/main/java/com/buession/aop/aspectj/AspectjAnnotationsMethodInterceptorLogUtils.java index dbcd015b2..81eca4088 100644 --- a/buession-aop/src/main/java/com/buession/aop/aspectj/AspectjAnnotationsMethodInterceptorLogUtils.java +++ b/buession-aop/src/main/java/com/buession/aop/aspectj/AspectjAnnotationsMethodInterceptorLogUtils.java @@ -34,7 +34,7 @@ * @author Yong.Teng * @since 2.1.0 */ -public class AspectjAnnotationsMethodInterceptorLogUtils { +class AspectjAnnotationsMethodInterceptorLogUtils { private AspectjAnnotationsMethodInterceptorLogUtils(){ diff --git a/buession-aop/src/main/java/com/buession/aop/exception/SignatureIllegalArgumentException.java b/buession-aop/src/main/java/com/buession/aop/exception/SignatureIllegalArgumentException.java index 67c9ea34b..f70df5043 100644 --- a/buession-aop/src/main/java/com/buession/aop/exception/SignatureIllegalArgumentException.java +++ b/buession-aop/src/main/java/com/buession/aop/exception/SignatureIllegalArgumentException.java @@ -27,29 +27,63 @@ import org.aspectj.lang.Signature; /** + * 签名错误异常 + * * @author Yong.Teng */ public class SignatureIllegalArgumentException extends IllegalArgumentException { private final static long serialVersionUID = 6148632731869242050L; + /** + * 签名 + */ private final Signature signature; + /** + * 构造函数,定义了默认异常信息 + * + * @param signature + * 签名 + */ public SignatureIllegalArgumentException(Signature signature){ this(signature, "The join point signature is invalid: expected a MethodSignature or an AdviceSignature but was "); } + /** + * 构造函数 + * + * @param signature + * 签名 + * @param message + * 异常信息 + */ public SignatureIllegalArgumentException(Signature signature, String message){ super(message + signature); this.signature = signature; } + /** + * 构造函数 + * + * @param signature + * 签名 + * @param message + * 异常信息 + * @param cause + * {@link Throwable} + */ public SignatureIllegalArgumentException(Signature signature, String message, Throwable cause){ super(message + signature, cause); this.signature = signature; } + /** + * 返回签名 + * + * @return 签名 + */ public Signature getSignature(){ return signature; } diff --git a/buession-aop/src/main/java/com/buession/aop/interceptor/AnnotationsMethodInterceptor.java b/buession-aop/src/main/java/com/buession/aop/interceptor/AnnotationsMethodInterceptor.java index 24ff687ac..4b0bf17af 100644 --- a/buession-aop/src/main/java/com/buession/aop/interceptor/AnnotationsMethodInterceptor.java +++ b/buession-aop/src/main/java/com/buession/aop/interceptor/AnnotationsMethodInterceptor.java @@ -27,9 +27,12 @@ import org.aopalliance.intercept.MethodInterceptor; /** + * 注解方法拦截器 + * * @author Yong.Teng * @since 2.1.0 */ +@FunctionalInterface public interface AnnotationsMethodInterceptor extends MethodInterceptor { } diff --git a/buession-beans/pom.xml b/buession-beans/pom.xml index ee25aa20c..4ed00a2a0 100644 --- a/buession-beans/pom.xml +++ b/buession-beans/pom.xml @@ -7,7 +7,7 @@ com.buession buession-parent ../buession-parent - 2.1.0 + 2.1.1 buession-beans https://github.com/buession/buessionframework diff --git a/buession-beans/src/main/java/com/buession/beans/PropertyDescriptorUtils.java b/buession-beans/src/main/java/com/buession/beans/PropertyDescriptorUtils.java index 1fef1443d..de54de74a 100644 --- a/buession-beans/src/main/java/com/buession/beans/PropertyDescriptorUtils.java +++ b/buession-beans/src/main/java/com/buession/beans/PropertyDescriptorUtils.java @@ -39,18 +39,54 @@ */ public class PropertyDescriptorUtils { + /** + * 返回 {@link PropertyDescriptor} 的 getter 方法 + * + * @param descriptor + * {@link PropertyDescriptor} + * + * @return {@link PropertyDescriptor} 的 getter 方法 + */ public static Method getReadMethod(final PropertyDescriptor descriptor){ return MethodUtils.getAccessibleMethod(descriptor.getReadMethod()); } + /** + * 返回类 clazz {@link PropertyDescriptor} 的 getter 方法 + * + * @param clazz + * 类 + * @param descriptor + * {@link PropertyDescriptor} + * + * @return 类 clazz {@link PropertyDescriptor} 的 getter 方法 + */ public static Method getReadMethod(final Class clazz, final PropertyDescriptor descriptor){ return MethodUtils.getAccessibleMethod(clazz, descriptor.getReadMethod()); } + /** + * 返回 {@link PropertyDescriptor} 的 setter 方法 + * + * @param descriptor + * {@link PropertyDescriptor} + * + * @return {@link PropertyDescriptor} 的 setter 方法 + */ public static Method getWriteMethod(final PropertyDescriptor descriptor){ return MethodUtils.getAccessibleMethod(descriptor.getWriteMethod()); } + /** + * 返回类 clazz {@link PropertyDescriptor} 的 setter 方法 + * + * @param clazz + * 类 + * @param descriptor + * {@link PropertyDescriptor} + * + * @return 类 clazz {@link PropertyDescriptor} 的 setter 方法 + */ public static Method getWriteMethod(final Class clazz, final PropertyDescriptor descriptor){ return MethodUtils.getAccessibleMethod(clazz, descriptor.getWriteMethod()); } diff --git a/buession-core/pom.xml b/buession-core/pom.xml index 6ac6fb0d5..df52335bc 100644 --- a/buession-core/pom.xml +++ b/buession-core/pom.xml @@ -7,7 +7,7 @@ com.buession buession-parent ../buession-parent - 2.1.0 + 2.1.1 buession-core https://github.com/buession/buessionframework diff --git a/buession-core/src/main/java/com/buession/core/datetime/DateTime.java b/buession-core/src/main/java/com/buession/core/datetime/DateTime.java index 83fe404de..f6402b2d4 100644 --- a/buession-core/src/main/java/com/buession/core/datetime/DateTime.java +++ b/buession-core/src/main/java/com/buession/core/datetime/DateTime.java @@ -59,4 +59,90 @@ public static long unixtime(){ return System.currentTimeMillis() / 1000L; } + /** + * 获取指定年的天数 + * + * @param year + * 年份 + * + * @return 指定年月份的天数;如果不是一个合法的年份,则返回 -1 + * + * @since 2.1.1 + */ + public static int getDays(final int year){ + if(year <= 0){ + return -1; + } + + int days = 0; + + for(int i = 1; i <= 12; i++){ + days += getDays(year, i); + } + + return days; + } + + /** + * 获取指定年月份的天数 + * + * @param year + * 年份 + * @param month + * 月份 + * + * @return 指定年月份的天数;如果不是一个合法的年份或月份,则返回 -1 + * + * @since 2.1.1 + */ + public static int getDays(final int year, final int month){ + if(year <= 0){ + return -1; + } + + switch(month){ + case 1: + case 3: + case 5: + case 7: + case 8: + case 10: + case 12: + return 31; + case 4: + case 6: + case 9: + case 11: + return 30; + case 2: + return isLeapYear(year) ? 29 : 28; + default: + return -1; + } + } + + /** + * 判断指定年份是否为闰年 + * + * @param year + * 年份 + * + * @return 指定年份为闰年,返回 true;否则,返回 false + * + * @since 2.1.1 + */ + public static boolean isLeapYear(final int year){ + if(year <= 0){ + return false; + } + + if(year % 4 == 0){ + if(year % 100 == 0){ + return year % 400 == 0; + } + } + + return false; + } + } diff --git a/buession-cron/pom.xml b/buession-cron/pom.xml index 2f74e593f..529e0503d 100644 --- a/buession-cron/pom.xml +++ b/buession-cron/pom.xml @@ -7,7 +7,7 @@ com.buession buession-parent ../buession-parent - 2.1.0 + 2.1.1 buession-cron https://github.com/buession/buessionframework diff --git a/buession-dao/pom.xml b/buession-dao/pom.xml index ecc1abf31..1dfa7e68c 100644 --- a/buession-dao/pom.xml +++ b/buession-dao/pom.xml @@ -7,7 +7,7 @@ com.buession buession-parent ../buession-parent - 2.1.0 + 2.1.1 buession-dao https://github.com/buession/buessionframework diff --git a/buession-dao/src/main/java/com/buession/dao/AbstractMyBatisDao.java b/buession-dao/src/main/java/com/buession/dao/AbstractMyBatisDao.java index 15f51204d..aace27290 100755 --- a/buession-dao/src/main/java/com/buession/dao/AbstractMyBatisDao.java +++ b/buession-dao/src/main/java/com/buession/dao/AbstractMyBatisDao.java @@ -142,9 +142,7 @@ public int update(E e, Map conditions){ BeanUtils.copyProperties(eMap, e); } - eMap.forEach((key, value)->{ - data.put(key.toString(), value); - }); + eMap.forEach((key, value)->data.put(key.toString(), value)); return getMasterSqlSessionTemplate().update(getStatement(DML.UPDATE), data); } diff --git a/buession-geoip/pom.xml b/buession-geoip/pom.xml index 040bdf8f3..f1662b7da 100644 --- a/buession-geoip/pom.xml +++ b/buession-geoip/pom.xml @@ -7,7 +7,7 @@ com.buession buession-parent ../buession-parent - 2.1.0 + 2.1.1 buession-geoip https://github.com/buession/buessionframework @@ -77,10 +77,12 @@ org.apache.httpcomponents httpcore + provided org.apache.httpcomponents httpclient + provided diff --git a/buession-geoip/src/main/java/com/buession/geoip/model/Traits.java b/buession-geoip/src/main/java/com/buession/geoip/model/Traits.java index edeb72224..f940a5c0c 100644 --- a/buession-geoip/src/main/java/com/buession/geoip/model/Traits.java +++ b/buession-geoip/src/main/java/com/buession/geoip/model/Traits.java @@ -179,6 +179,8 @@ public final class Traits implements Serializable { * Autonomous 系统号码 * @param mobileCountryCode * 移动国家代码 + * @param mobileNetworkCode + * 移动网络代码 * @param isAnonymous * 是否是 Autonomous * @param isAnonymousProxy diff --git a/buession-httpclient/pom.xml b/buession-httpclient/pom.xml index ea2e6a820..3a0fbac1a 100644 --- a/buession-httpclient/pom.xml +++ b/buession-httpclient/pom.xml @@ -7,7 +7,7 @@ com.buession buession-parent ../buession-parent - 2.1.0 + 2.1.1 buession-httpclient https://github.com/buession/buessionframework diff --git a/buession-io/pom.xml b/buession-io/pom.xml index 7861e9ab6..2bd8c3126 100644 --- a/buession-io/pom.xml +++ b/buession-io/pom.xml @@ -7,7 +7,7 @@ com.buession buession-parent ../buession-parent - 2.1.0 + 2.1.1 buession-io https://github.com/buession/buessionframework diff --git a/buession-jdbc/pom.xml b/buession-jdbc/pom.xml index 550405e13..8366a6533 100644 --- a/buession-jdbc/pom.xml +++ b/buession-jdbc/pom.xml @@ -7,7 +7,7 @@ com.buession buession-parent ../buession-parent - 2.1.0 + 2.1.1 buession-jdbc https://github.com/buession/buessionframework diff --git a/buession-jdbc/src/main/java/com/buession/jdbc/datasource/config/AbstractPoolConfiguration.java b/buession-jdbc/src/main/java/com/buession/jdbc/datasource/config/AbstractPoolConfiguration.java index 2eccb5eaf..299bd4904 100644 --- a/buession-jdbc/src/main/java/com/buession/jdbc/datasource/config/AbstractPoolConfiguration.java +++ b/buession-jdbc/src/main/java/com/buession/jdbc/datasource/config/AbstractPoolConfiguration.java @@ -147,4 +147,5 @@ public Properties getProperties(){ public void setProperties(Properties properties){ this.properties = properties; } + } diff --git a/buession-json/pom.xml b/buession-json/pom.xml index ad5d1f0f5..636f3b8d9 100644 --- a/buession-json/pom.xml +++ b/buession-json/pom.xml @@ -7,7 +7,7 @@ com.buession buession-parent ../buession-parent - 2.1.0 + 2.1.1 buession-json https://github.com/buession/buessionframework diff --git a/buession-lang/pom.xml b/buession-lang/pom.xml index 7ae3f46ec..ffb3e6c94 100644 --- a/buession-lang/pom.xml +++ b/buession-lang/pom.xml @@ -7,7 +7,7 @@ com.buession buession-parent ../buession-parent - 2.1.0 + 2.1.1 buession-lang https://github.com/buession/buessionframework diff --git a/buession-net/pom.xml b/buession-net/pom.xml index 1d024e136..6801199ae 100644 --- a/buession-net/pom.xml +++ b/buession-net/pom.xml @@ -7,7 +7,7 @@ com.buession buession-parent ../buession-parent - 2.1.0 + 2.1.1 buession-net https://github.com/buession/buessionframework diff --git a/buession-parent/pom.xml b/buession-parent/pom.xml index d0a9844b2..19e5d74e9 100644 --- a/buession-parent/pom.xml +++ b/buession-parent/pom.xml @@ -7,13 +7,13 @@ com.buession parent - 2.1.0 + 2.1.1 com.buession buession-parent https://github.com/buession/buessionframework Buession Framework Parent - 2.1.0 + 2.1.1 pom diff --git a/buession-redis/pom.xml b/buession-redis/pom.xml index 48a7bc253..494893a1a 100644 --- a/buession-redis/pom.xml +++ b/buession-redis/pom.xml @@ -7,7 +7,7 @@ com.buession buession-parent ../buession-parent - 2.1.0 + 2.1.1 buession-redis https://github.com/buession/buessionframework diff --git a/buession-session/pom.xml b/buession-session/pom.xml index 24b4bec0b..12f0de528 100644 --- a/buession-session/pom.xml +++ b/buession-session/pom.xml @@ -7,7 +7,7 @@ com.buession buession-parent ../buession-parent - 2.1.0 + 2.1.1 buession-session https://github.com/buession/buessionframework diff --git a/buession-thesaurus/pom.xml b/buession-thesaurus/pom.xml index 316f22153..4bef6dc35 100644 --- a/buession-thesaurus/pom.xml +++ b/buession-thesaurus/pom.xml @@ -7,7 +7,7 @@ com.buession buession-parent ../buession-parent - 2.1.0 + 2.1.1 buession-thesaurus https://github.com/buession/buessionframework diff --git a/buession-velocity/pom.xml b/buession-velocity/pom.xml index 65711dffb..d06fcc387 100644 --- a/buession-velocity/pom.xml +++ b/buession-velocity/pom.xml @@ -7,7 +7,7 @@ com.buession buession-parent ../buession-parent - 2.1.0 + 2.1.1 buession-velocity https://github.com/buession/buessionframework diff --git a/buession-web/pom.xml b/buession-web/pom.xml index 5eeedba55..b3bf34996 100644 --- a/buession-web/pom.xml +++ b/buession-web/pom.xml @@ -7,7 +7,7 @@ com.buession buession-parent ../buession-parent - 2.1.0 + 2.1.1 buession-web https://github.com/buession/buessionframework diff --git a/docs/images/logo.png b/logo.png similarity index 100% rename from docs/images/logo.png rename to logo.png