fix(): 优化时间处理流程,修复bug
parent
a0c2d916f2
commit
ca8bd65148
|
@ -21,7 +21,7 @@ import lombok.experimental.SuperBuilder;
|
||||||
@TableName(value = "fault_rule",autoResultMap = true)
|
@TableName(value = "fault_rule",autoResultMap = true)
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Tag(name = "故障规则")
|
@Tag(name = "故障规则")
|
||||||
public class FaultrRule extends BaseEntity {
|
public class FaultRule extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 故障规则ID
|
* 故障规则ID
|
||||||
*/
|
*/
|
|
@ -93,5 +93,11 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-common-rabbit</artifactId>
|
<artifactId>cloud-common-rabbit</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 企业缓存模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-modules-enterprise-cache</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
|
@ -7,6 +7,7 @@ import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: zi run
|
* @Author: zi run
|
||||||
|
@ -14,11 +15,12 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
* @Description 车辆下线消费者
|
* @Description 车辆下线消费者
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@Component
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class GoOfflineConsumer {
|
public class GoOfflineConsumer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缓存工具
|
* 存储字符串类型数据缓存工具
|
||||||
*/
|
*/
|
||||||
private final CacheUtil<String> cacheUtil;
|
private final CacheUtil<String> cacheUtil;
|
||||||
|
|
||||||
|
@ -34,7 +36,7 @@ public class GoOfflineConsumer {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
public void offline(String vin) {
|
public void offline(String vin) {
|
||||||
log.info("清除缓存,车辆vin: {}", vin);
|
log.info("车辆vin码:{},该车辆已下线", vin);
|
||||||
cacheUtil.remove(vin);
|
cacheUtil.remove(vin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.muyu.event.process.consumer;
|
||||||
|
|
||||||
import com.muyu.common.core.constant.KafkaConstants;
|
import com.muyu.common.core.constant.KafkaConstants;
|
||||||
import com.muyu.event.process.basic.EventPublisher;
|
import com.muyu.event.process.basic.EventPublisher;
|
||||||
import com.muyu.event.process.event.IoTDBInsertDataEvent;
|
import com.muyu.event.process.event.DataProcessEvent;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
||||||
|
@ -73,7 +73,7 @@ public class VehicleConsumer implements ApplicationRunner, ApplicationListener<C
|
||||||
String message = consumerRecord.value();
|
String message = consumerRecord.value();
|
||||||
log.info("接收到车辆报文数据,内容:{}", message);
|
log.info("接收到车辆报文数据,内容:{}", message);
|
||||||
log.info("------------------------------------------------");
|
log.info("------------------------------------------------");
|
||||||
eventPublisher.publish(new IoTDBInsertDataEvent(this, message));
|
eventPublisher.publish(new DataProcessEvent(this, message));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,6 +5,10 @@ import com.muyu.event.process.basic.BasicEvent;
|
||||||
import com.muyu.event.process.basic.BasicEventListener;
|
import com.muyu.event.process.basic.BasicEventListener;
|
||||||
import com.muyu.event.process.iotdb.service.IoTDBService;
|
import com.muyu.event.process.iotdb.service.IoTDBService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -15,9 +19,10 @@ import java.util.stream.Collectors;
|
||||||
* @Date 2024/9/29 22:12
|
* @Date 2024/9/29 22:12
|
||||||
* @Description 向IoTDB插入数据事件监听器
|
* @Description 向IoTDB插入数据事件监听器
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class IoTDBInsertDataListener implements BasicEventListener<String> {
|
public class IoTDBInsertDataEventListener implements BasicEventListener<String> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IoTDB业务层
|
* IoTDB业务层
|
||||||
|
@ -36,6 +41,7 @@ public class IoTDBInsertDataListener implements BasicEventListener<String> {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(BasicEvent<String> event) {
|
public void onEvent(BasicEvent<String> event) {
|
||||||
|
log.info("触发向IoTDB插入数据事件监听器……");
|
||||||
JSONObject data = JSONObject.parseObject(event.getData());
|
JSONObject data = JSONObject.parseObject(event.getData());
|
||||||
List<String> keyList = extractKeys(data);
|
List<String> keyList = extractKeys(data);
|
||||||
List<String> valueList = extractValues(data);
|
List<String> valueList = extractValues(data);
|
Loading…
Reference in New Issue