Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
wangw 2025-10-30 14:14:24 +08:00
commit 05fbdb0826
15 changed files with 133 additions and 13 deletions

View File

@ -8,6 +8,17 @@ spring:
active: dev active: dev
include: tools include: tools
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://192.168.1.42:9411/api/v2/spans
logging: logging:
config: classpath:logback.xml config: classpath:logback.xml

View File

@ -2,9 +2,10 @@
<configuration scan="true" scanPeriod="30 seconds" debug="false"> <configuration scan="true" scanPeriod="30 seconds" debug="false">
<contextName>account-server</contextName> <contextName>account-server</contextName>
<property name="log.charset" value="utf-8" /> <property name="log.charset" value="utf-8" />
<property name="log.pattern" value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" /> <property name="log.pattern"
value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) [traceId=%X{traceId:-}, spanId=%X{spanId:-}] - %msg%n" />
<!--写入文件格式--> <!--写入文件格式-->
<property name="p_file" value="%d | [%thread] %-5level %c [%L] - %msg %n"/> <property name="p_file" value="%d [traceId=%X{traceId:-}] | [%thread] %-5level %c [%L] - %msg %n "/>
<!--输出到控制台--> <!--输出到控制台-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>

View File

@ -14,6 +14,17 @@ wx:
operationMsgTmpId: wFdoUG-dUT7bDRHq8bMJD9CF5TjyH9x_uJQgQByZqHg operationMsgTmpId: wFdoUG-dUT7bDRHq8bMJD9CF5TjyH9x_uJQgQByZqHg
warnMsgTmpId: C08OUr80x6wGmUN1zpFhSQ3Sv7VF5vksdZigiEx2pD0 warnMsgTmpId: C08OUr80x6wGmUN1zpFhSQ3Sv7VF5vksdZigiEx2pD0
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://192.168.1.42:9411/api/v2/spans
logging: logging:
config: classpath:logback.xml config: classpath:logback.xml

View File

@ -2,9 +2,10 @@
<configuration scan="true" scanPeriod="30 seconds" debug="false"> <configuration scan="true" scanPeriod="30 seconds" debug="false">
<contextName>market-server</contextName> <contextName>market-server</contextName>
<property name="log.charset" value="utf-8" /> <property name="log.charset" value="utf-8" />
<property name="log.pattern" value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" /> <property name="log.pattern"
value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) [traceId=%X{traceId:-}, spanId=%X{spanId:-}] - %msg%n" />
<!--写入文件格式--> <!--写入文件格式-->
<property name="p_file" value="%d | [%thread] %-5level %c [%L] - %msg %n"/> <property name="p_file" value="%d [traceId=%X{traceId:-}] | [%thread] %-5level %c [%L] - %msg %n "/>
<!--输出到控制台--> <!--输出到控制台-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>

View File

@ -57,7 +57,7 @@ public class NotifyController {
@GetMapping("testOpen") @GetMapping("testOpen")
public JSONObject test1(String code) throws Exception { public JSONObject test1(String code) throws Exception {
distributionUserService.distribute(54659L, "WX1983728389726539776", BigDecimal.valueOf(1), 474L, 122L, "order"); distributionUserService.distribute(54664L, "WX1983735285514747904", BigDecimal.valueOf(1), 474L, 122L, "order");
return null; return null;
} }

View File

@ -8,6 +8,17 @@ spring:
active: dev active: dev
include: tools include: tools
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://192.168.1.42:9411/api/v2/spans
logging: logging:
config: classpath:logback.xml config: classpath:logback.xml

View File

@ -2,9 +2,10 @@
<configuration scan="true" scanPeriod="30 seconds" debug="false"> <configuration scan="true" scanPeriod="30 seconds" debug="false">
<contextName>order-server</contextName> <contextName>order-server</contextName>
<property name="log.charset" value="utf-8" /> <property name="log.charset" value="utf-8" />
<property name="log.pattern" value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" /> <property name="log.pattern"
value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) [traceId=%X{traceId:-}, spanId=%X{spanId:-}] - %msg%n" />
<!--写入文件格式--> <!--写入文件格式-->
<property name="p_file" value="%d | [%thread] %-5level %c [%L] - %msg %n"/> <property name="p_file" value="%d [traceId=%X{traceId:-}] | [%thread] %-5level %c [%L] - %msg %n "/>
<!--输出到控制台--> <!--输出到控制台-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>

View File

@ -18,6 +18,17 @@ wx:
appId: wx1fb600d0f5ea6279 appId: wx1fb600d0f5ea6279
secrete: b4c0534c9b5e6c84a7fe5c2078dff876 secrete: b4c0534c9b5e6c84a7fe5c2078dff876
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://192.168.1.42:9411/api/v2/spans
logging: logging:
config: classpath:logback.xml config: classpath:logback.xml

View File

@ -2,9 +2,10 @@
<configuration scan="true" scanPeriod="30 seconds" debug="false"> <configuration scan="true" scanPeriod="30 seconds" debug="false">
<contextName>product-server</contextName> <contextName>product-server</contextName>
<property name="log.charset" value="utf-8" /> <property name="log.charset" value="utf-8" />
<property name="log.pattern" value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" /> <property name="log.pattern"
value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) [traceId=%X{traceId:-}, spanId=%X{spanId:-}] - %msg%n" />
<!--写入文件格式--> <!--写入文件格式-->
<property name="p_file" value="%d | [%thread] %-5level %c [%L] - %msg %n"/> <property name="p_file" value="%d [traceId=%X{traceId:-}] | [%thread] %-5level %c [%L] - %msg %n "/>
<!--输出到控制台--> <!--输出到控制台-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>

View File

@ -7,6 +7,17 @@ spring:
profiles: profiles:
active: dev active: dev
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://192.168.1.42:9411/api/v2/spans
logging: logging:
config: classpath:logback.xml config: classpath:logback.xml

View File

@ -2,9 +2,11 @@
<configuration scan="true" scanPeriod="30 seconds" debug="false"> <configuration scan="true" scanPeriod="30 seconds" debug="false">
<contextName>system-server</contextName> <contextName>system-server</contextName>
<property name="log.charset" value="utf-8" /> <property name="log.charset" value="utf-8" />
<property name="log.pattern" value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" /> <!-- <property name="log.pattern" value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" />-->
<property name="log.pattern"
value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) [traceId=%X{traceId:-}, spanId=%X{spanId:-}] - %msg%n" />
<!--写入文件格式--> <!--写入文件格式-->
<property name="p_file" value="%d | [%thread] %-5level %c [%L] - %msg %n"/> <property name="p_file" value="%d [traceId=%X{traceId:-}] | [%thread] %-5level %c [%L] - %msg %n "/>
<!--输出到控制台--> <!--输出到控制台-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>

View File

@ -11,10 +11,13 @@ import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.MDC;
import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.Map;
/** /**
* 方法调用统一切面处理 * 方法调用统一切面处理
@ -59,7 +62,13 @@ public class ControllerAspect {
String requestUrl = request.getRequestURL().toString(); String requestUrl = request.getRequestURL().toString();
String requestIp = ServletUtil.getClientIP(request); String requestIp = ServletUtil.getClientIP(request);
long useTime = end - start; long useTime = end - start;
Map<String, String> contextMap = MDC.getCopyOfContextMap();
ThreadUtil.execAsync(() -> { ThreadUtil.execAsync(() -> {
if (contextMap != null) {
MDC.setContextMap(contextMap);
}
//请求的参数 //请求的参数
String resultJson = JSONObject.toJSONString(result); String resultJson = JSONObject.toJSONString(result);
if (StrUtil.isNotBlank(resultJson) && resultJson.length() > 200) { if (StrUtil.isNotBlank(resultJson) && resultJson.length() > 200) {
@ -82,6 +91,8 @@ public class ControllerAspect {
} }
} catch (Exception e) { } catch (Exception e) {
log.error("Request 为空" + e.getMessage()); log.error("Request 为空" + e.getMessage());
} finally {
MDC.clear();
} }
}); });
return result; return result;

View File

@ -41,6 +41,9 @@
<weixin.java.miniapp.version>3.8.0</weixin.java.miniapp.version> <weixin.java.miniapp.version>3.8.0</weixin.java.miniapp.version>
<pinyin.version>2.5.1</pinyin.version> <pinyin.version>2.5.1</pinyin.version>
<IJPay.version>2.9.10</IJPay.version> <IJPay.version>2.9.10</IJPay.version>
<micrometer.version>1.6.0-M3</micrometer.version>
<zipkin-reporter.version>3.5.1</zipkin-reporter.version>
<actuator.version>4.0.0-M3</actuator.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@ -242,6 +245,28 @@
<artifactId>excel-spring-boot-starter</artifactId> <artifactId>excel-spring-boot-starter</artifactId>
<version>3.4.0</version> <version>3.4.0</version>
</dependency> </dependency>
<!-- Micrometer Tracing 核心(必需) -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
<version>${micrometer.version}</version>
</dependency>
<!-- Zipkin Reporter用于将数据发送到 Zipkin -->
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
<version>${zipkin-reporter.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>${actuator.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>

View File

@ -57,7 +57,7 @@ public class MkDistributionAmountFlowServiceImpl extends ServiceImpl<MkDistribut
}); });
} }
Page<MkDistributionAmountFlowVO> pageInfo = pageAs(PageUtil.buildPage(), queryWrapper, MkDistributionAmountFlowVO.class); Page<MkDistributionAmountFlowVO> pageInfo = pageAs(PageUtil.buildPage(), queryWrapper.orderBy(MkDistributionAmountFlow::getCreateTime, false), MkDistributionAmountFlowVO.class);
Map<String, Object> map = BeanUtil.beanToMap(pageInfo); Map<String, Object> map = BeanUtil.beanToMap(pageInfo);
map.put("totalRecharge", getOne(new QueryWrapper().eq(MkDistributionAmountFlow::getShopId, shopId) map.put("totalRecharge", getOne(new QueryWrapper().eq(MkDistributionAmountFlow::getShopId, shopId)
.in(MkDistributionAmountFlow::getType, TableValueConstant.DistributionAmountFlow.Type.MANUAL_RECHARGE.getCode(), TableValueConstant.DistributionAmountFlow.Type.SELF_RECHARGE.getCode()) .in(MkDistributionAmountFlow::getType, TableValueConstant.DistributionAmountFlow.Type.MANUAL_RECHARGE.getCode(), TableValueConstant.DistributionAmountFlow.Type.SELF_RECHARGE.getCode())
@ -100,7 +100,7 @@ public class MkDistributionAmountFlowServiceImpl extends ServiceImpl<MkDistribut
}); });
} }
Page<MkDistributionAmountFlowVO> pageInfo = pageAs(PageUtil.buildPage(), queryWrapper, MkDistributionAmountFlowVO.class); Page<MkDistributionAmountFlowVO> pageInfo = pageAs(PageUtil.buildPage(), queryWrapper.orderBy(MkDistributionAmountFlow::getCreateTime, false), MkDistributionAmountFlowVO.class);
Map<String, Object> map = BeanUtil.beanToMap(pageInfo); Map<String, Object> map = BeanUtil.beanToMap(pageInfo);
map.put("totalAmount", getOne(new QueryWrapper().eq(MkDistributionAmountFlow::getShopId, shopId) map.put("totalAmount", getOne(new QueryWrapper().eq(MkDistributionAmountFlow::getShopId, shopId)
.in(MkDistributionAmountFlow::getType, TableValueConstant.DistributionAmountFlow.Type.MANUAL_RECHARGE.getCode(), TableValueConstant.DistributionAmountFlow.Type.SELF_RECHARGE.getCode()) .in(MkDistributionAmountFlow::getType, TableValueConstant.DistributionAmountFlow.Type.MANUAL_RECHARGE.getCode(), TableValueConstant.DistributionAmountFlow.Type.SELF_RECHARGE.getCode())

View File

@ -99,5 +99,28 @@
<version>8.0.2.Final</version> <version>8.0.2.Final</version>
</dependency> </dependency>
<!-- Micrometer Tracing 核心(必需) -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-observation</artifactId>
</dependency>
<!-- Zipkin Reporter用于将数据发送到 Zipkin -->
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>