优化服务器列表查询速度、筛选条件bug修复。

ipv4、ipv6初始流量处理。
增加日志排查收益未自动生成问题。
This commit is contained in:
gaoyutao
2025-12-10 18:32:07 +08:00
parent 13e51c11e1
commit 2eaf62ea82
12 changed files with 299 additions and 298 deletions
@@ -1,94 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/tongran-system" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<property name="log.path" value="logs/tongran-system" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 简化版debug.log配置,只包含日志框架的输出 -->
<!-- DEBUG级别日志输出 - 使用ThresholdFilter -->
<appender name="file_debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/debug.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/debug.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>30</maxHistory>
<maxHistory>7</maxHistory> <!-- debug日志只保留7天 -->
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<!-- 记录DEBUG及以上级别,但不记录ERROR(ERROR有单独文件) -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>DENY</onMatch>
<onMismatch>NEUTRAL</onMismatch>
</filter>
<!-- ThresholdFilter会记录指定级别及以上级别的日志 -->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.tongran" level="info" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.tongran" level="info" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<!-- 如果你想启用特定类的debug日志 -->
<logger name="com.tongran.system" level="debug" additivity="false">
<appender-ref ref="file_debug" />
<appender-ref ref="console" />
</logger>
<!-- 排除不需要debug的子包(如果需要) -->
<logger name="com.tongran.system.mapper" level="info" />
<root level="info">
<appender-ref ref="console" />
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="console" />
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
<!-- 这里不包含file_debug,避免所有框架的debug日志都记录 -->
</root>
</configuration>
@@ -194,6 +194,65 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
NOW()
)
</foreach>
ON DUPLICATE KEY UPDATE
device_sn = CASE
WHEN device_sn != VALUES(device_sn) OR (device_sn IS NULL AND VALUES(device_sn) IS NOT NULL)
THEN VALUES(device_sn)
ELSE device_sn
END,
node_name = CASE
WHEN node_name != VALUES(node_name) OR (node_name IS NULL AND VALUES(node_name) IS NOT NULL)
THEN VALUES(node_name)
ELSE node_name
END,
business_code = CASE
WHEN business_code != VALUES(business_code) OR (business_code IS NULL AND VALUES(business_code) IS NOT NULL)
THEN VALUES(business_code)
ELSE business_code
END,
business_name = CASE
WHEN business_name != VALUES(business_name) OR (business_name IS NULL AND VALUES(business_name) IS NOT NULL)
THEN VALUES(business_name)
ELSE business_name
END,
switch_name = CASE
WHEN switch_name != VALUES(switch_name) OR (switch_name IS NULL AND VALUES(switch_name) IS NOT NULL)
THEN VALUES(switch_name)
ELSE switch_name
END,
interface_device_type = CASE
WHEN interface_device_type != VALUES(interface_device_type) OR (interface_device_type IS NULL AND VALUES(interface_device_type) IS NOT NULL)
THEN VALUES(interface_device_type)
ELSE interface_device_type
END,
server_port = CASE
WHEN server_port != VALUES(server_port) OR (server_port IS NULL AND VALUES(server_port) IS NOT NULL)
THEN VALUES(server_port)
ELSE server_port
END,
switch_sn = CASE
WHEN switch_sn != VALUES(switch_sn) OR (switch_sn IS NULL AND VALUES(switch_sn) IS NOT NULL)
THEN VALUES(switch_sn)
ELSE switch_sn
END,
switch_ip = CASE
WHEN switch_ip != VALUES(switch_ip) OR (switch_ip IS NULL AND VALUES(switch_ip) IS NOT NULL)
THEN VALUES(switch_ip)
ELSE switch_ip
END,
update_time = CASE
WHEN device_sn != VALUES(device_sn) OR (device_sn IS NULL AND VALUES(device_sn) IS NOT NULL)
OR node_name != VALUES(node_name) OR (node_name IS NULL AND VALUES(node_name) IS NOT NULL)
OR business_code != VALUES(business_code) OR (business_code IS NULL AND VALUES(business_code) IS NOT NULL)
OR business_name != VALUES(business_name) OR (business_name IS NULL AND VALUES(business_name) IS NOT NULL)
OR switch_name != VALUES(switch_name) OR (switch_name IS NULL AND VALUES(switch_name) IS NOT NULL)
OR interface_device_type != VALUES(interface_device_type) OR (interface_device_type IS NULL AND VALUES(interface_device_type) IS NOT NULL)
OR server_port != VALUES(server_port) OR (server_port IS NULL AND VALUES(server_port) IS NOT NULL)
OR switch_sn != VALUES(switch_sn) OR (switch_sn IS NULL AND VALUES(switch_sn) IS NOT NULL)
OR switch_ip != VALUES(switch_ip) OR (switch_ip IS NULL AND VALUES(switch_ip) IS NOT NULL)
THEN NOW()
ELSE update_time
END
</insert>
<select id="getAllDeviceSn" parameterType="AllInterfaceName" resultType="AllInterfaceName">
@@ -234,7 +234,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.reported_bandwidth as reportedBandwidth,
b.machine_code as machineCode,
(select bandwidth_result from eps_node_bandwidth
where client_id=a.client_id and calculation_mode='1000' and bandwidth_type=1
where client_id=a.client_id and calculation_mode='1000' and bandwidth_type='1'
AND create_time = DATE(DATE_SUB(NOW(), INTERVAL 1 DAY)) limit 1) as bandwidthResult
from rm_resource_registration a
left join rm_registration_machine b on a.client_id = b.client_id