Compare commits
3 Commits
79146e77c4
...
638c54684f
| Author | SHA1 | Date |
|---|---|---|
|
|
638c54684f | |
|
|
ac0080fe7f | |
|
|
83fac17fe1 |
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>10.129.221.10: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>10.129.221.10: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="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="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>
|
||||||
|
|
|
||||||
|
|
@ -19,31 +19,31 @@ dubbo:
|
||||||
password: ${spring.cloud.nacos.password}
|
password: ${spring.cloud.nacos.password}
|
||||||
parameters:
|
parameters:
|
||||||
namespace: ${spring.profiles.active}
|
namespace: ${spring.profiles.active}
|
||||||
metadata-report:
|
|
||||||
address: redis://${spring.data.redis.host}:${spring.data.redis.port}
|
|
||||||
group: DUBBO_GROUP
|
|
||||||
username: dubbo
|
|
||||||
password: ruoyi123
|
|
||||||
# 集群开关
|
|
||||||
sentinel: true
|
|
||||||
parameters:
|
|
||||||
namespace: ${spring.profiles.active}
|
|
||||||
database: ${spring.data.redis.database}
|
|
||||||
timeout: ${spring.data.redis.timeout}
|
|
||||||
backup: 53.176.146.98:26380,53.176.146.99:26380,53.176.146.100: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
|
||||||
# username: dubbo
|
# username: dubbo
|
||||||
# password: ${spring.data.redis.password}
|
# password: Ycgis@2509
|
||||||
# # 集群开关
|
# # 集群开关
|
||||||
# cluster: false
|
# sentinel: false
|
||||||
# parameters:
|
# parameters:
|
||||||
# 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}
|
||||||
# # 集群地址 cluster 为 true 生效
|
# backup: 53.176.146.98:26380,53.176.146.99:26380,53.176.146.100:26380
|
||||||
# backup: 127.0.0.1:6379,127.0.0.1:6381
|
metadata-report:
|
||||||
|
address: redis://${spring.data.redis.host}:${spring.data.redis.port}
|
||||||
|
group: DUBBO_GROUP
|
||||||
|
username: dubbo
|
||||||
|
password: ${spring.data.redis.password}
|
||||||
|
# 集群开关
|
||||||
|
cluster: false
|
||||||
|
parameters:
|
||||||
|
namespace: ${spring.profiles.active}
|
||||||
|
database: ${spring.data.redis.database}
|
||||||
|
timeout: ${spring.data.redis.timeout}
|
||||||
|
# 集群地址 cluster 为 true 生效
|
||||||
|
backup: 127.0.0.1:6379,127.0.0.1:6381
|
||||||
# 消费者相关配置
|
# 消费者相关配置
|
||||||
consumer:
|
consumer:
|
||||||
# 结果缓存(LRU算法)
|
# 结果缓存(LRU算法)
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,9 @@ public class RedisExpireListener extends KeyExpirationEventMessageListener {
|
||||||
|
|
||||||
String deviceType = split[2];
|
String deviceType = split[2];
|
||||||
String deviceCode = split[3];
|
String deviceCode = split[3];
|
||||||
if ("5".equals(deviceType) || "9".equals(deviceType) || "8".equals(deviceType) || "7".equals(deviceType)){
|
/*if ("5".equals(deviceType) || "9".equals(deviceType) || "8".equals(deviceType) || "7".equals(deviceType)){
|
||||||
return;
|
return;
|
||||||
}
|
}*/
|
||||||
log.error("redis key expired:key={}",expiredKey);
|
log.error("redis key expired:key={}",expiredKey);
|
||||||
JSONObject object = RedisUtils.getBucket(RedisConstants.ONLINE_USERS + deviceType+":"+deviceCode);
|
JSONObject object = RedisUtils.getBucket(RedisConstants.ONLINE_USERS + deviceType+":"+deviceCode);
|
||||||
if (Objects.isNull(object)) {
|
if (Objects.isNull(object)) {
|
||||||
|
|
|
||||||
|
|
@ -33,13 +33,13 @@ public class BaseDataSchedule {
|
||||||
@Autowired
|
@Autowired
|
||||||
DSQinwuService dsQinwuService;
|
DSQinwuService dsQinwuService;
|
||||||
|
|
||||||
@Value("${ruansi.ruansi-kafka.send-to-third-enabled}")
|
// @Value("${ruansi.ruansi-kafka.send-to-third-enabled}")
|
||||||
private boolean sendToThirdEnabled;
|
private boolean sendToThirdEnabled;
|
||||||
|
|
||||||
@Value("${ruansi.ruansi-kafka.start-update-time}")
|
// @Value("${ruansi.ruansi-kafka.start-update-time}")
|
||||||
private String startUpdateTime;
|
private String startUpdateTime;
|
||||||
|
|
||||||
@Value("${ruansi.ruansi-kafka.ds-preurl}")
|
// @Value("${ruansi.ruansi-kafka.ds-preurl}")
|
||||||
private String dsPreurl;
|
private String dsPreurl;
|
||||||
/**
|
/**
|
||||||
* 娱特单位抽取
|
* 娱特单位抽取
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.dromara.data2es.api.RemoteDataToEsService;
|
import org.dromara.data2es.api.RemoteDataToEsService;
|
||||||
import org.dromara.data2es.api.domain.RemoteGpsInfo;
|
import org.dromara.data2es.api.domain.RemoteGpsInfo;
|
||||||
|
import org.dromara.extract.WzhjExtractApplication;
|
||||||
import org.dromara.extract.domain.EsGpsInfo;
|
import org.dromara.extract.domain.EsGpsInfo;
|
||||||
import org.dromara.extract.exception.MyBusinessException;
|
import org.dromara.extract.exception.MyBusinessException;
|
||||||
import org.dromara.extract.service.ITDeviceGpsService;
|
import org.dromara.extract.service.ITDeviceGpsService;
|
||||||
|
|
@ -16,6 +17,8 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
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.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
|
@ -42,6 +45,7 @@ public class DeviceGPSController {
|
||||||
@Value("${ruansi.start_update_time}")
|
@Value("${ruansi.start_update_time}")
|
||||||
private String startUpdateTime;
|
private String startUpdateTime;
|
||||||
|
|
||||||
|
@Value("${ruansi.jly_update_time}")
|
||||||
private String jlyUpdateTime;
|
private String jlyUpdateTime;
|
||||||
|
|
||||||
@Value("${ruansi.last_update_time}")
|
@Value("${ruansi.last_update_time}")
|
||||||
|
|
@ -60,8 +64,8 @@ public class DeviceGPSController {
|
||||||
return DateUtil.formatDateTime(info.getGpsTime());
|
return DateUtil.formatDateTime(info.getGpsTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0/10 * * * * ?")
|
// @Scheduled(cron = "0/10 * * * * ?")
|
||||||
@Async
|
// @Async
|
||||||
public void bdgcGps(){
|
public void bdgcGps(){
|
||||||
if(StringUtils.isBlank(lastUpdateTime)){
|
if(StringUtils.isBlank(lastUpdateTime)){
|
||||||
try {
|
try {
|
||||||
|
|
@ -106,8 +110,8 @@ public class DeviceGPSController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0/8 * * * * ?")
|
@Scheduled(cron = "0/5 * * * * ?")
|
||||||
@Async
|
// @Async
|
||||||
public void jlyGps(){
|
public void jlyGps(){
|
||||||
if(StringUtils.isBlank(jlyUpdateTime)){
|
if(StringUtils.isBlank(jlyUpdateTime)){
|
||||||
jlyUpdateTime = startUpdateTime;
|
jlyUpdateTime = startUpdateTime;
|
||||||
|
|
@ -141,7 +145,7 @@ public class DeviceGPSController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0/30 * * * * ?")
|
// @Scheduled(cron = "0/30 * * * * ?")
|
||||||
public void jlyGpsStatus(){
|
public void jlyGpsStatus(){
|
||||||
if(StringUtils.isBlank(jlyUpdateTime)){
|
if(StringUtils.isBlank(jlyUpdateTime)){
|
||||||
jlyUpdateTime = startUpdateTime;
|
jlyUpdateTime = startUpdateTime;
|
||||||
|
|
@ -193,4 +197,12 @@ public class DeviceGPSController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*public static void main(String[] args) {
|
||||||
|
String time = "2025-07-10T10:25:40";
|
||||||
|
EsGpsInfo gpsInfo = new EsGpsInfo();
|
||||||
|
gpsInfo.setGpsTime(DateUtil.parse(time));
|
||||||
|
System.out.println(gpsInfo.toString());
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,13 @@ public class JJDeviceSchedule {
|
||||||
@DubboReference
|
@DubboReference
|
||||||
RemoteDeviceService remoteDeviceService;
|
RemoteDeviceService remoteDeviceService;
|
||||||
|
|
||||||
@Value("${ruansi.start_jlyupdate_time}")
|
// @Value("${ruansi.start_jlyupdate_time}")
|
||||||
private String startUpdateTime;
|
private String startUpdateTime;
|
||||||
|
|
||||||
private String lastUpdateTime = "";
|
private String lastUpdateTime = "";
|
||||||
|
|
||||||
|
|
||||||
@Scheduled(cron = "0 0/10 * * * ?")
|
// @Scheduled(cron = "0 0/10 * * * ?")
|
||||||
public void saveORUpdateJly(){
|
public void saveORUpdateJly(){
|
||||||
if(StringUtils.isBlank(lastUpdateTime)){
|
if(StringUtils.isBlank(lastUpdateTime)){
|
||||||
lastUpdateTime = startUpdateTime;
|
lastUpdateTime = startUpdateTime;
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ public class TDeviceGpsServiceImpl implements ITDeviceGpsService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@DS("zfjly")
|
||||||
public List<EsGpsInfo> selectJlyGPS(EsGpsInfo esGpsInfo) {
|
public List<EsGpsInfo> selectJlyGPS(EsGpsInfo esGpsInfo) {
|
||||||
return deviceMapper.selectJlyGPS(esGpsInfo);
|
return deviceMapper.selectJlyGPS(esGpsInfo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,11 +49,11 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectJlyGPS" parameterType="org.dromara.extract.domain.EsGpsInfo" resultMap="DeviceResult">
|
<select id="selectJlyGPS" parameterType="org.dromara.extract.domain.EsGpsInfo" resultMap="DeviceResult">
|
||||||
select zdbh deviceCode,'5' deviceType, longitude lng, latitude lat,gpstime gpsTime,speed from bas_police_gps
|
select indexcode deviceCode,'5' deviceType, longitude lng, latitude lat,to_timestamp(updatatime, 'YYYY-MM-DD HH24:MI:SS') gpsTime from public.mobileposition_view
|
||||||
<where>
|
<where>
|
||||||
<if test="gpsTime != null "> and gpstime >= #{gpsTime}</if>
|
<if test="gpsTime != null "> and to_timestamp(updatatime, 'YYYY-MM-DD HH24:MI:SS') > #{gpsTime} </if>
|
||||||
</where>
|
</where>
|
||||||
order by gpstime desc
|
order by updatatime desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectJlyStatus" parameterType="org.dromara.extract.domain.EsGpsInfo" resultMap="DeviceResult">
|
<select id="selectJlyStatus" parameterType="org.dromara.extract.domain.EsGpsInfo" resultMap="DeviceResult">
|
||||||
|
|
|
||||||
|
|
@ -252,7 +252,7 @@ public class LocationController {
|
||||||
if (null != params.get("deviceType")){
|
if (null != params.get("deviceType")){
|
||||||
device.setDeviceType(params.get("deviceType").toString());
|
device.setDeviceType(params.get("deviceType").toString());
|
||||||
}
|
}
|
||||||
if (null != params.get("zzjgdm") && !"341800000000".equals(params.get("zzjgdm").toString())){
|
if (null != params.get("zzjgdm") && !"341600000000".equals(params.get("zzjgdm").toString())){
|
||||||
String[] zzjgdms = params.get("zzjgdm").toString().split(",");
|
String[] zzjgdms = params.get("zzjgdm").toString().split(",");
|
||||||
device.setZzjgdms(zzjgdms);
|
device.setZzjgdms(zzjgdms);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,32 +112,26 @@ public class IndexStaticsController extends BaseController {
|
||||||
* 各地市总数和在线数
|
* 各地市总数和在线数
|
||||||
* */
|
* */
|
||||||
@PostMapping("/onLineBar")
|
@PostMapping("/onLineBar")
|
||||||
public R onLineBar(){
|
public R onLineBar(@RequestBody TDeviceBo bo){
|
||||||
List<SysDeptVo> deptVoList = deptService.getDsList();
|
SysDeptBo deptBo = new SysDeptBo();
|
||||||
List<DeviceStaticsVo> staticsVoList = deviceService.countByDs();
|
deptBo.setIsVisible("1");
|
||||||
|
deptBo.setParentId(bo.getZzjgdm());
|
||||||
|
List<SysDeptVo> deptVoList = deptService.selectDeptList(deptBo);
|
||||||
List<DeviceStaticsVo> list = new ArrayList<>(); //用来接收处理后的统计结果
|
List<DeviceStaticsVo> list = new ArrayList<>(); //用来接收处理后的统计结果
|
||||||
for (SysDeptVo deptVo : deptVoList) {
|
for (SysDeptVo deptVo : deptVoList) {
|
||||||
boolean bl = false; //用来统计结果是否有当前这个机构
|
DeviceStaticsVo staticsVo = new DeviceStaticsVo();
|
||||||
for (DeviceStaticsVo staticsVo : staticsVoList) {
|
TDeviceBo deviceBo = new TDeviceBo();
|
||||||
String deptId = staticsVo.getZzjgdm()+"00000000";
|
deviceBo.setZzjgdm(deptVo.getDeptId());
|
||||||
if (deptId.equals(deptVo.getDeptId())){
|
deviceBo.setValid(1);
|
||||||
staticsVo.setZzjgdm(deptId);
|
DeviceRedis redis = new DeviceRedis();
|
||||||
staticsVo.setZzjgmc(deptVo.getDeptName().replaceAll("公安局",""));
|
redis.setZzjgdm(deptVo.getDeptId());
|
||||||
int onlineCo = RedisUtils.searchKeys("org_code:"+staticsVo.getZzjgdm()+"*");
|
Long co = deviceService.countByCondition(deviceBo);
|
||||||
staticsVo.setOnlineCo(onlineCo);
|
Long online = redisService.countByZzjgdm(redis);
|
||||||
list.add(staticsVo);
|
staticsVo.setZzjgdm(deptVo.getDeptId());
|
||||||
bl = true;
|
staticsVo.setZzjgmc(deptVo.getShortName());
|
||||||
break;
|
staticsVo.setCo(co);
|
||||||
}
|
staticsVo.setOnlineCo(online);
|
||||||
}
|
list.add(staticsVo);
|
||||||
if (!bl){
|
|
||||||
DeviceStaticsVo staticsVo = new DeviceStaticsVo();
|
|
||||||
staticsVo.setZzjgdm(deptVo.getDeptId());
|
|
||||||
staticsVo.setZzjgmc(deptVo.getDeptName().replaceAll("公安局",""));
|
|
||||||
staticsVo.setCo(0);
|
|
||||||
staticsVo.setOnlineCo(0);
|
|
||||||
list.add(staticsVo);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return R.ok(list);
|
return R.ok(list);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ public class DeviceStaticsVo implements Serializable {
|
||||||
|
|
||||||
private String zzjgdm;
|
private String zzjgdm;
|
||||||
|
|
||||||
private Integer co;
|
private Long co;
|
||||||
|
|
||||||
private Integer onlineCo;
|
private Long onlineCo;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
package org.dromara.system.mapper;
|
package org.dromara.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
import org.dromara.system.domain.DeviceRedis;
|
import org.dromara.system.domain.DeviceRedis;
|
||||||
import org.dromara.system.domain.vo.DeviceRedisVo;
|
import org.dromara.system.domain.vo.DeviceRedisVo;
|
||||||
|
|
@ -11,4 +14,6 @@ public interface DeviceRedisMapper extends BaseMapperPlus<DeviceRedis,DeviceRedi
|
||||||
int insertBatch(List<DeviceRedis> list);
|
int insertBatch(List<DeviceRedis> list);
|
||||||
|
|
||||||
List<DeviceRedisVo> countByCondition(DeviceRedis redis);
|
List<DeviceRedisVo> countByCondition(DeviceRedis redis);
|
||||||
|
|
||||||
|
Long countByzzjgdm(@Param(Constants.WRAPPER) Wrapper<DeviceRedis> queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,4 +69,21 @@ public class DeviceRedisSchedule {
|
||||||
RedisUtils.batchInsert(deviceInfoDataMap,-1);
|
RedisUtils.batchInsert(deviceInfoDataMap,-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 定时处理记录仪基本数据 10天没有更新的设备设置为删除状态
|
||||||
|
* */
|
||||||
|
// @Scheduled(cron = "0 0 0/1 * * ?")
|
||||||
|
public void deleteZfjly(){
|
||||||
|
deviceService.deleteZfjly();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 定时删除设备状态为删除的定位信息和在线表
|
||||||
|
* */
|
||||||
|
// @Scheduled(cron = "0 0 0/1 * * ?")
|
||||||
|
public void removeRedis(){
|
||||||
|
deviceService.deleteRedis();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,4 +9,6 @@ public interface IDeviceRedisService {
|
||||||
int insertBatch(List<DeviceRedis> list);
|
int insertBatch(List<DeviceRedis> list);
|
||||||
|
|
||||||
List<DeviceRedisVo> countByCondition(DeviceRedis redis);
|
List<DeviceRedisVo> countByCondition(DeviceRedis redis);
|
||||||
|
|
||||||
|
Long countByZzjgdm(DeviceRedis deviceRedis);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,4 +85,8 @@ public interface ITDeviceService {
|
||||||
TDeviceVo queryByDeviceCode(String deviceCode);
|
TDeviceVo queryByDeviceCode(String deviceCode);
|
||||||
|
|
||||||
List<TDeviceExportVo> selectDeviceExportList(TDeviceBo bo);
|
List<TDeviceExportVo> selectDeviceExportList(TDeviceBo bo);
|
||||||
|
|
||||||
|
int deleteZfjly();
|
||||||
|
|
||||||
|
int deleteRedis();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,20 @@
|
||||||
package org.dromara.system.service.impl;
|
package org.dromara.system.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.apache.ibatis.session.ExecutorType;
|
import org.apache.ibatis.session.ExecutorType;
|
||||||
import org.apache.ibatis.session.SqlSession;
|
import org.apache.ibatis.session.SqlSession;
|
||||||
import org.apache.ibatis.session.SqlSessionFactory;
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
|
import org.dromara.system.api.RemoteDataScopeService;
|
||||||
import org.dromara.system.domain.DeviceRedis;
|
import org.dromara.system.domain.DeviceRedis;
|
||||||
|
import org.dromara.system.domain.TDevice;
|
||||||
import org.dromara.system.domain.vo.DeviceRedisVo;
|
import org.dromara.system.domain.vo.DeviceRedisVo;
|
||||||
import org.dromara.system.mapper.DeviceRedisMapper;
|
import org.dromara.system.mapper.DeviceRedisMapper;
|
||||||
import org.dromara.system.service.IDeviceRedisService;
|
import org.dromara.system.service.IDeviceRedisService;
|
||||||
|
import org.dromara.system.service.ISysDeptService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
@ -23,6 +28,9 @@ public class DeviceRedisServiceImpl implements IDeviceRedisService {
|
||||||
|
|
||||||
private final DeviceRedisMapper baseMapper;
|
private final DeviceRedisMapper baseMapper;
|
||||||
|
|
||||||
|
@DubboReference
|
||||||
|
private RemoteDataScopeService remoteDataScopeService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
SqlSessionFactory sqlSessionFactory;
|
SqlSessionFactory sqlSessionFactory;
|
||||||
|
|
||||||
|
|
@ -61,4 +69,13 @@ public class DeviceRedisServiceImpl implements IDeviceRedisService {
|
||||||
public List<DeviceRedisVo> countByCondition(DeviceRedis redis) {
|
public List<DeviceRedisVo> countByCondition(DeviceRedis redis) {
|
||||||
return baseMapper.countByCondition(redis);
|
return baseMapper.countByCondition(redis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long countByZzjgdm(DeviceRedis deviceRedis) {
|
||||||
|
LambdaQueryWrapper<DeviceRedis> lqw = new LambdaQueryWrapper<>();
|
||||||
|
lqw.ne(DeviceRedis::getDeviceType,"9");
|
||||||
|
String depts = remoteDataScopeService.getDeptAndChild(deviceRedis.getZzjgdm());
|
||||||
|
lqw.inSql(DeviceRedis::getZzjgdm,depts);
|
||||||
|
return baseMapper.countByzzjgdm(lqw);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,8 +82,8 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getParentId()), SysDept::getParentId, bo.getParentId());
|
lqw.eq(StringUtils.isNotBlank(bo.getParentId()), SysDept::getParentId, bo.getParentId());
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getDeptName()), SysDept::getDeptName, bo.getDeptName());
|
lqw.like(StringUtils.isNotBlank(bo.getDeptName()), SysDept::getDeptName, bo.getDeptName());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysDept::getStatus, bo.getStatus());
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysDept::getStatus, bo.getStatus());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getIsVisible()),SysDept::getIsVisible,bo.getIsVisible());
|
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getFullName()), SysDept::getFullName, bo.getFullName());
|
lqw.eq(StringUtils.isNotBlank(bo.getFullName()), SysDept::getFullName, bo.getFullName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getIsVisible()),SysDept::getIsVisible,bo.getIsVisible());
|
||||||
lqw.orderByAsc(SysDept::getAncestors);
|
lqw.orderByAsc(SysDept::getAncestors);
|
||||||
lqw.orderByAsc(SysDept::getParentId);
|
lqw.orderByAsc(SysDept::getParentId);
|
||||||
lqw.orderByAsc(SysDept::getOrderNum);
|
lqw.orderByAsc(SysDept::getOrderNum);
|
||||||
|
|
@ -369,7 +369,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysDeptVo> deviceStatics(String deviceType,String manageDeptId) {
|
public List<SysDeptVo> deviceStatics(String deviceType,String manageDeptId) {
|
||||||
if(!manageDeptId.equals("341300000000")){
|
if(!manageDeptId.equals("341600000000")){
|
||||||
String subManageId = manageDeptId.substring(0,findLastNonZeroIndex(manageDeptId) + 1);
|
String subManageId = manageDeptId.substring(0,findLastNonZeroIndex(manageDeptId) + 1);
|
||||||
return baseMapper.deviceStaticsByDeptId(deviceType,subManageId);
|
return baseMapper.deviceStaticsByDeptId(deviceType,subManageId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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.common.redis.utils.RedisUtils;
|
||||||
import org.dromara.system.api.RemoteDataScopeService;
|
import org.dromara.system.api.RemoteDataScopeService;
|
||||||
|
import org.dromara.system.domain.DeviceRedis;
|
||||||
import org.dromara.system.domain.vo.DeviceStaticsVo;
|
import org.dromara.system.domain.vo.DeviceStaticsVo;
|
||||||
import org.dromara.system.domain.vo.TDeviceExportVo;
|
import org.dromara.system.domain.vo.TDeviceExportVo;
|
||||||
|
import org.dromara.system.mapper.DeviceRedisMapper;
|
||||||
|
import org.dromara.system.mapper.SysConfigMapper;
|
||||||
|
import org.dromara.system.service.ISysConfigService;
|
||||||
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;
|
||||||
|
|
@ -43,6 +48,12 @@ public class TDeviceServiceImpl implements ITDeviceService {
|
||||||
private final TDeviceMapper baseMapper;
|
private final TDeviceMapper baseMapper;
|
||||||
|
|
||||||
|
|
||||||
|
private final ISysConfigService configService;
|
||||||
|
|
||||||
|
private final DeviceRedisMapper redisMapper;
|
||||||
|
|
||||||
|
private String lastRemoveTime;
|
||||||
|
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private RemoteDataScopeService remoteDataScopeService;
|
private RemoteDataScopeService remoteDataScopeService;
|
||||||
|
|
||||||
|
|
@ -120,6 +131,53 @@ public class TDeviceServiceImpl implements ITDeviceService {
|
||||||
return baseMapper.selectDeviceExportList(lqw);
|
return baseMapper.selectDeviceExportList(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 删除长时间未更新的执法记录仪
|
||||||
|
* */
|
||||||
|
@Override
|
||||||
|
public int deleteZfjly() {
|
||||||
|
String day = configService.selectConfigByKey("device.remove.day");
|
||||||
|
LambdaQueryWrapper<TDevice> lqw = new LambdaQueryWrapper<>();
|
||||||
|
lqw.inSql(TDevice::getDeviceType,"'5','7','8'");
|
||||||
|
lqw.eq(TDevice::getValid,"1");
|
||||||
|
lqw.le(TDevice::getUpdateTime,DateUtil.offsetDay(new Date(),Integer.getInteger(day)));
|
||||||
|
List<TDevice> list = baseMapper.selectList(lqw);
|
||||||
|
for (TDevice device : list) {
|
||||||
|
device.setValid(0);
|
||||||
|
device.setUpdateTime(DateUtil.now());
|
||||||
|
baseMapper.updateById(device);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 删除状态为删除的设备定位信息和存在t_device_redis的数据
|
||||||
|
* */
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteRedis() {
|
||||||
|
LambdaQueryWrapper<TDevice> lqw = new LambdaQueryWrapper<>();
|
||||||
|
lqw.gt(StringUtils.isNotBlank(lastRemoveTime),TDevice::getUpdateTime,lastRemoveTime);
|
||||||
|
lqw.eq(TDevice::getValid,0);
|
||||||
|
lqw.orderByDesc(TDevice::getUpdateTime);
|
||||||
|
List<TDeviceVo> list = baseMapper.selectVoList(lqw);
|
||||||
|
try {
|
||||||
|
if (list.size()>0){
|
||||||
|
lastRemoveTime = list.get(0).getUpdateTime();
|
||||||
|
for (TDeviceVo deviceVo : list) {
|
||||||
|
RedisUtils.del("online_users:"+deviceVo.getDeviceType()+":"+deviceVo.getDeviceCode());
|
||||||
|
LambdaQueryWrapper<DeviceRedis> dqw = new LambdaQueryWrapper<>();
|
||||||
|
dqw.eq(DeviceRedis::getDeviceCode,deviceVo.getDeviceCode());
|
||||||
|
redisMapper.delete(dqw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TDeviceVo queryOne(TDeviceBo bo) {
|
public TDeviceVo queryOne(TDeviceBo bo) {
|
||||||
LambdaQueryWrapper<TDevice> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<TDevice> lqw = buildQueryWrapper(bo);
|
||||||
|
|
|
||||||
|
|
@ -46,4 +46,9 @@
|
||||||
WHERE d.dict_type = 'zd_device_type'
|
WHERE d.dict_type = 'zd_device_type'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="countByzzjgdm" resultType="Long">
|
||||||
|
select count(*) from t_device_redis
|
||||||
|
${ew.getCustomSqlSegment}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,8 @@
|
||||||
#{remark1},#{remark2},#{cardNum},#{createTime},#{updateTime})
|
#{remark1},#{remark2},#{cardNum},#{createTime},#{updateTime})
|
||||||
ON DUPLICATE KEY UPDATE
|
ON DUPLICATE KEY UPDATE
|
||||||
police_no = values(police_no),police_name = values(police_name),phone_num = values(phone_num),
|
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),
|
car_num = values(car_num),valid = '1',remark1 = values(remark1),remark2 = values(remark2),card_num = values(card_num),
|
||||||
update_time = now()
|
update_time = values(update_time)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -47,18 +47,25 @@ public class AsyncUtils {
|
||||||
* @throws ParseException
|
* @throws ParseException
|
||||||
*/
|
*/
|
||||||
@Async(value = "taskExecutor")
|
@Async(value = "taskExecutor")
|
||||||
public void saveData(byte[] bytes) throws Exception {
|
public void saveData(byte[] bytes, String deviceType) {
|
||||||
//logger.info("当前线程名={}",Thread.currentThread().getName());
|
//logger.info("当前线程名={}",Thread.currentThread().getName());
|
||||||
RemoteGpsInfo esGpsInfo = parseBytes(bytes);
|
RemoteGpsInfo esGpsInfo = null;
|
||||||
esGpsInfo.setDeviceType("3");
|
try {
|
||||||
//和redis过期监听时间一定要一致
|
logger.error("接收类型={}",deviceType);
|
||||||
if (DateUtil.between(new Date(),esGpsInfo.getGpsTime(),DateUnit.MINUTE)> 10){
|
esGpsInfo = parseBytes(bytes);
|
||||||
esGpsInfo.setOnline(0);
|
esGpsInfo.setDeviceType(deviceType);
|
||||||
}else {
|
//和redis过期监听时间一定要一致
|
||||||
esGpsInfo.setOnline(1);
|
if (DateUtil.between(new Date(),esGpsInfo.getGpsTime(),DateUnit.MINUTE)> 10){
|
||||||
|
esGpsInfo.setOnline(0);
|
||||||
|
}else {
|
||||||
|
esGpsInfo.setOnline(1);
|
||||||
|
}
|
||||||
|
logger.error("转换后的实体类={}",esGpsInfo.toString());
|
||||||
|
R response = dataEsService.saveData(esGpsInfo);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
logger.error(esGpsInfo.toString());
|
|
||||||
R response = dataEsService.saveData(esGpsInfo);
|
|
||||||
//logger.error("位置信息接口={},失败信息={},失败设备={}",response.getCode(),response.getMessage(),esGpsInfo.getDeviceId());
|
//logger.error("位置信息接口={},失败信息={},失败设备={}",response.getCode(),response.getMessage(),esGpsInfo.getDeviceId());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -67,7 +74,7 @@ public class AsyncUtils {
|
||||||
* AA--10101010 10101010 2^15+2^13+2^11+2^9 + 170=
|
* AA--10101010 10101010 2^15+2^13+2^11+2^9 + 170=
|
||||||
* @param bytes 待解析的字节数组
|
* @param bytes 待解析的字节数组
|
||||||
*/
|
*/
|
||||||
private RemoteGpsInfo parseBytes(byte[] bytes) throws ParseException {
|
private RemoteGpsInfo parseBytes(byte[] bytes) {
|
||||||
|
|
||||||
checkHeaderByte(bytes);
|
checkHeaderByte(bytes);
|
||||||
|
|
||||||
|
|
@ -101,7 +108,6 @@ public class AsyncUtils {
|
||||||
logger.error("jingdu:"+jingdu);
|
logger.error("jingdu:"+jingdu);
|
||||||
|
|
||||||
long year = BitConverter.byteArrayToShort(Arrays.copyOfRange(copyByte, 44, 46), true);
|
long year = BitConverter.byteArrayToShort(Arrays.copyOfRange(copyByte, 44, 46), true);
|
||||||
logger.error("year:"+year);
|
|
||||||
//月日时分秒
|
//月日时分秒
|
||||||
byte[] sfm = Arrays.copyOfRange(copyByte, 46, 51);
|
byte[] sfm = Arrays.copyOfRange(copyByte, 46, 51);
|
||||||
String time = singleByteToString2(sfm);
|
String time = singleByteToString2(sfm);
|
||||||
|
|
@ -126,7 +132,7 @@ public class AsyncUtils {
|
||||||
* @param time 20210616123208
|
* @param time 20210616123208
|
||||||
*/
|
*/
|
||||||
private RemoteGpsInfo BuilderEsGpsInfo(String gpsId, double lonD, double latD, long speed,
|
private RemoteGpsInfo BuilderEsGpsInfo(String gpsId, double lonD, double latD, long speed,
|
||||||
long angle, long height, long jingdu, String time) throws ParseException {
|
long angle, long height, long jingdu, String time) {
|
||||||
RemoteGpsInfo gpsInfo = new RemoteGpsInfo();
|
RemoteGpsInfo gpsInfo = new RemoteGpsInfo();
|
||||||
gpsInfo.setDeviceCode(parseGpsId(gpsId));
|
gpsInfo.setDeviceCode(parseGpsId(gpsId));
|
||||||
gpsInfo.setDeviceType(parseDeviceType(gpsId));
|
gpsInfo.setDeviceType(parseDeviceType(gpsId));
|
||||||
|
|
@ -141,11 +147,16 @@ public class AsyncUtils {
|
||||||
return gpsInfo;
|
return gpsInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Date parseGpsTime(String time) throws ParseException {
|
private Date parseGpsTime(String time) {
|
||||||
if(StringUtils.isEmpty(time)){
|
if(StringUtils.isEmpty(time)){
|
||||||
throw new MyBusinessException("时间为空");
|
logger.error("时间为空");
|
||||||
|
}
|
||||||
|
Date date = null;
|
||||||
|
try {
|
||||||
|
date = DateUtils.parseDate(time, new String[]{"yyyy-MM-dd HH:mm:ss", "yyyyMMddHHmmss"});
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
Date date = DateUtils.parseDate(time, new String[]{"yyyy-MM-dd HH:mm:ss", "yyyyMMddHHmmss"});
|
|
||||||
return date;
|
return date;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -166,7 +177,7 @@ public class AsyncUtils {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String parseDeviceType(String gpsId) {
|
private String parseDeviceType(String gpsId) {
|
||||||
checkGpsId(gpsId);
|
// checkGpsId(gpsId);
|
||||||
return gpsId;
|
return gpsId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -185,12 +196,13 @@ public class AsyncUtils {
|
||||||
* @return gpsId
|
* @return gpsId
|
||||||
*/
|
*/
|
||||||
private String parseGpsId(String gpsId) {
|
private String parseGpsId(String gpsId) {
|
||||||
checkGpsId(gpsId);
|
// checkGpsId(gpsId); 公车的id长度大于8
|
||||||
return gpsId;
|
return gpsId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkGpsId(String gpsId) {
|
private void checkGpsId(String gpsId) {
|
||||||
if(gpsId.length() != 8){
|
if(gpsId.length() != 8){
|
||||||
|
logger.error("gpsId为空");
|
||||||
throw new MyBusinessException("gpsId为空");
|
throw new MyBusinessException("gpsId为空");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.net.DatagramPacket;
|
import java.net.*;
|
||||||
import java.net.DatagramSocket;
|
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
import java.net.SocketException;
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
@ -76,14 +73,16 @@ public class OriginalUdpReceiver implements ApplicationListener<ApplicationReady
|
||||||
public void onApplicationEvent(ApplicationReadyEvent event) {
|
public void onApplicationEvent(ApplicationReadyEvent event) {
|
||||||
logger.info("原生方式启动");
|
logger.info("原生方式启动");
|
||||||
try {
|
try {
|
||||||
// Executors.newSingleThreadExecutor().execute(new UDPProcess("53.238.79.4",Integer.parseInt("10013")));
|
// Executors.newSingleThreadExecutor().execute(new UDPProcess("10.129.221.10",Integer.parseInt("10033")));
|
||||||
Executors.newSingleThreadExecutor().execute(new UDPProcess("53.176.146.100",Integer.parseInt("10013")));
|
Executors.newSingleThreadExecutor().execute(new UDPProcess("10.129.221.10",Integer.parseInt("10034")));
|
||||||
} catch (SocketException e) {
|
} catch (SocketException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class UDPProcess implements Runnable {
|
class UDPProcess implements Runnable {
|
||||||
DatagramSocket socket = null;
|
DatagramSocket socket = null;
|
||||||
|
|
||||||
|
|
@ -101,18 +100,10 @@ public class OriginalUdpReceiver implements ApplicationListener<ApplicationReady
|
||||||
try {
|
try {
|
||||||
socket.receive(packet);
|
socket.receive(packet);
|
||||||
byte[] data = packet.getData();
|
byte[] data = packet.getData();
|
||||||
|
|
||||||
String unSendData = new String(buffer,0,data.length);
|
String unSendData = new String(buffer,0,data.length);
|
||||||
//String sendData = bytes2hexStr(data);
|
//String sendData = bytes2hexStr(data);
|
||||||
logger.error("接收到了数据:"+data);
|
logger.error("接收到了数据"+data);
|
||||||
asyncUtils.saveData(data);
|
asyncUtils.saveData(data,"3");
|
||||||
/*taskExecutor.execute(() -> {
|
|
||||||
try {
|
|
||||||
saveData(data);
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,8 +85,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) );
|
||||||
newDevice.setZzjgdm("341300000000");
|
newDevice.setZzjgdm("341600000000");
|
||||||
newDevice.setZzjgmc("宿州市公安局");
|
newDevice.setZzjgmc("亳州市公安局");
|
||||||
// setZzjgdm(newDevice,originDevice);
|
// setZzjgdm(newDevice,originDevice);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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://10.129.221.10: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@2509
|
||||||
|
|
||||||
### 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