dev.protocol.parsing
parent
052a0012fc
commit
1a3b267685
|
@ -25,8 +25,9 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.kafka</groupId>
|
<groupId>org.apache.kafka</groupId>
|
||||||
<artifactId>spring-kafka</artifactId>
|
<artifactId>kafka-clients</artifactId>
|
||||||
|
<version>3.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.muyu.common.kafka.config;
|
||||||
|
|
||||||
|
import com.muyu.common.kafka.constants.KafkaConstants;
|
||||||
|
import org.apache.kafka.clients.consumer.KafkaConsumer;
|
||||||
|
import org.apache.kafka.common.serialization.Deserializer;
|
||||||
|
import org.apache.kafka.common.serialization.StringDeserializer;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.SpringBootConfiguration;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* kafka 消息的消费者 配置类
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class KafkaConsumerConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public KafkaConsumer kafkaConsumer() {
|
||||||
|
Map<String, Object> configs = new HashMap<>();
|
||||||
|
//kafka服务端的IP和端口,格式:(ip:port)
|
||||||
|
configs.put("bootstrap.servers", "47.116.173.119:9092");
|
||||||
|
//开启consumer的偏移量(offset)自动提交到Kafka
|
||||||
|
configs.put("enable.auto.commit", true);
|
||||||
|
//consumer的偏移量(offset) 自动提交的时间间隔,单位毫秒
|
||||||
|
configs.put("auto.commit.interval", 5000);
|
||||||
|
//在Kafka中没有初始化偏移量或者当前偏移量不存在情况
|
||||||
|
//earliest, 在偏移量无效的情况下, 自动重置为最早的偏移量
|
||||||
|
//latest, 在偏移量无效的情况下, 自动重置为最新的偏移量
|
||||||
|
//none, 在偏移量无效的情况下, 抛出异常.
|
||||||
|
configs.put("auto.offset.reset", "latest");
|
||||||
|
//请求阻塞的最大时间(毫秒)
|
||||||
|
configs.put("fetch.max.wait", 500);
|
||||||
|
//请求应答的最小字节数
|
||||||
|
configs.put("fetch.min.size", 1);
|
||||||
|
//心跳间隔时间(毫秒)
|
||||||
|
configs.put("heartbeat-interval", 3000);
|
||||||
|
//一次调用poll返回的最大记录条数
|
||||||
|
configs.put("max.poll.records", 500);
|
||||||
|
//指定消费组
|
||||||
|
configs.put("group.id", KafkaConstants.KafkaGrop);
|
||||||
|
//指定key使用的反序列化类
|
||||||
|
Deserializer keyDeserializer = new StringDeserializer();
|
||||||
|
//指定value使用的反序列化类
|
||||||
|
Deserializer valueDeserializer = new StringDeserializer();
|
||||||
|
//创建Kafka消费者
|
||||||
|
KafkaConsumer kafkaConsumer = new KafkaConsumer(configs, keyDeserializer, valueDeserializer);
|
||||||
|
return kafkaConsumer;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,45 +0,0 @@
|
||||||
package com.muyu.common.kafka.config;
|
|
||||||
|
|
||||||
|
|
||||||
import org.apache.kafka.clients.producer.ProducerConfig;
|
|
||||||
import org.apache.kafka.common.serialization.StringSerializer;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.kafka.core.KafkaTemplate;
|
|
||||||
import org.springframework.kafka.core.ProducerFactory;
|
|
||||||
import org.springframework.kafka.core.DefaultKafkaProducerFactory;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: 胡杨
|
|
||||||
* @Name: KafkaProducerConfig
|
|
||||||
* @Description: kafka生产者配置类
|
|
||||||
* @CreatedDate: 2024/9/27 下午7:38
|
|
||||||
* @FilePath: com.muyu.common.kafka.config
|
|
||||||
* kafka生产者配置类
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class KafkaProducerConfig {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public ProducerFactory<String, Object> producerFactory() {
|
|
||||||
Map<String, Object> configProps = new HashMap<>();
|
|
||||||
configProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "47.116.173.119:9092");
|
|
||||||
configProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
|
|
||||||
configProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
|
|
||||||
// 添加事务相关的配置
|
|
||||||
configProps.put(ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG, true);
|
|
||||||
configProps.put(ProducerConfig.ACKS_CONFIG, "all");
|
|
||||||
configProps.put(ProducerConfig.RETRIES_CONFIG, Integer.MAX_VALUE);
|
|
||||||
configProps.put(ProducerConfig.TRANSACTIONAL_ID_CONFIG, "transactionalId");
|
|
||||||
|
|
||||||
return new DefaultKafkaProducerFactory<>(configProps);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public KafkaTemplate<String, Object> kafkaTemplate() {
|
|
||||||
return new KafkaTemplate<>(producerFactory());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.muyu.common.kafka.config;
|
||||||
|
|
||||||
|
import org.apache.kafka.clients.producer.KafkaProducer;
|
||||||
|
import org.apache.kafka.common.serialization.Serializer;
|
||||||
|
import org.apache.kafka.common.serialization.StringSerializer;
|
||||||
|
import org.springframework.boot.SpringBootConfiguration;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* kafka 消息的生产者 配置类
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class KafkaProviderConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public KafkaProducer kafkaProducer() {
|
||||||
|
Map<String, Object> configs = new HashMap<>();
|
||||||
|
//#kafka服务端的IP和端口,格式:(ip:port)
|
||||||
|
configs.put("bootstrap.servers", "47.116.173.119:9092");
|
||||||
|
//客户端发送服务端失败的重试次数
|
||||||
|
configs.put("retries", 2);
|
||||||
|
//多个记录被发送到同一个分区时,生产者将尝试将记录一起批处理成更少的请求.
|
||||||
|
//此设置有助于提高客户端和服务器的性能,配置控制默认批量大小(以字节为单位)
|
||||||
|
configs.put("batch.size", 16384);
|
||||||
|
//生产者可用于缓冲等待发送到服务器的记录的总内存字节数(以字节为单位)
|
||||||
|
configs.put("buffer-memory", 33554432);
|
||||||
|
//生产者producer要求leader节点在考虑完成请求之前收到的确认数,用于控制发送记录在服务端的持久化
|
||||||
|
//acks=0,设置为0,则生产者producer将不会等待来自服务器的任何确认.该记录将立即添加到套接字(socket)缓冲区并视为已发送.在这种情况下,无法保证服务器已收到记录,并且重试配置(retries)将不会生效(因为客户端通常不会知道任何故障),每条记录返回的偏移量始终设置为-1.
|
||||||
|
//acks=1,设置为1,leader节点会把记录写入本地日志,不需要等待所有follower节点完全确认就会立即应答producer.在这种情况下,在follower节点复制前,leader节点确认记录后立即失败的话,记录将会丢失.
|
||||||
|
//acks=all,acks=-1,leader节点将等待所有同步复制副本完成再确认记录,这保证了只要至少有一个同步复制副本存活,记录就不会丢失.
|
||||||
|
configs.put("acks", "-1");
|
||||||
|
//指定key使用的序列化类
|
||||||
|
Serializer keySerializer = new StringSerializer();
|
||||||
|
//指定value使用的序列化类
|
||||||
|
Serializer valueSerializer = new StringSerializer();
|
||||||
|
//创建Kafka生产者
|
||||||
|
KafkaProducer kafkaProducer = new KafkaProducer(configs, keySerializer, valueSerializer);
|
||||||
|
return kafkaProducer;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,7 +1,5 @@
|
||||||
package com.muyu.common.kafka.constants;
|
package com.muyu.common.kafka.constants;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: 胡杨
|
* @Author: 胡杨
|
||||||
* @date: 2024/7/10
|
* @date: 2024/7/10
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
com.muyu.common.kafka.config.KafkaProducerConfig
|
com.muyu.common.kafka.config.KafkaConsumerConfig
|
||||||
|
com.muyu.common.kafka.config.KafkaProviderConfig
|
||||||
|
|
|
@ -11,6 +11,10 @@
|
||||||
|
|
||||||
<artifactId>cloud-data-processing</artifactId>
|
<artifactId>cloud-data-processing</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
cloud-data-processing 数据处理模块
|
||||||
|
</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
@ -63,35 +67,49 @@
|
||||||
<artifactId>mysql-connector-j</artifactId>
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- MuYu Common DataSource -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.muyu</groupId>
|
|
||||||
<artifactId>cloud-common-datasource</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- MuYu Common DataScope -->
|
<!-- MuYu Common DataScope -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-common-datascope</artifactId>
|
<artifactId>cloud-common-datascope</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- MuYu Common Log -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>org.apache.iotdb</groupId>
|
||||||
<artifactId>cloud-common-log</artifactId>
|
<artifactId>iotdb-jdbc</artifactId>
|
||||||
|
<version>0.12.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
|
<version>1.1.9</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 接口模块 -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>org.mybatis</groupId>
|
||||||
<artifactId>cloud-common-api-doc</artifactId>
|
<artifactId>mybatis-spring</artifactId>
|
||||||
|
<version>3.0.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
<version>3.5.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- XllJob定时任务 -->
|
<!-- <!– Druid –>-->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>com.muyu</groupId>
|
<!-- <groupId>com.alibaba</groupId>-->
|
||||||
<artifactId>cloud-common-xxl</artifactId>
|
<!-- <artifactId>druid-spring-boot-3-starter</artifactId>-->
|
||||||
</dependency>
|
<!-- <version>${druid.version}</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
|
||||||
|
<!-- <!– Dynamic DataSource –>-->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>com.baomidou</groupId>-->
|
||||||
|
<!-- <artifactId>dynamic-datasource-spring-boot3-starter</artifactId>-->
|
||||||
|
<!-- <version>${dynamic-ds.version}</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -16,15 +16,12 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
* @FilePath: com.muyu.data.processing
|
* @FilePath: com.muyu.data.processing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@EnableCustomConfig
|
|
||||||
//@EnableCustomSwagger2
|
|
||||||
@EnableMyFeignClients
|
@EnableMyFeignClients
|
||||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
@SpringBootApplication
|
||||||
public class MyDataApplication {
|
public class MyDataApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(MyDataApplication.class, args);
|
SpringApplication.run(MyDataApplication.class, args);
|
||||||
System.out.println(KafkaConstants.KafkaGrop);
|
|
||||||
System.out.println(KafkaConstants.KafkaTopic);
|
|
||||||
System.out.println("MyData 模块启动成功!");
|
System.out.println("MyData 模块启动成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,160 @@
|
||||||
|
package com.muyu.data.processing.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.data.processing.domain.IotDbData;
|
||||||
|
import com.muyu.data.processing.service.DataProcessingService;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据处理控制层
|
||||||
|
*
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: DataProcessing
|
||||||
|
* @Description: 数据处理控制层
|
||||||
|
* @CreatedDate: 2024/9/28 下午3:53
|
||||||
|
* @FilePath: com.muyu.data.processing.controller
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/DataProcessing")
|
||||||
|
public class DataProcessingController {
|
||||||
|
@Resource
|
||||||
|
private DataProcessingService service;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/createCarData", method = RequestMethod.POST)
|
||||||
|
// @Transactional(rollbackFor = Exception.class)
|
||||||
|
public Result createCarData(@RequestBody IotDbData data) {
|
||||||
|
try {
|
||||||
|
data.setTimestamp(System.currentTimeMillis());
|
||||||
|
data.setCreateTime(new Date());
|
||||||
|
Integer v = service.createCarData(data);
|
||||||
|
if (v == -1) {
|
||||||
|
return Result.success(v);
|
||||||
|
} else {
|
||||||
|
return Result.error(false);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("创建车辆报文记录失败!" + e);
|
||||||
|
return Result.error(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新操作 其实也是插入操作 时间戳相同 只和时间戳相关
|
||||||
|
* @param data
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/updateCarData", method = RequestMethod.POST)
|
||||||
|
public Result updateCarData(@RequestBody IotDbData data) {
|
||||||
|
try {
|
||||||
|
data.setTimestamp(System.currentTimeMillis());
|
||||||
|
data.setCreateTime(new Date());
|
||||||
|
Integer v = service.updateCarData(data);
|
||||||
|
if (v == -1) {
|
||||||
|
return Result.success(v);
|
||||||
|
} else {
|
||||||
|
return Result.error(false);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("更新车辆报文记录失败!" + e);
|
||||||
|
return Result.error(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除操作 要将时间戳的加号变成%2B
|
||||||
|
* @param timestamp
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/deleteCarData", method = RequestMethod.GET)
|
||||||
|
public Result deleteCarData(String timestamp) {
|
||||||
|
try {
|
||||||
|
Integer v = service.deleteCarData(timestamp);
|
||||||
|
if (v == -1) {
|
||||||
|
return Result.success(v);
|
||||||
|
} else {
|
||||||
|
return Result.error(false);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("删除车辆报文记录失败!" + e);
|
||||||
|
return Result.error(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建组 也就是相当于数据库
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/createCarDataGroup", method = RequestMethod.POST)
|
||||||
|
public Result createCarDataGroup() {
|
||||||
|
try {
|
||||||
|
Integer v = service.createCarDataGroup();
|
||||||
|
if (v > 0) {
|
||||||
|
return Result.success(v);
|
||||||
|
} else {
|
||||||
|
return Result.error(false);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("创建车辆报文记录组失败!" + e);
|
||||||
|
return Result.error(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有车辆报文记录数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/queryCarData", method = RequestMethod.GET)
|
||||||
|
public Result queryCarData() {
|
||||||
|
try {
|
||||||
|
List<IotDbData> v = service.queryCarData();
|
||||||
|
if (v.size() > 0) {
|
||||||
|
v.forEach(x -> {
|
||||||
|
System.out.println(x.toString());
|
||||||
|
});
|
||||||
|
return Result.success(v);
|
||||||
|
} else {
|
||||||
|
return Result.error(false);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("查询车辆报文记录组失败!" + e);
|
||||||
|
return Result.error(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看数据库有多少组
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/selectStorageGroup", method = RequestMethod.GET)
|
||||||
|
public Result selectStorageGroup() {
|
||||||
|
try {
|
||||||
|
List<String> v = service.selectStorageGroup();
|
||||||
|
if (v.size() > 0) {
|
||||||
|
v.forEach(x -> {
|
||||||
|
System.out.println("group------------------" + x.toString());
|
||||||
|
});
|
||||||
|
return Result.success(v);
|
||||||
|
} else {
|
||||||
|
return Result.error(false);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("查询组失败!" + e);
|
||||||
|
return Result.error(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,16 +1,21 @@
|
||||||
package com.muyu.data.processing.controller;
|
package com.muyu.data.processing.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.muyu.common.kafka.constants.KafkaConstants;
|
import com.muyu.common.kafka.constants.KafkaConstants;
|
||||||
|
import com.muyu.data.processing.domain.IotDbData;
|
||||||
|
import com.muyu.data.processing.domain.req.TestReq;
|
||||||
|
import com.muyu.data.processing.domain.resp.TestResp;
|
||||||
|
import com.muyu.data.processing.strategy.root.RootStrategy;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.kafka.core.KafkaTemplate;
|
import org.apache.kafka.clients.producer.KafkaProducer;
|
||||||
import org.springframework.messaging.MessageHeaders;
|
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.messaging.Message;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 测试控制层
|
||||||
* @Author: 胡杨
|
* @Author: 胡杨
|
||||||
* @Name: Test
|
* @Name: Test
|
||||||
* @Description:
|
* @Description:
|
||||||
|
@ -22,20 +27,35 @@ import org.springframework.messaging.Message;
|
||||||
@RequestMapping("/Test")
|
@RequestMapping("/Test")
|
||||||
public class TestController {
|
public class TestController {
|
||||||
@Resource
|
@Resource
|
||||||
private KafkaTemplate<String,Object> kafkaTemplate;
|
private KafkaProducer<String,String> kafkaProducer;
|
||||||
|
|
||||||
@GetMapping("/testKafka")
|
@GetMapping("/testKafka")
|
||||||
@Transactional
|
|
||||||
public void sendMsg(@RequestParam("msg") String msg) {
|
public void sendMsg(@RequestParam("msg") String msg) {
|
||||||
try {
|
try {
|
||||||
kafkaTemplate.send(KafkaConstants.KafkaTopic, msg).get();
|
IotDbData iotDbData = IotDbData.builder()
|
||||||
|
.timestamp(System.currentTimeMillis())
|
||||||
|
.vin("vin666")
|
||||||
|
.key("test")
|
||||||
|
.label("测试数据")
|
||||||
|
.value("Kafka测试")
|
||||||
|
.type("String")
|
||||||
|
.build();
|
||||||
|
String jsonString = JSONObject.toJSONString(iotDbData);
|
||||||
|
ProducerRecord<String, String> producerRecord = new ProducerRecord<>(KafkaConstants.KafkaTopic, jsonString);
|
||||||
|
kafkaProducer.send(producerRecord);
|
||||||
System.out.println("同步消息发送成功: " + msg);
|
System.out.println("同步消息发送成功: " + msg);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.out.println("同步消息发送失败: " + msg);
|
System.out.println("同步消息发送失败: " + msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RootStrategy rootStrategy;
|
||||||
|
|
||||||
|
@PostMapping("/testStrategy")
|
||||||
|
public TestResp testStrategy(@RequestBody TestReq testReq) {
|
||||||
|
return rootStrategy.applyStrategy(testReq);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.muyu.data.processing.domain;
|
||||||
|
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文信息 时序实体类
|
||||||
|
*
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: DataProcessing
|
||||||
|
* @Description: 报文信息 时序实体类
|
||||||
|
* @CreatedDate: 2024/9/28 下午3:48
|
||||||
|
* @FilePath: com.muyu.data.processing.domain
|
||||||
|
*/
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@ToString
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class IotDbData extends BaseEntity {
|
||||||
|
private long timestamp;
|
||||||
|
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
private String label;
|
||||||
|
private String value;
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.muyu.data.processing.domain;
|
||||||
|
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文信息 时序实体类
|
||||||
|
*
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: DataProcessing
|
||||||
|
* @Description: 报文信息 时序实体类
|
||||||
|
* @CreatedDate: 2024/9/28 下午3:48
|
||||||
|
* @FilePath: com.muyu.data.processing.domain
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ToString
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class KafkaData implements Serializable {
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
private String label;
|
||||||
|
private String value;
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.muyu.data.processing.domain;
|
||||||
|
|
||||||
|
import com.muyu.data.processing.domain.req.TestReq;
|
||||||
|
import com.muyu.data.processing.domain.resp.TestResp;
|
||||||
|
import com.muyu.data.processing.strategy.StrategyHandler;
|
||||||
|
import com.muyu.data.processing.strategy.branch.OneBranchStrategy;
|
||||||
|
import com.muyu.data.processing.strategy.branch.TwoBranchStrategy;
|
||||||
|
import com.muyu.data.processing.strategy.leaves.FourLeavesStrategy;
|
||||||
|
import com.muyu.data.processing.strategy.leaves.OneLeavesStrategy;
|
||||||
|
import com.muyu.data.processing.strategy.leaves.ThreeLeavesStrategy;
|
||||||
|
import com.muyu.data.processing.strategy.leaves.TwoLeavesStrategy;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 策略选择枚举
|
||||||
|
*
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: StrategyEums
|
||||||
|
* @Description: 策略选择枚举
|
||||||
|
* @CreatedDate: 2024/9/28 上午11:59
|
||||||
|
* @FilePath: com.muyu.data.processing.domain
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum StrategyEums {
|
||||||
|
TEST1("加减法", new OneBranchStrategy()),
|
||||||
|
TEST2("乘除法", new TwoBranchStrategy()),
|
||||||
|
TEST1_1("加法", new OneLeavesStrategy()),
|
||||||
|
TEST1_2("减法", new TwoLeavesStrategy()),
|
||||||
|
TEST2_1("乘法", new ThreeLeavesStrategy()),
|
||||||
|
TEST2_2("除法", new FourLeavesStrategy());
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
private final StrategyHandler<TestReq, TestResp> info;
|
||||||
|
|
||||||
|
StrategyEums(String code, StrategyHandler<TestReq, TestResp> info) {
|
||||||
|
this.code = code;
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 鉴别参数是否是枚举的值
|
||||||
|
*
|
||||||
|
* @param code 需鉴别参数
|
||||||
|
* @return 如果存在返回结果turn, 否则返回false
|
||||||
|
*/
|
||||||
|
public static boolean isCode(String code) {
|
||||||
|
return Arrays.stream(values())
|
||||||
|
.map(StrategyEums::getCode)
|
||||||
|
.anyMatch(c -> c.equals(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StrategyHandler<TestReq, TestResp> getStrategy(String code) {
|
||||||
|
return Arrays.stream(values())
|
||||||
|
.filter(c -> c.getCode().equals(code))
|
||||||
|
.findFirst()
|
||||||
|
.orElseThrow(() -> new IllegalArgumentException("参数错误"))
|
||||||
|
.getInfo();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.data.processing.domain.req;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试入参
|
||||||
|
*
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: TestReq
|
||||||
|
* @Description: 测试入参
|
||||||
|
* @CreatedDate: 2024/9/28 上午10:40
|
||||||
|
* @FilePath: com.muyu.data.processing.domain.req
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class TestReq {
|
||||||
|
private Integer one;
|
||||||
|
private Integer two;
|
||||||
|
|
||||||
|
private String type1;
|
||||||
|
private String type2;
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.muyu.data.processing.domain.resp;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试出参
|
||||||
|
*
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: TestResp
|
||||||
|
* @Description: 测试出参
|
||||||
|
* @CreatedDate: 2024/9/28 上午10:40
|
||||||
|
* @FilePath: com.muyu.data.processing.domain.req.resp
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class TestResp {
|
||||||
|
private String resp;
|
||||||
|
}
|
|
@ -1,12 +1,24 @@
|
||||||
package com.muyu.data.processing.kafka;
|
package com.muyu.data.processing.kafka;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
|
||||||
import com.muyu.common.kafka.constants.KafkaConstants;
|
import com.muyu.common.kafka.constants.KafkaConstants;
|
||||||
import io.swagger.v3.oas.annotations.servers.Server;
|
import com.muyu.data.processing.domain.IotDbData;
|
||||||
|
import com.muyu.data.processing.domain.KafkaData;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.kafka.annotation.KafkaListener;
|
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
||||||
|
import org.apache.kafka.clients.consumer.ConsumerRecords;
|
||||||
|
import org.apache.kafka.clients.consumer.KafkaConsumer;
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: 胡杨
|
* @Author: 胡杨
|
||||||
* @Name: KafkaConsumerService
|
* @Name: KafkaConsumerService
|
||||||
|
@ -17,10 +29,29 @@ import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
public class KafkaConsumerService {
|
public class KafkaConsumerService implements InitializingBean {
|
||||||
|
@Resource
|
||||||
|
private KafkaConsumer kafkaConsumer;
|
||||||
|
|
||||||
@KafkaListener(topics = {KafkaConstants.KafkaTopic}, groupId = KafkaConstants.KafkaGrop)
|
@Override
|
||||||
public void listen(String msg) {
|
public void afterPropertiesSet() throws Exception {
|
||||||
log.info("kafka 消费消息:{}", msg);
|
Thread thread = new Thread(() -> {
|
||||||
|
log.info("启动线程监听Topic: {}", KafkaConstants.KafkaTopic);
|
||||||
|
ThreadUtil.sleep(1000);
|
||||||
|
Collection<String> topics = Lists.newArrayList(KafkaConstants.KafkaTopic);
|
||||||
|
kafkaConsumer.subscribe(topics);
|
||||||
|
while (true) {
|
||||||
|
ConsumerRecords<String, String> consumerRecords = kafkaConsumer.poll(Duration.ofMillis(1000));
|
||||||
|
for (ConsumerRecord consumerRecord : consumerRecords) {
|
||||||
|
//1.从ConsumerRecord中获取消费数据
|
||||||
|
String originalMsg = (String) consumerRecord.value();
|
||||||
|
log.info("从Kafka中消费的原始数据: " + originalMsg);
|
||||||
|
//2.把消费数据转换为DTO对象
|
||||||
|
List<KafkaData> kafkaDataList = JSONUtil.toList(originalMsg, KafkaData.class);
|
||||||
|
log.info("消费数据转换为DTO对象: " + kafkaDataList.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
thread.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.muyu.data.processing.mapper;
|
||||||
|
|
||||||
|
import com.muyu.data.processing.domain.IotDbData;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据处理持久层
|
||||||
|
*
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: DataPeocessingMapper
|
||||||
|
* @Description: 数据处理持久层
|
||||||
|
* @CreatedDate: 2024/9/28 下午3:47
|
||||||
|
* @FilePath: com.muyu.data.processing.mapper
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
@Mapper
|
||||||
|
public interface DataProcessingMapper{
|
||||||
|
|
||||||
|
Integer createCarData(IotDbData data);
|
||||||
|
|
||||||
|
Integer updateCarData(IotDbData data);
|
||||||
|
|
||||||
|
Integer deleteCarData(String timestamp);
|
||||||
|
|
||||||
|
Integer createCarDataGroup();
|
||||||
|
|
||||||
|
Integer createCarDataGroupElement();
|
||||||
|
|
||||||
|
// List<DataProcessing> queryCarData();
|
||||||
|
|
||||||
|
List<String> selectStorageGroup();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.muyu.data.processing.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.data.processing.domain.IotDbData;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据处理业务层
|
||||||
|
*
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: DataProcessing
|
||||||
|
* @Description: 数据处理业务层
|
||||||
|
* @CreatedDate: 2024/9/28 下午3:52
|
||||||
|
* @FilePath: com.muyu.data.processing.server
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface DataProcessingService{
|
||||||
|
/**
|
||||||
|
* 创建车辆报文记录
|
||||||
|
*
|
||||||
|
* @param data 数据
|
||||||
|
* @return {@link Integer }
|
||||||
|
*/
|
||||||
|
Integer createCarData(IotDbData data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新车辆报文记录
|
||||||
|
*
|
||||||
|
* @param data 数据
|
||||||
|
* @return {@link Integer }
|
||||||
|
*/
|
||||||
|
Integer updateCarData(IotDbData data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除车辆报文记录
|
||||||
|
*
|
||||||
|
* @param timestamp 时间戳
|
||||||
|
* @return {@link Integer }
|
||||||
|
*/
|
||||||
|
Integer deleteCarData(String timestamp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建车辆报文记录组
|
||||||
|
*
|
||||||
|
* @return {@link Integer }
|
||||||
|
*/
|
||||||
|
Integer createCarDataGroup();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询顺序
|
||||||
|
*
|
||||||
|
* @return {@link List }<{@link IotDbData }>
|
||||||
|
*/
|
||||||
|
List<IotDbData> queryCarData();
|
||||||
|
/**
|
||||||
|
* 选择存储组
|
||||||
|
*
|
||||||
|
* @return {@link List }<{@link String }>
|
||||||
|
*/
|
||||||
|
List<String> selectStorageGroup();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.muyu.data.processing.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import com.muyu.data.processing.domain.IotDbData;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import com.muyu.data.processing.mapper.DataProcessingMapper;
|
||||||
|
import com.muyu.data.processing.service.DataProcessingService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据处理实现层
|
||||||
|
*
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: DataProcessing
|
||||||
|
* @Description: 数据处理实现层
|
||||||
|
* @CreatedDate: 2024/9/28 下午3:52
|
||||||
|
* @FilePath: com.muyu.data.processing.server.impl
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class DataProcessingServiceImpl implements DataProcessingService {
|
||||||
|
@Resource
|
||||||
|
private DataProcessingMapper mapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer createCarData(IotDbData data) {
|
||||||
|
return mapper.createCarData(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer updateCarData(IotDbData data) {
|
||||||
|
return mapper.updateCarData(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer deleteCarData(String timestamp) {
|
||||||
|
return mapper.deleteCarData(timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer createCarDataGroup() {
|
||||||
|
try {
|
||||||
|
Integer flag = mapper.createCarDataGroup();
|
||||||
|
Integer flagEle = mapper.createCarDataGroupElement();
|
||||||
|
System.out.println("\n\t执行sql数量为{}" + flagEle);
|
||||||
|
return flagEle;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<IotDbData> queryCarData() {
|
||||||
|
// return mapper.queryCarData();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> selectStorageGroup() {
|
||||||
|
return mapper.selectStorageGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.muyu.data.processing.strategy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 策略控制者接口
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: StrategyHandler
|
||||||
|
* @Description: 策略控制者接口
|
||||||
|
* @CreatedDate: 2024/9/28 上午9:35
|
||||||
|
* @FilePath: com.muyu.data.processing.strategy
|
||||||
|
*/
|
||||||
|
public interface StrategyHandler<T,R> {
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
StrategyHandler DEFAULT = t -> null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行方法
|
||||||
|
* @param t 入参
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
R apply(T t);
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.muyu.data.processing.strategy;
|
||||||
|
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
/**
|
||||||
|
* 抽象策略路由
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: abstractStrategyRouter
|
||||||
|
* @Description: 抽象策略路由
|
||||||
|
* @CreatedDate: 2024/9/28 上午9:26
|
||||||
|
* @FilePath: com.muyu.data.processing.strategy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public abstract class abstractStrategyRouter<T,R> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 策略映射器, 指定入参与出参以决定策略处理者
|
||||||
|
* @param <T> 策略入参
|
||||||
|
* @param <R> 策略出参
|
||||||
|
*/
|
||||||
|
public interface StrategyMapper<T,R>{
|
||||||
|
// 通过入参获取对应策略处理方法,使用Map实现
|
||||||
|
StrategyHandler<T,R> getHandler(T param);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抽象注册方法
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected abstract StrategyMapper<T,R> registerStrategy();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认策略处理者
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private StrategyHandler<T,R> defaultStrategyHandler = StrategyHandler.DEFAULT;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择策略处理者
|
||||||
|
* @param param 入参
|
||||||
|
* @return 策略处理结果
|
||||||
|
*/
|
||||||
|
public R applyStrategy(T param) {
|
||||||
|
final StrategyHandler<T,R> strategyHandler = registerStrategy().getHandler(param);
|
||||||
|
if (strategyHandler != null) {
|
||||||
|
return strategyHandler.apply(param);
|
||||||
|
}
|
||||||
|
// 使用默认策略处理者
|
||||||
|
return defaultStrategyHandler.apply(param);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.muyu.data.processing.strategy.branch;
|
||||||
|
|
||||||
|
import com.muyu.data.processing.domain.StrategyEums;
|
||||||
|
import com.muyu.data.processing.domain.req.TestReq;
|
||||||
|
import com.muyu.data.processing.domain.resp.TestResp;
|
||||||
|
import com.muyu.data.processing.strategy.StrategyHandler;
|
||||||
|
import com.muyu.data.processing.strategy.abstractStrategyRouter;
|
||||||
|
import com.muyu.data.processing.strategy.leaves.FourLeavesStrategy;
|
||||||
|
import com.muyu.data.processing.strategy.leaves.OneLeavesStrategy;
|
||||||
|
import com.muyu.data.processing.strategy.leaves.ThreeLeavesStrategy;
|
||||||
|
import com.muyu.data.processing.strategy.leaves.TwoLeavesStrategy;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1号分支策略方法实现
|
||||||
|
*
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: OneBranchStrategy
|
||||||
|
* @Description: 1号叶子策略方法实现
|
||||||
|
* @CreatedDate: 2024/9/28 上午11:50
|
||||||
|
* @FilePath: com.muyu.data.processing.strategy.impl
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class OneBranchStrategy extends abstractStrategyRouter<TestReq, TestResp> implements StrategyHandler<TestReq,TestResp> {
|
||||||
|
@Override
|
||||||
|
public TestResp apply(TestReq testReq) {
|
||||||
|
log.info("1号分支策略方法实现,参数1:{},参数2:{},执行方法:{}", testReq.getOne(), testReq.getTwo(), testReq.getType2());
|
||||||
|
return applyStrategy(testReq);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected StrategyMapper<TestReq, TestResp> registerStrategy() {
|
||||||
|
return param -> StrategyEums.getStrategy(param.getType2());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.muyu.data.processing.strategy.branch;
|
||||||
|
|
||||||
|
import com.muyu.data.processing.domain.StrategyEums;
|
||||||
|
import com.muyu.data.processing.domain.req.TestReq;
|
||||||
|
import com.muyu.data.processing.domain.resp.TestResp;
|
||||||
|
import com.muyu.data.processing.strategy.StrategyHandler;
|
||||||
|
import com.muyu.data.processing.strategy.abstractStrategyRouter;
|
||||||
|
import com.muyu.data.processing.strategy.leaves.FourLeavesStrategy;
|
||||||
|
import com.muyu.data.processing.strategy.leaves.OneLeavesStrategy;
|
||||||
|
import com.muyu.data.processing.strategy.leaves.ThreeLeavesStrategy;
|
||||||
|
import com.muyu.data.processing.strategy.leaves.TwoLeavesStrategy;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2号分支策略方法实现
|
||||||
|
*
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: TwoBranchStrategy
|
||||||
|
* @Description: 1号叶子策略方法实现
|
||||||
|
* @CreatedDate: 2024/9/28 上午11:50
|
||||||
|
* @FilePath: com.muyu.data.processing.strategy.impl
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class TwoBranchStrategy extends abstractStrategyRouter<TestReq, TestResp> implements StrategyHandler<TestReq,TestResp> {
|
||||||
|
@Override
|
||||||
|
public TestResp apply(TestReq testReq) {
|
||||||
|
log.info("2号分支策略方法实现,参数1:{},参数2:{},执行方法:{}", testReq.getOne(), testReq.getTwo(), testReq.getType2());
|
||||||
|
return applyStrategy(testReq);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected StrategyMapper<TestReq, TestResp> registerStrategy() {
|
||||||
|
return param -> StrategyEums.getStrategy(param.getType2());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.muyu.data.processing.strategy.leaves;
|
||||||
|
|
||||||
|
import com.muyu.data.processing.domain.req.TestReq;
|
||||||
|
import com.muyu.data.processing.domain.resp.TestResp;
|
||||||
|
import com.muyu.data.processing.strategy.StrategyHandler;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4号处理者
|
||||||
|
*
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: FourLeavesStrategy
|
||||||
|
* @Description: 4号处理者
|
||||||
|
* @CreatedDate: 2024/9/28 上午11:54
|
||||||
|
* @FilePath: com.muyu.data.processing.strategy.leaves
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class FourLeavesStrategy implements StrategyHandler<TestReq, TestResp> {
|
||||||
|
@Override
|
||||||
|
public TestResp apply(TestReq testReq) {
|
||||||
|
log.info("4号处理者实现,参数1:{},参数2:{},执行方法:{},结果:{}", testReq.getOne(), testReq.getTwo(), testReq.getType2(), (testReq.getOne()*1.0/testReq.getTwo()));
|
||||||
|
return new TestResp("执行4号处理者-除法");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.muyu.data.processing.strategy.leaves;
|
||||||
|
|
||||||
|
import com.muyu.data.processing.domain.req.TestReq;
|
||||||
|
import com.muyu.data.processing.domain.resp.TestResp;
|
||||||
|
import com.muyu.data.processing.strategy.StrategyHandler;
|
||||||
|
import com.muyu.data.processing.strategy.abstractStrategyRouter;
|
||||||
|
import com.muyu.data.processing.strategy.branch.OneBranchStrategy;
|
||||||
|
import com.muyu.data.processing.strategy.branch.TwoBranchStrategy;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1号处理者
|
||||||
|
*
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: OneLeavesStrategy
|
||||||
|
* @Description: 1号处理者
|
||||||
|
* @CreatedDate: 2024/9/28 上午11:54
|
||||||
|
* @FilePath: com.muyu.data.processing.strategy.leaves
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class OneLeavesStrategy implements StrategyHandler<TestReq, TestResp> {
|
||||||
|
@Override
|
||||||
|
public TestResp apply(TestReq testReq) {
|
||||||
|
log.info("1号处理者实现,参数1:{},参数2:{},执行方法:{},结果:{}", testReq.getOne(), testReq.getTwo(), testReq.getType2(), (testReq.getOne()+testReq.getTwo()));
|
||||||
|
return new TestResp("执行1号处理者-加法");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.muyu.data.processing.strategy.leaves;
|
||||||
|
|
||||||
|
import com.muyu.data.processing.domain.req.TestReq;
|
||||||
|
import com.muyu.data.processing.domain.resp.TestResp;
|
||||||
|
import com.muyu.data.processing.strategy.StrategyHandler;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 3号处理者
|
||||||
|
*
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: ThreeLeavesStrategy
|
||||||
|
* @Description: 3号处理者
|
||||||
|
* @CreatedDate: 2024/9/28 上午11:54
|
||||||
|
* @FilePath: com.muyu.data.processing.strategy.leaves
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class ThreeLeavesStrategy implements StrategyHandler<TestReq, TestResp> {
|
||||||
|
@Override
|
||||||
|
public TestResp apply(TestReq testReq) {
|
||||||
|
log.info("3号处理者实现,参数1:{},参数2:{},执行方法:{},结果:{}", testReq.getOne(), testReq.getTwo(), testReq.getType2(), (testReq.getOne()*testReq.getTwo()));
|
||||||
|
return new TestResp("执行3号处理者-乘法");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.muyu.data.processing.strategy.leaves;
|
||||||
|
|
||||||
|
import com.muyu.data.processing.domain.req.TestReq;
|
||||||
|
import com.muyu.data.processing.domain.resp.TestResp;
|
||||||
|
import com.muyu.data.processing.strategy.StrategyHandler;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2号处理者
|
||||||
|
*
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: TwoLeavesStrategy
|
||||||
|
* @Description: 2号处理者
|
||||||
|
* @CreatedDate: 2024/9/28 上午11:54
|
||||||
|
* @FilePath: com.muyu.data.processing.strategy.leaves
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class TwoLeavesStrategy implements StrategyHandler<TestReq, TestResp> {
|
||||||
|
@Override
|
||||||
|
public TestResp apply(TestReq testReq) {
|
||||||
|
log.info("2号处理者实现,参数1:{},参数2:{},执行方法:{},结果:{}", testReq.getOne(), testReq.getTwo(), testReq.getType2(), (testReq.getOne()-testReq.getTwo()));
|
||||||
|
return new TestResp("执行2号处理者-减法");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.muyu.data.processing.strategy.root;
|
||||||
|
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.data.processing.domain.StrategyEums;
|
||||||
|
import com.muyu.data.processing.domain.req.TestReq;
|
||||||
|
import com.muyu.data.processing.domain.resp.TestResp;
|
||||||
|
import com.muyu.data.processing.strategy.StrategyHandler;
|
||||||
|
import com.muyu.data.processing.strategy.abstractStrategyRouter;
|
||||||
|
import com.muyu.data.processing.strategy.branch.OneBranchStrategy;
|
||||||
|
import com.muyu.data.processing.strategy.branch.TwoBranchStrategy;
|
||||||
|
import com.muyu.data.processing.strategy.leaves.FourLeavesStrategy;
|
||||||
|
import com.muyu.data.processing.strategy.leaves.OneLeavesStrategy;
|
||||||
|
import com.muyu.data.processing.strategy.leaves.ThreeLeavesStrategy;
|
||||||
|
import com.muyu.data.processing.strategy.leaves.TwoLeavesStrategy;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 策略路由实现
|
||||||
|
*
|
||||||
|
* @Author: 胡杨
|
||||||
|
* @Name: RootStrategy
|
||||||
|
* @Description: 策略路由实现
|
||||||
|
* @CreatedDate: 2024/9/28 上午10:39
|
||||||
|
* @FilePath: com.muyu.data.processing.strategy.impl
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class RootStrategy extends abstractStrategyRouter<TestReq, TestResp> {
|
||||||
|
@Override
|
||||||
|
protected StrategyMapper<TestReq , TestResp> registerStrategy() {
|
||||||
|
return param -> StrategyEums.getStrategy(param.getType1());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -11,6 +11,22 @@ nacos:
|
||||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
datasource:
|
||||||
|
username: root
|
||||||
|
password: root
|
||||||
|
driver-class-name: org.apache.iotdb.jdbc.IoTDBDriver
|
||||||
|
url: jdbc:iotdb://47.116.173.119:6667/
|
||||||
|
initial-size: 5
|
||||||
|
min-idle: 10
|
||||||
|
max-active: 20
|
||||||
|
max-wait: 60000
|
||||||
|
remove-abandoned: true
|
||||||
|
remove-abandoned-timeout: 30
|
||||||
|
time-between-eviction-runs-millis: 60000
|
||||||
|
min-evictable-idle-time-millis: 300000
|
||||||
|
test-while-idle: false
|
||||||
|
test-on-borrow: false
|
||||||
|
test-on-return: false
|
||||||
amqp:
|
amqp:
|
||||||
deserialization:
|
deserialization:
|
||||||
trust:
|
trust:
|
||||||
|
@ -61,3 +77,4 @@ spring:
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
com.muyu.system.mapper: DEBUG
|
com.muyu.system.mapper: DEBUG
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.muyu.data.processing.mapper.DataProcessingMapper">
|
||||||
|
|
||||||
|
<insert id="createCarData" parameterType="com.muyu.data.processing.domain.IotDbData">
|
||||||
|
insert into root.one.data(timestamp, CarData_id, CarData_num, CarData_name,create_time) values(#{timestamp},#{CarDataId},#{CarDataNum},#{CarDataName},#{createTime});
|
||||||
|
</insert>
|
||||||
|
<select id="selectStorageGroup" resultType="java.lang.String">
|
||||||
|
show storage group
|
||||||
|
</select>
|
||||||
|
<delete id="deleteCarData" parameterType="java.lang.String">
|
||||||
|
delete from root.one.data where timestamp = ${timestamp};
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<insert id="updateCarData">
|
||||||
|
insert into root.one.data(timestamp, CarData_id, CarData_num, CarData_name,create_time) values(2021-11-24T18:28:20.689+08:00,#{CarDataId},#{CarDataNum},#{CarDataName},#{createTime});
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="createCarDataGroup">
|
||||||
|
SET STORAGE GROUP TO root.one.data
|
||||||
|
</update>
|
||||||
|
<update id="createCarDataGroupElement">
|
||||||
|
CREATE TIMESERIES root.one.data.CarData_num WITH DATATYPE=INT32, ENCODING=PLAIN, COMPRESSOR=SNAPPY;
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -10,6 +10,11 @@
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>cloud-breakdown</artifactId>
|
<artifactId>cloud-breakdown</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
cloud-breakdown 故障
|
||||||
|
</description>
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<modules>
|
<modules>
|
||||||
<module>cloud-breakdown-common</module>
|
<module>cloud-breakdown-common</module>
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>cloud-modules-car</artifactId>
|
<artifactId>cloud-modules-car</artifactId>
|
||||||
|
<description>
|
||||||
|
cloud-modules-car 电子围栏
|
||||||
|
</description>
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
|
|
@ -96,6 +96,10 @@
|
||||||
<artifactId>bcpkix-jdk15on</artifactId>
|
<artifactId>bcpkix-jdk15on</artifactId>
|
||||||
<version>1.70</version>
|
<version>1.70</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-kafka</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -1,44 +1,36 @@
|
||||||
package com.muyu.car.controller;
|
package com.muyu.car.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.muyu.car.domain.SysCarMessage;
|
||||||
|
import com.muyu.car.domain.resp.SysMessageResp;
|
||||||
|
import com.muyu.car.service.ISysCarMessageService;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.servlet.http.HttpSession;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.muyu.car.domain.SysCarMessage;
|
|
||||||
import com.muyu.car.domain.SysMessageType;
|
|
||||||
import com.muyu.car.domain.VO.SysMessageVO;
|
|
||||||
import com.muyu.car.service.ISysCarMessageService;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpSession;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆报文记录Controller
|
* 车辆报文记录Controller
|
||||||
*
|
*
|
||||||
* @author muyu
|
* @author muyu
|
||||||
* @date 2024-09-18
|
* @date 2024-09-18
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/messageInfo")
|
@RequestMapping("/messageInfo")
|
||||||
public class SysCarMessageController extends BaseController {
|
public class SysCarMessageController extends BaseController {
|
||||||
|
@ -48,10 +40,12 @@ public class SysCarMessageController extends BaseController {
|
||||||
private HttpSession session;
|
private HttpSession session;
|
||||||
static String TEST = "56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56";
|
static String TEST = "56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询车辆报文记录列表
|
* 查询车辆报文记录列表
|
||||||
*/
|
*/
|
||||||
// @RequiresPermissions("message:message:list")
|
// @RequiresPermissions("message:message:list")
|
||||||
|
@Transactional
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public Result<List<SysCarMessage>> list(SysCarMessage sysCarMessage) throws ExecutionException, InterruptedException {
|
public Result<List<SysCarMessage>> list(SysCarMessage sysCarMessage) throws ExecutionException, InterruptedException {
|
||||||
List<SysCarMessage> list = sysCarMessageService.selectSysCarMessageList(sysCarMessage);
|
List<SysCarMessage> list = sysCarMessageService.selectSysCarMessageList(sysCarMessage);
|
||||||
|
@ -83,16 +77,16 @@ public class SysCarMessageController extends BaseController {
|
||||||
for (int i = 0; i < futures.size(); i++) {
|
for (int i = 0; i < futures.size(); i++) {
|
||||||
results[i] = futures.get(i).get();
|
results[i] = futures.get(i).get();
|
||||||
}
|
}
|
||||||
JSONObject jsonObject = new JSONObject();
|
String jsonString = JSONObject.toJSONString(results);
|
||||||
jsonObject.put("results", results);
|
|
||||||
System.out.println(jsonObject);
|
log.info("消息发送成功:{}", jsonString);
|
||||||
return Result.success(list);
|
return Result.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("message:message:dobList")
|
@RequiresPermissions("message:message:dobList")
|
||||||
@GetMapping("/dobList")
|
@GetMapping("/dobList")
|
||||||
public Result<List<SysMessageVO>> dobList(SysMessageVO sysMessageVO) {
|
public Result<List<SysMessageResp>> dobList(SysMessageResp sysMessageResp) {
|
||||||
List<SysMessageVO> list = sysCarMessageService.dobList(sysMessageVO);
|
List<SysMessageResp> list = sysCarMessageService.dobList(sysMessageResp);
|
||||||
return Result.success(list);
|
return Result.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆报文记录对象 sys_car_message
|
* 车辆报文记录对象 sys_car_message
|
||||||
*
|
*
|
||||||
|
@ -24,7 +26,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@TableName("sys_car_message")
|
@TableName("sys_car_message")
|
||||||
public class SysCarMessage {
|
public class SysCarMessage implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 自增主键 */
|
/** 自增主键 */
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.muyu.car.domain.VO;
|
package com.muyu.car.domain.resp;
|
||||||
|
|
||||||
import com.muyu.common.core.annotation.Excel;
|
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +10,7 @@ import lombok.*;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class SysMessageVO {
|
public class SysMessageResp {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private Long id;
|
private Long id;
|
||||||
private String modelCode;
|
private String modelCode;
|
|
@ -4,7 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.car.domain.SysCarMessage;
|
import com.muyu.car.domain.SysCarMessage;
|
||||||
import com.muyu.car.domain.VO.SysMessageVO;
|
import com.muyu.car.domain.resp.SysMessageResp;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,5 +15,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SysCarMessageMapper extends BaseMapper<SysCarMessage>{
|
public interface SysCarMessageMapper extends BaseMapper<SysCarMessage>{
|
||||||
List<SysMessageVO>dobList(SysMessageVO sysMessageVO);
|
List<SysMessageResp>dobList(SysMessageResp sysMessageResp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.car.domain.SysCarMessage;
|
import com.muyu.car.domain.SysCarMessage;
|
||||||
import com.muyu.car.domain.VO.SysMessageVO;
|
import com.muyu.car.domain.resp.SysMessageResp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆报文记录Service接口
|
* 车辆报文记录Service接口
|
||||||
|
@ -14,7 +14,7 @@ import com.muyu.car.domain.VO.SysMessageVO;
|
||||||
*/
|
*/
|
||||||
public interface ISysCarMessageService extends IService<SysCarMessage> {
|
public interface ISysCarMessageService extends IService<SysCarMessage> {
|
||||||
|
|
||||||
List<SysMessageVO>dobList(SysMessageVO sysMessageVO);
|
List<SysMessageResp>dobList(SysMessageResp sysMessageResp);
|
||||||
/**
|
/**
|
||||||
* 精确查询车辆报文记录
|
* 精确查询车辆报文记录
|
||||||
*
|
*
|
||||||
|
|
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||||
import com.muyu.car.domain.SysCar;
|
import com.muyu.car.domain.SysCar;
|
||||||
import com.muyu.car.domain.SysCarMessage;
|
import com.muyu.car.domain.SysCarMessage;
|
||||||
import com.muyu.car.domain.SysMessageType;
|
import com.muyu.car.domain.SysMessageType;
|
||||||
import com.muyu.car.domain.VO.SysMessageVO;
|
import com.muyu.car.domain.resp.SysMessageResp;
|
||||||
import com.muyu.car.mapper.SysCarMessageMapper;
|
import com.muyu.car.mapper.SysCarMessageMapper;
|
||||||
import com.muyu.car.service.ISysCarMessageService;
|
import com.muyu.car.service.ISysCarMessageService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -29,8 +29,8 @@ public class SysCarMessageServiceImpl
|
||||||
private SysCarMessageMapper mapper;
|
private SysCarMessageMapper mapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysMessageVO> dobList(SysMessageVO sysMessageVO) {
|
public List<SysMessageResp> dobList(SysMessageResp sysMessageResp) {
|
||||||
return mapper.dobList(sysMessageVO);
|
return mapper.dobList(sysMessageResp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 10010
|
port: 10011
|
||||||
|
|
||||||
# nacos线上地址
|
# nacos线上地址
|
||||||
nacos:
|
nacos:
|
||||||
|
@ -19,7 +19,7 @@ spring:
|
||||||
allow-bean-definition-overriding: true
|
allow-bean-definition-overriding: true
|
||||||
application:
|
application:
|
||||||
# 应用名称
|
# 应用名称
|
||||||
name: cloud-car
|
name: cloud-parsing
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: dev
|
active: dev
|
||||||
|
|
|
@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<include refid="selectSysCarMessageVo"/>
|
<include refid="selectSysCarMessageVo"/>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
<select id="dobList" resultType="com.muyu.car.domain.VO.SysMessageVO">
|
<select id="dobList" resultType="com.muyu.car.domain.resp.SysMessageResp">
|
||||||
SELECT sys_car_message.*,sys_message_type.message_name FROM sys_car_message LEFT JOIN sys_message_type ON sys_message_type.message_code=sys_car_message.message_type_code
|
SELECT sys_car_message.*,sys_message_type.message_name FROM sys_car_message LEFT JOIN sys_message_type ON sys_message_type.message_code=sys_car_message.message_type_code
|
||||||
<where>
|
<where>
|
||||||
<if test="modelCode!=null and modelCode!=''">
|
<if test="modelCode!=null and modelCode!=''">
|
||||||
|
|
|
@ -2,21 +2,23 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
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">
|
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>
|
<parent>
|
||||||
<artifactId>cloud-modules</artifactId>
|
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-modules</artifactId>
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>cloud-modules-rail</artifactId>
|
|
||||||
|
|
||||||
|
<artifactId>cloud-modules-parsing</artifactId>
|
||||||
|
<description>
|
||||||
|
cloud-modules-parsing 协议解析模块
|
||||||
|
</description>
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- SpringCloud Alibaba Nacos -->
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
@ -59,17 +61,45 @@
|
||||||
<artifactId>cloud-common-datascope</artifactId>
|
<artifactId>cloud-common-datascope</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common Log -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-common-core</artifactId>
|
<artifactId>cloud-common-log</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 接口模块 -->
|
<!-- 接口模块 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-common-api-doc</artifactId>
|
<artifactId>cloud-common-api-doc</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- XllJob定时任务 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-xxl</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-rabbit</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bouncycastle</groupId>
|
||||||
|
<artifactId>bcpkix-jdk15on</artifactId>
|
||||||
|
<version>1.70</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- kafka-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-kafka</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- mqtt-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.paho</groupId>
|
||||||
|
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||||
|
<version>1.2.2</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.muyu.parsing;
|
||||||
|
|
||||||
|
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||||
|
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统模块
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
*/
|
||||||
|
@EnableCustomConfig
|
||||||
|
//@EnableCustomSwagger2
|
||||||
|
@EnableMyFeignClients
|
||||||
|
@SpringBootApplication
|
||||||
|
public class CloudParsingApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(CloudParsingApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,231 @@
|
||||||
|
package com.muyu.parsing.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.kafka.constants.KafkaConstants;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.muyu.parsing.domain.KafKaData;
|
||||||
|
import com.muyu.parsing.domain.SysCarMessage;
|
||||||
|
import com.muyu.parsing.domain.resp.SysMessageResp;
|
||||||
|
import com.muyu.parsing.service.ISysCarMessageService;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.kafka.clients.producer.KafkaProducer;
|
||||||
|
import org.apache.kafka.clients.producer.ProducerConfig;
|
||||||
|
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||||
|
import org.apache.kafka.common.serialization.StringSerializer;
|
||||||
|
import org.eclipse.paho.client.mqttv3.*;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆报文记录Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-18
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/messageInfo")
|
||||||
|
public class SysCarMessageController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private ISysCarMessageService sysCarMessageService;
|
||||||
|
@Resource
|
||||||
|
private KafkaProducer<String, String> kafkaProducer;
|
||||||
|
static String TEST = "56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56";
|
||||||
|
|
||||||
|
// @Autowired
|
||||||
|
// private KafkaTemplate<String, Object> kafkaTemplate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆报文记录列表
|
||||||
|
*/
|
||||||
|
// @RequiresPermissions("message:message:list")
|
||||||
|
@Transactional
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<List<SysCarMessage>> list(SysCarMessage sysCarMessage) throws ExecutionException, InterruptedException {
|
||||||
|
|
||||||
|
List<SysCarMessage> list = sysCarMessageService.selectSysCarMessageList(sysCarMessage);
|
||||||
|
if (list == null || list.isEmpty()) {
|
||||||
|
return Result.error(); //为空返回错误信息
|
||||||
|
}
|
||||||
|
String[] test = TEST.split(" ");
|
||||||
|
String[] results = new String[list.size()];
|
||||||
|
List<CompletableFuture<String>> futures = new ArrayList<>();
|
||||||
|
|
||||||
|
for (SysCarMessage carMessage : list) {
|
||||||
|
futures.add(CompletableFuture.supplyAsync(() -> {
|
||||||
|
int start = Integer.parseInt(carMessage.getMessageStartIndex()) - 1;
|
||||||
|
int end = Integer.parseInt(carMessage.getMessageEndIndex());
|
||||||
|
StringBuilder hexBuilder = new StringBuilder();
|
||||||
|
for (int i = start; i < end; i++) {
|
||||||
|
hexBuilder.append(test[i]);
|
||||||
|
}
|
||||||
|
String hex = hexBuilder.toString();
|
||||||
|
char[] result = new char[hex.length() / 2];
|
||||||
|
for (int x = 0; x < hex.length(); x += 2) {
|
||||||
|
int high = Character.digit(hex.charAt(x), 16);
|
||||||
|
int low = Character.digit(hex.charAt(x + 1), 16);
|
||||||
|
result[x / 2] = (char) ((high << 4) + low);
|
||||||
|
}
|
||||||
|
return new String(result);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
for (int i = 0; i < futures.size(); i++) {
|
||||||
|
results[i] = futures.get(i).get();
|
||||||
|
|
||||||
|
}
|
||||||
|
log.info("======================={}", results);
|
||||||
|
String jsonString = """
|
||||||
|
[{
|
||||||
|
"key": "vin",
|
||||||
|
"label": "VIN码",
|
||||||
|
"type": "String",
|
||||||
|
"value": "vin131413534474"
|
||||||
|
},{
|
||||||
|
"key": "timestamp",
|
||||||
|
"label": "时间戳",
|
||||||
|
"type": "String",
|
||||||
|
"value": "1727525252127"
|
||||||
|
},{
|
||||||
|
"key": "latitude",
|
||||||
|
"label": "纬度",
|
||||||
|
"type": "String",
|
||||||
|
"value": "66.898"
|
||||||
|
},{
|
||||||
|
"key": "longitude",
|
||||||
|
"label": "经度",
|
||||||
|
"type": "String",
|
||||||
|
"value": "99.124"
|
||||||
|
}]""";
|
||||||
|
|
||||||
|
ProducerRecord<String, String> producerRecord = new ProducerRecord<>(KafkaConstants.KafkaTopic, jsonString);
|
||||||
|
kafkaProducer.send(producerRecord);
|
||||||
|
log.info("消息发送成功:{}", jsonString);
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequiresPermissions("message:message:dobList")
|
||||||
|
@GetMapping("/dobList")
|
||||||
|
public Result<List<SysMessageResp>> dobList(SysMessageResp sysMessageResp) {
|
||||||
|
List<SysMessageResp> list = sysCarMessageService.dobList(sysMessageResp);
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出车辆报文记录列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("message:message:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysCarMessage sysCarMessage) {
|
||||||
|
List<SysCarMessage> list = sysCarMessageService.selectSysCarMessageList(sysCarMessage);
|
||||||
|
ExcelUtil<SysCarMessage> util = new ExcelUtil<SysCarMessage>(SysCarMessage.class);
|
||||||
|
util.exportExcel(response, list, "车辆报文记录数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取车辆报文记录详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("message:message:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result<List<SysCarMessage>> getInfo(@PathVariable("id") Long id) {
|
||||||
|
return success(sysCarMessageService.selectSysCarMessageById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增车辆报文记录
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("message:message:add")
|
||||||
|
@PostMapping
|
||||||
|
public Result<Integer> add(
|
||||||
|
@Validated @RequestBody SysCarMessage sysCarMessage) {
|
||||||
|
if (sysCarMessageService.checkIdUnique(sysCarMessage)) {
|
||||||
|
return error("新增 车辆报文记录 '" + sysCarMessage + "'失败,车辆报文记录已存在");
|
||||||
|
}
|
||||||
|
return toAjax(sysCarMessageService.save(sysCarMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改车辆报文记录
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("message:message:edit")
|
||||||
|
@PutMapping
|
||||||
|
public Result<Integer> edit(
|
||||||
|
@Validated @RequestBody SysCarMessage sysCarMessage) {
|
||||||
|
if (!sysCarMessageService.checkIdUnique(sysCarMessage)) {
|
||||||
|
return error("修改 车辆报文记录 '" + sysCarMessage + "'失败,车辆报文记录不存在");
|
||||||
|
}
|
||||||
|
return toAjax(sysCarMessageService.updateById(sysCarMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除车辆报文记录
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("message:message:remove")
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result<Integer> remove(@PathVariable("ids") Long[] ids) {
|
||||||
|
sysCarMessageService.removeBatchByIds(Arrays.asList(ids));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
// public String message() {
|
||||||
|
// String topic = "vehicle";
|
||||||
|
// String content = "Message from MqttPublishSample";
|
||||||
|
// int qos = 2;
|
||||||
|
// String broker = "tcp://106.15.136.7:1883";
|
||||||
|
// String clientId = "JavaSample";
|
||||||
|
// try {
|
||||||
|
// // 第三个参数为空,默认持久化策略
|
||||||
|
// MqttClient sampleClient = new MqttClient(broker, clientId);
|
||||||
|
// MqttConnectOptions connOpts = new MqttConnectOptions();
|
||||||
|
// connOpts.setCleanSession(true);
|
||||||
|
// System.out.println("Connecting to broker: " + broker);
|
||||||
|
// sampleClient.connect(connOpts);
|
||||||
|
// sampleClient.subscribe(topic, 0);
|
||||||
|
// sampleClient.setCallback(new MqttCallback() {
|
||||||
|
// // 连接丢失
|
||||||
|
// @Override
|
||||||
|
// public void connectionLost(Throwable throwable) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 连接成功
|
||||||
|
// @Override
|
||||||
|
// public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
|
||||||
|
// System.out.println(new String(mqttMessage.getPayload()));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 接收信息
|
||||||
|
// @Override
|
||||||
|
// public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// } catch (MqttException me) {
|
||||||
|
// System.out.println("reason " + me.getReasonCode());
|
||||||
|
// System.out.println("msg " + me.getMessage());
|
||||||
|
// System.out.println("loc " + me.getLocalizedMessage());
|
||||||
|
// System.out.println("cause " + me.getCause());
|
||||||
|
// System.out.println("excep " + me);
|
||||||
|
// me.printStackTrace();
|
||||||
|
// }
|
||||||
|
// return this.messageArrived();
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.muyu.parsing.domain;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文消息 ktlv
|
||||||
|
*
|
||||||
|
* @ClassName KafKaData
|
||||||
|
* @Description 描述
|
||||||
|
* @Author Chen
|
||||||
|
* @Date 2024/9/28 20:41
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@ToString//
|
||||||
|
public class KafKaData implements Serializable {
|
||||||
|
private String key;
|
||||||
|
private String value;
|
||||||
|
private String type;
|
||||||
|
private String label;
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.muyu.parsing.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆报文记录对象 sys_car_message
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-18
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("sys_car_message")
|
||||||
|
public class SysCarMessage implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 自增主键 */
|
||||||
|
@TableId( type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 车辆型号编码 */
|
||||||
|
@Excel(name = "车辆型号编码")
|
||||||
|
private String modelCode;
|
||||||
|
|
||||||
|
/** 车辆报文类型编码 */
|
||||||
|
@Excel(name = "i")
|
||||||
|
private String messageTypeCode;
|
||||||
|
|
||||||
|
/** 开始位下标 */
|
||||||
|
@Excel(name = "开始位下标")
|
||||||
|
private String messageStartIndex;
|
||||||
|
|
||||||
|
/** 结束位下标 */
|
||||||
|
@Excel(name = "结束位下标")
|
||||||
|
private String messageEndIndex;
|
||||||
|
|
||||||
|
/** 报文分类 */
|
||||||
|
@Excel(name = "报文分类")
|
||||||
|
private String messageType;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("modelCode", getModelCode())
|
||||||
|
.append("messageTypeCode", getMessageTypeCode())
|
||||||
|
.append("messageStartIndex", getMessageStartIndex())
|
||||||
|
.append("messageEndIndex", getMessageEndIndex())
|
||||||
|
.append("messageType", getMessageType())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.muyu.parsing.domain.resp;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆报文类型对象 sys_message_type
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-18
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SysMessageResp {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private Long id;
|
||||||
|
private String modelCode;
|
||||||
|
private String messageTypeCode;
|
||||||
|
private String messageStartIndex;
|
||||||
|
private String messageEndIndex;
|
||||||
|
private String messageType;
|
||||||
|
private String messageName;
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.muyu.parsing.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
import com.muyu.parsing.domain.SysCarMessage;
|
||||||
|
import com.muyu.parsing.domain.resp.SysMessageResp;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆报文记录Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-18
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SysCarMessageMapper extends BaseMapper<SysCarMessage>{
|
||||||
|
List<SysMessageResp>dobList(SysMessageResp sysMessageResp);
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.muyu.parsing.mqtt;
|
||||||
|
|
||||||
|
import org.eclipse.paho.client.mqttv3.*;
|
||||||
|
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试MQTT
|
||||||
|
*
|
||||||
|
* @ClassName demo
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YiBo.Liu
|
||||||
|
* @Date 2024/9/27 22:27
|
||||||
|
*/
|
||||||
|
public class Demo {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
String topic = "vehicle";
|
||||||
|
String content = "Message from MqttPublishSample";
|
||||||
|
int qos = 2;
|
||||||
|
String broker = "tcp://106.54.193.225:1883";
|
||||||
|
String clientId = "JavaSample";
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 第三个参数为空,默认持久化策略
|
||||||
|
MqttClient sampleClient = new MqttClient(broker, clientId);
|
||||||
|
MqttConnectOptions connOpts = new MqttConnectOptions();
|
||||||
|
connOpts.setCleanSession(true);
|
||||||
|
System.out.println("Connecting to broker: " + broker);
|
||||||
|
sampleClient.connect(connOpts);
|
||||||
|
sampleClient.subscribe(topic, 0);
|
||||||
|
sampleClient.setCallback(new MqttCallback() {
|
||||||
|
// 连接丢失
|
||||||
|
@Override
|
||||||
|
public void connectionLost(Throwable throwable) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 连接成功
|
||||||
|
@Override
|
||||||
|
public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
|
||||||
|
System.out.println(new String(mqttMessage.getPayload()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 接收信息
|
||||||
|
@Override
|
||||||
|
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (MqttException me) {
|
||||||
|
System.out.println("reason " + me.getReasonCode());
|
||||||
|
System.out.println("msg " + me.getMessage());
|
||||||
|
System.out.println("loc " + me.getLocalizedMessage());
|
||||||
|
System.out.println("cause " + me.getCause());
|
||||||
|
System.out.println("excep " + me);
|
||||||
|
me.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,192 @@
|
||||||
|
package com.muyu.parsing.mqtt;
|
||||||
|
|
||||||
|
import com.muyu.common.kafka.constants.KafkaConstants;
|
||||||
|
import com.muyu.parsing.domain.SysCarMessage;
|
||||||
|
import com.muyu.parsing.service.impl.SysCarMessageServiceImpl;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.kafka.clients.producer.KafkaProducer;
|
||||||
|
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||||
|
import org.eclipse.paho.client.mqttv3.*;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName MqttTest
|
||||||
|
* @Description 描述
|
||||||
|
* @Author Chen
|
||||||
|
* @Date 2024/9/28 23:49
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class MqttTest {
|
||||||
|
@Resource
|
||||||
|
private KafkaProducer<String, String> kafkaProducer;
|
||||||
|
@Resource
|
||||||
|
private SysCarMessageServiceImpl sysCarMessageService;
|
||||||
|
@PostConstruct
|
||||||
|
public void Test() {
|
||||||
|
String topic = "vehicle";
|
||||||
|
String content = "Message from MqttPublishSample";
|
||||||
|
int qos = 2;
|
||||||
|
String broker = "tcp://106.15.136.7:1883";
|
||||||
|
String clientId = "JavaSample";
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 第三个参数为空,默认持久化策略
|
||||||
|
MqttClient sampleClient = new MqttClient(broker, clientId);
|
||||||
|
MqttConnectOptions connOpts = new MqttConnectOptions();
|
||||||
|
connOpts.setCleanSession(true);
|
||||||
|
System.out.println("Connecting to broker: " + broker);
|
||||||
|
sampleClient.connect(connOpts);
|
||||||
|
sampleClient.subscribe(topic, 0);
|
||||||
|
sampleClient.setCallback(new MqttCallback() {
|
||||||
|
// 连接丢失
|
||||||
|
@Override
|
||||||
|
public void connectionLost(Throwable throwable) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 连接成功
|
||||||
|
@Override
|
||||||
|
public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
|
||||||
|
List<SysCarMessage> list = sysCarMessageService.selectSysCarMessageLists(1, 1);
|
||||||
|
String string = new String(mqttMessage.getPayload());
|
||||||
|
System.out.println(new String(mqttMessage.getPayload()));
|
||||||
|
String[] test = string.split(" ");
|
||||||
|
String[] results = new String[list.size()];
|
||||||
|
List<CompletableFuture<String>> futures = new ArrayList<>();
|
||||||
|
|
||||||
|
for (SysCarMessage carMessage : list) {
|
||||||
|
futures.add(CompletableFuture.supplyAsync(() -> {
|
||||||
|
int start = Integer.parseInt(carMessage.getMessageStartIndex()) - 1;
|
||||||
|
int end = Integer.parseInt(carMessage.getMessageEndIndex());
|
||||||
|
StringBuilder hexBuilder = new StringBuilder();
|
||||||
|
for (int i = start; i < end; i++) {
|
||||||
|
hexBuilder.append(test[i]);
|
||||||
|
}
|
||||||
|
String hex = hexBuilder.toString();
|
||||||
|
char[] result = new char[hex.length() / 2];
|
||||||
|
for (int x = 0; x < hex.length(); x += 2) {
|
||||||
|
int high = Character.digit(hex.charAt(x), 16);
|
||||||
|
int low = Character.digit(hex.charAt(x + 1), 16);
|
||||||
|
result[x / 2] = (char) ((high << 4) + low);
|
||||||
|
}
|
||||||
|
return new String(result);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
for (int i = 0; i < futures.size(); i++) {
|
||||||
|
results[i] = futures.get(i).get();
|
||||||
|
}
|
||||||
|
log.info("======================={}", results);
|
||||||
|
String jsonString = """
|
||||||
|
[{
|
||||||
|
"key": "vin",
|
||||||
|
"label": "VIN码",
|
||||||
|
"type": "String",
|
||||||
|
"value": "vin131413534474"
|
||||||
|
},{
|
||||||
|
"key": "timestamp",
|
||||||
|
"label": "时间戳",
|
||||||
|
"type": "String",
|
||||||
|
"value": "1727525252127"
|
||||||
|
},{
|
||||||
|
"key": "latitude",
|
||||||
|
"label": "纬度",
|
||||||
|
"type": "String",
|
||||||
|
"value": "66.898"
|
||||||
|
},{
|
||||||
|
"key": "longitude",
|
||||||
|
"label": "经度",
|
||||||
|
"type": "String",
|
||||||
|
"value": "99.124"
|
||||||
|
}]""";
|
||||||
|
|
||||||
|
ProducerRecord<String, String> producerRecord = new ProducerRecord<>(KafkaConstants.KafkaTopic, jsonString);
|
||||||
|
kafkaProducer.send(producerRecord);
|
||||||
|
log.info("消息发送成功:{}", jsonString);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 接收信息
|
||||||
|
@Override
|
||||||
|
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// public Result<List<SysCarMessage>> list(SysCarMessage sysCarMessage) throws ExecutionException, InterruptedException {
|
||||||
|
// List<SysCarMessage> list = sysCarMessageService.selectSysCarMessageList(sysCarMessage);
|
||||||
|
// if (list == null || list.isEmpty()) {
|
||||||
|
// return Result.error(); //为空返回错误信息
|
||||||
|
// }
|
||||||
|
// String[] test = TEST.split(" ");
|
||||||
|
// String[] results = new String[list.size()];
|
||||||
|
// List<CompletableFuture<String>> futures = new ArrayList<>();
|
||||||
|
//
|
||||||
|
// for (SysCarMessage carMessage : list) {
|
||||||
|
// futures.add(CompletableFuture.supplyAsync(() -> {
|
||||||
|
// int start = Integer.parseInt(carMessage.getMessageStartIndex()) - 1;
|
||||||
|
// int end = Integer.parseInt(carMessage.getMessageEndIndex());
|
||||||
|
// StringBuilder hexBuilder = new StringBuilder();
|
||||||
|
// for (int i = start; i < end; i++) {
|
||||||
|
// hexBuilder.append(test[i]);
|
||||||
|
// }
|
||||||
|
// String hex = hexBuilder.toString();
|
||||||
|
// char[] result = new char[hex.length() / 2];
|
||||||
|
// for (int x = 0; x < hex.length(); x += 2) {
|
||||||
|
// int high = Character.digit(hex.charAt(x), 16);
|
||||||
|
// int low = Character.digit(hex.charAt(x + 1), 16);
|
||||||
|
// result[x / 2] = (char) ((high << 4) + low);
|
||||||
|
// }
|
||||||
|
// return new String(result);
|
||||||
|
// }));
|
||||||
|
// }
|
||||||
|
// for (int i = 0; i < futures.size(); i++) {
|
||||||
|
// results[i] = futures.get(i).get();
|
||||||
|
// }
|
||||||
|
// log.info("======================={}", results);
|
||||||
|
// String jsonString = """
|
||||||
|
// [{
|
||||||
|
// "key": "vin",
|
||||||
|
// "label": "VIN码",
|
||||||
|
// "type": "String",
|
||||||
|
// "value": "vin131413534474"
|
||||||
|
// },{
|
||||||
|
// "key": "timestamp",
|
||||||
|
// "label": "时间戳",
|
||||||
|
// "type": "String",
|
||||||
|
// "value": "1727525252127"
|
||||||
|
// },{
|
||||||
|
// "key": "latitude",
|
||||||
|
// "label": "纬度",
|
||||||
|
// "type": "String",
|
||||||
|
// "value": "66.898"
|
||||||
|
// },{
|
||||||
|
// "key": "longitude",
|
||||||
|
// "label": "经度",
|
||||||
|
// "type": "String",
|
||||||
|
// "value": "99.124"
|
||||||
|
// }]""";
|
||||||
|
//
|
||||||
|
// ProducerRecord<String, String> producerRecord = new ProducerRecord<>(KafkaConstants.KafkaTopic, jsonString);
|
||||||
|
// kafkaProducer.send(producerRecord);
|
||||||
|
// log.info("消息发送成功:{}", jsonString);
|
||||||
|
// return Result.success(list);
|
||||||
|
// }
|
||||||
|
|
||||||
|
});
|
||||||
|
} catch (MqttException me) {
|
||||||
|
System.out.println("reason " + me.getReasonCode());
|
||||||
|
System.out.println("msg " + me.getMessage());
|
||||||
|
System.out.println("loc " + me.getLocalizedMessage());
|
||||||
|
System.out.println("cause " + me.getCause());
|
||||||
|
System.out.println("excep " + me);
|
||||||
|
me.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.muyu.parsing.remote;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.parsing.domain.SysCarMessage;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName CarMessageRemote
|
||||||
|
* @Description 描述
|
||||||
|
* @Author Chen
|
||||||
|
* @Date 2024/9/28 23:45
|
||||||
|
*/
|
||||||
|
|
||||||
|
//public interface CarMessageRemote {
|
||||||
|
// @GetMapping("/list")
|
||||||
|
// public Result<List<SysCarMessage>> list(SysCarMessage sysCarMessage);
|
||||||
|
//}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.muyu.parsing.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.parsing.domain.SysCarMessage;
|
||||||
|
import com.muyu.parsing.domain.resp.SysMessageResp;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆报文记录Service接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-18
|
||||||
|
*/
|
||||||
|
public interface ISysCarMessageService extends IService<SysCarMessage> {
|
||||||
|
|
||||||
|
List<SysMessageResp>dobList(SysMessageResp sysMessageResp);
|
||||||
|
/**
|
||||||
|
* 精确查询车辆报文记录
|
||||||
|
*
|
||||||
|
* @param id 车辆报文记录主键
|
||||||
|
* @return 车辆报文记录
|
||||||
|
*/
|
||||||
|
public SysCarMessage selectSysCarMessageById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆报文记录列表
|
||||||
|
*
|
||||||
|
* @param sysCarMessage 车辆报文记录
|
||||||
|
* @return 车辆报文记录集合
|
||||||
|
*/
|
||||||
|
public List<SysCarMessage> selectSysCarMessageList(SysCarMessage sysCarMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断 车辆报文记录 id是否唯一
|
||||||
|
* @param sysCarMessage 车辆报文记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
Boolean checkIdUnique(SysCarMessage sysCarMessage);
|
||||||
|
|
||||||
|
// Boolean checkById(SysCarMessage sysCarMessage);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,97 @@
|
||||||
|
package com.muyu.parsing.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.parsing.domain.SysCarMessage;
|
||||||
|
import com.muyu.parsing.domain.resp.SysMessageResp;
|
||||||
|
import com.muyu.parsing.mapper.SysCarMessageMapper;
|
||||||
|
import com.muyu.parsing.service.ISysCarMessageService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆报文记录Service业务层处理
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-18
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysCarMessageServiceImpl
|
||||||
|
extends ServiceImpl<SysCarMessageMapper, SysCarMessage>
|
||||||
|
implements ISysCarMessageService {
|
||||||
|
@Autowired
|
||||||
|
private SysCarMessageMapper mapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysMessageResp> dobList(SysMessageResp sysMessageResp) {
|
||||||
|
return mapper.dobList(sysMessageResp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 精确查询车辆报文记录
|
||||||
|
*
|
||||||
|
* @param id 车辆报文记录主键
|
||||||
|
* @return 车辆报文记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysCarMessage selectSysCarMessageById(Long id) {
|
||||||
|
LambdaQueryWrapper<SysCarMessage> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
Assert.notNull(id, "id不可为空");
|
||||||
|
queryWrapper.eq(SysCarMessage::getId, id);
|
||||||
|
return this.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆报文记录列表
|
||||||
|
*
|
||||||
|
* @param sysCarMessage 车辆报文记录
|
||||||
|
* @return 车辆报文记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysCarMessage> selectSysCarMessageList(SysCarMessage sysCarMessage) {
|
||||||
|
LambdaQueryWrapper<SysCarMessage> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StringUtils.isNotEmpty(sysCarMessage.getModelCode())) {
|
||||||
|
queryWrapper.eq(SysCarMessage::getModelCode, sysCarMessage.getModelCode());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(sysCarMessage.getMessageType())) {
|
||||||
|
queryWrapper.eq(SysCarMessage::getMessageType, sysCarMessage.getMessageType());
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 唯一 判断
|
||||||
|
*
|
||||||
|
* @param sysCarMessage 车辆报文记录
|
||||||
|
* @return 车辆报文记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean checkIdUnique(SysCarMessage sysCarMessage) {
|
||||||
|
LambdaQueryWrapper<SysCarMessage> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(SysCarMessage::getId, sysCarMessage.getId());
|
||||||
|
return this.count(queryWrapper) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SysCarMessage> selectSysCarMessageLists(int id, int modelCode) {
|
||||||
|
LambdaQueryWrapper<SysCarMessage> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(SysCarMessage::getModelCode, id);
|
||||||
|
queryWrapper.eq(SysCarMessage::getMessageType, modelCode);
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public Boolean checkById(SysMessageType sysMessageType) {
|
||||||
|
// LambdaQueryWrapper<SysCarMessage> sysCarMessageLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
// sysCarMessageLambdaQueryWrapper.eq(SysCarMessage::getMessageType, sysMessageType);
|
||||||
|
//// sysCarMessageLambdaQueryWrapper.eq(SysCarMessage::getMessageType, sysMessageType);
|
||||||
|
// sysCarMessageLambdaQueryWrapper.eq(SysCarMessage::get, sysMessageType);
|
||||||
|
//// return this.count(sysCarMessageLambdaQueryWrapper) > 0;
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
Spring Boot Version: ${spring-boot.version}
|
||||||
|
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,77 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 10010
|
||||||
|
|
||||||
|
# nacos线上地址
|
||||||
|
nacos:
|
||||||
|
addr: 49.235.136.60:8848
|
||||||
|
user-name: nacos
|
||||||
|
password: nacos
|
||||||
|
namespace: wyh
|
||||||
|
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
amqp:
|
||||||
|
deserialization:
|
||||||
|
trust:
|
||||||
|
all: true
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: cloud-parsing
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: ${nacos.addr}
|
||||||
|
# # nacos用户名
|
||||||
|
# username: ${nacos.user-name}
|
||||||
|
# # nacos密码
|
||||||
|
# password: ${nacos.password}
|
||||||
|
# 命名空间
|
||||||
|
namespace: ${nacos.namespace}
|
||||||
|
config:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: ${nacos.addr}
|
||||||
|
# # nacos用户名
|
||||||
|
# username: ${nacos.user-name}
|
||||||
|
# # nacos密码
|
||||||
|
# password: ${nacos.password}
|
||||||
|
# 命名空间
|
||||||
|
namespace: ${nacos.namespace}
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
# 系统共享配置
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
# 系统环境Config共享配置
|
||||||
|
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
# xxl-job 配置文件
|
||||||
|
- application-xxl-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
# rabbit 配置文件
|
||||||
|
- application-rabbit-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
com.muyu.system.mapper: DEBUG
|
||||||
|
#mqtt:
|
||||||
|
# host:tcp://172.0.0.1:1883
|
||||||
|
# userName: root
|
||||||
|
# passWord: 11
|
||||||
|
### MQTT##
|
||||||
|
mqtt:
|
||||||
|
host: tcp://192.168.10.198:1883
|
||||||
|
userName: root
|
||||||
|
passWord: 123456
|
||||||
|
qos: 1
|
||||||
|
clientId: ClientId_local #ClientId_local必须唯一 比如你已经定了叫ABC 那你就一直叫ABC 其他地方就不要使用ABC了
|
||||||
|
timeout: 10
|
||||||
|
keepalive: 20
|
||||||
|
topic1: A/pick/warn/# #符号是代表整个warn下面的全部子主题 没有理解的话 可以百度仔细理解一下
|
||||||
|
topic2: A/cmd/resp
|
||||||
|
topic3: ABCF
|
||||||
|
topic4: ABCH
|
|
@ -0,0 +1,74 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="logs/cloud-system"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.muyu" level="info"/>
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn"/>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="console"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info"/>
|
||||||
|
<appender-ref ref="file_error"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,81 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="logs/cloud-system"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.sky.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 使用gRpc将日志发送到skywalking服务端 -->
|
||||||
|
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||||
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||||
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||||
|
<Pattern>${log.sky.pattern}</Pattern>
|
||||||
|
</layout>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.muyu" level="info"/>
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn"/>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="GRPC_LOG"/>
|
||||||
|
<appender-ref ref="console"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info"/>
|
||||||
|
<appender-ref ref="file_error"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,81 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="logs/cloud-system"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.sky.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 使用gRpc将日志发送到skywalking服务端 -->
|
||||||
|
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||||
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||||
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||||
|
<Pattern>${log.sky.pattern}</Pattern>
|
||||||
|
</layout>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.muyu" level="info"/>
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn"/>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="GRPC_LOG"/>
|
||||||
|
<appender-ref ref="console"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info"/>
|
||||||
|
<appender-ref ref="file_error"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -1,7 +0,0 @@
|
||||||
package com.zhangyi.rail;
|
|
||||||
|
|
||||||
public class CloudRailApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
package com.zhangyi.rail.controller;
|
|
||||||
|
|
||||||
public class RailController {
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
package com.zhangyi.rail.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.muyu.common.core.annotation.Excel;
|
|
||||||
import lombok.*;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Setter
|
|
||||||
@Getter
|
|
||||||
@SuperBuilder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@TableName("sys_corpuscle_fence")
|
|
||||||
public class SysFenceRail {
|
|
||||||
private static final long seriaversionUID =1L;
|
|
||||||
/** 自增主键 */
|
|
||||||
@TableId(type = IdType.AUTO)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 围栏编码 */
|
|
||||||
@Excel(name="围栏编码")
|
|
||||||
private String fenceCode;
|
|
||||||
/**围栏名称**/
|
|
||||||
@Excel(name = "围栏名称")
|
|
||||||
private String fenceName;
|
|
||||||
|
|
||||||
/**围栏类型**/
|
|
||||||
@Excel(name = "围栏类型")
|
|
||||||
private Long fenceType;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -10,7 +10,9 @@
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>cloud-modules-system-saas</artifactId>
|
<artifactId>cloud-modules-system-saas</artifactId>
|
||||||
|
<description>
|
||||||
|
cloud-modules-system-saas saas
|
||||||
|
</description>
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 微信公众号
|
||||||
* @Author: Chen
|
* @Author: Chen
|
||||||
* @name:GetWxController
|
* @name:GetWxController
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>cloud-modules-warn</artifactId>
|
<artifactId>cloud-modules-warn</artifactId>
|
||||||
|
<description>
|
||||||
|
预警
|
||||||
|
</description>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<modules>
|
<modules>
|
||||||
<module>cloud-warn-common</module>
|
<module>cloud-warn-common</module>
|
||||||
|
|
|
@ -15,9 +15,9 @@
|
||||||
<module>cloud-modules-system-saas</module>
|
<module>cloud-modules-system-saas</module>
|
||||||
<module>cloud-breakdown</module>
|
<module>cloud-breakdown</module>
|
||||||
<module>cloud-modules-car</module>
|
<module>cloud-modules-car</module>
|
||||||
<module>cloud-modules-rail</module>
|
|
||||||
<module>cloud-modules-warn</module>
|
<module>cloud-modules-warn</module>
|
||||||
<module>cloud-modules-carmanage</module>
|
<module>cloud-modules-carmanage</module>
|
||||||
|
<module>cloud-modules-parsing</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>cloud-modules</artifactId>
|
<artifactId>cloud-modules</artifactId>
|
||||||
|
|
Loading…
Reference in New Issue