feat: 优化代码
parent
db1368379e
commit
7d77386b3a
|
@ -17,11 +17,9 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: 172469
|
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: 172469
|
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -17,14 +17,14 @@ public interface AnalyzeEventContents {
|
||||||
/**
|
/**
|
||||||
* 电子围栏
|
* 电子围栏
|
||||||
*/
|
*/
|
||||||
static final String ELECTRONIC_FENCE = "electronic-fence";
|
static final String ELECTRONIC_FENCE = "electronic_fence";
|
||||||
/**
|
/**
|
||||||
* 实时数据
|
* 实时数据
|
||||||
*/
|
*/
|
||||||
static final String REAL_TIME_DATA = "real-time-data";
|
static final String REAL_TIME_DATA = "real_time_data";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 存储
|
* 存储
|
||||||
*/
|
*/
|
||||||
static final String STORED_EVENT = "stored-event";
|
static final String STORED_EVENT = "stored_event";
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,9 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: 172469
|
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: 172469
|
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -76,12 +76,6 @@ public class ModelsKafkaMessage {
|
||||||
// message.getMessageProperties().setMessageId(UUID.randomUUID().toString());
|
// message.getMessageProperties().setMessageId(UUID.randomUUID().toString());
|
||||||
// return message;
|
// return message;
|
||||||
// });
|
// });
|
||||||
|
|
||||||
try {
|
|
||||||
sleep(100);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new VehicleException("睡眠失败" + e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.couplet.analyze.msg.service.impl;
|
package com.couplet.analyze.msg.service.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.couplet.analyze.common.contents.AnalyzeEventContents;
|
||||||
import com.couplet.analyze.msg.contents.StateConstant;
|
import com.couplet.analyze.msg.contents.StateConstant;
|
||||||
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||||
import com.couplet.analyze.msg.service.IncidentService;
|
import com.couplet.analyze.msg.service.IncidentService;
|
||||||
|
@ -26,7 +27,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
* @Date: 2024/4/2
|
* @Date: 2024/4/2
|
||||||
* @Description: 故障事件
|
* @Description: 故障事件
|
||||||
*/
|
*/
|
||||||
@Service("breakdown")
|
@Service(AnalyzeEventContents.BREAKDOWN)
|
||||||
public class BreakdownServiceImpl extends KeyExpirationEventMessageListener implements IncidentService {
|
public class BreakdownServiceImpl extends KeyExpirationEventMessageListener implements IncidentService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,7 +94,7 @@ public class BreakdownServiceImpl extends KeyExpirationEventMessageListener impl
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "breakdown";
|
return AnalyzeEventContents.BREAKDOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void scheduledRedis() {
|
public void scheduledRedis() {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.couplet.analyze.msg.service.impl;
|
package com.couplet.analyze.msg.service.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.couplet.analyze.common.contents.AnalyzeEventContents;
|
||||||
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||||
import com.couplet.analyze.msg.service.IncidentService;
|
import com.couplet.analyze.msg.service.IncidentService;
|
||||||
import com.couplet.common.core.text.Convert;
|
import com.couplet.common.core.text.Convert;
|
||||||
|
@ -22,7 +23,7 @@ import java.util.Set;
|
||||||
* @Date: 2024/4/2
|
* @Date: 2024/4/2
|
||||||
* @Description: 电子围栏事件服务实现类
|
* @Description: 电子围栏事件服务实现类
|
||||||
*/
|
*/
|
||||||
@Service("electronic_fence")
|
@Service(AnalyzeEventContents.ELECTRONIC_FENCE)
|
||||||
@Log4j2
|
@Log4j2
|
||||||
public class ElectronicFenceServiceImpl implements IncidentService {
|
public class ElectronicFenceServiceImpl implements IncidentService {
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@ public class ElectronicFenceServiceImpl implements IncidentService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "electronic-fence";
|
return AnalyzeEventContents.ELECTRONIC_FENCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.couplet.analyze.msg.service.impl;
|
package com.couplet.analyze.msg.service.impl;
|
||||||
|
|
||||||
|
import com.couplet.analyze.common.contents.AnalyzeEventContents;
|
||||||
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||||
import com.couplet.analyze.msg.mapper.IncidentMapper;
|
import com.couplet.analyze.msg.mapper.IncidentMapper;
|
||||||
import com.couplet.analyze.msg.service.IncidentService;
|
import com.couplet.analyze.msg.service.IncidentService;
|
||||||
|
@ -18,7 +19,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
* @Date: 2024/4/2
|
* @Date: 2024/4/2
|
||||||
* @Description: 实时数据事件
|
* @Description: 实时数据事件
|
||||||
*/
|
*/
|
||||||
@Service("real_time_data")
|
@Service(AnalyzeEventContents.REAL_TIME_DATA)
|
||||||
@Log4j2
|
@Log4j2
|
||||||
public class RealTimeDataServiceImpl implements IncidentService {
|
public class RealTimeDataServiceImpl implements IncidentService {
|
||||||
|
|
||||||
|
@ -37,7 +38,8 @@ public class RealTimeDataServiceImpl implements IncidentService {
|
||||||
* @param coupletMsgData
|
* @param coupletMsgData
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void incident(CoupletMsgData coupletMsgData) {
|
public synchronized void incident(CoupletMsgData coupletMsgData) {
|
||||||
|
|
||||||
|
|
||||||
log.info("实时数据事件开始.....");
|
log.info("实时数据事件开始.....");
|
||||||
|
|
||||||
|
@ -69,6 +71,6 @@ public class RealTimeDataServiceImpl implements IncidentService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "real-time-data";
|
return AnalyzeEventContents.REAL_TIME_DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.couplet.analyze.msg.service.impl;
|
package com.couplet.analyze.msg.service.impl;
|
||||||
|
|
||||||
|
import com.couplet.analyze.common.contents.AnalyzeEventContents;
|
||||||
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||||
import com.couplet.analyze.msg.mapper.IncidentMapper;
|
import com.couplet.analyze.msg.mapper.IncidentMapper;
|
||||||
import com.couplet.analyze.msg.service.IncidentService;
|
import com.couplet.analyze.msg.service.IncidentService;
|
||||||
|
@ -12,7 +13,7 @@ import org.springframework.stereotype.Service;
|
||||||
* @Date: 2024/4/2
|
* @Date: 2024/4/2
|
||||||
* @Description: 事件存储服务
|
* @Description: 事件存储服务
|
||||||
*/
|
*/
|
||||||
@Service("stored_event")
|
@Service(AnalyzeEventContents.STORED_EVENT)
|
||||||
@Log4j2
|
@Log4j2
|
||||||
public class StoredEventServiceImpl implements IncidentService {
|
public class StoredEventServiceImpl implements IncidentService {
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -36,6 +37,6 @@ public class StoredEventServiceImpl implements IncidentService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "stored-event";
|
return AnalyzeEventContents.STORED_EVENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,9 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: 172469
|
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: 172469
|
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
@ -50,9 +48,3 @@ logging:
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
configuration:
|
configuration:
|
||||||
map-underscore-to-camel-case: true
|
map-underscore-to-camel-case: true
|
||||||
|
|
||||||
# RabbitMQ配置
|
|
||||||
mq:
|
|
||||||
queueName: queue
|
|
||||||
exchangeName: exchange
|
|
||||||
routingKey: routingKey
|
|
||||||
|
|
|
@ -16,11 +16,9 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: 172469
|
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: 172469
|
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -15,11 +15,9 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: 172469
|
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: 172469
|
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
@ -38,7 +36,7 @@ mqtt:
|
||||||
# broker: mqtt://115.159.47.13:1883
|
# broker: mqtt://115.159.47.13:1883
|
||||||
username:
|
username:
|
||||||
password:
|
password:
|
||||||
clientId: liuyunhu
|
clientId: xiaoYao
|
||||||
qos: 0
|
qos: 0
|
||||||
topic: liuyunhu
|
topic: xiaoYao
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue