1. 统一包名修改
This commit is contained in:
@@ -34,7 +34,7 @@ public class CorsResponseHeaderFilter implements GlobalFilter, Ordered {
|
||||
@Override
|
||||
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
|
||||
return chain.filter(exchange).then(Mono.defer(() -> {
|
||||
// https://gitee.com/zhijiantianya/cloud-cloud/pulls/177/
|
||||
// https://gitee.com/zhijiantianya/zt-cloud/pulls/177/
|
||||
List<String> keysToModify = exchange.getResponse().getHeaders().entrySet().stream()
|
||||
.filter(kv -> (kv.getValue() != null && kv.getValue().size() > 1))
|
||||
.filter(kv -> (kv.getKey().equals(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)
|
||||
|
||||
@@ -47,7 +47,7 @@ public class GrayReactiveLoadBalancerClientFilter implements GlobalFilter, Order
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
// https://github.com/YunaiV/cloud-cloud/pull/213
|
||||
// https://github.com/YunaiV/zt-cloud/pull/213
|
||||
return ReactiveLoadBalancerClientFilter.LOAD_BALANCER_CLIENT_FILTER_ORDER - 50;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class GrayReactiveLoadBalancerClientFilter implements GlobalFilter, Order
|
||||
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
|
||||
URI url = exchange.getAttribute(GATEWAY_REQUEST_URL_ATTR);
|
||||
String schemePrefix = exchange.getAttribute(GATEWAY_SCHEME_PREFIX_ATTR);
|
||||
// 修改 by ZT源码:将 lb 替换成 grayLb,表示灰度负载均衡
|
||||
// 修改 by 芋道源码:将 lb 替换成 grayLb,表示灰度负载均衡
|
||||
if (url == null || (!"grayLb".equals(url.getScheme()) && !"grayLb".equals(schemePrefix))) {
|
||||
return chain.filter(exchange);
|
||||
}
|
||||
@@ -121,7 +121,7 @@ public class GrayReactiveLoadBalancerClientFilter implements GlobalFilter, Order
|
||||
|
||||
private Mono<Response<ServiceInstance>> choose(Request<RequestDataContext> lbRequest, String serviceId,
|
||||
Set<LoadBalancerLifecycle> supportedLifecycleProcessors) {
|
||||
// 修改 by ZT源码:直接创建 GrayLoadBalancer 对象
|
||||
// 修改 by 芋道源码:直接创建 GrayLoadBalancer 对象
|
||||
GrayLoadBalancer loadBalancer = new GrayLoadBalancer(
|
||||
clientFactory.getLazyProvider(serviceId, ServiceInstanceListSupplier.class), serviceId);
|
||||
supportedLifecycleProcessors.forEach(lifecycle -> lifecycle.onStart(lbRequest));
|
||||
|
||||
@@ -48,7 +48,7 @@ import static cn.hutool.core.date.DatePattern.NORM_DATETIME_MS_FORMATTER;
|
||||
/**
|
||||
* 网关的访问日志过滤器
|
||||
*
|
||||
* 从功能上,它类似 cloud-spring-boot-starter-web 的 ApiAccessLogFilter 过滤器
|
||||
* 从功能上,它类似 zt-spring-boot-starter-web 的 ApiAccessLogFilter 过滤器
|
||||
*
|
||||
* TODO 芋艿:如果网关执行异常,不会记录访问日志,后续研究下 https://github.com/Silvmike/webflux-demo/blob/master/tests/src/test/java/ru/hardcoders/demo/webflux/web_handler/filters/logging
|
||||
*
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.Map;
|
||||
/**
|
||||
* 登录用户信息
|
||||
*
|
||||
* copy from cloud-spring-boot-starter-security 的 LoginUser 类
|
||||
* copy from zt-spring-boot-starter-security 的 LoginUser 类
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,7 @@ import static com.zt.plat.framework.common.exception.enums.GlobalErrorCodeConsta
|
||||
/**
|
||||
* Gateway 的全局异常处理器,将 Exception 翻译成 CommonResult + 对应的异常编号
|
||||
*
|
||||
* 在功能上,和 cloud-spring-boot-starter-web 的 GlobalExceptionHandler 类是一致的
|
||||
* 在功能上,和 zt-spring-boot-starter-web 的 GlobalExceptionHandler 类是一致的
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* 在 Nacos 配置发生变化时,Spring Cloud Alibaba Nacos Config 内置的监听器,会监听到配置刷新,最终触发 Gateway 的路由信息刷新。
|
||||
*
|
||||
* 参见 https://www.iocoder.cn/Spring-Cloud/Spring-Cloud-Gateway/?cloud 博客的「6. 基于配置中心 Nacos 实现动态路由」小节
|
||||
* 参见 https://www.iocoder.cn/Spring-Cloud/Spring-Cloud-Gateway/?zt 博客的「6. 基于配置中心 Nacos 实现动态路由」小节
|
||||
*
|
||||
* 使用方式:在 Nacos 修改 DataId 为 gateway-server.yaml 的配置,修改 spring.cloud.gateway.routes 配置项
|
||||
*
|
||||
|
||||
@@ -30,19 +30,19 @@ public class BannerApplicationRunner implements ApplicationRunner {
|
||||
"http://172.16.46.63:30888");
|
||||
|
||||
// 数据报表
|
||||
System.out.println("[报表模块 cloud-module-report 教程][参考 http://172.16.46.63:30888/report/ 开启]");
|
||||
System.out.println("[报表模块 zt-module-report 教程][参考 http://172.16.46.63:30888/report/ 开启]");
|
||||
// 工作流
|
||||
System.out.println("[工作流模块 cloud-module-bpm 教程][参考 http://172.16.46.63:30888/bpm/ 开启]");
|
||||
System.out.println("[工作流模块 zt-module-bpm 教程][参考 http://172.16.46.63:30888/bpm/ 开启]");
|
||||
|
||||
// 微信公众号
|
||||
System.out.println("[微信公众号 cloud-module-mp 教程][参考 http://172.16.46.63:30888/mp/build/ 开启]");
|
||||
System.out.println("[微信公众号 zt-module-mp 教程][参考 http://172.16.46.63:30888/mp/build/ 开启]");
|
||||
|
||||
// AI 大模型
|
||||
System.out.println("[AI 大模型 cloud-module-ai - 教程][参考 http://172.16.46.63:30888/ai/build/ 开启]");
|
||||
System.out.println("[AI 大模型 zt-module-ai - 教程][参考 http://172.16.46.63:30888/ai/build/ 开启]");
|
||||
// IOT 物联网
|
||||
System.out.println("[IoT 物联网 cloud-module-iot - 教程][参考 http://172.16.46.63:30888/iot/build/ 开启]");
|
||||
System.out.println("[IoT 物联网 zt-module-iot - 教程][参考 http://172.16.46.63:30888/iot/build/ 开启]");
|
||||
// IOT 项目模板
|
||||
System.out.println("[Template 项目模板 cloud-module-template - 教程][参考 http://172.16.46.63:30888/template/ 开启]");
|
||||
System.out.println("[Template 项目模板 zt-module-template - 教程][参考 http://172.16.46.63:30888/template/ 开启]");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.Objects;
|
||||
/**
|
||||
* 环境 Utils
|
||||
*
|
||||
* copy from cloud-spring-boot-starter-env 的 EnvUtils 类
|
||||
* copy from zt-spring-boot-starter-env 的 EnvUtils 类
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.nio.charset.StandardCharsets;
|
||||
/**
|
||||
* 安全服务工具类
|
||||
*
|
||||
* copy from cloud-spring-boot-starter-security 的 SecurityFrameworkUtils 类
|
||||
* copy from zt-spring-boot-starter-security 的 SecurityFrameworkUtils 类
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
|
||||
@@ -19,7 +19,7 @@ import reactor.core.publisher.Mono;
|
||||
/**
|
||||
* Web 工具类
|
||||
*
|
||||
* copy from cloud-spring-boot-starter-web 的 WebFrameworkUtils 类
|
||||
* copy from zt-spring-boot-starter-web 的 WebFrameworkUtils 类
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,7 @@ spring:
|
||||
active: ${env.name}
|
||||
|
||||
codec:
|
||||
max-in-memory-size: 10MB # 调整缓冲区大小https://gitee.com/zhijiantianya/cloud-cloud/pulls/176
|
||||
max-in-memory-size: 10MB # 调整缓冲区大小https://gitee.com/zhijiantianya/zt-cloud/pulls/176
|
||||
|
||||
# Jackson 配置项
|
||||
jackson:
|
||||
@@ -265,8 +265,8 @@ knife4j:
|
||||
service-name: iot-server
|
||||
url: /admin-api/iot/v3/api-docs
|
||||
|
||||
--- #################### ZT相关配置 ####################
|
||||
--- #################### 芋道相关配置 ####################
|
||||
|
||||
cloud:
|
||||
zt:
|
||||
info:
|
||||
version: 1.0.0
|
||||
@@ -1,5 +1,5 @@
|
||||
ZT源码 http://www.iocoder.cn
|
||||
Application Version: ${cloud.info.version}
|
||||
芋道源码 http://www.iocoder.cn
|
||||
Application Version: ${zt.info.version}
|
||||
Spring Boot Version: ${spring-boot.version}
|
||||
|
||||
.__ __. ______ .______ __ __ _______
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<configuration>
|
||||
<!-- 引用 Spring Boot 的 logback 基础配置 -->
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
||||
<!-- 变量 cloud.info.base-package,基础业务包 -->
|
||||
<springProperty scope="context" name="cloud.info.base-package" source="cloud.info.base-package"/>
|
||||
<!-- 变量 zt.info.base-package,基础业务包 -->
|
||||
<springProperty scope="context" name="zt.info.base-package" source="zt.info.base-package"/>
|
||||
<!-- 格式化输出:%d 表示日期,%X{tid} SkWalking 链路追踪编号,%thread 表示线程名,%-5level:级别从左显示 5 个字符宽度,%msg:日志消息,%n是换行符 -->
|
||||
<property name="PATTERN_DEFAULT" value="%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} | %highlight(${LOG_LEVEL_PATTERN:-%5p} ${PID:- }) | %boldYellow(%thread [%tid]) %boldGreen(%-40.40logger{39}) | %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
|
||||
|
||||
|
||||
@@ -26,9 +26,9 @@ import static java.io.File.separator;
|
||||
public class ProjectReactor {
|
||||
|
||||
private static final String GROUP_ID = "com.zt.plat";
|
||||
private static final String ARTIFACT_ID = "cloud";
|
||||
private static final String ARTIFACT_ID = "zt";
|
||||
private static final String PACKAGE_NAME = "com.zt.plat";
|
||||
private static final String TITLE = "土豆管理系统";
|
||||
private static final String TITLE = "中铜系统平台";
|
||||
|
||||
/**
|
||||
* 白名单文件,不进行重写,避免出问题
|
||||
@@ -46,7 +46,7 @@ public class ProjectReactor {
|
||||
String groupIdNew = "com.zt.plat";
|
||||
String artifactIdNew = "zt";
|
||||
String packageNameNew = "com.zt.plat";
|
||||
String titleNew = "土豆管理系统";
|
||||
String titleNew = "中铜系统平台";
|
||||
String projectBaseDirNew = projectBaseDir + "-new"; // 一键改名后,“新”项目所在的目录
|
||||
log.info("[main][检测新项目目录 ({})是否存在]", projectBaseDirNew);
|
||||
if (FileUtil.exist(projectBaseDirNew)) {
|
||||
|
||||
Reference in New Issue
Block a user