宣城改动 解决记录仪基础数据不更新
parent
688cb8383c
commit
ea4df4a979
6
pom.xml
6
pom.xml
|
|
@ -89,12 +89,12 @@
|
||||||
<id>prod</id>
|
<id>prod</id>
|
||||||
<properties>
|
<properties>
|
||||||
<profiles.active>prod</profiles.active>
|
<profiles.active>prod</profiles.active>
|
||||||
<nacos.server>53.176.146.99:8848</nacos.server>
|
<nacos.server>53.238.79.33:8848</nacos.server>
|
||||||
<nacos.discovery.group>DEFAULT_GROUP</nacos.discovery.group>
|
<nacos.discovery.group>DEFAULT_GROUP</nacos.discovery.group>
|
||||||
<nacos.config.group>DEFAULT_GROUP</nacos.config.group>
|
<nacos.config.group>DEFAULT_GROUP</nacos.config.group>
|
||||||
<nacos.username>nacos</nacos.username>
|
<nacos.username>nacos</nacos.username>
|
||||||
<nacos.password>nacos</nacos.password>
|
<nacos.password>Ycgis!2509</nacos.password>
|
||||||
<logstash.address>53.176.146.99:4560</logstash.address>
|
<logstash.address>53.238.79.33:4560</logstash.address>
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
|
|
|
||||||
|
|
@ -1,87 +1,49 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
<!-- 日志存放路径 -->
|
<!-- 日志存放路径 -->
|
||||||
<property name="log.path" value="logs/${project.artifactId}" />
|
<property name="log.path" value="logs" />
|
||||||
<property name="log.file" value="${project.artifactId}" />
|
<property name="log.file" value="auth" />
|
||||||
|
<property name="MAX_FILE_SIZE" value="30MB" />
|
||||||
|
<property name="MAX_HISTORY" value="30" />
|
||||||
<!-- 日志输出格式 -->
|
<!-- 日志输出格式 -->
|
||||||
<property name="console.log.pattern"
|
<!-- INFO日志Appender -->
|
||||||
value="%red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}%n) - %msg%n"/>
|
<appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.${log.file}.log</file>
|
||||||
<!-- <!– 控制台输出 –>
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>${console.log.pattern}</pattern>
|
|
||||||
<charset>utf-8</charset>
|
|
||||||
</encoder>
|
|
||||||
</appender>-->
|
|
||||||
|
|
||||||
<include resource="logback-common.xml" />
|
|
||||||
|
|
||||||
<include resource="logback-logstash.xml" />
|
|
||||||
|
|
||||||
<!-- 开启 skywalking 日志收集 -->
|
|
||||||
<include resource="logback-skylog.xml" />
|
|
||||||
|
|
||||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
|
|
||||||
<!--如果只是想要 Info 级别的日志,只是过滤 info 还是会输出 Error 日志,因为 Error 的级别高,
|
|
||||||
所以我们使用下面的策略,可以避免输出 Error 的日志-->
|
|
||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
<!--过滤 Error-->
|
<level>INFO</level>
|
||||||
<level>ERROR</level>
|
<onMatch>ACCEPT</onMatch>
|
||||||
<!--匹配到就禁止-->
|
<onMismatch>DENY</onMismatch>
|
||||||
<onMatch>DENY</onMatch>
|
|
||||||
<!--没有匹配到就允许-->
|
|
||||||
<onMismatch>ACCEPT</onMismatch>
|
|
||||||
</filter>
|
</filter>
|
||||||
<!--日志名称,如果没有File 属性,那么只会使用FileNamePattern的文件路径规则
|
|
||||||
如果同时有<File>和<FileNamePattern>,那么当天日志是<File>,明天会自动把今天
|
|
||||||
的日志改名为今天的日期。即,<File> 的日志都是当天的。
|
|
||||||
-->
|
|
||||||
<File>${log.path}${log.file}</File>
|
|
||||||
<encoder>
|
|
||||||
<charset>UTF-8</charset>
|
|
||||||
<pattern>%date [%level] [%thread] %logger{60} [%file : %line] %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
<fileNamePattern>${log.path}info/${log.file}.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
|
<fileNamePattern>${log.path}/info/info.${log.file}.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||||
<maxFileSize>50MB</maxFileSize>
|
<maxFileSize>${MAX_FILE_SIZE}</maxFileSize>
|
||||||
<maxHistory>20</maxHistory> <!-- 保留180天 -->
|
<maxHistory>${MAX_HISTORY}</maxHistory>
|
||||||
</rollingPolicy>
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<!--error log-->
|
<!-- ERROR日志Appender -->
|
||||||
<appender name="ERRORFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
<appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
<!--如果只是想要 Error 级别的日志,那么需要过滤一下,默认是 info 级别的,ThresholdFilter-->
|
<file>${log.path}/error.${log.file}.log</file>
|
||||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||||
<level>Error</level>
|
<level>ERROR</level>
|
||||||
</filter>
|
</filter>
|
||||||
<!--日志名称,如果没有File 属性,那么只会使用FileNamePattern的文件路径规则
|
|
||||||
如果同时有<File>和<FileNamePattern>,那么当天日志是<File>,明天会自动把今天
|
|
||||||
的日志改名为今天的日期。即,<File> 的日志都是当天的。
|
|
||||||
-->
|
|
||||||
<File>${log.path}error.${log.file}</File>
|
|
||||||
<!--滚动策略,按照时间滚动 TimeBasedRollingPolicy-->
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
<!--文件路径,定义了日志的切分方式——把每一天的日志归档到一个文件中,以防止日志填满整个磁盘空间-->
|
<fileNamePattern>${log.path}/error/error.${log.file}.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||||
<FileNamePattern>${log.path}error/${log.file}.%d{yyyy-MM-dd}.%i.gz</FileNamePattern>
|
<maxFileSize>${MAX_FILE_SIZE}</maxFileSize>
|
||||||
<!--只保留最近90天的日志-->
|
<maxHistory>${MAX_HISTORY}</maxHistory>
|
||||||
<maxFileSize>50MB</maxFileSize>
|
|
||||||
<maxHistory>180</maxHistory>
|
|
||||||
<!--用来指定日志文件的上限大小,那么到了这个值,就会删除旧的日志-->
|
|
||||||
<!--<totalSizeCap>1GB</totalSizeCap>-->
|
|
||||||
</rollingPolicy>
|
</rollingPolicy>
|
||||||
<!--日志输出编码格式化-->
|
|
||||||
<encoder>
|
<encoder>
|
||||||
<charset>UTF-8</charset>
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||||
<pattern>%date [%level] [%thread] %logger{60} [%file : %line] %msg%n</pattern>
|
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
|
<!-- 根Logger配置(禁用控制台输出) -->
|
||||||
<root level="INFO">
|
<root level="INFO">
|
||||||
<appender-ref ref="CONSOLE"/>
|
<appender-ref ref="FILE_INFO" />
|
||||||
<appender-ref ref="FILE"/>
|
<appender-ref ref="FILE_ERROR" />
|
||||||
<appender-ref ref="ERRORFILE"/>
|
|
||||||
</root>
|
</root>
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ dubbo:
|
||||||
namespace: ${spring.profiles.active}
|
namespace: ${spring.profiles.active}
|
||||||
database: ${spring.data.redis.database}
|
database: ${spring.data.redis.database}
|
||||||
timeout: ${spring.data.redis.timeout}
|
timeout: ${spring.data.redis.timeout}
|
||||||
backup: 53.176.146.98:26380,53.176.146.99:26380,53.176.146.100:26380
|
backup: 53.238.79.33:26380,53.238.79.34:26380,53.238.79.35:26380
|
||||||
# metadata-report:
|
# metadata-report:
|
||||||
# address: redis://${spring.data.redis.host}:${spring.data.redis.port}
|
# address: redis://${spring.data.redis.host}:${spring.data.redis.port}
|
||||||
# group: DUBBO_GROUP
|
# group: DUBBO_GROUP
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ public class KafkaConfig {
|
||||||
// private String kafkaServers = "140.168.2.31:21007,140.168.2.32:21007,140.168.2.33:21007";
|
// private String kafkaServers = "140.168.2.31:21007,140.168.2.32:21007,140.168.2.33:21007";
|
||||||
// private String kafkaServers = "53.208.61.105:6667,53.208.61.106:6667,53.208.61.107:6667";//六安GA网
|
// private String kafkaServers = "53.208.61.105:6667,53.208.61.106:6667,53.208.61.107:6667";//六安GA网
|
||||||
// private String kafkaServers = "34.72.62.93:9092";//六安视频网
|
// private String kafkaServers = "34.72.62.93:9092";//六安视频网
|
||||||
private String kafkaServers = "53.176.146.99:9092,53.176.146.100:9092,53.176.146.101:9092";//本地
|
private String kafkaServers = "53.238.79.33:9092,53.238.79.34:9092,53.238.79.35:9092";//本地
|
||||||
// private String kafkaServers = "53.238.79.4:9092,53.238.79.5:9092,53.238.79.6:9092";//省厅 马伟提供
|
// private String kafkaServers = "53.238.79.4:9092,53.238.79.5:9092,53.238.79.6:9092";//省厅 马伟提供
|
||||||
|
|
||||||
private String groupId = "ruansiProducer";
|
private String groupId = "ruansiProducer";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package org.dromara.data2es.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Configuration
|
||||||
|
@RefreshScope
|
||||||
|
@ConfigurationProperties(prefix = "ruansi")
|
||||||
|
public class RuansiConfiguration {
|
||||||
|
|
||||||
|
private boolean sendToThirdEnabled;
|
||||||
|
|
||||||
|
private String startUpdateTime;
|
||||||
|
|
||||||
|
private String dsPreurl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -49,7 +49,7 @@ public class DataInsertBatchHandler implements CommandLineRunner {
|
||||||
log.info("batch size={}", list.size());
|
log.info("batch size={}", list.size());
|
||||||
if(CollectionUtil.isNotEmpty(list)) {
|
if(CollectionUtil.isNotEmpty(list)) {
|
||||||
gpsService.saveDataBatch(list);
|
gpsService.saveDataBatch(list);
|
||||||
// storeDataService.saveDataByPersonTypeBatch(list);
|
storeDataService.saveDataByPersonTypeBatch(list);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("缓存队列批量消费异常:{}", e.getMessage());
|
log.error("缓存队列批量消费异常:{}", e.getMessage());
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,17 @@ package org.dromara.data2es.schedule;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.dromara.data2es.config.RuansiConfiguration;
|
||||||
import org.dromara.data2es.domain.DSQinwuEntity;
|
import org.dromara.data2es.domain.DSQinwuEntity;
|
||||||
import org.dromara.data2es.domain.vo.DSResponse;
|
import org.dromara.data2es.domain.vo.DSResponse;
|
||||||
import org.dromara.data2es.service.DSQinwuService;
|
import org.dromara.data2es.service.DSQinwuService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -23,28 +26,23 @@ import java.util.*;
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class BaseDataSchedule {
|
public class BaseDataSchedule {
|
||||||
|
|
||||||
|
|
||||||
private String lastUpdateTime;
|
private String lastUpdateTime;
|
||||||
|
|
||||||
private String preUrl = "http://53.238.84.10:28080/ds-portal-web";
|
// private String preUrl = "http://53.238.84.10:28080/ds-portal-web";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
DSQinwuService dsQinwuService;
|
DSQinwuService dsQinwuService;
|
||||||
|
|
||||||
@Value("${ruansi.ruansi-kafka.send-to-third-enabled}")
|
private final RuansiConfiguration ruansiConfiguration;
|
||||||
private boolean sendToThirdEnabled;
|
|
||||||
|
|
||||||
@Value("${ruansi.ruansi-kafka.start-update-time}")
|
|
||||||
private String startUpdateTime;
|
|
||||||
|
|
||||||
@Value("${ruansi.ruansi-kafka.ds-preurl}")
|
|
||||||
private String dsPreurl;
|
|
||||||
/**
|
/**
|
||||||
* 娱特单位抽取
|
* 娱特单位抽取
|
||||||
*/
|
*/
|
||||||
// @Scheduled(cron = "0/30 * * * * ?")
|
@Scheduled(cron = "0/30 * * * * ?")
|
||||||
public void updateDsQw(){
|
public void updateDsQw(){
|
||||||
if(StringUtils.isBlank(lastUpdateTime)){
|
if(StringUtils.isBlank(lastUpdateTime)){
|
||||||
DSQinwuEntity qinwu = dsQinwuService.lastOne();
|
DSQinwuEntity qinwu = dsQinwuService.lastOne();
|
||||||
|
|
@ -152,7 +150,7 @@ public class BaseDataSchedule {
|
||||||
private DSResponse requestList(String updateTime, String suffixUrl) {
|
private DSResponse requestList(String updateTime, String suffixUrl) {
|
||||||
Map<String,Object> map = new HashMap<>();
|
Map<String,Object> map = new HashMap<>();
|
||||||
map.put("updateTime",updateTime);
|
map.put("updateTime",updateTime);
|
||||||
String content = HttpUtil.get(dsPreurl + suffixUrl, map);
|
String content = HttpUtil.get(ruansiConfiguration.getDsPreurl() + suffixUrl, map);
|
||||||
DSResponse dsResponse = JSONUtil.toBean(content, DSResponse.class);
|
DSResponse dsResponse = JSONUtil.toBean(content, DSResponse.class);
|
||||||
return dsResponse;
|
return dsResponse;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ public class DSQinwuServiceImpl implements DSQinwuService {
|
||||||
public DSQinwuEntity checkExist(DSQinwuEntity dsQinwuEntity) {
|
public DSQinwuEntity checkExist(DSQinwuEntity dsQinwuEntity) {
|
||||||
LambdaQueryWrapper<DSQinwuEntity> lqw = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<DSQinwuEntity> lqw = new LambdaQueryWrapper<>();
|
||||||
lqw.eq(DSQinwuEntity::getImei, dsQinwuEntity.getImei());
|
lqw.eq(DSQinwuEntity::getImei, dsQinwuEntity.getImei());
|
||||||
lqw.eq(DSQinwuEntity::getType, dsQinwuEntity.getType());
|
// lqw.eq(DSQinwuEntity::getType, dsQinwuEntity.getType());
|
||||||
DSQinwuEntity entity = dsQinwuMapper.selectOne(lqw);
|
DSQinwuEntity entity = dsQinwuMapper.selectOne(lqw);
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUnit;
|
import cn.hutool.core.date.DateUnit;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
|
|
@ -176,14 +175,12 @@ public class GpsServiceImpl implements IGpsService {
|
||||||
String deviceCode = originEsGpsInfo.getDeviceCode();
|
String deviceCode = originEsGpsInfo.getDeviceCode();
|
||||||
String deviceType = originEsGpsInfo.getDeviceType();
|
String deviceType = originEsGpsInfo.getDeviceType();
|
||||||
// DeviceEntityV2 de = deviceService.checkDeviceExists(info);
|
// DeviceEntityV2 de = deviceService.checkDeviceExists(info);
|
||||||
Object o = RedisUtils.getBucket(RedisConstants.ONLINE_USERS + deviceType+":" + deviceCode);
|
JSONObject o = RedisUtils.getBucket(RedisConstants.ONLINE_USERS + deviceType+":" + deviceCode);
|
||||||
if (Objects.isNull(o)) {
|
if (Objects.isNull(o)) {
|
||||||
logger.error("redis中的Object=null,deviceType={},deviceCode={}",deviceType,deviceCode);
|
logger.error("redis中的Object=null,deviceType={},deviceCode={}",deviceType,deviceCode);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
JSONObject o1 = (JSONObject) o;
|
EsGpsInfoVO2 esGpsInfoVO2 = JSONUtil.toBean(o, EsGpsInfoVO2.class);
|
||||||
String json = o1.toJSONString();
|
|
||||||
EsGpsInfoVO2 esGpsInfoVO2 = JSON.parseObject(json, EsGpsInfoVO2.class);
|
|
||||||
//更新在线状态和时间,经纬度不变
|
//更新在线状态和时间,经纬度不变
|
||||||
esGpsInfoVO2.setOnline(originEsGpsInfo.getOnline());
|
esGpsInfoVO2.setOnline(originEsGpsInfo.getOnline());
|
||||||
|
|
||||||
|
|
@ -222,14 +219,13 @@ public class GpsServiceImpl implements IGpsService {
|
||||||
String deviceCode = gpsInfoVO2.getDeviceCode();
|
String deviceCode = gpsInfoVO2.getDeviceCode();
|
||||||
String deviceType = gpsInfoVO2.getDeviceType();
|
String deviceType = gpsInfoVO2.getDeviceType();
|
||||||
// DeviceEntityV2 de = deviceService.checkDeviceExists(info);
|
// DeviceEntityV2 de = deviceService.checkDeviceExists(info);
|
||||||
Object o = RedisUtils.getBucket(RedisConstants.ONLINE_USERS + deviceType + ":" + deviceCode);
|
JSONObject o = RedisUtils.getBucket(RedisConstants.ONLINE_USERS + deviceType + ":" + deviceCode);
|
||||||
if (Objects.isNull(o)) {
|
if (Objects.isNull(o)) {
|
||||||
logger.error("redis中的Object=null,deviceType={},deviceCode={}", deviceType, deviceCode);
|
logger.error("redis中的Object=null,deviceType={},deviceCode={}", deviceType, deviceCode);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
JSONObject o1 = (JSONObject) o;
|
|
||||||
String json = o1.toJSONString();
|
EsGpsInfoVO2 esGpsInfoVO2 = JSONUtil.toBean(o, EsGpsInfoVO2.class);
|
||||||
EsGpsInfoVO2 esGpsInfoVO2 = JSON.parseObject(json, EsGpsInfoVO2.class);
|
|
||||||
//更新在线状态和时间,经纬度不变
|
//更新在线状态和时间,经纬度不变
|
||||||
esGpsInfoVO2.setOnline(gpsInfoVO2.getOnline());
|
esGpsInfoVO2.setOnline(gpsInfoVO2.getOnline());
|
||||||
|
|
||||||
|
|
@ -415,7 +411,19 @@ public class GpsServiceImpl implements IGpsService {
|
||||||
}*/
|
}*/
|
||||||
deviceEntityV2.setDeviceCode(deviceCode);
|
deviceEntityV2.setDeviceCode(deviceCode);
|
||||||
deviceEntityV2.setDeviceType(deviceType);
|
deviceEntityV2.setDeviceType(deviceType);
|
||||||
RemoteDeviceVo deviceEntityV21 = BeanUtil.toBean(RedisUtils.getBucket("deviceInfo:" + deviceType+":"+deviceCode), RemoteDeviceVo.class) ;
|
RemoteDeviceVo deviceEntityV21 = new RemoteDeviceVo();
|
||||||
|
if ("5".equals(deviceType)){
|
||||||
|
deviceEntityV21 = BeanUtil.toBean(RedisUtils.getBucket("deviceInfo:" + deviceType+":"+deviceCode), RemoteDeviceVo.class) ;
|
||||||
|
if (null == deviceEntityV21){
|
||||||
|
deviceEntityV21 = BeanUtil.toBean(RedisUtils.getBucket("deviceInfo:8" +":"+deviceCode), RemoteDeviceVo.class) ;
|
||||||
|
if (null == deviceEntityV21){
|
||||||
|
deviceEntityV21 = BeanUtil.toBean(RedisUtils.getBucket("deviceInfo:7" +":"+deviceCode), RemoteDeviceVo.class) ;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
deviceEntityV21 = BeanUtil.toBean(RedisUtils.getBucket("deviceInfo:" + deviceType+":"+deviceCode), RemoteDeviceVo.class) ;
|
||||||
|
}
|
||||||
if(Objects.isNull(deviceEntityV21)){
|
if(Objects.isNull(deviceEntityV21)){
|
||||||
logger.error("库里没有这个数据,deviceCode={}",deviceCode);
|
logger.error("库里没有这个数据,deviceCode={}",deviceCode);
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -438,11 +446,10 @@ public class GpsServiceImpl implements IGpsService {
|
||||||
//如果定位是0的话 ,则上传最后一次有定位的坐标,如果最后一次是0的话,那就上传0
|
//如果定位是0的话 ,则上传最后一次有定位的坐标,如果最后一次是0的话,那就上传0
|
||||||
boolean nonLatLng = isNonLatLng(lat, lng);
|
boolean nonLatLng = isNonLatLng(lat, lng);
|
||||||
if(nonLatLng){
|
if(nonLatLng){
|
||||||
Object o = RedisUtils.getBucket(RedisConstants.ONLINE_USERS + deviceType + ":" + deviceCode);
|
JSONObject o = RedisUtils.getBucket(RedisConstants.ONLINE_USERS + deviceType + ":" + deviceCode);
|
||||||
if(!Objects.isNull(o)) {
|
if(!Objects.isNull(o)) {
|
||||||
com.alibaba.fastjson.JSONObject o1 = (JSONObject) o;
|
|
||||||
String json = o1.toJSONString();
|
EsGpsInfoVO2 esGpsInfoVO3 = JSONUtil.toBean(o, EsGpsInfoVO2.class);
|
||||||
EsGpsInfoVO2 esGpsInfoVO3 = JSON.parseObject(json, EsGpsInfoVO2.class);
|
|
||||||
String lat1 = esGpsInfoVO3.getLat();
|
String lat1 = esGpsInfoVO3.getLat();
|
||||||
String lng1 = esGpsInfoVO3.getLng();
|
String lng1 = esGpsInfoVO3.getLng();
|
||||||
esGpsInfoVO2.setLat(lat1);
|
esGpsInfoVO2.setLat(lat1);
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,6 @@ public class DeviceGPSController {
|
||||||
@DubboReference
|
@DubboReference
|
||||||
RemoteDataToEsService dataToEsService;
|
RemoteDataToEsService dataToEsService;
|
||||||
|
|
||||||
@Value("${ruansi.start_update_time}")
|
|
||||||
private String startUpdateTime;
|
|
||||||
|
|
||||||
private String jlyUpdateTime;
|
|
||||||
|
|
||||||
@Value("${ruansi.last_update_time}")
|
@Value("${ruansi.last_update_time}")
|
||||||
private String lastUpdateTime;
|
private String lastUpdateTime;
|
||||||
|
|
@ -60,22 +56,17 @@ public class DeviceGPSController {
|
||||||
return DateUtil.formatDateTime(info.getGpsTime());
|
return DateUtil.formatDateTime(info.getGpsTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0/10 * * * * ?")
|
@Scheduled(cron = "0/30 * * * * ?")
|
||||||
@Async
|
|
||||||
public void bdgcGps(){
|
public void bdgcGps(){
|
||||||
if(StringUtils.isBlank(lastUpdateTime)){
|
|
||||||
try {
|
|
||||||
lastUpdateTime = getLastUpdateTimeFromProperties();
|
|
||||||
}catch (Exception e){
|
|
||||||
logger.info("lastUpdateTime={},lastUpdateTimeError={}",lastUpdateTime,e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Date date = DateUtil.parseDateTime(lastUpdateTime);
|
// Date date = DateUtil.parseDateTime(lastUpdateTime);
|
||||||
EsGpsInfo gpsInfo = new EsGpsInfo();
|
EsGpsInfo gpsInfo = new EsGpsInfo();
|
||||||
gpsInfo.setGpsTime(DateUtil.parseDateTime(lastUpdateTime));
|
gpsInfo.setGpsTime(DateUtil.parseDateTime(lastUpdateTime));
|
||||||
Instant start = Instant.now();
|
Instant start = Instant.now();
|
||||||
// some code
|
// some code
|
||||||
|
logger.info("进入公车定时任务");
|
||||||
List<EsGpsInfo> list = deviceGpsService.selectBDGCGPS(gpsInfo);
|
List<EsGpsInfo> list = deviceGpsService.selectBDGCGPS(gpsInfo);
|
||||||
|
logger.info("查询结束");
|
||||||
Instant finish = Instant.now();
|
Instant finish = Instant.now();
|
||||||
long timeElapsed = Duration.between(start, finish).toMillis();
|
long timeElapsed = Duration.between(start, finish).toMillis();
|
||||||
logger.info("公车查询耗时:"+timeElapsed);
|
logger.info("公车查询耗时:"+timeElapsed);
|
||||||
|
|
@ -106,59 +97,6 @@ public class DeviceGPSController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0/8 * * * * ?")
|
|
||||||
@Async
|
|
||||||
public void jlyGps(){
|
|
||||||
if(StringUtils.isBlank(jlyUpdateTime)){
|
|
||||||
jlyUpdateTime = startUpdateTime;
|
|
||||||
}
|
|
||||||
EsGpsInfo gpsInfo = new EsGpsInfo();
|
|
||||||
gpsInfo.setGpsTime(DateUtil.parse(jlyUpdateTime));
|
|
||||||
logger.info("更新时间:"+jlyUpdateTime);
|
|
||||||
Instant start = Instant.now();
|
|
||||||
List<EsGpsInfo> list = deviceGpsService.selectJlyGPS(gpsInfo);
|
|
||||||
Instant finish = Instant.now();
|
|
||||||
long timeElapsed = Duration.between(start, finish).toMillis();
|
|
||||||
logger.info("查询耗时:"+timeElapsed);
|
|
||||||
logger.info("数据大小size"+list.size());
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
|
||||||
EsGpsInfo info = list.get(i);
|
|
||||||
if(i == 0){
|
|
||||||
jlyUpdateTime = DateUtil.format(info.getGpsTime(),"yyyy-MM-dd HH:mm:ss") ;
|
|
||||||
}
|
|
||||||
if (DateUtil.between(new Date(),info.getGpsTime(),DateUnit.MINUTE) > 5){
|
|
||||||
info.setOnline("0");
|
|
||||||
}else {
|
|
||||||
info.setOnline("1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ArrayList<EsGpsInfo> collect = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() ->
|
|
||||||
new TreeSet<>(Comparator.comparing(EsGpsInfo::getDeviceCode))), ArrayList::new));
|
|
||||||
dataToEsService.saveDataBatch(BeanUtil.copyToList(collect,RemoteGpsInfo.class));
|
|
||||||
Instant end = Instant.now();
|
|
||||||
long timeEnd = Duration.between(finish, end).toMillis();
|
|
||||||
logger.info("方法执行逻辑耗时:"+timeEnd);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Scheduled(cron = "0/30 * * * * ?")
|
|
||||||
public void jlyGpsStatus(){
|
|
||||||
if(StringUtils.isBlank(jlyUpdateTime)){
|
|
||||||
jlyUpdateTime = startUpdateTime;
|
|
||||||
}
|
|
||||||
EsGpsInfo gpsInfo = new EsGpsInfo();
|
|
||||||
gpsInfo.setGpsTime(DateUtil.parse(jlyUpdateTime));
|
|
||||||
List<EsGpsInfo> list = deviceGpsService.selectJlyStatus(gpsInfo);
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
|
||||||
EsGpsInfo info = list.get(i);
|
|
||||||
if(i == 0){
|
|
||||||
jlyUpdateTime = DateUtil.format(info.getGpsTime(),"yyyy-MM-dd HH:mm:ss") ;
|
|
||||||
}
|
|
||||||
info.setGpsTime(null);
|
|
||||||
}
|
|
||||||
dataToEsService.updateOnlineStatusBatch(BeanUtil.copyToList(list,RemoteGpsInfo.class));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void resetUpdateTime(String lastUpdateTime) {
|
private void resetUpdateTime(String lastUpdateTime) {
|
||||||
|
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
package org.dromara.extract.schedule;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
|
||||||
import org.dromara.extract.domain.Device;
|
|
||||||
import org.dromara.extract.service.IDeviceService;
|
|
||||||
import org.dromara.system.api.RemoteDeviceService;
|
|
||||||
import org.dromara.system.api.domain.bo.RemoteDeviceBo;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@Slf4j
|
|
||||||
/*
|
|
||||||
* 交警记录仪基础信息定时抽取
|
|
||||||
* */
|
|
||||||
public class JJDeviceSchedule {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
IDeviceService deviceService;
|
|
||||||
|
|
||||||
@DubboReference
|
|
||||||
RemoteDeviceService remoteDeviceService;
|
|
||||||
|
|
||||||
@Value("${ruansi.start_jlyupdate_time}")
|
|
||||||
private String startUpdateTime;
|
|
||||||
|
|
||||||
private String lastUpdateTime = "";
|
|
||||||
|
|
||||||
|
|
||||||
@Scheduled(cron = "0 0/10 * * * ?")
|
|
||||||
public void saveORUpdateJly(){
|
|
||||||
if(StringUtils.isBlank(lastUpdateTime)){
|
|
||||||
lastUpdateTime = startUpdateTime;
|
|
||||||
}
|
|
||||||
Device device = new Device();
|
|
||||||
device.setUpdateTime(DateUtil.parse(lastUpdateTime));
|
|
||||||
List<Device> list = deviceService.selectJly(device);
|
|
||||||
remoteDeviceService.batchSaveDevice(BeanUtil.copyToList(list, RemoteDeviceBo.class));
|
|
||||||
if (list.size() != 0){
|
|
||||||
lastUpdateTime = DateUtil.format(list.get(0).getUpdateTime(),"yyyy-MM-dd HH:mm:ss") ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -36,11 +36,13 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectBDGCGPS" parameterType="org.dromara.extract.domain.EsGpsInfo" resultMap="DeviceResult">
|
<select id="selectBDGCGPS" parameterType="org.dromara.extract.domain.EsGpsInfo" resultMap="DeviceResult">
|
||||||
select terminalid deviceCode,'2' deviceType, lon lng, lat lat, gpstime gpsTime from car_gps_info
|
select id, deviceCode,deviceType,lng,lat, gpsTime, speed from (
|
||||||
|
select id, gpsid deviceCode,'2' deviceType, longitude lng, latitude lat, DATE_FORMAT(time,'%Y-%m-%d %H:%i:%s') gpsTime, speed speed from vehicle_trajectory
|
||||||
<where>
|
<where>
|
||||||
<if test="gpsTime != null "> and gpstime >= #{gpsTime}</if>
|
<if test="gpsTime != null "> and time > #{gpsTime}</if>
|
||||||
</where>
|
</where>
|
||||||
order by gpstime desc
|
) a group by deviceCode
|
||||||
|
order by gpsTime desc limit 100
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectBDGCMaxTime" resultMap="DeviceResult">
|
<select id="selectBDGCMaxTime" resultMap="DeviceResult">
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,9 @@ public class SearchServiceImpl implements ISearchService {
|
||||||
List<RemoteDictDataVo> list = dictService.selectDictDataByType("zd_device_type");
|
List<RemoteDictDataVo> list = dictService.selectDictDataByType("zd_device_type");
|
||||||
List<String> maps = new ArrayList<>();
|
List<String> maps = new ArrayList<>();
|
||||||
for (RemoteDictDataVo dataVo : list) {
|
for (RemoteDictDataVo dataVo : list) {
|
||||||
|
if (null != dataVo.getRemark() && dataVo.getRemark().contains("无短信")){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
BoolQueryBuilder boolBuilder = QueryBuilders.boolQuery();
|
BoolQueryBuilder boolBuilder = QueryBuilders.boolQuery();
|
||||||
// 匹配第二个
|
// 匹配第二个
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package org.dromara.system.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Configuration
|
||||||
|
@RefreshScope
|
||||||
|
@ConfigurationProperties(prefix = "ywry")
|
||||||
|
public class YwryProperties {
|
||||||
|
|
||||||
|
private String phone1;
|
||||||
|
|
||||||
|
//运维人员2手机号
|
||||||
|
private String phone2;
|
||||||
|
|
||||||
|
private Boolean isSend; // 自动匹配 is_send/is-send/isSend
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -9,7 +9,9 @@ import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.redis.utils.RedisUtils;
|
import org.dromara.common.redis.utils.RedisUtils;
|
||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
import org.dromara.location.api.RemoteElasticSearchService;
|
import org.dromara.location.api.RemoteElasticSearchService;
|
||||||
|
import org.dromara.system.config.YwryProperties;
|
||||||
import org.dromara.system.domain.DeviceRedis;
|
import org.dromara.system.domain.DeviceRedis;
|
||||||
|
import org.dromara.system.domain.SysMessageMas;
|
||||||
import org.dromara.system.domain.SysNotice;
|
import org.dromara.system.domain.SysNotice;
|
||||||
import org.dromara.system.domain.bo.SysDeptBo;
|
import org.dromara.system.domain.bo.SysDeptBo;
|
||||||
import org.dromara.system.domain.bo.SysNoticeBo;
|
import org.dromara.system.domain.bo.SysNoticeBo;
|
||||||
|
|
@ -17,6 +19,7 @@ import org.dromara.system.domain.bo.TDeviceBo;
|
||||||
import org.dromara.system.domain.vo.*;
|
import org.dromara.system.domain.vo.*;
|
||||||
import org.dromara.system.service.*;
|
import org.dromara.system.service.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
@ -36,12 +39,15 @@ public class IndexStaticsController extends BaseController {
|
||||||
|
|
||||||
private final ISysNoticeService noticeService;
|
private final ISysNoticeService noticeService;
|
||||||
|
|
||||||
|
private final ISysMessageMasService masService;
|
||||||
|
|
||||||
|
private final YwryProperties ywryProperties;
|
||||||
|
|
||||||
@DubboReference
|
@DubboReference
|
||||||
RemoteElasticSearchService elasticSearchService;
|
RemoteElasticSearchService elasticSearchService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 在线终端数量
|
* 在线终端数量
|
||||||
* */
|
* */
|
||||||
|
|
@ -93,18 +99,30 @@ public class IndexStaticsController extends BaseController {
|
||||||
@Scheduled(cron = "0 */30 * * * ?")
|
@Scheduled(cron = "0 */30 * * * ?")
|
||||||
public void listen(){
|
public void listen(){
|
||||||
List<String> strs = elasticSearchService.linstenDataStatus();
|
List<String> strs = elasticSearchService.linstenDataStatus();
|
||||||
if (strs.size() >0){
|
if (ywryProperties.getIsSend()){
|
||||||
List<SysNoticeVo> nlist = noticeService.selectTodayNoticeList();
|
if (strs.size() >0){
|
||||||
if (nlist.size() <=2){
|
List<SysNoticeVo> nlist = noticeService.selectTodayNoticeList();
|
||||||
// -- todo 发送短信
|
if (nlist.size() <=2){
|
||||||
SysNoticeBo noticeBo = new SysNoticeBo();
|
// -- todo 发送短信
|
||||||
noticeBo.setNoticeTitle("手机号码");
|
SysNoticeBo noticeBo = new SysNoticeBo();
|
||||||
noticeBo.setNoticeType("3");
|
noticeBo.setNoticeTitle(ywryProperties.getPhone1());
|
||||||
noticeBo.setNoticeContent(strs.toString()+"数据不正常,请检查服务是否正常");
|
noticeBo.setNoticeType("3");
|
||||||
noticeBo.setCreateTime(DateUtil.date());
|
noticeBo.setNoticeContent(strs.toString()+"数据不正常,请检查服务是否正常");
|
||||||
noticeService.insertNotice(noticeBo);
|
noticeBo.setCreateTime(DateUtil.date());
|
||||||
}
|
noticeService.insertNotice(noticeBo);
|
||||||
|
noticeBo.setNoticeTitle(ywryProperties.getPhone2());
|
||||||
|
noticeService.insertNotice(noticeBo);
|
||||||
|
|
||||||
|
SysMessageMas mas = new SysMessageMas();
|
||||||
|
mas.setContent(strs.toString()+"数据不正常,请检查服务是否正常");
|
||||||
|
mas.setMobiles(ywryProperties.getPhone1());
|
||||||
|
mas.setAddserial("1234");
|
||||||
|
masService.insertMessage(mas);
|
||||||
|
mas.setMobiles(ywryProperties.getPhone2());
|
||||||
|
masService.insertMessage(mas);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.dromara.system.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 宣城短信接口对接 实体类
|
||||||
|
* */
|
||||||
|
@Data
|
||||||
|
@TableName("sys_message_mas")
|
||||||
|
public class SysMessageMas {
|
||||||
|
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
private String mobiles;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
private String addserial;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package org.dromara.system.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("sys_dept_jly")
|
||||||
|
public class SysdeptJly {
|
||||||
|
|
||||||
|
private String qymc;
|
||||||
|
|
||||||
|
private String fqylj;
|
||||||
|
|
||||||
|
private String qyCode;
|
||||||
|
|
||||||
|
private String deptId;
|
||||||
|
|
||||||
|
private String deptName;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
package org.dromara.system.domain.bo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.dromara.system.domain.SysDept;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = SysDept.class, reverseConvertGenerate = false)
|
||||||
|
public class SysdeptJlyBo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private String qymc;
|
||||||
|
|
||||||
|
private String fqylj;
|
||||||
|
|
||||||
|
private String qyCode;
|
||||||
|
|
||||||
|
private String deptId;
|
||||||
|
|
||||||
|
private String deptName;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package org.dromara.system.domain.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.dromara.system.domain.SysDept;
|
||||||
|
import org.dromara.system.domain.SysdeptJly;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = SysdeptJly.class)
|
||||||
|
public class SysdeptJlyVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private String qymc;
|
||||||
|
|
||||||
|
private String fqylj;
|
||||||
|
|
||||||
|
private String qyCode;
|
||||||
|
|
||||||
|
private String deptId;
|
||||||
|
|
||||||
|
private String deptName;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
package org.dromara.system.mapper;
|
||||||
|
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
import org.dromara.system.domain.SysdeptJly;
|
||||||
|
import org.dromara.system.domain.vo.SysdeptJlyVo;
|
||||||
|
|
||||||
|
public interface SysDeptJlyMapper extends BaseMapperPlus<SysdeptJly, SysdeptJlyVo> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
package org.dromara.system.mapper;
|
||||||
|
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
import org.dromara.system.domain.SysMessageMas;
|
||||||
|
|
||||||
|
public interface SysMessageMasMapper extends BaseMapperPlus<SysMessageMas,SysMessageMas> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -38,4 +38,6 @@ public interface TDeviceMapper extends BaseMapperPlus<TDevice, TDeviceVo> {
|
||||||
|
|
||||||
int updateBatch(HashMap<String,Object> map);
|
int updateBatch(HashMap<String,Object> map);
|
||||||
|
|
||||||
|
int insertOrUpdateByCodeAndType(TDevice device);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
package org.dromara.system.service;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.SysMessageMas;
|
||||||
|
|
||||||
|
public interface ISysMessageMasService {
|
||||||
|
|
||||||
|
int insertMessage(SysMessageMas mas);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package org.dromara.system.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.system.domain.SysMessageMas;
|
||||||
|
import org.dromara.system.mapper.SysMessageMasMapper;
|
||||||
|
import org.dromara.system.service.ISysMessageMasService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
@DS("slave")
|
||||||
|
public class SysMessageMasServiceImpl implements ISysMessageMasService {
|
||||||
|
|
||||||
|
private final SysMessageMasMapper baseMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insertMessage(SysMessageMas mas) {
|
||||||
|
return baseMapper.insert(mas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -15,8 +15,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.system.api.RemoteDataScopeService;
|
import org.dromara.system.api.RemoteDataScopeService;
|
||||||
|
import org.dromara.system.domain.SysdeptJly;
|
||||||
import org.dromara.system.domain.vo.DeviceStaticsVo;
|
import org.dromara.system.domain.vo.DeviceStaticsVo;
|
||||||
|
import org.dromara.system.domain.vo.SysdeptJlyVo;
|
||||||
import org.dromara.system.domain.vo.TDeviceExportVo;
|
import org.dromara.system.domain.vo.TDeviceExportVo;
|
||||||
|
import org.dromara.system.mapper.SysDeptJlyMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.dromara.system.domain.bo.TDeviceBo;
|
import org.dromara.system.domain.bo.TDeviceBo;
|
||||||
import org.dromara.system.domain.vo.TDeviceVo;
|
import org.dromara.system.domain.vo.TDeviceVo;
|
||||||
|
|
@ -42,6 +45,8 @@ public class TDeviceServiceImpl implements ITDeviceService {
|
||||||
|
|
||||||
private final TDeviceMapper baseMapper;
|
private final TDeviceMapper baseMapper;
|
||||||
|
|
||||||
|
private final SysDeptJlyMapper deptJlyMapper;
|
||||||
|
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private RemoteDataScopeService remoteDataScopeService;
|
private RemoteDataScopeService remoteDataScopeService;
|
||||||
|
|
||||||
|
|
@ -232,18 +237,29 @@ public class TDeviceServiceImpl implements ITDeviceService {
|
||||||
public Boolean batchSaveOrUpdate(List<TDevice> list) {
|
public Boolean batchSaveOrUpdate(List<TDevice> list) {
|
||||||
boolean flag = true;
|
boolean flag = true;
|
||||||
// 先根据 field1 和 field2 查询出已存在的记录
|
// 先根据 field1 和 field2 查询出已存在的记录
|
||||||
List<TDevice> existingEntities = baseMapper.selectList(new QueryWrapper<TDevice>()
|
/*List<TDevice> existingEntities = baseMapper.selectList(new QueryWrapper<TDevice>()
|
||||||
.in("device_code", list.stream().map(TDevice::getDeviceCode).collect(Collectors.toList()))
|
.in("device_code", list.stream().map(TDevice::getDeviceCode).collect(Collectors.toList()))
|
||||||
.in("device_type", list.stream().map(TDevice::getDeviceType).collect(Collectors.toList())));
|
.in("device_type", list.stream().map(TDevice::getDeviceType).collect(Collectors.toList())));
|
||||||
|
*/
|
||||||
// 找到需要更新的记录
|
// 找到需要更新的记录
|
||||||
List<TDevice> toUpdate = new ArrayList<>();
|
List<TDevice> toUpdate = new ArrayList<>();
|
||||||
// 找到需要插入的记录
|
// 找到需要插入的记录
|
||||||
List<TDevice> toInsert = new ArrayList<>();
|
List<TDevice> toInsert = new ArrayList<>();
|
||||||
|
LambdaQueryWrapper<SysdeptJly> lqw = new LambdaQueryWrapper<>();
|
||||||
for (TDevice entity : list) {
|
for (TDevice entity : list) {
|
||||||
boolean exists = false;
|
// boolean exists = false;
|
||||||
for (TDevice existingEntity : existingEntities) {
|
if (entity.getDeviceType().equals("5") || entity.getDeviceType().equals("8")
|
||||||
|
|| entity.getDeviceType().equals("7")){ // 记录仪、5G车载、布控球 处理机构
|
||||||
|
lqw.eq(SysdeptJly::getQyCode,entity.getZzjgdm());
|
||||||
|
SysdeptJlyVo jlyVo = deptJlyMapper.selectVoOne(lqw);
|
||||||
|
if (null != jlyVo){
|
||||||
|
entity.setZzjgdm(jlyVo.getDeptId());
|
||||||
|
entity.setZzjgmc(jlyVo.getDeptName());
|
||||||
|
}
|
||||||
|
baseMapper.insertOrUpdateByCodeAndType(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*for (TDevice existingEntity : existingEntities) {
|
||||||
if (entity.getDeviceCode().equals(existingEntity.getDeviceCode()) && entity.getDeviceType().equals(existingEntity.getDeviceType())) {
|
if (entity.getDeviceCode().equals(existingEntity.getDeviceCode()) && entity.getDeviceType().equals(existingEntity.getDeviceType())) {
|
||||||
entity.setId(existingEntity.getId()); // 设置 ID 以便更新
|
entity.setId(existingEntity.getId()); // 设置 ID 以便更新
|
||||||
toUpdate.add(entity);
|
toUpdate.add(entity);
|
||||||
|
|
@ -253,18 +269,18 @@ public class TDeviceServiceImpl implements ITDeviceService {
|
||||||
}
|
}
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
toInsert.add(entity);
|
toInsert.add(entity);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// 批量更新
|
// 批量更新
|
||||||
if (!toUpdate.isEmpty()) {
|
/*if (!toUpdate.isEmpty()) {
|
||||||
flag = baseMapper.updateBatchById(toUpdate);
|
flag = baseMapper.updateBatchById(toUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 批量插入
|
// 批量插入
|
||||||
if (!toInsert.isEmpty()) {
|
if (!toInsert.isEmpty()) {
|
||||||
flag = baseMapper.insertBatch(toInsert); // insertBatchSomeColumn 是 MyBatis-Plus 提供的批量插入方法
|
flag = baseMapper.insertBatch(toInsert); // insertBatchSomeColumn 是 MyBatis-Plus 提供的批量插入方法
|
||||||
}
|
}*/
|
||||||
return flag;
|
return flag;
|
||||||
// return baseMapper.insertOrUpdateBatch(List);
|
// return baseMapper.insertOrUpdateBatch(List);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.dromara.system.mapper.SysDeptJlyMapper">
|
||||||
|
|
||||||
|
<resultMap type="org.dromara.system.domain.vo.SysdeptJlyVo" id="SysDeptJlyResult">
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.dromara.system.mapper.SysMessageMasMapper">
|
||||||
|
|
||||||
|
<resultMap type="org.dromara.system.domain.SysMessageMas" id="SysMessageMasResult">
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -42,4 +42,15 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<insert id="insertOrUpdateByCodeAndType">
|
||||||
|
insert into t_device (device_code, device_type, zzjgdm, zzjgmc, police_no, police_name, phone_num, car_num, valid,
|
||||||
|
remark1, remark2, card_num, create_time, update_time)
|
||||||
|
values (#{deviceCode},#{deviceType},#{zzjgdm},#{zzjgmc},#{policeNo},#{policeName},#{phoneNum},#{carNum},#{valid},
|
||||||
|
#{remark1},#{remark2},#{cardNum},#{createTime},#{updateTime})
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
zzjgdm = values(zzjgdm),zzjgmc = values(zzjgmc),police_no = values(police_no),police_name = values(police_name),phone_num = values(phone_num),
|
||||||
|
car_num = values(car_num),valid = values(valid),remark1 = values(remark1),remark2 = values(remark2),card_num = values(card_num),
|
||||||
|
update_time = now()
|
||||||
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ public class MyApplicationContextRefreshedListener implements ApplicationListene
|
||||||
//滁州
|
//滁州
|
||||||
// public static final String WEBSOCKET_URL = "ws://53.193.3.5:32090/vms/websocket/socketServer.do";
|
// public static final String WEBSOCKET_URL = "ws://53.193.3.5:32090/vms/websocket/socketServer.do";
|
||||||
//铜陵
|
//铜陵
|
||||||
public static final String WEBSOCKET_URL = "ws://53.176.146.97:32090/vms/websocket/socketServer.do";
|
public static final String WEBSOCKET_URL = "ws://53.238.84.26:32090/vms/websocket/socketServer.do";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定义websocket配置
|
* 定义websocket配置
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,9 @@ public class DeviceSchedule {
|
||||||
RemoteDeviceService deviceService;
|
RemoteDeviceService deviceService;
|
||||||
|
|
||||||
|
|
||||||
@Scheduled( cron = "0 */3 * * * ?")
|
@Scheduled( cron = "0 */10 * * * ?")
|
||||||
public void deviceTrans(){
|
public void deviceTrans(){
|
||||||
|
log.info("进入更新记录仪设备");
|
||||||
if(StringUtils.isBlank(lastUpdateTime)){
|
if(StringUtils.isBlank(lastUpdateTime)){
|
||||||
lastUpdateTime = startUpdateTime;
|
lastUpdateTime = startUpdateTime;
|
||||||
}
|
}
|
||||||
|
|
@ -85,7 +86,8 @@ public class DeviceSchedule {
|
||||||
Timestamp updateTime = originDevice.getUpdateTime();
|
Timestamp updateTime = originDevice.getUpdateTime();
|
||||||
// DateTime dateTime = DateUtil.offsetHour(updateTime, 13);
|
// DateTime dateTime = DateUtil.offsetHour(updateTime, 13);
|
||||||
newDevice.setUpdateTime(DateUtil.formatDateTime(updateTime) );
|
newDevice.setUpdateTime(DateUtil.formatDateTime(updateTime) );
|
||||||
setZzjgdm(newDevice,originDevice);
|
newDevice.setZzjgdm(originDevice.getParentId());
|
||||||
|
// setZzjgdm(newDevice,originDevice);
|
||||||
|
|
||||||
}
|
}
|
||||||
if(StringUtils.isBlank(newDevice.getZzjgdm())){
|
if(StringUtils.isBlank(newDevice.getZzjgdm())){
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,49 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
<!-- 日志存放路径 -->
|
<!-- 日志存放路径 -->
|
||||||
<property name="log.path" value="logs/${project.artifactId}" />
|
<property name="log.path" value="logs" />
|
||||||
<!-- 日志输出格式 -->
|
<property name="log.file" value="monitor" />
|
||||||
<property name="console.log.pattern"
|
<property name="MAX_FILE_SIZE" value="30MB" />
|
||||||
value="%red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}%n) - %msg%n"/>
|
<property name="MAX_HISTORY" value="30" />
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
<!-- 控制台输出 -->
|
<!-- INFO日志Appender -->
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.${log.file}.log</file>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<level>INFO</level>
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${log.path}/info/info.${log.file}.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||||
|
<maxFileSize>${MAX_FILE_SIZE}</maxFileSize>
|
||||||
|
<maxHistory>${MAX_HISTORY}</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
<encoder>
|
<encoder>
|
||||||
<pattern>${console.log.pattern}</pattern>
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||||
<charset>utf-8</charset>
|
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<include resource="logback-common.xml" />
|
<!-- ERROR日志Appender -->
|
||||||
|
<appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/error.${log.file}.log</file>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||||
|
<level>ERROR</level>
|
||||||
|
</filter>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${log.path}/error/error.${log.file}.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||||
|
<maxFileSize>${MAX_FILE_SIZE}</maxFileSize>
|
||||||
|
<maxHistory>${MAX_HISTORY}</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
<include resource="logback-logstash.xml" />
|
<!-- 根Logger配置(禁用控制台输出) -->
|
||||||
|
<root level="INFO">
|
||||||
<!-- 开启 skywalking 日志收集 -->
|
<appender-ref ref="FILE_INFO" />
|
||||||
<include resource="logback-skylog.xml" />
|
<appender-ref ref="FILE_ERROR" />
|
||||||
|
|
||||||
<!--系统操作日志-->
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="console" />
|
|
||||||
</root>
|
</root>
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
|
||||||
|
|
@ -41,9 +41,9 @@ db.num=1
|
||||||
|
|
||||||
### Connect URL of DB:
|
### Connect URL of DB:
|
||||||
#db.url.0=jdbc:mysql://127.0.0.1:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
|
#db.url.0=jdbc:mysql://127.0.0.1:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
|
||||||
db.url.0=jdbc:mysql://53.176.146.102:3306/wzhj-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
|
db.url.0=jdbc:mysql://53.238.79.3:3306/wzhj-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
|
||||||
db.user.0=root
|
db.user.0=root
|
||||||
db.password.0=Ycgis!2509
|
db.password.0=ycgis
|
||||||
|
|
||||||
### the maximum retry times for push
|
### the maximum retry times for push
|
||||||
nacos.config.push.maxRetryTime=50
|
nacos.config.push.maxRetryTime=50
|
||||||
|
|
|
||||||
|
|
@ -1,99 +1,49 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
<!-- 日志存放路径 -->
|
<!-- 日志存放路径 -->
|
||||||
<property name="log.path" value="logs/${project.artifactId}" />
|
<property name="log.path" value="logs" />
|
||||||
<property name="log.file" value="${project.artifactId}" />
|
<property name="log.file" value="gateway" />
|
||||||
|
<property name="MAX_FILE_SIZE" value="10MB" />
|
||||||
|
<property name="MAX_HISTORY" value="30" />
|
||||||
<!-- 日志输出格式 -->
|
<!-- 日志输出格式 -->
|
||||||
<property name="console.log.pattern"
|
<!-- INFO日志Appender -->
|
||||||
value="%red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}%n) - %msg%n"/>
|
<appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.${log.file}.log</file>
|
||||||
|
|
||||||
<!-- 控制台输出 -->
|
|
||||||
<appender name="file_console" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/console.log</file>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<!-- 日志文件名格式 -->
|
|
||||||
<fileNamePattern>${log.path}/console.%d{yyyy-MM-dd}.log</fileNamePattern>
|
|
||||||
<!-- 日志最大 1天 -->
|
|
||||||
<maxHistory>1</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
<charset>utf-8</charset>
|
|
||||||
</encoder>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
|
||||||
<!-- 过滤的级别 -->
|
|
||||||
<level>INFO</level>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
|
|
||||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
|
|
||||||
<!--如果只是想要 Info 级别的日志,只是过滤 info 还是会输出 Error 日志,因为 Error 的级别高,
|
|
||||||
所以我们使用下面的策略,可以避免输出 Error 的日志-->
|
|
||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
<!--过滤 Error-->
|
<level>INFO</level>
|
||||||
<level>ERROR</level>
|
<onMatch>ACCEPT</onMatch>
|
||||||
<!--匹配到就禁止-->
|
<onMismatch>DENY</onMismatch>
|
||||||
<onMatch>DENY</onMatch>
|
|
||||||
<!--没有匹配到就允许-->
|
|
||||||
<onMismatch>ACCEPT</onMismatch>
|
|
||||||
</filter>
|
</filter>
|
||||||
<!--日志名称,如果没有File 属性,那么只会使用FileNamePattern的文件路径规则
|
|
||||||
如果同时有<File>和<FileNamePattern>,那么当天日志是<File>,明天会自动把今天
|
|
||||||
的日志改名为今天的日期。即,<File> 的日志都是当天的。
|
|
||||||
-->
|
|
||||||
<File>${log.path}${log.file}</File>
|
|
||||||
<encoder>
|
|
||||||
<charset>UTF-8</charset>
|
|
||||||
<pattern>%date [%level] [%thread] %logger{60} [%file : %line] %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
<fileNamePattern>${log.path}info/${log.file}.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
|
<fileNamePattern>${log.path}/info/info.${log.file}.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||||
<maxFileSize>50MB</maxFileSize>
|
<maxFileSize>${MAX_FILE_SIZE}</maxFileSize>
|
||||||
<maxHistory>20</maxHistory> <!-- 保留180天 -->
|
<maxHistory>${MAX_HISTORY}</maxHistory>
|
||||||
</rollingPolicy>
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<!--error log-->
|
<!-- ERROR日志Appender -->
|
||||||
<appender name="ERRORFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
<appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
<!--如果只是想要 Error 级别的日志,那么需要过滤一下,默认是 info 级别的,ThresholdFilter-->
|
<file>${log.path}/error.${log.file}.log</file>
|
||||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||||
<level>Error</level>
|
<level>ERROR</level>
|
||||||
</filter>
|
</filter>
|
||||||
<!--日志名称,如果没有File 属性,那么只会使用FileNamePattern的文件路径规则
|
|
||||||
如果同时有<File>和<FileNamePattern>,那么当天日志是<File>,明天会自动把今天
|
|
||||||
的日志改名为今天的日期。即,<File> 的日志都是当天的。
|
|
||||||
-->
|
|
||||||
<File>${log.path}error.${log.file}</File>
|
|
||||||
<!--滚动策略,按照时间滚动 TimeBasedRollingPolicy-->
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
<!--文件路径,定义了日志的切分方式——把每一天的日志归档到一个文件中,以防止日志填满整个磁盘空间-->
|
<fileNamePattern>${log.path}/error/error.${log.file}.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||||
<FileNamePattern>${log.path}error/${log.file}.%d{yyyy-MM-dd}.%i.gz</FileNamePattern>
|
<maxFileSize>${MAX_FILE_SIZE}</maxFileSize>
|
||||||
<!--只保留最近90天的日志-->
|
<maxHistory>${MAX_HISTORY}</maxHistory>
|
||||||
<maxFileSize>50MB</maxFileSize>
|
|
||||||
<maxHistory>180</maxHistory>
|
|
||||||
<!--用来指定日志文件的上限大小,那么到了这个值,就会删除旧的日志-->
|
|
||||||
<!--<totalSizeCap>1GB</totalSizeCap>-->
|
|
||||||
</rollingPolicy>
|
</rollingPolicy>
|
||||||
<!--日志输出编码格式化-->
|
|
||||||
<encoder>
|
<encoder>
|
||||||
<charset>UTF-8</charset>
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||||
<pattern>%date [%level] [%thread] %logger{60} [%file : %line] %msg%n</pattern>
|
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
|
<!-- 根Logger配置(禁用控制台输出) -->
|
||||||
<include resource="logback-logstash.xml" />
|
|
||||||
|
|
||||||
<!-- 开启 skywalking 日志收集 -->
|
|
||||||
<include resource="logback-skylog.xml" />
|
|
||||||
|
|
||||||
<root level="INFO">
|
<root level="INFO">
|
||||||
<appender-ref ref="console"/>
|
<appender-ref ref="FILE_INFO" />
|
||||||
<appender-ref ref="FILE"/>
|
<appender-ref ref="FILE_ERROR" />
|
||||||
<appender-ref ref="ERRORFILE"/>
|
|
||||||
<appender-ref ref="file_console"/>
|
|
||||||
</root>
|
</root>
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue