From 4cd8f66276cd29259a382932a1fda7e202ceb972 Mon Sep 17 00:00:00 2001 From: smallchill Date: Wed, 12 Feb 2020 00:59:22 +0800 Subject: [PATCH] =?UTF-8?q?:tada:=202.6.1=E5=8F=91=E5=B8=83,=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=99=BB=E9=99=86=E9=AA=8C=E8=AF=81=E7=A0=81,?= =?UTF-8?q?=E6=94=AF=E6=8C=81Seata1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 +- blade-auth/pom.xml | 8 +- .../auth/config/RegistryConfiguration.java | 39 ------- .../auth/controller/AuthController.java | 21 ++++ .../auth/granter/CaptchaTokenGranter.java | 80 ++++++++++++++ .../auth/granter/TokenGranterBuilder.java | 1 + .../org/springblade/auth/utils/TokenUtil.java | 3 + blade-common/pom.xml | 2 +- .../springblade/common/cache/CacheNames.java | 2 + blade-gateway/pom.xml | 2 +- .../gateway/provider/AuthProvider.java | 3 + blade-ops/blade-admin/pom.xml | 2 +- blade-ops/blade-develop/pom.xml | 2 +- blade-ops/blade-resource/pom.xml | 2 +- blade-ops/blade-seata-order/pom.xml | 2 +- .../order/config/OrderConfiguration.java | 39 ------- .../seata/order/feign/IStorageClient.java | 2 +- .../src/main/resources/application-dev.yml | 21 ++++ .../src/main/resources/registry.conf | 20 ---- blade-ops/blade-seata-storage/pom.xml | 2 +- .../storage/SeataStorageApplication.java | 4 - .../storage/config/StorageConfiguration.java | 39 ------- .../storage/controller/StorageController.java | 1 + .../src/main/resources/application-dev.yml | 21 ++++ .../src/main/resources/registry.conf | 20 ---- blade-ops/blade-zipkin/Dockerfile | 15 --- blade-ops/blade-zipkin/pom.xml | 104 ------------------ .../springblade/zipkin/ZipkinApplication.java | 36 ------ .../src/main/resources/bootstrap.yml | 18 --- blade-ops/pom.xml | 3 +- blade-service-api/blade-demo-api/pom.xml | 2 +- blade-service-api/blade-desk-api/pom.xml | 2 +- blade-service-api/blade-dict-api/pom.xml | 2 +- blade-service-api/blade-system-api/pom.xml | 2 +- blade-service-api/blade-user-api/pom.xml | 2 +- blade-service-api/pom.xml | 4 +- blade-service/blade-demo/pom.xml | 2 +- blade-service/blade-desk/pom.xml | 2 +- blade-service/blade-log/pom.xml | 2 +- blade-service/blade-system/pom.xml | 2 +- blade-service/blade-user/pom.xml | 2 +- blade-service/pom.xml | 4 +- doc/sql/seata/seata.sql | 52 ++++----- pom.xml | 20 ++-- script/docker/.env | 2 +- 45 files changed, 225 insertions(+), 400 deletions(-) delete mode 100644 blade-auth/src/main/java/org/springblade/auth/config/RegistryConfiguration.java create mode 100644 blade-auth/src/main/java/org/springblade/auth/granter/CaptchaTokenGranter.java delete mode 100644 blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/config/OrderConfiguration.java delete mode 100644 blade-ops/blade-seata-order/src/main/resources/registry.conf delete mode 100644 blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/config/StorageConfiguration.java delete mode 100644 blade-ops/blade-seata-storage/src/main/resources/registry.conf delete mode 100644 blade-ops/blade-zipkin/Dockerfile delete mode 100644 blade-ops/blade-zipkin/pom.xml delete mode 100644 blade-ops/blade-zipkin/src/main/java/org/springblade/zipkin/ZipkinApplication.java delete mode 100644 blade-ops/blade-zipkin/src/main/resources/bootstrap.yml diff --git a/README.md b/README.md index 8c2405f..f48ce6d 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@

