refactor: 修改框架

server_five
lijiayao 2024-04-04 08:58:43 +08:00 committed by ffr
parent 2734077121
commit f2463c9753
7 changed files with 19 additions and 15 deletions

View File

@ -301,8 +301,8 @@ public class RedisService {
}
public void setVinAndUserId(RealTimeDataRequest realTimeDataRequest) {
String key = "vin:"+realTimeDataRequest.getVin();
redisTemplate.opsForValue().set(key, realTimeDataRequest);
String key = "vin:" + realTimeDataRequest.getVin();
redisTemplate.opsForSet().add(key,realTimeDataRequest);
}
public void stopViewingData(String vin) {

View File

@ -36,7 +36,7 @@ import static java.lang.Thread.sleep;
@Component
@Slf4j
public class ModelsKafkaMessage {
private static final String TOPIC_NAME = "online";
private static final String TOPIC_NAME = "fufanrui";
private static final String BOOTSTRAP_SERVERS = "39.103.133.136:9092";

View File

@ -46,10 +46,10 @@ public class ElectronicFenceServiceImpl implements IncidentService {
if (redisService.hasKey(fenceKey)) {
Set<Fence> cacheSet = redisService.getCacheSet(fenceKey);
log.info("电子围栏事件redis存在.......");
// jingdu;
// longitude;
// weidu;
// latitude;
//jingdu;
//longitude;
//weidu;
//latitude;
for (Fence fence : cacheSet) {
String fenceLongitudeLatitude = fence.getFenceLongitudeLatitude();
/**

View File

@ -21,8 +21,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import springfox.documentation.spring.web.json.Json;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
@ -53,10 +56,9 @@ public class VehicleDetectionServiceImpl implements VehicleDetectionService{
public List<CoupletMsgData> monitorinDataList(String vin) {
String key = "vin:query:" + vin;
log.info("key为:"+key);
CoupletMsgData coupletMsgData = redisService.getCacheObject(key);
ArrayList<CoupletMsgData> coupletMsgDataArrayList = new ArrayList<>();
coupletMsgDataArrayList.add(coupletMsgData);
return coupletMsgDataArrayList;
Set<CoupletMsgData> cacheSet = redisService.getCacheSet(key);
ArrayList<CoupletMsgData> coupletMsgData = new ArrayList<>(cacheSet);
return coupletMsgData;
}
@Override

View File

@ -16,9 +16,11 @@ spring:
discovery:
# 服务注册地址
server-addr: 121.89.211.230:8848
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
config:
# 配置中心地址
server-addr: 121.89.211.230:8848
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -76,7 +76,7 @@ public class MqttMonitor {
//Kafka生产者配置
private static final String TOPIC_NAME = "xiaoYao";
private static final String TOPIC_NAME = "fufanrui";
private static final String BOOTSTRAP_SERVERS = "39.103.133.136:9092";
//线程池,用于异步处理消息到来时的业务逻辑

View File

@ -36,7 +36,7 @@ mqtt:
# broker: mqtt://115.159.47.13:1883
username:
password:
clientId: xiaoYao
clientId: fufanrui44
qos: 0
topic: xiaoYao
topic: test898