三次更新
parent
4afd656bc5
commit
63d8209f95
129
pom.xml
129
pom.xml
|
@ -7,20 +7,135 @@
|
|||
<artifactId>ruoyi</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>ruoyi-receive-common</module>
|
||||
<module>ruoyi-receive-remote</module>
|
||||
<module>ruoyi-receive-server</module>
|
||||
</modules>
|
||||
<packaging>jar</packaging>
|
||||
<version>3.6.3</version>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-modules-receive</artifactId>
|
||||
<artifactId>ruoyireceive</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-modules-receive 接收模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-receive-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-redis</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <!– RuoYi Common DataSource –>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.ruoyi</groupId>-->
|
||||
<!-- <artifactId>ruoyi-common-datasource</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- <!– RuoYi Common DataScope –>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.ruoyi</groupId>-->
|
||||
<!-- <artifactId>ruoyi-common-datascope</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- RuoYi Common Log -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.ruoyi</groupId>-->
|
||||
<!-- <artifactId>ruoyi-common-log</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- RuoYi Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-file-remote</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- netty 公共包-->
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-all</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Boot Redis -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
<version>2.0.4.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- zookeeper客户端依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.curator</groupId>
|
||||
<artifactId>curator-framework</artifactId>
|
||||
<version>4.2.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.gu</groupId>
|
||||
<artifactId>ruoyi-business-cache</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.mysql</groupId>-->
|
||||
<!-- <artifactId>mysql-connector-j</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-core</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
|
@ -1,71 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
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.ruoyi</groupId>
|
||||
<artifactId>ruoyi-modules-receive</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-receive-common</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.mysql</groupId>-->
|
||||
<!-- <artifactId>mysql-connector-j</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-core</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,38 +0,0 @@
|
|||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
|
@ -1,29 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
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.ruoyi</groupId>
|
||||
<artifactId>ruoyi-modules-receive</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-receive-remote</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-receive-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -1,38 +0,0 @@
|
|||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
|
@ -1,122 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
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.ruoyi</groupId>
|
||||
<artifactId>ruoyi-modules-receive</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-receive-server</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-receive-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <!– RuoYi Common DataSource –>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.ruoyi</groupId>-->
|
||||
<!-- <artifactId>ruoyi-common-datasource</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- <!– RuoYi Common DataScope –>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.ruoyi</groupId>-->
|
||||
<!-- <artifactId>ruoyi-common-datascope</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- RuoYi Common Log -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.ruoyi</groupId>-->
|
||||
<!-- <artifactId>ruoyi-common-log</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- RuoYi Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-file-remote</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- netty 公共包-->
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-all</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Boot Redis -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
<version>2.0.4.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- zookeeper客户端依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.curator</groupId>
|
||||
<artifactId>curator-framework</artifactId>
|
||||
<version>4.2.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.gu</groupId>
|
||||
<artifactId>ruoyi-business-cache</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<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-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -1,19 +0,0 @@
|
|||
package com.ruoyi.receive.netty.server.impl;
|
||||
|
||||
import com.ruoyi.receive.netty.server.KafkaConsumerService;
|
||||
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
||||
import org.apache.kafka.clients.consumer.ConsumerRecords;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class KafkaConsumerServiceImpl implements KafkaConsumerService {
|
||||
|
||||
@Override
|
||||
public void service(ConsumerRecords<String, String> records) {
|
||||
|
||||
for (ConsumerRecord<String,String> record : records){
|
||||
System.out.println("消息:key = " + record.key() + ",value = " + record.value());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package com.ruoyi.receive.domain;
|
||||
|
||||
/**
|
||||
* 连接常量
|
||||
*/
|
||||
public class VehicleConstant {
|
||||
/**
|
||||
* 分包符
|
||||
*/
|
||||
public static final String DATA_PACK_SEPARATOR = "#$&*";
|
||||
|
||||
/**
|
||||
* 报文起始位
|
||||
*/
|
||||
public static final String MSG_START = "7E ";
|
||||
|
||||
/**
|
||||
* 报文结束位
|
||||
*/
|
||||
public static final String MSG_END = "7E";
|
||||
|
||||
/**
|
||||
* 连接消息VIN
|
||||
*/
|
||||
public final static String START_VIN_SUF = "START_VIN:";
|
||||
/**
|
||||
* 连接消息VIN
|
||||
*/
|
||||
public final static String START_VIN_SUCCESS_SUF = "SUCCESS_VIN:";
|
||||
/**
|
||||
* 车辆消息报文前缀
|
||||
*/
|
||||
public final static String VEHICLE_MSG_SUF = "VEHICLE_MSG:";
|
||||
/**
|
||||
* 车辆启动报文前缀
|
||||
*/
|
||||
public final static String VEHICLE_START_SUF = "VEHICLE_START:";
|
||||
/**
|
||||
* 车辆关闭报文前缀
|
||||
*/
|
||||
public final static String VEHICLE_STOP_SUF = "VEHICLE_STOP:";
|
||||
|
||||
/**
|
||||
* 连接启动信息
|
||||
*/
|
||||
public final static String NETTY_CONNECT = "CONNECT";
|
||||
/**
|
||||
* 连接关闭信息
|
||||
*/
|
||||
public final static String NETTY_WILL_CLOSE = "WILL_CLOSE:";
|
||||
/**
|
||||
* 连接关闭信息
|
||||
*/
|
||||
public final static String NETTY_CLOSE = "CLOSE";
|
||||
|
||||
/**
|
||||
* 车辆VIN正则表达式
|
||||
*/
|
||||
public final static String VIN_REGEX = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{17}$";
|
||||
|
||||
|
||||
/**
|
||||
* 车辆基础故障组
|
||||
*/
|
||||
public final static String VEHICLE_BASE_FAULT = "vehicle_base";
|
||||
|
||||
/**
|
||||
* 车辆零配件故障组
|
||||
*/
|
||||
public final static String VEHICLE_PARTS_FAULT = "vehicle_parts";
|
||||
|
||||
/**
|
||||
* 车辆电池故障组
|
||||
*/
|
||||
public final static String VEHICLE_BATTERY_FAULT = "vehicle_battery";
|
||||
}
|
|
@ -0,0 +1,582 @@
|
|||
package com.ruoyi.receive.domain;
|
||||
|
||||
/**
|
||||
* 报文实体类
|
||||
*/
|
||||
public class VehicleMessage {
|
||||
//消息标识
|
||||
private String identification;
|
||||
//VIN码
|
||||
private String vinCode;
|
||||
//经度
|
||||
private String longitude;
|
||||
//纬度
|
||||
private String latitude;
|
||||
//车速
|
||||
private String speedOfVehicle;
|
||||
//总里程
|
||||
private String totalMileage;
|
||||
//总电压
|
||||
private String totalVoltage;
|
||||
//总电流
|
||||
private String combinedCurrent;
|
||||
//绝缘电阻
|
||||
private String insulationResistance;
|
||||
//档位
|
||||
private String gearPosition;
|
||||
//加速踏板行程值
|
||||
private String acceleratorPedalTravelValue;
|
||||
//制动踏板行程值
|
||||
private String brakePedalTravelValue;
|
||||
//燃料消耗率
|
||||
private String specificFuelConsumption;
|
||||
//电机控制器温度
|
||||
private String motorControllerTemperature;
|
||||
//电机转速
|
||||
private String motorSpeed;
|
||||
//电机转矩
|
||||
private String motorTorque;
|
||||
//电机温度
|
||||
private String motorTemperature;
|
||||
//电机电压
|
||||
private String motorVoltage;
|
||||
//电机电流
|
||||
private String motorCurrent;
|
||||
//动力电池剩余电量SOC
|
||||
private String electricalSoc;
|
||||
//当前状态允许的最大反馈功率
|
||||
private String maximumFeedbackPower;
|
||||
//当前状态允许最大放电功率
|
||||
private String maximumDischargePower;
|
||||
//BMS自检计数器
|
||||
private String bms;
|
||||
//动力电池充放电电流
|
||||
private String batteryCurrent;
|
||||
//动力电池负载端总电压V3
|
||||
private String v3;
|
||||
//单次最大电压
|
||||
private String singleMaximumVoltage;
|
||||
//单体电池最低电压
|
||||
private String minimumVoltageOfBattery;
|
||||
//单体电池最高温度
|
||||
private String maximumBatteryTemperature;
|
||||
//单体电池最低温度
|
||||
private String minimumBatteryTemperature;
|
||||
//动力电池可用容量
|
||||
private String powerBatteryAvailableCapacity;
|
||||
//车辆状态
|
||||
private Integer carStatus;
|
||||
//充电状态
|
||||
private Integer chargingState;
|
||||
//运行状态
|
||||
private Integer runningState;
|
||||
//SOC
|
||||
private String soc;
|
||||
//可充电储能装置工作状态
|
||||
private String workingCondition;
|
||||
//驱动电机状态
|
||||
private String driveMotorCondition;
|
||||
//定位是否有效
|
||||
private String whetherTheLocationValid;
|
||||
//EAS
|
||||
private String eas;
|
||||
//PTC
|
||||
private String ptc;
|
||||
//EPS
|
||||
private String eps;
|
||||
//ABS
|
||||
private String abs;
|
||||
//MCU
|
||||
private String mcu;
|
||||
//动力电池加热状态
|
||||
private String powerBatteryHeatingState;
|
||||
//动力电池当前状态
|
||||
private String powerBattery;
|
||||
//动力电池保温状态
|
||||
private String powerBatteryInsulationState;
|
||||
//DCDC
|
||||
private String dcdc;
|
||||
//CHG
|
||||
private String chg;
|
||||
|
||||
//时间
|
||||
private Long time;
|
||||
|
||||
public String getIdentification() {
|
||||
return identification;
|
||||
}
|
||||
|
||||
public void setIdentification(Object identification) {
|
||||
if(identification!=null) {this.identification = (String) identification;}
|
||||
}
|
||||
|
||||
public String getVinCode() {
|
||||
return vinCode;
|
||||
}
|
||||
|
||||
public void setVinCode(Object vinCode) {
|
||||
if (vinCode!=null) {
|
||||
this.vinCode = (String) vinCode;
|
||||
}
|
||||
}
|
||||
|
||||
public String getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public void setLongitude(Object longitude) {
|
||||
if (longitude!=null) {
|
||||
this.longitude = (String) longitude;
|
||||
}
|
||||
}
|
||||
|
||||
public String getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public void setLatitude(Object latitude) {
|
||||
if (latitude!=null) {
|
||||
this.latitude = (String) latitude;
|
||||
}
|
||||
}
|
||||
|
||||
public String getSpeedOfVehicle() {
|
||||
return speedOfVehicle;
|
||||
}
|
||||
|
||||
public void setSpeedOfVehicle(Object speedOfVehicle) {
|
||||
if (speedOfVehicle!=null) {
|
||||
this.speedOfVehicle = (String) speedOfVehicle;
|
||||
}
|
||||
}
|
||||
|
||||
public String getTotalMileage() {
|
||||
return totalMileage;
|
||||
}
|
||||
|
||||
public void setTotalMileage(Object totalMileage) {
|
||||
if (totalMileage!=null) {
|
||||
this.totalMileage = (String) totalMileage;
|
||||
}
|
||||
}
|
||||
|
||||
public String getTotalVoltage() {
|
||||
return totalVoltage;
|
||||
}
|
||||
|
||||
public void setTotalVoltage(Object totalVoltage) {
|
||||
if (totalVoltage!=null) {
|
||||
this.totalVoltage = (String) totalVoltage;
|
||||
}
|
||||
}
|
||||
|
||||
public String getCombinedCurrent() {
|
||||
return combinedCurrent;
|
||||
}
|
||||
|
||||
public void setCombinedCurrent(Object combinedCurrent) {
|
||||
if (combinedCurrent!=null) {
|
||||
this.combinedCurrent = (String) combinedCurrent;
|
||||
}
|
||||
}
|
||||
|
||||
public String getInsulationResistance() {
|
||||
return insulationResistance;
|
||||
}
|
||||
|
||||
public void setInsulationResistance(Object insulationResistance) {
|
||||
if (insulationResistance!=null) {
|
||||
this.insulationResistance = (String) insulationResistance;
|
||||
}
|
||||
}
|
||||
|
||||
public String getGearPosition() {
|
||||
return gearPosition;
|
||||
}
|
||||
|
||||
public void setGearPosition(Object gearPosition) {
|
||||
if (gearPosition!=null) {
|
||||
this.gearPosition = (String) gearPosition;
|
||||
}
|
||||
}
|
||||
|
||||
public String getAcceleratorPedalTravelValue() {
|
||||
return acceleratorPedalTravelValue;
|
||||
}
|
||||
|
||||
public void setAcceleratorPedalTravelValue(Object acceleratorPedalTravelValue) {
|
||||
if (acceleratorPedalTravelValue!=null) {
|
||||
this.acceleratorPedalTravelValue = (String) acceleratorPedalTravelValue;
|
||||
}
|
||||
}
|
||||
|
||||
public String getBrakePedalTravelValue() {
|
||||
return brakePedalTravelValue;
|
||||
}
|
||||
|
||||
public void setBrakePedalTravelValue(Object brakePedalTravelValue) {
|
||||
if (brakePedalTravelValue!=null) {
|
||||
this.brakePedalTravelValue = (String) brakePedalTravelValue;
|
||||
}
|
||||
}
|
||||
|
||||
public String getSpecificFuelConsumption() {
|
||||
return specificFuelConsumption;
|
||||
}
|
||||
|
||||
public void setSpecificFuelConsumption(Object specificFuelConsumption) {
|
||||
if (specificFuelConsumption!=null) {
|
||||
this.specificFuelConsumption = (String) specificFuelConsumption;
|
||||
}
|
||||
}
|
||||
|
||||
public String getMotorControllerTemperature() {
|
||||
return motorControllerTemperature;
|
||||
}
|
||||
|
||||
public void setMotorControllerTemperature(Object motorControllerTemperature) {
|
||||
if (motorControllerTemperature!=null) {
|
||||
this.motorControllerTemperature = (String) motorControllerTemperature;
|
||||
}
|
||||
}
|
||||
|
||||
public String getMotorSpeed() {
|
||||
return motorSpeed;
|
||||
}
|
||||
|
||||
public void setMotorSpeed(Object motorSpeed) {
|
||||
if (motorSpeed!=null) {
|
||||
this.motorSpeed = (String) motorSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
public String getMotorTorque() {
|
||||
return motorTorque;
|
||||
}
|
||||
|
||||
public void setMotorTorque(Object motorTorque) {
|
||||
if (motorTorque!=null) {
|
||||
this.motorTorque = (String) motorTorque;
|
||||
}
|
||||
}
|
||||
|
||||
public String getMotorTemperature() {
|
||||
return motorTemperature;
|
||||
}
|
||||
|
||||
public void setMotorTemperature(Object motorTemperature) {
|
||||
if (motorTemperature!=null) {
|
||||
this.motorTemperature = (String) motorTemperature;
|
||||
}
|
||||
}
|
||||
|
||||
public String getMotorVoltage() {
|
||||
return motorVoltage;
|
||||
}
|
||||
|
||||
public void setMotorVoltage(Object motorVoltage) {
|
||||
if (motorVoltage!=null) {
|
||||
this.motorVoltage = (String) motorVoltage;
|
||||
}
|
||||
}
|
||||
|
||||
public String getMotorCurrent() {
|
||||
return motorCurrent;
|
||||
}
|
||||
|
||||
public void setMotorCurrent(Object motorCurrent) {
|
||||
if (motorCurrent!=null) {
|
||||
this.motorCurrent = (String) motorCurrent;
|
||||
}
|
||||
}
|
||||
|
||||
public String getElectricalSoc() {
|
||||
return electricalSoc;
|
||||
}
|
||||
|
||||
public void setElectricalSoc(Object electricalSoc) {
|
||||
if (electricalSoc!=null) {
|
||||
this.electricalSoc = (String) electricalSoc;
|
||||
}
|
||||
}
|
||||
|
||||
public String getMaximumFeedbackPower() {
|
||||
return maximumFeedbackPower;
|
||||
}
|
||||
|
||||
public void setMaximumFeedbackPower(Object maximumFeedbackPower) {
|
||||
if (maximumFeedbackPower!=null) {
|
||||
this.maximumFeedbackPower = (String) maximumFeedbackPower;
|
||||
}
|
||||
}
|
||||
|
||||
public String getMaximumDischargePower() {
|
||||
return maximumDischargePower;
|
||||
}
|
||||
|
||||
public void setMaximumDischargePower(Object maximumDischargePower) {
|
||||
if (maximumDischargePower!=null) {
|
||||
this.maximumDischargePower = (String) maximumDischargePower;
|
||||
}
|
||||
}
|
||||
|
||||
public String getBms() {
|
||||
return bms;
|
||||
}
|
||||
|
||||
public void setBms(Object bms) {
|
||||
if (bms!=null) {
|
||||
this.bms = (String) bms;
|
||||
}
|
||||
}
|
||||
|
||||
public String getBatteryCurrent() {
|
||||
return batteryCurrent;
|
||||
}
|
||||
|
||||
public void setBatteryCurrent(Object batteryCurrent) {
|
||||
if (batteryCurrent!=null) {
|
||||
this.batteryCurrent = (String) batteryCurrent;
|
||||
}
|
||||
}
|
||||
|
||||
public String getV3() {
|
||||
return v3;
|
||||
}
|
||||
|
||||
public void setV3(Object v3) {
|
||||
if (v3!=null) {
|
||||
this.v3 = (String) v3;
|
||||
}
|
||||
}
|
||||
|
||||
public String getSingleMaximumVoltage() {
|
||||
return singleMaximumVoltage;
|
||||
}
|
||||
|
||||
public void setSingleMaximumVoltage(Object singleMaximumVoltage) {
|
||||
if (singleMaximumVoltage!=null) {
|
||||
this.singleMaximumVoltage = (String) singleMaximumVoltage;
|
||||
}
|
||||
}
|
||||
|
||||
public String getMinimumVoltageOfBattery() {
|
||||
return minimumVoltageOfBattery;
|
||||
}
|
||||
|
||||
public void setMinimumVoltageOfBattery(Object minimumVoltageOfBattery) {
|
||||
if (minimumVoltageOfBattery!=null) {
|
||||
this.minimumVoltageOfBattery = (String) minimumVoltageOfBattery;
|
||||
}
|
||||
}
|
||||
|
||||
public String getMaximumBatteryTemperature() {
|
||||
return maximumBatteryTemperature;
|
||||
}
|
||||
|
||||
public void setMaximumBatteryTemperature(Object maximumBatteryTemperature) {
|
||||
if (maximumBatteryTemperature!=null) {
|
||||
this.maximumBatteryTemperature = (String) maximumBatteryTemperature;
|
||||
}
|
||||
}
|
||||
|
||||
public String getMinimumBatteryTemperature() {
|
||||
return minimumBatteryTemperature;
|
||||
}
|
||||
|
||||
public void setMinimumBatteryTemperature(Object minimumBatteryTemperature) {
|
||||
if (minimumBatteryTemperature!=null) {
|
||||
this.minimumBatteryTemperature = (String) minimumBatteryTemperature;
|
||||
}
|
||||
}
|
||||
|
||||
public String getPowerBatteryAvailableCapacity() {
|
||||
return powerBatteryAvailableCapacity;
|
||||
}
|
||||
|
||||
public void setPowerBatteryAvailableCapacity(Object powerBatteryAvailableCapacity) {
|
||||
if (powerBatteryAvailableCapacity!=null) {
|
||||
this.powerBatteryAvailableCapacity = (String) powerBatteryAvailableCapacity;
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getCarStatus() {
|
||||
return carStatus;
|
||||
}
|
||||
|
||||
public void setCarStatus(Object carStatus) {
|
||||
if (carStatus!=null) {
|
||||
this.carStatus = Integer.valueOf(carStatus.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getChargingState() {
|
||||
return chargingState;
|
||||
}
|
||||
|
||||
public void setChargingState(Object chargingState) {
|
||||
if (chargingState!=null) {
|
||||
this.chargingState = Integer.valueOf(chargingState.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getRunningState() {
|
||||
return runningState;
|
||||
}
|
||||
|
||||
public void setRunningState(Object runningState) {
|
||||
if (runningState!=null) {
|
||||
this.runningState = Integer.valueOf(runningState.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public String getSoc() {
|
||||
return soc;
|
||||
}
|
||||
|
||||
public void setSoc(Object soc) {
|
||||
if (soc!=null) {
|
||||
this.soc = (String) soc;
|
||||
}
|
||||
}
|
||||
|
||||
public String getWorkingCondition() {
|
||||
return workingCondition;
|
||||
}
|
||||
|
||||
public void setWorkingCondition(Object workingCondition) {
|
||||
if (workingCondition!=null) {
|
||||
this.workingCondition = (String) workingCondition;
|
||||
}
|
||||
}
|
||||
|
||||
public String getDriveMotorCondition() {
|
||||
return driveMotorCondition;
|
||||
}
|
||||
|
||||
public void setDriveMotorCondition(Object driveMotorCondition) {
|
||||
if (driveMotorCondition!=null) {
|
||||
this.driveMotorCondition = (String) driveMotorCondition;
|
||||
}
|
||||
}
|
||||
|
||||
public String getWhetherTheLocationValid() {
|
||||
return whetherTheLocationValid;
|
||||
}
|
||||
|
||||
public void setWhetherTheLocationValid(Object whetherTheLocationValid) {
|
||||
if (whetherTheLocationValid!=null) {
|
||||
this.whetherTheLocationValid = (String) whetherTheLocationValid;
|
||||
}
|
||||
}
|
||||
|
||||
public String getEas() {
|
||||
return eas;
|
||||
}
|
||||
|
||||
public void setEas(Object eas) {
|
||||
if (eas!=null) {
|
||||
this.eas = (String) eas;
|
||||
}
|
||||
}
|
||||
|
||||
public String getPtc() {
|
||||
return ptc;
|
||||
}
|
||||
|
||||
public void setPtc(Object ptc) {
|
||||
if (ptc!=null) {
|
||||
this.ptc = (String) ptc;
|
||||
}
|
||||
}
|
||||
|
||||
public String getEps() {
|
||||
return eps;
|
||||
}
|
||||
|
||||
public void setEps(Object eps) {
|
||||
if (eps!=null) {
|
||||
this.eps = (String) eps;
|
||||
}
|
||||
}
|
||||
|
||||
public String getAbs() {
|
||||
return abs;
|
||||
}
|
||||
|
||||
public void setAbs(Object abs) {
|
||||
if (abs!=null) {
|
||||
this.abs = (String) abs;
|
||||
}
|
||||
}
|
||||
|
||||
public String getMcu() {
|
||||
return mcu;
|
||||
}
|
||||
|
||||
public void setMcu(Object mcu) {
|
||||
if (mcu!=null) {
|
||||
this.mcu = (String) mcu;
|
||||
}
|
||||
}
|
||||
|
||||
public String getPowerBatteryHeatingState() {
|
||||
return powerBatteryHeatingState;
|
||||
}
|
||||
|
||||
public void setPowerBatteryHeatingState(Object powerBatteryHeatingState) {
|
||||
if (powerBatteryHeatingState!=null) {
|
||||
this.powerBatteryHeatingState = (String) powerBatteryHeatingState;
|
||||
}
|
||||
}
|
||||
|
||||
public String getPowerBattery() {
|
||||
return powerBattery;
|
||||
}
|
||||
|
||||
public void setPowerBattery(Object powerBattery) {
|
||||
if (powerBattery!=null) {
|
||||
this.powerBattery = (String) powerBattery;
|
||||
}
|
||||
}
|
||||
|
||||
public String getPowerBatteryInsulationState() {
|
||||
return powerBatteryInsulationState;
|
||||
}
|
||||
|
||||
public void setPowerBatteryInsulationState(Object powerBatteryInsulationState) {
|
||||
if (powerBatteryInsulationState!=null) {
|
||||
this.powerBatteryInsulationState = (String) powerBatteryInsulationState;
|
||||
}
|
||||
}
|
||||
|
||||
public String getDcdc() {
|
||||
return dcdc;
|
||||
}
|
||||
|
||||
public void setDcdc(Object dcdc) {
|
||||
if (dcdc!=null) {
|
||||
this.dcdc = (String) dcdc;
|
||||
}
|
||||
}
|
||||
|
||||
public String getChg() {
|
||||
return chg;
|
||||
}
|
||||
|
||||
public void setChg(Object chg) {
|
||||
if (chg!=null) {
|
||||
this.chg = (String) chg;
|
||||
}
|
||||
}
|
||||
|
||||
public Long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(Object time) {
|
||||
if (time!=null) {
|
||||
this.time = Long.valueOf(time.toString());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,24 +21,23 @@ import java.util.Properties;
|
|||
@Component
|
||||
public class Consumer {
|
||||
|
||||
private final KafkaConsumerConfig kafkaConsumerConfig;
|
||||
private final KafkaConfig kafkaConfig;
|
||||
|
||||
private final ConsumerCustomConfig consumerCustomConfig;
|
||||
|
||||
private final KafkaConsumerService kafkaConsumerService;
|
||||
|
||||
public Consumer(KafkaConsumerConfig kafkaConsumerConfig, ConsumerCustomConfig consumerCustomConfig, KafkaConsumerService kafkaConsumerService) {
|
||||
this.kafkaConsumerConfig = kafkaConsumerConfig;
|
||||
public Consumer(KafkaConfig kafkaConfig, ConsumerCustomConfig consumerCustomConfig, KafkaConsumerService kafkaConsumerService) {
|
||||
this.kafkaConfig = kafkaConfig;
|
||||
this.consumerCustomConfig = consumerCustomConfig;
|
||||
this.kafkaConsumerService = kafkaConsumerService;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public KafkaConsumer<String,String> consumerInit(){
|
||||
//创建kafka消费者配置
|
||||
Properties properties = new Properties();
|
||||
properties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,kafkaConsumerConfig.consumerConfigs() );
|
||||
properties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,kafkaConfig.getHosts() );
|
||||
properties.put(ConsumerConfig.GROUP_ID_CONFIG,consumerCustomConfig.getGroup());
|
||||
properties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
|
||||
properties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,StringDeserializer.class.getName());
|
|
@ -0,0 +1,28 @@
|
|||
package com.ruoyi.receive.kafka.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* kafka config配置类
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "kafka.config")
|
||||
public class KafkaConfig {
|
||||
|
||||
|
||||
/**
|
||||
* 服务地址
|
||||
*/
|
||||
private String hosts;
|
||||
|
||||
/**
|
||||
* topic
|
||||
*/
|
||||
|
||||
private String topic;
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.ruoyi.receive.kafka.consumer;
|
||||
|
||||
import com.ruoyi.receive.domain.VehicleConstant;
|
||||
|
||||
public class KafkaConsumer {
|
||||
|
||||
|
||||
public static boolean checkMessageHandler(String message){
|
||||
|
||||
if(!message.contains(VehicleConstant.DATA_PACK_SEPARATOR)){
|
||||
return false;
|
||||
}
|
||||
String temp = message.replaceAll("#\\$&\\*","");
|
||||
if(message.indexOf(VehicleConstant.MSG_START) !=0) return false;
|
||||
if((message.lastIndexOf(VehicleConstant.MSG_END)+2) != temp.length()) return false;
|
||||
String content = message.substring(2,message.length()-9);
|
||||
String data = content.replace(" ", "");
|
||||
int dSum = 0;
|
||||
int length = data.length();
|
||||
int index = 0;
|
||||
// 遍历十六进制,并计算总和
|
||||
while (index < length) {
|
||||
// 截取2位字符
|
||||
String s = data.substring(index, index + 2);
|
||||
// 十六进制转成十进制 , 并计算十进制的总和
|
||||
dSum += Integer.parseInt(s, 16);
|
||||
index = index + 2;
|
||||
}
|
||||
// 用256取余,十六进制最大是FF,FF的十进制是255
|
||||
int mod = dSum % 256;
|
||||
// 余数转成十六进制
|
||||
String checkSumHex = Integer.toHexString(mod);
|
||||
length = checkSumHex.length();
|
||||
if (length < 2) {
|
||||
// 校验位不足两位的,在前面补0
|
||||
checkSumHex = "0" + checkSumHex;
|
||||
}
|
||||
String parityBit = message.substring(message.length() - 9,message.length() - 7);
|
||||
return parityBit.equals(checkSumHex);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.ruoyi.receive.netty.server.impl;
|
||||
|
||||
import com.ruoyi.receive.domain.VehicleMessage;
|
||||
import com.ruoyi.receive.kafka.consumer.KafkaConsumer;
|
||||
import com.ruoyi.receive.netty.server.KafkaConsumerService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
||||
import org.apache.kafka.clients.consumer.ConsumerRecords;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Log4j2
|
||||
@Service
|
||||
public class KafkaConsumerServiceImpl implements KafkaConsumerService {
|
||||
|
||||
@Override
|
||||
public void service(ConsumerRecords<String, String> records) {
|
||||
|
||||
for (ConsumerRecord<String,String> record : records){
|
||||
log.info("消息:key:{},msg:{}",record.key(),record.value());
|
||||
|
||||
String vehicleMessage = record.value();
|
||||
|
||||
boolean checkMessageHandler = KafkaConsumer.checkMessageHandler(vehicleMessage);
|
||||
|
||||
if (checkMessageHandler){
|
||||
VehicleMessage message = new VehicleMessage();
|
||||
}else {
|
||||
throw new RuntimeException("解析错误");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.ruoyi.receive.service;
|
||||
|
||||
import com.ruoyi.common.core.utils.SpringUtils;
|
||||
import com.ruoyi.common.redis.service.RedisService;
|
||||
import com.ruoyi.receive.domain.VehicleMessage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 消息处理上下文
|
||||
*/
|
||||
@Component
|
||||
public class MessageContext {
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
private Map<String,MessageService> messageServiceMap = new HashMap<>();
|
||||
|
||||
|
||||
|
||||
@PostConstruct
|
||||
private void init(){
|
||||
List<String> allMessageServiceKeyList = redisService.getCacheObject("消息处理的key");
|
||||
allMessageServiceKeyList.forEach(allMessageServiceKey ->{
|
||||
MessageService messageService = SpringUtils.getBean(allMessageServiceKey);
|
||||
messageServiceMap.put(allMessageServiceKey,messageService);
|
||||
});
|
||||
}
|
||||
|
||||
public void handler(VehicleMessage message){
|
||||
String vinCode = message.getVinCode();
|
||||
|
||||
List<String> analysisList = redisService.getCacheList("msg:analysis:" + vinCode);
|
||||
|
||||
analysisList.forEach(analysis ->{
|
||||
MessageService messageService = messageServiceMap.get(analysis);
|
||||
messageService.excetion(message);
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.ruoyi.receive.service;
|
||||
|
||||
import com.ruoyi.receive.domain.VehicleMessage;
|
||||
|
||||
/**
|
||||
* 报文处理基准
|
||||
*/
|
||||
public interface MessageService {
|
||||
|
||||
/**
|
||||
* 车辆解析
|
||||
* @param message
|
||||
*/
|
||||
public void excetion(VehicleMessage message);
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.ruoyi.receive.service.impl;
|
||||
|
||||
import com.ruoyi.receive.domain.VehicleMessage;
|
||||
import com.ruoyi.receive.service.MessageService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 故障
|
||||
*/
|
||||
@Service("guzhang")
|
||||
public class MessageGuZhangServiceImpl implements MessageService {
|
||||
|
||||
|
||||
@Override
|
||||
public void excetion(VehicleMessage message) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.ruoyi.receive.service.impl;
|
||||
|
||||
import com.ruoyi.receive.domain.VehicleMessage;
|
||||
import com.ruoyi.receive.service.MessageService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 实时数据
|
||||
*/
|
||||
@Service("shishi")
|
||||
public class MessageShiShiServiceImpl implements MessageService {
|
||||
|
||||
|
||||
@Override
|
||||
public void excetion(VehicleMessage message) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.ruoyi.receive.service.impl;
|
||||
|
||||
import com.ruoyi.receive.domain.VehicleMessage;
|
||||
import com.ruoyi.receive.service.MessageService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 电子围栏
|
||||
*/
|
||||
@Service("weilan")
|
||||
public class MessageWeiLanServiceImpl implements MessageService {
|
||||
|
||||
|
||||
@Override
|
||||
public void excetion(VehicleMessage message) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.ruoyi.receive.service.impl;
|
||||
|
||||
import com.ruoyi.receive.domain.VehicleMessage;
|
||||
import com.ruoyi.receive.service.MessageService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 预警
|
||||
*/
|
||||
@Service("yujing")
|
||||
public class MessageYuJingServiceImpl implements MessageService {
|
||||
|
||||
|
||||
@Override
|
||||
public void excetion(VehicleMessage message) {
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue