配置文件修改,test新增

This commit is contained in:
tianfeng 2025-08-27 08:52:37 +00:00
parent 4cbfd00319
commit 2d0ba8e42a
10 changed files with 480 additions and 3 deletions

View File

@ -14,7 +14,7 @@
<properties>
<revision>1.0.0-local</revision>
<profiles.active>local</profiles.active>
<register.namespace>75ec24ef-edb0-4605-a8c5-7fb03c3eef8d</register.namespace>
<register.namespace>f7a8594e-090c-4830-a3ad-b5c0f9afcc07</register.namespace>
</properties>
<activation>
<activeByDefault>true</activeByDefault>

View File

@ -42,7 +42,11 @@
<artifactId>telegrambots-client</artifactId>
<version>8.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<parent>

View File

@ -104,7 +104,7 @@ public class TeamBillQryExe {
}
// 经产品和运营确认如果是钻石政策并且是日结区域显示日账单列表
TeamPolicyManager policy = teamPolicyManagerService.getReleaseByRegionAndType(SysOriginPlatformEnum.TARAB.name(), teamBillCycles.get(0).getRegion());
TeamPolicyManager policy = teamPolicyManagerService.getReleaseByRegionAndType(SysOriginPlatformEnum.LIKEI.name(), teamBillCycles.get(0).getRegion());
if (Objects.isNull(policy)) {
return teamBill;
}

View File

