GPS 管理
parent
ec4319f53f
commit
802fcd5608
|
|
@ -70,6 +70,10 @@
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
<artifactId>hutool-crypto</artifactId>
|
<artifactId>hutool-crypto</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-poi</artifactId>
|
||||||
|
</dependency>
|
||||||
<!--</editor-fold>-->
|
<!--</editor-fold>-->
|
||||||
|
|
||||||
<!-- lombok -->
|
<!-- lombok -->
|
||||||
|
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<groupId>com.njzscloud</groupId>
|
|
||||||
<artifactId>njzscloud-common</artifactId>
|
|
||||||
<version>0.0.1</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>njzscloud-common-job</artifactId>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<xxl-job.version>2.4.1</xxl-job.version>
|
|
||||||
</properties>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.njzscloud</groupId>
|
|
||||||
<artifactId>njzscloud-common-core</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- xxl-job -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.xuxueli</groupId>
|
|
||||||
<artifactId>xxl-job-core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- junit -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.junit.jupiter</groupId>
|
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- spring-boot -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- configuration processor -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
package com.njzscloud.common.job;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
public class XxlAdminProperties {
|
|
||||||
/**
|
|
||||||
* 调度中心部署跟地址 [选填]:如调度中心集群部署存在多个地址则用逗号分隔。
|
|
||||||
* 执行器将会使用该地址进行"执行器心跳注册"和"任务结果回调";为空则关闭自动注册;
|
|
||||||
*/
|
|
||||||
private String protocol = "http";
|
|
||||||
private String ip;
|
|
||||||
private String port;
|
|
||||||
private String contextPath = "/xxl-job-admin";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 执行器通讯TOKEN [选填]:非空时启用;
|
|
||||||
*/
|
|
||||||
private String accessToken = "XXLJob";
|
|
||||||
|
|
||||||
public String getAddresses() {
|
|
||||||
return protocol + "://" + ip + ":" + port + contextPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
package com.njzscloud.common.job;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
public class XxlExecutorProperties {
|
|
||||||
/**
|
|
||||||
* 执行器AppName:执行器心跳注册分组依据;为空则关闭自动注册
|
|
||||||
*/
|
|
||||||
private String appName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 执行器IP [选填]:默认为空表示自动获取IP,多网卡时可手动设置指定IP
|
|
||||||
* ,该IP不会绑定Host仅作为通讯实用;地址信息用于 "执行器注册" 和 "调度中心请求并触发任务"
|
|
||||||
*/
|
|
||||||
private String ip;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 执行器端口号 [选填]:小于等于0则自动获取;默认端口为9999,单机部署多个执行器时,注意要配置不同执行器端口;
|
|
||||||
*/
|
|
||||||
private Integer port = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 执行器运行日志文件存储磁盘路径 [选填] :需要对该路径拥有读写权限;为空则使用默认路径;
|
|
||||||
*/
|
|
||||||
private String logPath = "logs/xxl-job";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 执行器日志保存天数 [选填] :值大于3时生效,启用执行器Log文件定期清理功能,否则不生效;
|
|
||||||
*/
|
|
||||||
private Integer logRetentionDays = 30;
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
package com.njzscloud.common.job;
|
|
||||||
|
|
||||||
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
|
||||||
@EnableConfigurationProperties({XxlJobProperties.class})
|
|
||||||
@ConditionalOnProperty(value = "xxl-job.enable", havingValue = "true")
|
|
||||||
public class XxlJobAutoConfiguration {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public XxlJobSpringExecutor xxlJobSpringExecutor(XxlJobProperties xxlJobProperties) {
|
|
||||||
XxlAdminProperties xxlAdminProperties = xxlJobProperties.getAdmin();
|
|
||||||
XxlExecutorProperties xxlExecutorProperties = xxlJobProperties.getExecutor();
|
|
||||||
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
|
|
||||||
xxlJobSpringExecutor.setAdminAddresses(xxlAdminProperties.getAddresses());
|
|
||||||
xxlJobSpringExecutor.setAppname(xxlExecutorProperties.getAppName());
|
|
||||||
xxlJobSpringExecutor.setIp(xxlExecutorProperties.getIp());
|
|
||||||
xxlJobSpringExecutor.setPort(xxlExecutorProperties.getPort());
|
|
||||||
xxlJobSpringExecutor.setAccessToken(xxlAdminProperties.getAccessToken());
|
|
||||||
xxlJobSpringExecutor.setLogPath(xxlExecutorProperties.getLogPath());
|
|
||||||
xxlJobSpringExecutor.setLogRetentionDays(xxlExecutorProperties.getLogRetentionDays());
|
|
||||||
return xxlJobSpringExecutor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
package com.njzscloud.common.job;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@ConfigurationProperties(prefix = "xxl-job")
|
|
||||||
public class XxlJobProperties {
|
|
||||||
private boolean enable = false;
|
|
||||||
private XxlAdminProperties admin = new XxlAdminProperties();
|
|
||||||
|
|
||||||
private XxlExecutorProperties executor = new XxlExecutorProperties();
|
|
||||||
}
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration = \
|
|
||||||
com.njzscloud.common.job.XxlJobAutoConfiguration
|
|
||||||
|
|
@ -19,9 +19,9 @@ public class JT808MessageResolver {
|
||||||
public static final String LocationSearch = "LocationSearch";
|
public static final String LocationSearch = "LocationSearch";
|
||||||
public static final String TxtReport = "TxtReport";
|
public static final String TxtReport = "TxtReport";
|
||||||
|
|
||||||
private static Map<String, Consumer<TerminalMessageBody>> resolvers = new ConcurrentHashMap<>();
|
private static final Map<String, Consumer<TerminalMessageBody>> resolvers = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private static Map<Integer, Consumer<JT808Message>> stdResolvers = MapUtil.<Integer, Consumer<JT808Message>>builder()
|
private static final Map<Integer, Consumer<JT808Message>> stdResolvers = MapUtil.<Integer, Consumer<JT808Message>>builder()
|
||||||
.put(0x0100, JT808MessageResolver::onTerminalRegister)
|
.put(0x0100, JT808MessageResolver::onTerminalRegister)
|
||||||
.put(0x0102, JT808MessageResolver::onTerminalAuth)
|
.put(0x0102, JT808MessageResolver::onTerminalAuth)
|
||||||
.put(0x0002, JT808MessageResolver::onHeartbeat)
|
.put(0x0002, JT808MessageResolver::onHeartbeat)
|
||||||
|
|
|
||||||
|
|
@ -55,21 +55,21 @@ public class TcpServer {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("服务器启动失败", e);
|
log.error("JT808 服务器启动失败", e);
|
||||||
this.stop();
|
this.stop();
|
||||||
throw Exceptions.error(e, "服务器构建失败");
|
throw Exceptions.error(e, "JT808 服务器构建失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
try {
|
try {
|
||||||
ChannelFuture future = bootstrap.bind(port).sync();
|
ChannelFuture future = bootstrap.bind(port).sync();
|
||||||
log.info("服务器已启动,监听端口: {}", port);
|
log.info("JT808 服务器已启动,监听端口: {}", port);
|
||||||
future.channel().closeFuture().addListener(it -> stop());
|
future.channel().closeFuture().addListener(it -> stop());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("服务器启动失败,端口: {}", port, e);
|
log.error("JT808 服务器启动失败,端口: {}", port, e);
|
||||||
stop();
|
stop();
|
||||||
throw Exceptions.error(e, "服务器启动失败");
|
throw Exceptions.error(e, "JT808 服务器启动失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,6 +82,6 @@ public class TcpServer {
|
||||||
workerGroup.shutdownGracefully();
|
workerGroup.shutdownGracefully();
|
||||||
workerGroup = null;
|
workerGroup = null;
|
||||||
}
|
}
|
||||||
log.info("服务器已停止");
|
log.info("JT808服务器已停止");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ public class MqttMsgHandlers {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启用报警
|
* 配置设备的连接地址
|
||||||
*/
|
*/
|
||||||
@MqttListener(topic = "location/config_ip_port")
|
@MqttListener(topic = "location/config_ip_port")
|
||||||
public void configIpPort(MqttMsg msg) {
|
public void configIpPort(MqttMsg msg) {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
<module>njzscloud-common-redis</module>
|
<module>njzscloud-common-redis</module>
|
||||||
<module>njzscloud-common-oss</module>
|
<module>njzscloud-common-oss</module>
|
||||||
<module>njzscloud-common-email</module>
|
<module>njzscloud-common-email</module>
|
||||||
<module>njzscloud-common-job</module>
|
|
||||||
<module>njzscloud-common-cache</module>
|
<module>njzscloud-common-cache</module>
|
||||||
<module>njzscloud-common-sichen</module>
|
<module>njzscloud-common-sichen</module>
|
||||||
<module>njzscloud-common-sn</module>
|
<module>njzscloud-common-sn</module>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.njzscloud</groupId>
|
||||||
|
<artifactId>njzscloud</artifactId>
|
||||||
|
<version>0.0.1</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>njzscloud-localizer-svr</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njzscloud</groupId>
|
||||||
|
<artifactId>njzscloud-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njzscloud</groupId>
|
||||||
|
<artifactId>njzscloud-common-localizer</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njzscloud</groupId>
|
||||||
|
<artifactId>njzscloud-common-mqtt</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<annotationProcessorPaths>
|
||||||
|
<path>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.30</version>
|
||||||
|
</path>
|
||||||
|
<path>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct-processor</artifactId>
|
||||||
|
<version>${mapstruct.version}</version>
|
||||||
|
</path>
|
||||||
|
</annotationProcessorPaths>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>post-package-actions</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<target>
|
||||||
|
<exec executable="cmd" osfamily="windows" failonerror="false">
|
||||||
|
<arg value="/c"/>
|
||||||
|
<arg value="explorer"/>
|
||||||
|
<arg value="${project.build.directory}"/>
|
||||||
|
</exec>
|
||||||
|
<exec executable="open" osfamily="mac" failonerror="false">
|
||||||
|
<arg value="${project.build.directory}"/>
|
||||||
|
</exec>
|
||||||
|
|
||||||
|
<exec executable="xdg-open" osfamily="unix" failonerror="false">
|
||||||
|
<arg value="${project.build.directory}"/>
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.njzscloud.localizer;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class LocalizerSvr {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(LocalizerSvr.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
mqtt:
|
||||||
|
enabled: true
|
||||||
|
broker: tcp://139.224.54.144:1883
|
||||||
|
client-id: njzscloud-svr1
|
||||||
|
username: gps
|
||||||
|
password: TKG4TV3dF7CeazDnUdCF
|
||||||
|
|
||||||
|
localizer:
|
||||||
|
enabled: true
|
||||||
|
boss-threads: 1
|
||||||
|
worker-threads: 1
|
||||||
|
port: 18888
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
mqtt:
|
||||||
|
enabled: true
|
||||||
|
broker: tcp://139.224.54.144:1883
|
||||||
|
client-id: njzscloud-svr1
|
||||||
|
username: gps
|
||||||
|
password: TKG4TV3dF7CeazDnUdCF
|
||||||
|
|
||||||
|
localizer:
|
||||||
|
enabled: true
|
||||||
|
boss-threads: 1
|
||||||
|
worker-threads: 1
|
||||||
|
port: 18888
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
spring:
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
location: /home/njzscloud/temp
|
||||||
|
datasource:
|
||||||
|
url: jdbc:mysql://127.0.0.1:3306/njzscloud?characterEncoding=UTF-8&allowMultiQueries=true&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||||
|
username: root
|
||||||
|
password: root
|
||||||
|
|
||||||
|
oss:
|
||||||
|
type: ali
|
||||||
|
ali:
|
||||||
|
region: cn-shanghai
|
||||||
|
endpoint: oss-cn-shanghai.aliyuncs.com
|
||||||
|
access-key: LTAI5tJJu2WayYchExrT5W1E
|
||||||
|
secret-key: zllX0ZJ1EwsZXT6dE6swCLgTF4ImGg
|
||||||
|
bucket-name: cdn-zsy
|
||||||
|
|
||||||
|
mybatis-plus:
|
||||||
|
tunnel:
|
||||||
|
enable: false
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
server:
|
||||||
|
port: ${APP_PORT:10087}
|
||||||
|
tomcat:
|
||||||
|
max-http-form-post-size: 20MB
|
||||||
|
spring:
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
max-file-size: 20MB
|
||||||
|
max-request-size: 20MB
|
||||||
|
file-size-threshold: 1MB
|
||||||
|
resolve-lazily: true
|
||||||
|
profiles:
|
||||||
|
active: ${APP_PROFILE:dev}
|
||||||
|
web:
|
||||||
|
resources:
|
||||||
|
add-mappings: false
|
||||||
|
mvc:
|
||||||
|
throw-exception-if-no-handler-found: true
|
||||||
|
format:
|
||||||
|
date: yyyy-MM-dd
|
||||||
|
time: HH:mm:ss
|
||||||
|
date-time: yyyy-MM-dd HH:mm:ss
|
||||||
|
jackson:
|
||||||
|
locale: zh_CN
|
||||||
|
time-zone: GMT+8
|
||||||
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
default-property-inclusion: always
|
||||||
|
serialization:
|
||||||
|
# 对象不含任何字段时是否报错
|
||||||
|
fail-on-empty-beans: false
|
||||||
|
# 是否捕获并且包装异常信息
|
||||||
|
wrap-exceptions: true
|
||||||
|
# 是否将字符数组输出为数组
|
||||||
|
write-char-arrays-as-json-arrays: true
|
||||||
|
# 格式化输出(加入空格/回车)
|
||||||
|
indent-output: false
|
||||||
|
# 对 Map 类型按键排序
|
||||||
|
order-map-entries-by-keys: true
|
||||||
|
# 是否将日期/时间序列化为时间错
|
||||||
|
write-dates-as-timestamps: false
|
||||||
|
write-bigdecimal-as-plain: true
|
||||||
|
deserialization:
|
||||||
|
# 未知属性是否报错
|
||||||
|
fail-on-unknown-properties: false
|
||||||
|
generator:
|
||||||
|
# 是否忽略位置属性
|
||||||
|
ignore-unknown: true
|
||||||
|
visibility:
|
||||||
|
creator: public_only
|
||||||
|
field: any
|
||||||
|
getter: public_only
|
||||||
|
is-getter: public_only
|
||||||
|
setter: public_only
|
||||||
|
|
||||||
|
datasource:
|
||||||
|
hikari:
|
||||||
|
minimum-idle: 10
|
||||||
|
maximum-pool-size: 30
|
||||||
|
auto-commit: true
|
||||||
|
idle-timeout: 30000
|
||||||
|
pool-name: HikariCP
|
||||||
|
max-lifetime: 900000
|
||||||
|
connection-timeout: 10000
|
||||||
|
connection-test-query: SELECT 1
|
||||||
|
validation-timeout: 1000
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
com.njzscloud.common.sichen.TaskMapper: off
|
||||||
|
com.njzscloud.supervisory.sys.stationletter: off
|
||||||
|
com.njzscloud: debug
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration debug="false">
|
||||||
|
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||||
|
|
||||||
|
<property name="log_path" value="logs"/>
|
||||||
|
<property name="service_name" value="${project.artifactId}"/>
|
||||||
|
|
||||||
|
<property name="console_pattern" value="%magenta(%d{yyyy-MM-dd HH:mm:ss.SSS}) %clr(%-5p) %blue([%t]) %cyan(%c) %blue([%M:%L]): %clr(%m%n)"/>
|
||||||
|
|
||||||
|
<property name="file_pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p [%t] %c [%M:%L] : %m%n"/>
|
||||||
|
|
||||||
|
<appender name="console_appender" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<withJansi>false</withJansi>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${console_pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_appender" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log_path}/${service_name}.log</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${log_path}/%d{yyyy-MM, aux}/${service_name}.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern>
|
||||||
|
<maxFileSize>50MB</maxFileSize>
|
||||||
|
<maxHistory>15</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${file_pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- TRACE < DEBUG < INFO < WARN < ERROR -->
|
||||||
|
<root level="WARN">
|
||||||
|
<appender-ref ref="console_appender"/>
|
||||||
|
<appender-ref ref="file_appender"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
||||||
|
|
@ -59,11 +59,11 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njzscloud</groupId>
|
<groupId>com.njzscloud</groupId>
|
||||||
<artifactId>njzscloud-common-localizer</artifactId>
|
<artifactId>njzscloud-common-gen</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njzscloud</groupId>
|
<groupId>com.njzscloud</groupId>
|
||||||
<artifactId>njzscloud-common-gen</artifactId>
|
<artifactId>njzscloud-common-localizer</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njzscloud</groupId>
|
<groupId>com.njzscloud</groupId>
|
||||||
|
|
@ -92,11 +92,11 @@
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
<version>3.5.3</version>
|
<version>3.5.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<!-- <dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
<artifactId>hutool-all</artifactId>
|
<artifactId>hutool-all</artifactId>
|
||||||
<version>5.8.35</version>
|
<version>5.8.35</version>
|
||||||
</dependency>
|
</dependency> -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.binarywang</groupId>
|
<groupId>com.github.binarywang</groupId>
|
||||||
<artifactId>weixin-java-pay</artifactId>
|
<artifactId>weixin-java-pay</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,15 @@ public class DeviceLocalizerController {
|
||||||
return R.success(deviceLocalizerService.detail(id));
|
return R.success(deviceLocalizerService.detail(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新设备配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/reflash_config")
|
||||||
|
public R<SearchDeviceLocalizerResult> reflashConfig(@RequestParam Long id) {
|
||||||
|
deviceLocalizerService.reflashConfig(id);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -21,5 +21,5 @@ public interface DeviceLocalizerMapper extends BaseMapper<DeviceLocalizerEntity>
|
||||||
|
|
||||||
SearchDeviceLocalizerResult detail(@Param("id") Long id);
|
SearchDeviceLocalizerResult detail(@Param("id") Long id);
|
||||||
|
|
||||||
IPage<SearchDeviceLocalizerResult> paging(Page<Object> page, QueryWrapper<?> ew);
|
IPage<SearchDeviceLocalizerResult> paging(Page<Object> page, @Param("ew") QueryWrapper<?> ew);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,23 @@
|
||||||
package com.njzscloud.supervisory.device.service;
|
package com.njzscloud.supervisory.device.service;
|
||||||
|
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njzscloud.common.core.ex.Exceptions;
|
import com.njzscloud.common.core.ex.Exceptions;
|
||||||
|
import com.njzscloud.common.core.utils.R;
|
||||||
import com.njzscloud.common.localizer.mqtt.param.ConfigIpPortParam;
|
import com.njzscloud.common.localizer.mqtt.param.ConfigIpPortParam;
|
||||||
import com.njzscloud.common.localizer.mqtt.param.EnableWarnParam;
|
import com.njzscloud.common.localizer.mqtt.param.EnableWarnParam;
|
||||||
|
import com.njzscloud.common.localizer.mqtt.param.ObtainDeviceInfoParam;
|
||||||
import com.njzscloud.common.localizer.mqtt.param.SpeedThresholdParam;
|
import com.njzscloud.common.localizer.mqtt.param.SpeedThresholdParam;
|
||||||
import com.njzscloud.common.mp.support.PageParam;
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
import com.njzscloud.common.mqtt.support.MqttMsg;
|
import com.njzscloud.common.mqtt.support.MqttMsg;
|
||||||
import com.njzscloud.common.mqtt.util.Mqtt;
|
import com.njzscloud.common.mqtt.util.Mqtt;
|
||||||
|
import com.njzscloud.common.ws.support.Websocket;
|
||||||
import com.njzscloud.supervisory.biz.service.TruckLocationTrackService;
|
import com.njzscloud.supervisory.biz.service.TruckLocationTrackService;
|
||||||
import com.njzscloud.supervisory.device.contant.LocalizerCategory;
|
import com.njzscloud.supervisory.device.contant.LocalizerCategory;
|
||||||
import com.njzscloud.supervisory.device.mapper.DeviceLocalizerMapper;
|
import com.njzscloud.supervisory.device.mapper.DeviceLocalizerMapper;
|
||||||
|
|
@ -54,7 +58,9 @@ public class DeviceLocalizerService extends ServiceImpl<DeviceLocalizerMapper, D
|
||||||
.eq(DeviceLocalizerEntity::getTerminalId, terminalId)
|
.eq(DeviceLocalizerEntity::getTerminalId, terminalId)
|
||||||
.eq(DeviceLocalizerEntity::getLocalizerCategory, localizerCategory)),
|
.eq(DeviceLocalizerEntity::getLocalizerCategory, localizerCategory)),
|
||||||
() -> Exceptions.exception("定位器已存在"));
|
() -> Exceptions.exception("定位器已存在"));
|
||||||
this.save(deviceLocalizerEntity.setConfig(new LocalizerConfig()));
|
this.save(deviceLocalizerEntity.setConfig(new LocalizerConfig()
|
||||||
|
.setEnableWarn(false)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -107,6 +113,7 @@ public class DeviceLocalizerService extends ServiceImpl<DeviceLocalizerMapper, D
|
||||||
Boolean online = searchDeviceLocalizerParam.getOnline();
|
Boolean online = searchDeviceLocalizerParam.getOnline();
|
||||||
|
|
||||||
QueryWrapper<Object> ew = Wrappers.query()
|
QueryWrapper<Object> ew = Wrappers.query()
|
||||||
|
.eq("a.deleted", false)
|
||||||
.like(StrUtil.isNotEmpty(terminalId), "a.terminal_id", terminalId)
|
.like(StrUtil.isNotEmpty(terminalId), "a.terminal_id", terminalId)
|
||||||
.like(StrUtil.isNotEmpty(licensePlate), "b.license_plate", licensePlate)
|
.like(StrUtil.isNotEmpty(licensePlate), "b.license_plate", licensePlate)
|
||||||
.eq(localizerCategory != null, "a.localizer_category", localizerCategory)
|
.eq(localizerCategory != null, "a.localizer_category", localizerCategory)
|
||||||
|
|
@ -144,13 +151,22 @@ public class DeviceLocalizerService extends ServiceImpl<DeviceLocalizerMapper, D
|
||||||
public void updateDeviceLocalizerStatus(MqttMsg msg) {
|
public void updateDeviceLocalizerStatus(MqttMsg msg) {
|
||||||
DeviceInfoResult deviceInfoResult = msg.getMsg(DeviceInfoResult.class);
|
DeviceInfoResult deviceInfoResult = msg.getMsg(DeviceInfoResult.class);
|
||||||
if (deviceInfoResult == null) return;
|
if (deviceInfoResult == null) return;
|
||||||
this.update(Wrappers.lambdaUpdate(DeviceLocalizerEntity.class)
|
String terminalId = deviceInfoResult.getTerminalId();
|
||||||
.set(DeviceLocalizerEntity::getOnline, Boolean.TRUE)
|
DeviceLocalizerEntity deviceLocalizerEntity = this.getOne(Wrappers.lambdaQuery(DeviceLocalizerEntity.class).eq(DeviceLocalizerEntity::getTerminalId, terminalId));
|
||||||
.set(DeviceLocalizerEntity::getLastTime, LocalDateTime.now())
|
if (deviceLocalizerEntity == null) return;
|
||||||
.eq(DeviceLocalizerEntity::getTerminalId, deviceInfoResult.getTerminalId()));
|
this.updateById(new DeviceLocalizerEntity()
|
||||||
|
.setId(deviceLocalizerEntity.getId())
|
||||||
|
.setConfig(new LocalizerConfig()
|
||||||
|
.setIp(deviceInfoResult.getServerIp())
|
||||||
|
.setPort(deviceInfoResult.getServerPort())
|
||||||
|
.setEnableWarn(deviceInfoResult.getEnableWarn() == 1)
|
||||||
|
.setSpeedThreshold(deviceInfoResult.getSpeedThreshold())
|
||||||
|
));
|
||||||
|
Websocket.publish("down/reflash/device_info", R.success(MapUtil.builder()
|
||||||
|
.put("terminalId", terminalId)
|
||||||
|
.build()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void modifyConfig(Long id, LocalizerConfig config) {
|
public void modifyConfig(Long id, LocalizerConfig config) {
|
||||||
DeviceLocalizerEntity localizerEntity = this.getById(id);
|
DeviceLocalizerEntity localizerEntity = this.getById(id);
|
||||||
|
|
@ -164,7 +180,7 @@ public class DeviceLocalizerService extends ServiceImpl<DeviceLocalizerMapper, D
|
||||||
Integer speedThreshold = config.getSpeedThreshold();
|
Integer speedThreshold = config.getSpeedThreshold();
|
||||||
Boolean enableWarn = config.getEnableWarn();
|
Boolean enableWarn = config.getEnableWarn();
|
||||||
|
|
||||||
if (StrUtil.isEmpty(ip) && port != null && port > 0) {
|
if (StrUtil.isNotBlank(ip) && port != null && port > 0) {
|
||||||
oldConfig.setIp(ip).setPort(port);
|
oldConfig.setIp(ip).setPort(port);
|
||||||
}
|
}
|
||||||
if (speedThreshold != null && speedThreshold > 0) {
|
if (speedThreshold != null && speedThreshold > 0) {
|
||||||
|
|
@ -173,9 +189,8 @@ public class DeviceLocalizerService extends ServiceImpl<DeviceLocalizerMapper, D
|
||||||
if (enableWarn != null) {
|
if (enableWarn != null) {
|
||||||
oldConfig.setEnableWarn(enableWarn);
|
oldConfig.setEnableWarn(enableWarn);
|
||||||
}
|
}
|
||||||
this.configDevice(terminalId, config);
|
|
||||||
|
|
||||||
this.updateById(new DeviceLocalizerEntity().setId(id).setConfig(oldConfig));
|
this.updateById(new DeviceLocalizerEntity().setId(id).setConfig(oldConfig));
|
||||||
|
this.configDevice(terminalId, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void configDevice(String terminalId, LocalizerConfig config) {
|
private void configDevice(String terminalId, LocalizerConfig config) {
|
||||||
|
|
@ -184,7 +199,7 @@ public class DeviceLocalizerService extends ServiceImpl<DeviceLocalizerMapper, D
|
||||||
Integer speedThreshold = config.getSpeedThreshold();
|
Integer speedThreshold = config.getSpeedThreshold();
|
||||||
Boolean enableWarn = config.getEnableWarn();
|
Boolean enableWarn = config.getEnableWarn();
|
||||||
|
|
||||||
if (StrUtil.isEmpty(ip) && port != null && port > 0) {
|
if (StrUtil.isNotBlank(ip) && port != null && port > 0) {
|
||||||
modifyIpPort(terminalId, ip, port);
|
modifyIpPort(terminalId, ip, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -221,4 +236,11 @@ public class DeviceLocalizerService extends ServiceImpl<DeviceLocalizerMapper, D
|
||||||
.setEnable(enableWarn)
|
.setEnable(enableWarn)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void reflashConfig(Long id) {
|
||||||
|
DeviceLocalizerEntity localizerEntity = this.getById(id);
|
||||||
|
Assert.notNull(localizerEntity, () -> Exceptions.clierr("设备不存在"));
|
||||||
|
String terminalId = localizerEntity.getTerminalId();
|
||||||
|
Mqtt.publish("location/device_info", new ObtainDeviceInfoParam().setTerminalId(terminalId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,9 +84,3 @@ mqtt:
|
||||||
client-id: njzscloud-svr1
|
client-id: njzscloud-svr1
|
||||||
username: gps
|
username: gps
|
||||||
password: TKG4TV3dF7CeazDnUdCF
|
password: TKG4TV3dF7CeazDnUdCF
|
||||||
|
|
||||||
localizer:
|
|
||||||
enabled: true
|
|
||||||
boss-threads: 1
|
|
||||||
worker-threads: 1
|
|
||||||
port: 18888
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
<id property="id" column="id"/>
|
<id property="id" column="id"/>
|
||||||
<result property="terminalId" column="terminal_id"/>
|
<result property="terminalId" column="terminal_id"/>
|
||||||
<result property="licensePlate" column="license_plate"/>
|
<result property="licensePlate" column="license_plate"/>
|
||||||
|
<result property="config" column="config" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
|
||||||
<result property="localizerCategory" column="localizer_category" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
|
<result property="localizerCategory" column="localizer_category" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
|
||||||
<result property="online" column="online"/>
|
<result property="online" column="online"/>
|
||||||
<result property="lastTime" column="last_time"/>
|
<result property="lastTime" column="last_time"/>
|
||||||
|
|
@ -25,9 +26,10 @@
|
||||||
<select id="detail" resultMap="detailResultMap">
|
<select id="detail" resultMap="detailResultMap">
|
||||||
select a.id,
|
select a.id,
|
||||||
a.terminal_id,
|
a.terminal_id,
|
||||||
|
a.config,
|
||||||
b.license_plate,
|
b.license_plate,
|
||||||
a.localizer_category,
|
a.localizer_category,
|
||||||
a.online,
|
a.last_time >= DATE_SUB(NOW(), INTERVAL 5 MINUTE) `online`,
|
||||||
a.last_time,
|
a.last_time,
|
||||||
a.create_time,
|
a.create_time,
|
||||||
a.modify_time
|
a.modify_time
|
||||||
|
|
@ -35,8 +37,11 @@
|
||||||
left join biz_truck b on b.gps = a.terminal_id and b.deleted = 0
|
left join biz_truck b on b.gps = a.terminal_id and b.deleted = 0
|
||||||
where a.id = #{id}
|
where a.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
<select id="paging" resultType="com.njzscloud.supervisory.device.pojo.result.SearchDeviceLocalizerResult">
|
<select id="paging" resultMap="detailResultMap">
|
||||||
select a.id, a.terminal_id, b.license_plate, a.localizer_category, a.online, a.last_time, a.create_time, a.modify_time
|
select a.id, a.terminal_id, b.license_plate, a.localizer_category,
|
||||||
|
a.config,
|
||||||
|
a.last_time >= DATE_SUB(NOW(), INTERVAL 5 MINUTE) `online`,
|
||||||
|
a.last_time, a.create_time, a.modify_time
|
||||||
from device_localizer a
|
from device_localizer a
|
||||||
left join biz_truck b on b.gps = a.terminal_id and b.deleted = 0
|
left join biz_truck b on b.gps = a.terminal_id and b.deleted = 0
|
||||||
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||||
|
|
|
||||||
11
pom.xml
11
pom.xml
|
|
@ -12,6 +12,7 @@
|
||||||
<modules>
|
<modules>
|
||||||
<module>njzscloud-common</module>
|
<module>njzscloud-common</module>
|
||||||
<module>njzscloud-svr</module>
|
<module>njzscloud-svr</module>
|
||||||
|
<module>njzscloud-localizer-svr</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
@ -37,16 +38,6 @@
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>com.xuxueli</groupId>
|
|
||||||
<artifactId>xxl-job-core</artifactId>
|
|
||||||
<version>${xxl-job.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.mapstruct</groupId>
|
|
||||||
<artifactId>mapstruct</artifactId>
|
|
||||||
<version>${mapstruct.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njzscloud</groupId>
|
<groupId>com.njzscloud</groupId>
|
||||||
<artifactId>njzscloud-common-core</artifactId>
|
<artifactId>njzscloud-common-core</artifactId>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue