From e08a94f934a2bff7aae76354774a6b9ba11c49e3 Mon Sep 17 00:00:00 2001 From: smallchill Date: Sat, 4 May 2019 22:15:31 +0800 Subject: [PATCH] :tada: 2.3.0.RELEASE --- blade-core-boot/pom.xml | 4 +- .../boot/config/MybatisPlusConfiguration.java | 9 +- .../core/boot/logger/RequestLogAspect.java | 109 ++++++++++-------- .../core/boot/tenant/BladeTenantHandler.java | 8 +- .../src/main/resources/bootstrap.yml | 4 +- .../src/main/resources/log/logback_dev.xml | 3 + .../src/main/resources/log/logback_prod.xml | 3 + .../src/main/resources/log/logback_test.xml | 3 + blade-core-cloud/pom.xml | 2 +- blade-core-develop/pom.xml | 2 +- .../main/resources/templates/code.properties | 2 +- blade-core-launch/pom.xml | 2 +- .../core/launch/BladeApplication.java | 4 +- .../core/launch/constant/AppConstant.java | 4 +- blade-core-log/pom.xml | 2 +- .../core/log/exception/ServiceException.java | 2 +- .../core/log/feign/ILogClient.java | 15 ++- ...entHystric.java => LogClientFallback.java} | 17 +-- .../core/log/model/LogAbstract.java | 11 +- .../core/log/utils/LogAbstractUtil.java | 19 ++- blade-core-mybatis/pom.xml | 2 +- blade-core-secure/pom.xml | 2 +- blade-core-swagger/pom.xml | 2 +- .../core/swagger/SwaggerProperties.java | 2 +- blade-core-tool/pom.xml | 2 +- pom.xml | 14 +-- 26 files changed, 126 insertions(+), 123 deletions(-) rename blade-core-log/src/main/java/org/springblade/core/log/feign/{fallback/ILogClientHystric.java => LogClientFallback.java} (50%) diff --git a/blade-core-boot/pom.xml b/blade-core-boot/pom.xml index 0195473..d2eb66e 100644 --- a/blade-core-boot/pom.xml +++ b/blade-core-boot/pom.xml @@ -5,7 +5,7 @@ org.springblade blade-tool - 2.2.3 + 2.3.0 4.0.0 @@ -115,7 +115,7 @@ mysql mysql-connector-java - runtime + 8.0.15 + + diff --git a/blade-core-boot/src/main/resources/log/logback_prod.xml b/blade-core-boot/src/main/resources/log/logback_prod.xml index dc30faa..fbeab21 100644 --- a/blade-core-boot/src/main/resources/log/logback_prod.xml +++ b/blade-core-boot/src/main/resources/log/logback_prod.xml @@ -86,4 +86,7 @@ + + + diff --git a/blade-core-boot/src/main/resources/log/logback_test.xml b/blade-core-boot/src/main/resources/log/logback_test.xml index dc30faa..fbeab21 100644 --- a/blade-core-boot/src/main/resources/log/logback_test.xml +++ b/blade-core-boot/src/main/resources/log/logback_test.xml @@ -86,4 +86,7 @@ + + + diff --git a/blade-core-cloud/pom.xml b/blade-core-cloud/pom.xml index 4d341ce..7f4d042 100644 --- a/blade-core-cloud/pom.xml +++ b/blade-core-cloud/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.2.3 + 2.3.0 4.0.0 diff --git a/blade-core-develop/pom.xml b/blade-core-develop/pom.xml index f80f1d9..7642af8 100644 --- a/blade-core-develop/pom.xml +++ b/blade-core-develop/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.2.3 + 2.3.0 4.0.0 diff --git a/blade-core-develop/src/main/resources/templates/code.properties b/blade-core-develop/src/main/resources/templates/code.properties index 48fb198..229dc31 100644 --- a/blade-core-develop/src/main/resources/templates/code.properties +++ b/blade-core-develop/src/main/resources/templates/code.properties @@ -1,4 +1,4 @@ -spring.datasource.driver-class-name=com.mysql.jdbc.Driver +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/blade?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&serverTimezone=GMT%2B8 spring.datasource.username=root spring.datasource.password=root diff --git a/blade-core-launch/pom.xml b/blade-core-launch/pom.xml index c672867..1e5619b 100644 --- a/blade-core-launch/pom.xml +++ b/blade-core-launch/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.2.3 + 2.3.0 4.0.0 diff --git a/blade-core-launch/src/main/java/org/springblade/core/launch/BladeApplication.java b/blade-core-launch/src/main/java/org/springblade/core/launch/BladeApplication.java index 9aa110c..dd9088c 100644 --- a/blade-core-launch/src/main/java/org/springblade/core/launch/BladeApplication.java +++ b/blade-core-launch/src/main/java/org/springblade/core/launch/BladeApplication.java @@ -61,7 +61,7 @@ public class BladeApplication { // 判断环境:dev、test、prod List profiles = Arrays.asList(activeProfiles); // 预设的环境 - List presetProfiles = new ArrayList<>(Arrays.asList(AppConstant.DEV_CDOE, AppConstant.TEST_CODE, AppConstant.PROD_CODE)); + List presetProfiles = new ArrayList<>(Arrays.asList(AppConstant.DEV_CODE, AppConstant.TEST_CODE, AppConstant.PROD_CODE)); // 交集 presetProfiles.retainAll(profiles); // 当前使用 @@ -71,7 +71,7 @@ public class BladeApplication { String profile; if (activeProfileList.isEmpty()) { // 默认dev开发 - profile = AppConstant.DEV_CDOE; + profile = AppConstant.DEV_CODE; activeProfileList.add(profile); builder.profiles(profile); } else if (activeProfileList.size() == 1) { diff --git a/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java b/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java index 1793716..db8f541 100644 --- a/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java +++ b/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java @@ -25,7 +25,7 @@ public interface AppConstant { /** * 应用版本 */ - String APPLICATION_VERSION = "2.0.0"; + String APPLICATION_VERSION = "2.3.0"; /** * 基础包 @@ -76,7 +76,7 @@ public interface AppConstant { /** * 开发环境 */ - String DEV_CDOE = "dev"; + String DEV_CODE = "dev"; /** * 生产环境 */ diff --git a/blade-core-log/pom.xml b/blade-core-log/pom.xml index 5aa854c..ca5ee08 100644 --- a/blade-core-log/pom.xml +++ b/blade-core-log/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.2.3 + 2.3.0 4.0.0 diff --git a/blade-core-log/src/main/java/org/springblade/core/log/exception/ServiceException.java b/blade-core-log/src/main/java/org/springblade/core/log/exception/ServiceException.java index 50e7706..5e5df93 100644 --- a/blade-core-log/src/main/java/org/springblade/core/log/exception/ServiceException.java +++ b/blade-core-log/src/main/java/org/springblade/core/log/exception/ServiceException.java @@ -33,7 +33,7 @@ public class ServiceException extends RuntimeException { public ServiceException(String message) { super(message); - this.resultCode = ResultCode.INTERNAL_SERVER_ERROR; + this.resultCode = ResultCode.FAILURE; } public ServiceException(IResultCode resultCode) { diff --git a/blade-core-log/src/main/java/org/springblade/core/log/feign/ILogClient.java b/blade-core-log/src/main/java/org/springblade/core/log/feign/ILogClient.java index d5ed7df..3ecbfda 100644 --- a/blade-core-log/src/main/java/org/springblade/core/log/feign/ILogClient.java +++ b/blade-core-log/src/main/java/org/springblade/core/log/feign/ILogClient.java @@ -16,7 +16,6 @@ package org.springblade.core.log.feign; import org.springblade.core.launch.constant.AppConstant; -import org.springblade.core.log.feign.fallback.ILogClientHystric; import org.springblade.core.log.model.LogApi; import org.springblade.core.log.model.LogUsual; import org.springblade.core.log.model.LogError; @@ -32,7 +31,7 @@ import org.springframework.web.bind.annotation.RequestBody; */ @FeignClient( value = AppConstant.APPLICATION_LOG_NAME, - fallback = ILogClientHystric.class + fallback = LogClientFallback.class ) public interface ILogClient { @@ -41,8 +40,8 @@ public interface ILogClient { /** * 保存错误日志 * - * @param log - * @return + * @param log 日志实体 + * @return boolean */ @PostMapping(API_PREFIX + "/saveUsualLog") R saveUsualLog(@RequestBody LogUsual log); @@ -50,8 +49,8 @@ public interface ILogClient { /** * 保存操作日志 * - * @param log - * @return + * @param log 日志实体 + * @return boolean */ @PostMapping(API_PREFIX + "/saveApiLog") R saveApiLog(@RequestBody LogApi log); @@ -59,8 +58,8 @@ public interface ILogClient { /** * 保存错误日志 * - * @param log - * @return + * @param log 日志实体 + * @return boolean */ @PostMapping(API_PREFIX + "/saveErrorLog") R saveErrorLog(@RequestBody LogError log); diff --git a/blade-core-log/src/main/java/org/springblade/core/log/feign/fallback/ILogClientHystric.java b/blade-core-log/src/main/java/org/springblade/core/log/feign/LogClientFallback.java similarity index 50% rename from blade-core-log/src/main/java/org/springblade/core/log/feign/fallback/ILogClientHystric.java rename to blade-core-log/src/main/java/org/springblade/core/log/feign/LogClientFallback.java index b400ddd..4baa111 100644 --- a/blade-core-log/src/main/java/org/springblade/core/log/feign/fallback/ILogClientHystric.java +++ b/blade-core-log/src/main/java/org/springblade/core/log/feign/LogClientFallback.java @@ -1,8 +1,6 @@ -package org.springblade.core.log.feign.fallback; +package org.springblade.core.log.feign; -import com.alibaba.fastjson.JSON; import lombok.extern.slf4j.Slf4j; -import org.springblade.core.log.feign.ILogClient; import org.springblade.core.log.model.LogApi; import org.springblade.core.log.model.LogError; import org.springblade.core.log.model.LogUsual; @@ -10,29 +8,26 @@ import org.springblade.core.tool.api.R; import org.springframework.stereotype.Component; /** - * @Auther: jiang - * @Date: 2019/04/26 23:04 + * 日志fallback + * + * @author jiang */ -@Component @Slf4j -public class ILogClientHystric implements ILogClient { +@Component +public class LogClientFallback implements ILogClient { @Override public R saveUsualLog(LogUsual log) { - //注:这里如果使用log.toString()来打印日志的话,只能打印出该对象自身的属性值,无法输出父类的属性值 - this.log.error("usual log send fail:{}", JSON.toJSONString(log)); return R.fail("usual log send fail"); } @Override public R saveApiLog(LogApi log) { - this.log.error("api log send fail:{}", JSON.toJSONString(log)); return R.fail("api log send fail"); } @Override public R saveErrorLog(LogError log) { - this.log.error("error log send fail:{}", JSON.toJSONString(log)); return R.fail("error log send fail"); } } diff --git a/blade-core-log/src/main/java/org/springblade/core/log/model/LogAbstract.java b/blade-core-log/src/main/java/org/springblade/core/log/model/LogAbstract.java index ba04552..429234a 100644 --- a/blade-core-log/src/main/java/org/springblade/core/log/model/LogAbstract.java +++ b/blade-core-log/src/main/java/org/springblade/core/log/model/LogAbstract.java @@ -20,23 +20,16 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; -import org.springblade.core.launch.props.BladeProperties; -import org.springblade.core.launch.server.ServerInfo; -import org.springblade.core.secure.utils.SecureUtil; import org.springblade.core.tool.utils.DateUtil; -import org.springblade.core.tool.utils.StringPool; -import org.springblade.core.tool.utils.UrlUtil; -import org.springblade.core.tool.utils.WebUtil; import org.springframework.format.annotation.DateTimeFormat; -import javax.servlet.http.HttpServletRequest; import java.io.Serializable; import java.time.LocalDateTime; /** * logApi、logError、logUsual的父类,拥有相同的属性值 - * @Auther: jiang - * @Date: 2019/04/26 23:00 + * + * @author jiang */ @Data public class LogAbstract implements Serializable { diff --git a/blade-core-log/src/main/java/org/springblade/core/log/utils/LogAbstractUtil.java b/blade-core-log/src/main/java/org/springblade/core/log/utils/LogAbstractUtil.java index 0873a38..a39269f 100644 --- a/blade-core-log/src/main/java/org/springblade/core/log/utils/LogAbstractUtil.java +++ b/blade-core-log/src/main/java/org/springblade/core/log/utils/LogAbstractUtil.java @@ -25,12 +25,7 @@ import org.springblade.core.tool.utils.UrlUtil; import org.springblade.core.tool.utils.WebUtil; import javax.servlet.http.HttpServletRequest; -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.ServerSocket; -import java.net.UnknownHostException; import java.time.LocalDateTime; -import java.util.Enumeration; /** * INet 相关工具 @@ -41,8 +36,9 @@ public class LogAbstractUtil { /** * 向log中添加补齐request的信息 - * @param request - * @param logAbstract + * + * @param request 请求 + * @param logAbstract 日志基础类 */ public static void addRequestInfoToLog(HttpServletRequest request, LogAbstract logAbstract) { logAbstract.setRemoteIp(WebUtil.getIP(request)); @@ -55,9 +51,10 @@ public class LogAbstractUtil { /** * 向log中添加补齐其他的信息(eg:blade、server等) - * @param logAbstract - * @param bladeProperties - * @param serverInfo + * + * @param logAbstract 日志基础类 + * @param bladeProperties 配置信息 + * @param serverInfo 服务信息 */ public static void addOtherInfoToLog(LogAbstract logAbstract, BladeProperties bladeProperties, ServerInfo serverInfo) { logAbstract.setServiceId(bladeProperties.getName()); @@ -67,7 +64,7 @@ public class LogAbstractUtil { logAbstract.setCreateTime(LocalDateTime.now()); //这里判断一下params为null的情况,否则blade-log服务在解析该字段的时候,可能会报出NPE - if(logAbstract.getParams() == null){ + if (logAbstract.getParams() == null) { logAbstract.setParams(StringPool.EMPTY); } } diff --git a/blade-core-mybatis/pom.xml b/blade-core-mybatis/pom.xml index ee72317..e266629 100644 --- a/blade-core-mybatis/pom.xml +++ b/blade-core-mybatis/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.2.3 + 2.3.0 4.0.0 diff --git a/blade-core-secure/pom.xml b/blade-core-secure/pom.xml index 41e1d8c..33d4c19 100644 --- a/blade-core-secure/pom.xml +++ b/blade-core-secure/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.2.3 + 2.3.0 4.0.0 diff --git a/blade-core-swagger/pom.xml b/blade-core-swagger/pom.xml index 7736604..a4121ba 100644 --- a/blade-core-swagger/pom.xml +++ b/blade-core-swagger/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.2.3 + 2.3.0 4.0.0 diff --git a/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java b/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java index ab97dc2..c2f76a4 100644 --- a/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java +++ b/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java @@ -53,7 +53,7 @@ public class SwaggerProperties { /** * 版本 **/ - private String version = "2.0.0"; + private String version = "2.3.0"; /** * 许可证 **/ diff --git a/blade-core-tool/pom.xml b/blade-core-tool/pom.xml index b5ee338..2941660 100644 --- a/blade-core-tool/pom.xml +++ b/blade-core-tool/pom.xml @@ -6,7 +6,7 @@ org.springblade blade-tool - 2.2.3 + 2.3.0 4.0.0 diff --git a/pom.xml b/pom.xml index e20d9a7..974e98f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springblade blade-tool - 2.2.3 + 2.3.0 pom blade-tool @@ -36,23 +36,23 @@ - 2.2.3 + 2.3.0 1.8 3.8.0 2.9.2 1.5.21 - 1.9.2 + 1.9.3 3.1.0 4.0.1 1.6.0 3.4.2 - 2.0.2 + 2.1.4 1.0.1 - 0.2.1.RELEASE + 0.9.0.RELEASE - 2.0.8.RELEASE - Finchley.SR2 + 2.1.4.RELEASE + Greenwich.SR1 Cairo-SR7 UTF-8