- Downloads + Downloads Build Status Build Status Coverage Status - Downloads + Downloads Downloads @@ -56,8 +56,9 @@ SpringBlade * 官网地址:[https://bladex.vip](https://bladex.vip) * 问答社区:[https://sns.bladex.vip](https://sns.bladex.vip) * 会员计划:[SpringBlade会员计划](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade会员计划) -* 交流一群:`477853168` -* 交流二群:`751253339` +* 交流一群:`477853168`(满) +* 交流二群:`751253339`(满) +* 交流三群:`784729540` ## 在线演示 * Saber-基于Vue:[https://saber.bladex.vip](https://saber.bladex.vip) diff --git a/blade-auth/pom.xml b/blade-auth/pom.xml index b2013b0..30c30d0 100644 --- a/blade-auth/pom.xml +++ b/blade-auth/pom.xml @@ -8,7 +8,7 @@ SpringBlade org.springblade - 2.6.0 + 2.6.1 blade-auth @@ -48,6 +48,12 @@ blade-core-swagger ${blade.tool.version} + + + com.github.whvcse + easy-captcha + ${captcha.version} + mysql diff --git a/blade-auth/src/main/java/org/springblade/auth/config/RegistryConfiguration.java b/blade-auth/src/main/java/org/springblade/auth/config/RegistryConfiguration.java deleted file mode 100644 index 98f8ee5..0000000 --- a/blade-auth/src/main/java/org/springblade/auth/config/RegistryConfiguration.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * Licensed 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. - */ -package org.springblade.auth.config; - - -import org.springblade.core.secure.registry.SecureRegistry; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -/** - * secure模块api放行配置 - * - * @author Chill - */ -@Configuration -public class RegistryConfiguration implements WebMvcConfigurer { - - @Bean - public SecureRegistry secureRegistry() { - SecureRegistry secureRegistry = new SecureRegistry(); - secureRegistry.excludePathPatterns("/token/**"); - return secureRegistry; - } - -} diff --git a/blade-auth/src/main/java/org/springblade/auth/controller/AuthController.java b/blade-auth/src/main/java/org/springblade/auth/controller/AuthController.java index 3c8599e..1f1c95d 100644 --- a/blade-auth/src/main/java/org/springblade/auth/controller/AuthController.java +++ b/blade-auth/src/main/java/org/springblade/auth/controller/AuthController.java @@ -15,6 +15,7 @@ */ package org.springblade.auth.controller; +import com.wf.captcha.SpecCaptcha; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -23,15 +24,22 @@ import org.springblade.auth.granter.ITokenGranter; import org.springblade.auth.granter.TokenGranterBuilder; import org.springblade.auth.granter.TokenParameter; import org.springblade.auth.utils.TokenUtil; +import org.springblade.common.cache.CacheNames; import org.springblade.core.secure.AuthInfo; import org.springblade.core.tool.api.R; +import org.springblade.core.tool.support.Kv; import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.RedisUtil; import org.springblade.core.tool.utils.WebUtil; import org.springblade.system.user.entity.UserInfo; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import java.util.UUID; +import java.util.concurrent.TimeUnit; + /** * 认证模块 * @@ -42,6 +50,8 @@ import org.springframework.web.bind.annotation.RestController; @Api(value = "用户授权认证", tags = "授权接口") public class AuthController { + private RedisUtil redisUtil; + @PostMapping("token") @ApiOperation(value = "获取认证token", notes = "传入租户ID:tenantId,账号:account,密码:password") public R token(@ApiParam(value = "授权类型", required = true) @RequestParam(defaultValue = "password", required = false) String grantType, @@ -70,4 +80,15 @@ public class AuthController { return R.data(TokenUtil.createAuthInfo(userInfo)); } + @GetMapping("/captcha") + public R captcha() { + SpecCaptcha specCaptcha = new SpecCaptcha(130, 48, 5); + String verCode = specCaptcha.text().toLowerCase(); + String key = UUID.randomUUID().toString(); + // 存入redis并设置过期时间为30分钟 + redisUtil.set(CacheNames.CAPTCHA_KEY + key, verCode, 30L, TimeUnit.MINUTES); + // 将key和base64返回给前端 + return R.data(Kv.init().set("key", key).set("image", specCaptcha.toBase64())); + } + } diff --git a/blade-auth/src/main/java/org/springblade/auth/granter/CaptchaTokenGranter.java b/blade-auth/src/main/java/org/springblade/auth/granter/CaptchaTokenGranter.java new file mode 100644 index 0000000..e075910 --- /dev/null +++ b/blade-auth/src/main/java/org/springblade/auth/granter/CaptchaTokenGranter.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package org.springblade.auth.granter; + +import lombok.AllArgsConstructor; +import org.springblade.auth.enums.BladeUserEnum; +import org.springblade.auth.utils.TokenUtil; +import org.springblade.common.cache.CacheNames; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.*; +import org.springblade.system.user.entity.UserInfo; +import org.springblade.system.user.feign.IUserClient; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; + +/** + * 验证码TokenGranter + * + * @author Chill + */ +@Component +@AllArgsConstructor +public class CaptchaTokenGranter implements ITokenGranter { + + public static final String GRANT_TYPE = "captcha"; + + private IUserClient userClient; + private RedisUtil redisUtil; + + @Override + public UserInfo grant(TokenParameter tokenParameter) { + HttpServletRequest request = WebUtil.getRequest(); + + String key = request.getHeader(TokenUtil.CAPTCHA_HEADER_KEY); + String code = request.getHeader(TokenUtil.CAPTCHA_HEADER_CODE); + // 获取验证码 + String redisCode = String.valueOf(redisUtil.get(CacheNames.CAPTCHA_KEY + key)); + // 判断验证码 + if (code == null || !StringUtil.equalsIgnoreCase(redisCode, code)) { + throw new ServiceException(TokenUtil.CAPTCHA_NOT_CORRECT); + } + + String tenantId = tokenParameter.getArgs().getStr("tenantId"); + String account = tokenParameter.getArgs().getStr("account"); + String password = tokenParameter.getArgs().getStr("password"); + UserInfo userInfo = null; + if (Func.isNoneBlank(account, password)) { + // 获取用户类型 + String userType = tokenParameter.getArgs().getStr("userType"); + R result; + // 根据不同用户类型调用对应的接口返回数据,用户可自行拓展 + if (userType.equals(BladeUserEnum.WEB.getName())) { + result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(password)); + } else if (userType.equals(BladeUserEnum.APP.getName())) { + result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(password)); + } else { + result = userClient.userInfo(tenantId, account, DigestUtil.encrypt(password)); + } + userInfo = result.isSuccess() ? result.getData() : null; + } + return userInfo; + } + +} diff --git a/blade-auth/src/main/java/org/springblade/auth/granter/TokenGranterBuilder.java b/blade-auth/src/main/java/org/springblade/auth/granter/TokenGranterBuilder.java index 5f11660..1b035a1 100644 --- a/blade-auth/src/main/java/org/springblade/auth/granter/TokenGranterBuilder.java +++ b/blade-auth/src/main/java/org/springblade/auth/granter/TokenGranterBuilder.java @@ -38,6 +38,7 @@ public class TokenGranterBuilder { static { granterPool.put(PasswordTokenGranter.GRANT_TYPE, SpringUtil.getBean(PasswordTokenGranter.class)); + granterPool.put(CaptchaTokenGranter.GRANT_TYPE, SpringUtil.getBean(CaptchaTokenGranter.class)); granterPool.put(RefreshTokenGranter.GRANT_TYPE, SpringUtil.getBean(RefreshTokenGranter.class)); } diff --git a/blade-auth/src/main/java/org/springblade/auth/utils/TokenUtil.java b/blade-auth/src/main/java/org/springblade/auth/utils/TokenUtil.java index 9f11dc0..c3e1d64 100644 --- a/blade-auth/src/main/java/org/springblade/auth/utils/TokenUtil.java +++ b/blade-auth/src/main/java/org/springblade/auth/utils/TokenUtil.java @@ -33,6 +33,9 @@ import java.util.Map; */ public class TokenUtil { + public final static String CAPTCHA_HEADER_KEY = "Captcha-Key"; + public final static String CAPTCHA_HEADER_CODE = "Captcha-Code"; + public final static String CAPTCHA_NOT_CORRECT = "验证码不正确"; public final static String TENANT_HEADER_KEY = "Tenant-Id"; public final static String DEFAULT_TENANT_ID = "000000"; public final static String USER_TYPE_HEADER_KEY = "User-Type"; diff --git a/blade-common/pom.xml b/blade-common/pom.xml index 3b1c3ec..6a27646 100644 --- a/blade-common/pom.xml +++ b/blade-common/pom.xml @@ -5,7 +5,7 @@ SpringBlade org.springblade - 2.6.0 + 2.6.1 4.0.0 diff --git a/blade-common/src/main/java/org/springblade/common/cache/CacheNames.java b/blade-common/src/main/java/org/springblade/common/cache/CacheNames.java index 818c6ce..7fbb007 100644 --- a/blade-common/src/main/java/org/springblade/common/cache/CacheNames.java +++ b/blade-common/src/main/java/org/springblade/common/cache/CacheNames.java @@ -27,4 +27,6 @@ public interface CacheNames { String DICT_VALUE = "dict:value"; String DICT_LIST = "dict:list"; + String CAPTCHA_KEY = "blade:auth::captcha:"; + } diff --git a/blade-gateway/pom.xml b/blade-gateway/pom.xml index a1eeeba..3870c3c 100644 --- a/blade-gateway/pom.xml +++ b/blade-gateway/pom.xml @@ -5,7 +5,7 @@ SpringBlade org.springblade - 2.6.0 + 2.6.1 4.0.0 diff --git a/blade-gateway/src/main/java/org/springblade/gateway/provider/AuthProvider.java b/blade-gateway/src/main/java/org/springblade/gateway/provider/AuthProvider.java index 4fa3a10..4728ce6 100644 --- a/blade-gateway/src/main/java/org/springblade/gateway/provider/AuthProvider.java +++ b/blade-gateway/src/main/java/org/springblade/gateway/provider/AuthProvider.java @@ -35,6 +35,7 @@ public class AuthProvider { static { defaultSkipUrl.add("/example"); defaultSkipUrl.add("/token/**"); + defaultSkipUrl.add("/captcha/**"); defaultSkipUrl.add("/actuator/health/**"); defaultSkipUrl.add("/v2/api-docs/**"); defaultSkipUrl.add("/v2/api-docs-ext/**"); @@ -42,6 +43,8 @@ public class AuthProvider { defaultSkipUrl.add("/log/**"); defaultSkipUrl.add("/menu/routes"); defaultSkipUrl.add("/menu/auth-routes"); + defaultSkipUrl.add("/order/create/**"); + defaultSkipUrl.add("/storage/deduct/**"); defaultSkipUrl.add("/error/**"); defaultSkipUrl.add("/assets/**"); } diff --git a/blade-ops/blade-admin/pom.xml b/blade-ops/blade-admin/pom.xml index 649f18e..50a7cb4 100644 --- a/blade-ops/blade-admin/pom.xml +++ b/blade-ops/blade-admin/pom.xml @@ -5,7 +5,7 @@ blade-ops org.springblade - 2.6.0 + 2.6.1 4.0.0 diff --git a/blade-ops/blade-develop/pom.xml b/blade-ops/blade-develop/pom.xml index 35dcfa6..51b3d53 100644 --- a/blade-ops/blade-develop/pom.xml +++ b/blade-ops/blade-develop/pom.xml @@ -6,7 +6,7 @@ org.springblade blade-ops - 2.6.0 + 2.6.1 4.0.0 diff --git a/blade-ops/blade-resource/pom.xml b/blade-ops/blade-resource/pom.xml index 74c4245..af1faf1 100644 --- a/blade-ops/blade-resource/pom.xml +++ b/blade-ops/blade-resource/pom.xml @@ -5,7 +5,7 @@ blade-ops org.springblade - 2.6.0 + 2.6.1 4.0.0 diff --git a/blade-ops/blade-seata-order/pom.xml b/blade-ops/blade-seata-order/pom.xml index 2424bac..839076b 100644 --- a/blade-ops/blade-seata-order/pom.xml +++ b/blade-ops/blade-seata-order/pom.xml @@ -5,7 +5,7 @@ blade-ops org.springblade - 2.6.0 + 2.6.1 4.0.0 diff --git a/blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/config/OrderConfiguration.java b/blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/config/OrderConfiguration.java deleted file mode 100644 index edafd3a..0000000 --- a/blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/config/OrderConfiguration.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * Licensed 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. - */ -package org.springblade.seata.order.config; - - -import org.springblade.core.secure.registry.SecureRegistry; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -/** - * secure模块api放行配置 - * - * @author Chill - */ -@Configuration -public class OrderConfiguration implements WebMvcConfigurer { - - @Bean - public SecureRegistry secureRegistry() { - SecureRegistry secureRegistry = new SecureRegistry(); - secureRegistry.excludePathPatterns("/order/create/**"); - return secureRegistry; - } - -} diff --git a/blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/feign/IStorageClient.java b/blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/feign/IStorageClient.java index 1312d8b..1605f1d 100644 --- a/blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/feign/IStorageClient.java +++ b/blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/feign/IStorageClient.java @@ -19,7 +19,7 @@ public interface IStorageClient { * @param count 数量 * @return boolean */ - @GetMapping("/deduct") + @GetMapping("/storage/deduct") int deduct(@RequestParam("commodityCode") String commodityCode, @RequestParam("count") Integer count); } diff --git a/blade-ops/blade-seata-order/src/main/resources/application-dev.yml b/blade-ops/blade-seata-order/src/main/resources/application-dev.yml index ed2ec08..14e5433 100644 --- a/blade-ops/blade-seata-order/src/main/resources/application-dev.yml +++ b/blade-ops/blade-seata-order/src/main/resources/application-dev.yml @@ -8,3 +8,24 @@ spring: url: jdbc:mysql://localhost:3306/seata_order?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true username: root password: root + +# seata配置 +seata: + tx-service-group: blade-seata-order-group + #registry: + # type: nacos + # nacos: + # server-addr: localhost + #config: + # type: nacos + # nacos: + # server-addr: localhost + service: + grouplist: 127.0.0.1:8091 + vgroup-mapping: default + disable-global-transaction: false + client: + support: + spring: + datasource-autoproxy: false + rm-report-success-enable: false diff --git a/blade-ops/blade-seata-order/src/main/resources/registry.conf b/blade-ops/blade-seata-order/src/main/resources/registry.conf deleted file mode 100644 index da0dda8..0000000 --- a/blade-ops/blade-seata-order/src/main/resources/registry.conf +++ /dev/null @@ -1,20 +0,0 @@ -registry { - # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa - type = "nacos" - - nacos { - serverAddr = "localhost" - namespace = "" - cluster = "default" - } -} - -config { - # file、nacos 、apollo、zk、consul、etcd3 - type = "nacos" - - nacos { - serverAddr = "localhost" - namespace = "" - } -} diff --git a/blade-ops/blade-seata-storage/pom.xml b/blade-ops/blade-seata-storage/pom.xml index 42b0fd8..61e570c 100644 --- a/blade-ops/blade-seata-storage/pom.xml +++ b/blade-ops/blade-seata-storage/pom.xml @@ -5,7 +5,7 @@ blade-ops org.springblade - 2.6.0 + 2.6.1 4.0.0 diff --git a/blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/SeataStorageApplication.java b/blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/SeataStorageApplication.java index d98ee65..5f8686d 100644 --- a/blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/SeataStorageApplication.java +++ b/blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/SeataStorageApplication.java @@ -18,10 +18,6 @@ package org.springblade.seata.storage; import org.springblade.core.launch.BladeApplication; import org.springblade.core.launch.constant.AppConstant; import org.springblade.core.transaction.annotation.SeataCloudApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; -import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.openfeign.EnableFeignClients; /** diff --git a/blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/config/StorageConfiguration.java b/blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/config/StorageConfiguration.java deleted file mode 100644 index 7ac2e9e..0000000 --- a/blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/config/StorageConfiguration.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * Licensed 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. - */ -package org.springblade.seata.storage.config; - - -import org.springblade.core.secure.registry.SecureRegistry; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -/** - * secure模块api放行配置 - * - * @author Chill - */ -@Configuration -public class StorageConfiguration implements WebMvcConfigurer { - - @Bean - public SecureRegistry secureRegistry() { - SecureRegistry secureRegistry = new SecureRegistry(); - secureRegistry.excludePathPatterns("/deduct/**"); - return secureRegistry; - } - -} diff --git a/blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/controller/StorageController.java b/blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/controller/StorageController.java index 0033d28..f444709 100644 --- a/blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/controller/StorageController.java +++ b/blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/controller/StorageController.java @@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RestController; * @author Chill */ @RestController +@RequestMapping("storage") @AllArgsConstructor public class StorageController { diff --git a/blade-ops/blade-seata-storage/src/main/resources/application-dev.yml b/blade-ops/blade-seata-storage/src/main/resources/application-dev.yml index 35d9cb4..3118022 100644 --- a/blade-ops/blade-seata-storage/src/main/resources/application-dev.yml +++ b/blade-ops/blade-seata-storage/src/main/resources/application-dev.yml @@ -8,3 +8,24 @@ spring: url: jdbc:mysql://localhost:3306/seata_storage?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true username: root password: root + +# seata配置 +seata: + tx-service-group: blade-seata-storage-group + #registry: + # type: nacos + # nacos: + # server-addr: localhost + #config: + # type: nacos + # nacos: + # server-addr: localhost + service: + grouplist: 127.0.0.1:8091 + vgroup-mapping: default + disable-global-transaction: false + client: + support: + spring: + datasource-autoproxy: false + rm-report-success-enable: false diff --git a/blade-ops/blade-seata-storage/src/main/resources/registry.conf b/blade-ops/blade-seata-storage/src/main/resources/registry.conf deleted file mode 100644 index da0dda8..0000000 --- a/blade-ops/blade-seata-storage/src/main/resources/registry.conf +++ /dev/null @@ -1,20 +0,0 @@ -registry { - # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa - type = "nacos" - - nacos { - serverAddr = "localhost" - namespace = "" - cluster = "default" - } -} - -config { - # file、nacos 、apollo、zk、consul、etcd3 - type = "nacos" - - nacos { - serverAddr = "localhost" - namespace = "" - } -} diff --git a/blade-ops/blade-zipkin/Dockerfile b/blade-ops/blade-zipkin/Dockerfile deleted file mode 100644 index 313e11e..0000000 --- a/blade-ops/blade-zipkin/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM anapsix/alpine-java:8_server-jre_unlimited - -MAINTAINER smallchill@163.com - -RUN mkdir -p /blade/zipkin - -WORKDIR /blade/zipkin - -EXPOSE 9411 - -ADD ./target/blade-zipkin.jar ./app.jar - -ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"] - -CMD ["--spring.profiles.active=test"] diff --git a/blade-ops/blade-zipkin/pom.xml b/blade-ops/blade-zipkin/pom.xml deleted file mode 100644 index cb44716..0000000 --- a/blade-ops/blade-zipkin/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - blade-ops - org.springblade - 2.6.0 - - 4.0.0 - - blade-zipkin - ${project.artifactId} - ${bladex.project.version} - jar - - - - - org.springblade - blade-common - ${blade.project.version} - - - org.springblade - blade-core-tool - ${blade.tool.version} - - - org.springblade - blade-core-cloud - - - org.springblade - blade-core-secure - - - ${blade.tool.version} - - - - io.zipkin.java - zipkin-server - 2.12.3 - - - log4j-slf4j-impl - org.apache.logging.log4j - - - - - io.zipkin.java - zipkin-autoconfigure-ui - 2.12.3 - - - - - - - com.spotify - docker-maven-plugin - ${docker.plugin.version} - - ${docker.registry.url}/blade/${project.artifactId}:${project.version} - ${project.basedir} - ${docker.registry.host} - - - / - ${project.build.directory} - ${project.build.finalName}.jar - - - ${docker.registry.url} - ${docker.registry.url} - true - - - - org.apache.maven.plugins - maven-antrun-plugin - - - package - - run - - - - - - - - - - - - - - diff --git a/blade-ops/blade-zipkin/src/main/java/org/springblade/zipkin/ZipkinApplication.java b/blade-ops/blade-zipkin/src/main/java/org/springblade/zipkin/ZipkinApplication.java deleted file mode 100644 index 2dd0890..0000000 --- a/blade-ops/blade-zipkin/src/main/java/org/springblade/zipkin/ZipkinApplication.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * Licensed 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. - */ -package org.springblade.zipkin; - -import org.springblade.core.launch.BladeApplication; -import org.springblade.core.launch.constant.AppConstant; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import zipkin2.server.internal.EnableZipkinServer; - -/** - * Zipkin启动器 - * - * @author Chill - */ -@EnableZipkinServer -@SpringBootApplication -public class ZipkinApplication { - - public static void main(String[] args) { - BladeApplication.run(AppConstant.APPLICATION_ZIPKIN_NAME, ZipkinApplication.class, args); - } - -} diff --git a/blade-ops/blade-zipkin/src/main/resources/bootstrap.yml b/blade-ops/blade-zipkin/src/main/resources/bootstrap.yml deleted file mode 100644 index b5fe10d..0000000 --- a/blade-ops/blade-zipkin/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,18 +0,0 @@ -server: - port: 9411 - undertow: - # 设置IO线程数, 它主要执行非阻塞的任务,它们会负责多个连接, 默认设置每个CPU核心一个线程 - io-threads: 4 - # 阻塞任务线程池, 当执行类似servlet请求阻塞操作, undertow会从这个线程池中取得线程,它的值设置取决于系统的负载 - worker-threads: 20 - # 以下的配置会影响buffer,这些buffer会用于服务器连接的IO操作,有点类似netty的池化内存管理 - buffer-size: 1024 - # 是否分配的直接内存 - direct-buffers: true - -#zipkin启动报错无法访问的解决方法 -management: - metrics: - web: - server: - auto-time-requests: false diff --git a/blade-ops/pom.xml b/blade-ops/pom.xml index 3b9867f..d1dd745 100644 --- a/blade-ops/pom.xml +++ b/blade-ops/pom.xml @@ -5,7 +5,7 @@ SpringBlade org.springblade - 2.6.0 + 2.6.1 4.0.0 @@ -17,7 +17,6 @@ blade-resource blade-seata-order blade-seata-storage - blade-zipkin diff --git a/blade-service-api/blade-demo-api/pom.xml b/blade-service-api/blade-demo-api/pom.xml index d170b2a..11e595b 100644 --- a/blade-service-api/blade-demo-api/pom.xml +++ b/blade-service-api/blade-demo-api/pom.xml @@ -5,7 +5,7 @@ blade-service-api org.springblade - 2.6.0 + 2.6.1 4.0.0 diff --git a/blade-service-api/blade-desk-api/pom.xml b/blade-service-api/blade-desk-api/pom.xml index 7e1c8f2..c59fdf8 100644 --- a/blade-service-api/blade-desk-api/pom.xml +++ b/blade-service-api/blade-desk-api/pom.xml @@ -5,7 +5,7 @@ blade-service-api org.springblade - 2.6.0 + 2.6.1 4.0.0 diff --git a/blade-service-api/blade-dict-api/pom.xml b/blade-service-api/blade-dict-api/pom.xml index 698c91b..4a7e48a 100644 --- a/blade-service-api/blade-dict-api/pom.xml +++ b/blade-service-api/blade-dict-api/pom.xml @@ -5,7 +5,7 @@ blade-service-api org.springblade - 2.6.0 + 2.6.1 4.0.0 diff --git a/blade-service-api/blade-system-api/pom.xml b/blade-service-api/blade-system-api/pom.xml index c1df0d7..8928f00 100644 --- a/blade-service-api/blade-system-api/pom.xml +++ b/blade-service-api/blade-system-api/pom.xml @@ -5,7 +5,7 @@ blade-service-api org.springblade - 2.6.0 + 2.6.1 4.0.0 diff --git a/blade-service-api/blade-user-api/pom.xml b/blade-service-api/blade-user-api/pom.xml index 67a5caf..4a0fb24 100644 --- a/blade-service-api/blade-user-api/pom.xml +++ b/blade-service-api/blade-user-api/pom.xml @@ -5,7 +5,7 @@ blade-service-api org.springblade - 2.6.0 + 2.6.1 4.0.0 diff --git a/blade-service-api/pom.xml b/blade-service-api/pom.xml index 0070b24..c7b39a3 100644 --- a/blade-service-api/pom.xml +++ b/blade-service-api/pom.xml @@ -5,13 +5,13 @@ SpringBlade org.springblade - 2.6.0 + 2.6.1 4.0.0 blade-service-api ${project.artifactId} - 2.6.0 + 2.6.1 pom SpringBlade 微服务API集合 diff --git a/blade-service/blade-demo/pom.xml b/blade-service/blade-demo/pom.xml index 2e13711..8687f7a 100644 --- a/blade-service/blade-demo/pom.xml +++ b/blade-service/blade-demo/pom.xml @@ -5,7 +5,7 @@ blade-service org.springblade - 2.6.0 + 2.6.1 4.0.0 diff --git a/blade-service/blade-desk/pom.xml b/blade-service/blade-desk/pom.xml index 4ef4dee..6a7bfeb 100644 --- a/blade-service/blade-desk/pom.xml +++ b/blade-service/blade-desk/pom.xml @@ -6,7 +6,7 @@ org.springblade blade-service - 2.6.0 + 2.6.1 4.0.0 diff --git a/blade-service/blade-log/pom.xml b/blade-service/blade-log/pom.xml index 707fef5..8d562d0 100644 --- a/blade-service/blade-log/pom.xml +++ b/blade-service/blade-log/pom.xml @@ -5,7 +5,7 @@ blade-service org.springblade - 2.6.0 + 2.6.1 4.0.0 diff --git a/blade-service/blade-system/pom.xml b/blade-service/blade-system/pom.xml index 995cfab..8135b5a 100644 --- a/blade-service/blade-system/pom.xml +++ b/blade-service/blade-system/pom.xml @@ -5,7 +5,7 @@ blade-service org.springblade - 2.6.0 + 2.6.1 4.0.0 diff --git a/blade-service/blade-user/pom.xml b/blade-service/blade-user/pom.xml index ceb1995..f1ed881 100644 --- a/blade-service/blade-user/pom.xml +++ b/blade-service/blade-user/pom.xml @@ -5,7 +5,7 @@ blade-service org.springblade - 2.6.0 + 2.6.1 4.0.0 diff --git a/blade-service/pom.xml b/blade-service/pom.xml index e42daaa..b767548 100644 --- a/blade-service/pom.xml +++ b/blade-service/pom.xml @@ -7,12 +7,12 @@ org.springblade SpringBlade - 2.6.0 + 2.6.1 blade-service ${project.artifactId} - 2.6.0 + 2.6.1 pom SpringBlade 微服务集合 diff --git a/doc/sql/seata/seata.sql b/doc/sql/seata/seata.sql index 26d1890..aa558bf 100644 --- a/doc/sql/seata/seata.sql +++ b/doc/sql/seata/seata.sql @@ -11,7 +11,7 @@ Target Server Version : 50723 File Encoding : 65001 - Date: 13/11/2019 18:14:10 + Date: 10/02/2020 23:42:58 */ SET NAMES utf8mb4; @@ -23,57 +23,57 @@ SET FOREIGN_KEY_CHECKS = 0; DROP TABLE IF EXISTS `branch_table`; CREATE TABLE `branch_table` ( `branch_id` bigint(20) NOT NULL, - `xid` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `xid` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `transaction_id` bigint(20) NULL DEFAULT NULL, - `resource_group_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `resource_id` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `lock_key` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `branch_type` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `resource_group_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `resource_id` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `branch_type` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `status` tinyint(4) NULL DEFAULT NULL, - `client_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `application_data` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `gmt_create` datetime(0) NULL DEFAULT NULL, - `gmt_modified` datetime(0) NULL DEFAULT NULL, + `client_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `application_data` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `gmt_create` datetime(6) NULL DEFAULT NULL, + `gmt_modified` datetime(6) NULL DEFAULT NULL, PRIMARY KEY (`branch_id`) USING BTREE, INDEX `idx_xid`(`xid`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci; -- ---------------------------- -- Table structure for global_table -- ---------------------------- DROP TABLE IF EXISTS `global_table`; CREATE TABLE `global_table` ( - `xid` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `xid` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `transaction_id` bigint(20) NULL DEFAULT NULL, `status` tinyint(4) NOT NULL, - `application_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `transaction_service_group` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `transaction_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `application_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `transaction_service_group` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `transaction_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `timeout` int(11) NULL DEFAULT NULL, `begin_time` bigint(20) NULL DEFAULT NULL, - `application_data` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `application_data` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `gmt_create` datetime(0) NULL DEFAULT NULL, `gmt_modified` datetime(0) NULL DEFAULT NULL, PRIMARY KEY (`xid`) USING BTREE, INDEX `idx_gmt_modified_status`(`gmt_modified`, `status`) USING BTREE, INDEX `idx_transaction_id`(`transaction_id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci; -- ---------------------------- -- Table structure for lock_table -- ---------------------------- DROP TABLE IF EXISTS `lock_table`; CREATE TABLE `lock_table` ( - `row_key` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `xid` varchar(96) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `transaction_id` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL, - `branch_id` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL, - `resource_id` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `table_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `pk` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `row_key` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `xid` varchar(96) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `transaction_id` bigint(20) NULL DEFAULT NULL, + `branch_id` bigint(20) NOT NULL, + `resource_id` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `table_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `pk` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `gmt_create` datetime(0) NULL DEFAULT NULL, `gmt_modified` datetime(0) NULL DEFAULT NULL, - PRIMARY KEY (`row_key`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci; + PRIMARY KEY (`row_key`) USING BTREE, + INDEX `idx_branch_id`(`branch_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci; SET FOREIGN_KEY_CHECKS = 1; diff --git a/pom.xml b/pom.xml index fa7075c..d446294 100644 --- a/pom.xml +++ b/pom.xml @@ -5,26 +5,26 @@ org.springblade SpringBlade - 2.6.0 + 2.6.1 pom - 2.6.0 - 2.6.0 + 2.6.1 + 2.6.1 1.8 3.8.1 2.9.2 1.5.21 2.0.1 - 3.2.0 - 4.0.1 + 3.3.1 1.6.0 + 1.6.2 1.1.0 - 2.1.1.RELEASE - 2.2.0 + 2.2.0.RELEASE + 2.2.2 - 2.2.2.RELEASE + 2.2.4.RELEASE Hoxton.SR1 Cairo-SR8 @@ -132,7 +132,7 @@ aliyun-repos - http://maven.aliyun.com/nexus/content/groups/public/ + https://maven.aliyun.com/nexus/content/groups/public/ false @@ -142,7 +142,7 @@ aliyun-plugin - http://maven.aliyun.com/nexus/content/groups/public/ + https://maven.aliyun.com/nexus/content/groups/public/ false diff --git a/script/docker/.env b/script/docker/.env index c105eb3..247f0b4 100644 --- a/script/docker/.env +++ b/script/docker/.env @@ -1,2 +1,2 @@ REGISTER=192.168.0.157/blade -TAG=2.6.0 +TAG=2.6.1