@ -128,6 +128,13 @@ public class TeamBillSettleListener implements MessageListener {
}
}
/**
* 测试使用
*/
public void processBillTest(Long teamId) {
this.process(new TeamBillSettleEvent().setTeamId(teamId));
}
private void processBill(TeamProfile teamProfile, TeamBillCycle teamBillCycle) {
// 获取团队区域政策
TeamPolicyManager regionPolicyManager = teamPolicyManagerService.getReleaseByRegionAndType(

View File

@ -0,0 +1,39 @@
import com.red.circle.OtherServiceApplication;
import com.red.circle.other.app.listener.team.TeamBillSettleListener;
import com.red.circle.other.app.scheduler.TeamBillTask;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
@SpringBootTest(classes = OtherServiceApplication.class)
@RunWith(SpringRunner.class)
public class TeamMonthBillTest {
@Autowired
private TeamBillTask teamBillTask;
@Autowired
private TeamBillSettleListener teamBillSettleListener;
/**
* 更新账单 然很发布消息
*/
@Test
public void processTeamBill() {
// teamBillTask.processTeamMonthBillTest();
}
/**
* listener直接处理团队账单
*/
@Test
public void testListener() {
Long teamId = 1960260858980765698L;
// teamBillSettleListener.processBillTest(teamId);
}
}

View File

@ -0,0 +1,22 @@
logging:
level:
com.red.circle.*: debug
com.alibaba.cloud.nacos.*: debug
feign:
gateway:
url: http://127.0.0.1:1100
wallet:
url: http://127.0.0.1:2000
other:
url: http://127.0.0.1:2400
live:
url: http://127.0.0.1:2500
console:
url: http://127.0.0.1:2700
auth:
url: http://127.0.0.1:1000
order:
url: http://127.0.0.1:2600
external:
url: http://127.0.0.1:3000

View File

@ -0,0 +1,40 @@
server:
port: 2400
shutdown: graceful
undertow:
no-request-timeout: 10000
spring:
lifecycle:
timeout-per-shutdown-phase: 30s
main:
allow-bean-definition-overriding: true
profiles:
active: local
group:
local: web-framework,openfeign,mybatis-plus
dev: web-framework,openfeign,mybatis-plus
prod: web-framework,openfeign,mybatis-plus
servlet:
multipart:
max-file-size: 20MB
max-request-size: 20MB
enabled: true
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
shutdown:
enabled: false
info:
enabled: true
health:
show-details: always
metrics:
web:
server:
# http.client.requests (URI tag)太多了, 超出问题
max-uri-tags: 500

View File

@ -0,0 +1,49 @@
spring-profile.active: local
spring:
application:
name: rc-service-other
cloud:
nacos:
username: ${NACOS_USERNAME:nacos}
password: ${NACOS_PASSWORD:nacos}
discovery:
server-addr: ${NACOS_HOST:127.0.0.1}:${NACOS_PORT:8848}
namespace: f7a8594e-090c-4830-a3ad-b5c0f9afcc07
group: ${spring-profile.active}
register-enabled: false
config:
server-addr: ${NACOS_HOST:127.0.0.1}:${NACOS_PORT:8848}
file-extension: yml
namespace: f7a8594e-090c-4830-a3ad-b5c0f9afcc07
group: ${spring.application.name}
shared-configs:
- data-id: application.yml
group: ${spring.application.name}
refresh: true
loadbalancer:
cache:
ttl: 5s
config:
import:
- optional:nacos:application.yml?refresh=true&group=rc-service-other
- optional:nacos:application-${spring-profile.active}.yml?refresh=true&group=rc-service-other
- optional:nacos:${spring.application.name}-${spring-profile.active}.yml?refresh=true&group=rc-service-other
- optional:nacos:rds-config.yml?group=common
- optional:nacos:redis-config.yml?group=common
- optional:nacos:mongo-config.yml?group=common
- optional:nacos:rocketmq.yml?group=common
- optional:nacos:external.yml?refresh=true&group=common
- optional:nacos:framework-config.yml?refresh=true&group=common
logging:
level:
com:
alibaba:
cloud:
nacos:
configdata:
NacosConfigDataLoader: error
client:
NacosPropertySourceBuilder: error

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="false">
<!-- <shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>-->
<springProperty scop="context" name="spring.application.name" source="spring.application.name"
defaultValue=""/>
<property name="log.path" value="logs/${spring.application.name}"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr"
converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
<conversionRule conversionWord="wex"
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
<conversionRule conversionWord="wEx"
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<!-- Console log output -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- Log file debug output -->
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>7</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
</appender>
<!-- Log file error output -->
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>7</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<appender name="sls-develop" class="com.tencentcloudapi.cls.LoghubAppender">
<!--必选项-->
<endpoint>ap-singapore.cls.tencentcs.com</endpoint>
<accessKeyId>AKIDSnx10rZK4d6NTRGtIYbPQFuLcp3CB0nR</accessKeyId>
<accessKeySecret>c5oT2Y8nNnxzongUDlKkCVfjbLvKUXRC</accessKeySecret>
<topicId>180afe72-b0fe-4502-bbc2-55a8a5193e78</topicId>
<!-- 可选项 详见 '参数说明'-->
<totalSizeInBytes>104857600</totalSizeInBytes>
<maxBlockMs>60000</maxBlockMs>
<ioThreadCount>8</ioThreadCount>
<batchSizeThresholdInBytes>524288</batchSizeThresholdInBytes>
<batchCountThreshold>4096</batchCountThreshold>
<lingerMs>2000</lingerMs>
<retries>10</retries>
<baseRetryBackoffMs>100</baseRetryBackoffMs>
<maxRetryBackoffMs>100</maxRetryBackoffMs>
<!-- 可选项 通过配置 encoder 的 pattern 自定义 log 的格式 -->
<encoder>
<pattern>%d %-5level [%thread] %logger{0}</pattern>
</encoder>
<!-- 可选项 设置 time 字段呈现的格式 -->
<timeFormat>yyyy-MM-dd'T'HH:mmZ</timeFormat>
<!-- 可选项 设置 time 字段呈现的时区 -->
<timeZone>Asia/Shanghai</timeZone>
<customFields>{"app":"${spring.application.name}"}</customFields>
</appender>
<appender name="sls-prod" class="com.tencentcloudapi.cls.LoghubAppender">
<!--必选项-->
<endpoint>ap-singapore.cls.tencentcs.com</endpoint>
<accessKeyId>AKIDSnx10rZK4d6NTRGtIYbPQFuLcp3CB0nR</accessKeyId>
<accessKeySecret>c5oT2Y8nNnxzongUDlKkCVfjbLvKUXRC</accessKeySecret>
<topicId>4d467d31-9165-42c6-b80a-2ea23ae7777e</topicId>
<!-- 可选项 详见 '参数说明'-->
<totalSizeInBytes>104857600</totalSizeInBytes>
<maxBlockMs>60000</maxBlockMs>
<ioThreadCount>8</ioThreadCount>
<batchSizeThresholdInBytes>524288</batchSizeThresholdInBytes>
<batchCountThreshold>4096</batchCountThreshold>
<lingerMs>2000</lingerMs>
<retries>10</retries>
<baseRetryBackoffMs>100</baseRetryBackoffMs>
<maxRetryBackoffMs>100</maxRetryBackoffMs>
<!-- 可选项 通过配置 encoder 的 pattern 自定义 log 的格式 -->
<encoder>
<pattern>%d %-5level [%thread] %logger{0}</pattern>
</encoder>
<!-- 可选项 设置 time 字段呈现的格式 -->
<timeFormat>yyyy-MM-dd'T'HH:mmZ</timeFormat>
<!-- 可选项 设置 time 字段呈现的时区 -->
<timeZone>Asia/Shanghai</timeZone>
<customFields>{"app":"${spring.application.name}"}</customFields>
</appender>
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<springProfile name="local">
<root level="INFO">
<appender-ref ref="console"/>
<appender-ref ref="debug"/>
<appender-ref ref="error"/>
</root>
</springProfile>
<springProfile name="dev">
<root level="INFO">
<appender-ref ref="console"/>
<appender-ref ref="debug"/>
<appender-ref ref="error"/>
<appender-ref ref="sls-develop"/>
</root>
</springProfile>
<springProfile name="test">
<root level="WARN">
<appender-ref ref="console"/>
<appender-ref ref="debug"/>
<appender-ref ref="error"/>
</root>
</springProfile>
<springProfile name="prod">
<root level="WARN">
<appender-ref ref="console"/>
<appender-ref ref="debug"/>
<appender-ref ref="error"/>
<appender-ref ref="sls-prod"/>
</root>
</springProfile>
</configuration>

View File

@ -0,0 +1,168 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="false">
<!-- <shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>-->
<springProperty scop="context" name="spring.application.name" source="spring.application.name"
defaultValue=""/>
<property name="log.path" value="logs/${spring.application.name}"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr"
converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
<conversionRule conversionWord="wex"
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
<conversionRule conversionWord="wEx"
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<!-- Console log output -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>
[%thread] %-5level %logger{15}#%line %X{req.requestURI} traceId: %X{trace_id} spanId:
%X{span_id} %msg
</pattern>
</encoder>
</appender>
<!-- Log file debug output -->
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>7</maxHistory>
</rollingPolicy>
<encoder>
<pattern>
[%thread] %-5level %logger{15}#%line %X{req.requestURI} traceId: %X{trace_id} spanId:
%X{span_id} %msg
</pattern>
</encoder>
</appender>
<!-- Log file error output -->
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>7</maxHistory>
</rollingPolicy>
<encoder>
<pattern>
[%thread] %-5level %logger{15}#%line %X{req.requestURI} traceId: %X{trace_id} spanId:
%X{span_id} %msg
</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<appender name="sls-develop" class="com.tencentcloudapi.cls.LoghubAppender">
<!--必选项-->
<endpoint>ap-singapore.cls.tencentcs.com</endpoint>
<accessKeyId>AKIDSnx10rZK4d6NTRGtIYbPQFuLcp3CB0nR</accessKeyId>
<accessKeySecret>c5oT2Y8nNnxzongUDlKkCVfjbLvKUXRC</accessKeySecret>
<topicId>180afe72-b0fe-4502-bbc2-55a8a5193e78</topicId>
<!-- 可选项 详见 '参数说明'-->
<totalSizeInBytes>104857600</totalSizeInBytes>
<maxBlockMs>60000</maxBlockMs>
<ioThreadCount>8</ioThreadCount>
<batchSizeThresholdInBytes>524288</batchSizeThresholdInBytes>
<batchCountThreshold>4096</batchCountThreshold>
<lingerMs>2000</lingerMs>
<retries>10</retries>
<baseRetryBackoffMs>100</baseRetryBackoffMs>
<maxRetryBackoffMs>100</maxRetryBackoffMs>
<!-- 可选项 通过配置 encoder 的 pattern 自定义 log 的格式 -->
<encoder>
<pattern>
[%thread] %-5level %logger{15}#%line %X{req.requestURI} traceId: %X{trace_id} spanId:
%X{span_id} %msg
</pattern>
</encoder>
<!-- 可选项 设置 time 字段呈现的格式 -->
<timeFormat>yyyy-MM-dd'T'HH:mmZ</timeFormat>
<!-- 可选项 设置 time 字段呈现的时区 -->
<timeZone>Asia/Shanghai</timeZone>
<customFields>{"app":"${spring.application.name}"}</customFields>
</appender>
<appender name="sls-prod" class="com.tencentcloudapi.cls.LoghubAppender">
<!--必选项-->
<endpoint>ap-singapore.cls.tencentcs.com</endpoint>
<accessKeyId>AKIDSnx10rZK4d6NTRGtIYbPQFuLcp3CB0nR</accessKeyId>
<accessKeySecret>c5oT2Y8nNnxzongUDlKkCVfjbLvKUXRC</accessKeySecret>
<topicId>4d467d31-9165-42c6-b80a-2ea23ae7777e</topicId>
<!-- 可选项 详见 '参数说明'-->
<totalSizeInBytes>104857600</totalSizeInBytes>
<maxBlockMs>60000</maxBlockMs>
<ioThreadCount>8</ioThreadCount>
<batchSizeThresholdInBytes>524288</batchSizeThresholdInBytes>
<batchCountThreshold>4096</batchCountThreshold>
<lingerMs>2000</lingerMs>
<retries>10</retries>
<baseRetryBackoffMs>100</baseRetryBackoffMs>
<maxRetryBackoffMs>100</maxRetryBackoffMs>
<!-- 可选项 通过配置 encoder 的 pattern 自定义 log 的格式 -->
<encoder>
<pattern>
[%thread] %-5level %logger{15}#%line %X{req.requestURI} traceId: %X{trace_id} spanId:
%X{span_id} %msg
</pattern>
</encoder>
<!-- 可选项 设置 time 字段呈现的格式 -->
<timeFormat>yyyy-MM-dd'T'HH:mmZ</timeFormat>
<!-- 可选项 设置 time 字段呈现的时区 -->
<timeZone>Asia/Shanghai</timeZone>
<customFields>{"app":"${spring.application.name}"}</customFields>
</appender>
<!--nacos 心跳 INFO 屏蔽-->
<logger name="com.alibaba.nacos" level="OFF">
<appender-ref ref="error"/>
</logger>
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<springProfile name="local">
<root level="INFO">
<appender-ref ref="console"/>
<appender-ref ref="debug"/>
<appender-ref ref="error"/>
</root>
</springProfile>
<springProfile name="dev">
<root level="WARN">
<appender-ref ref="console"/>
<appender-ref ref="debug"/>
<appender-ref ref="error"/>
<appender-ref ref="sls-develop"/>
</root>
</springProfile>
<springProfile name="test">
<root level="WARN">
<appender-ref ref="console"/>
<appender-ref ref="debug"/>
<appender-ref ref="error"/>
</root>
</springProfile>
<springProfile name="prod">
<root level="WARN">
<appender-ref ref="console"/>
<appender-ref ref="debug"/>
<appender-ref ref="error"/>
<appender-ref ref="sls-prod"/>
</root>
</springProfile>
</configuration>