feat: 优化代码

server_five_liuyunhu
lijiayao 2024-04-08 20:41:29 +08:00
parent db1368379e
commit 7d77386b3a
11 changed files with 19 additions and 36 deletions

View File

@ -17,11 +17,9 @@ spring:
discovery:
# 服务注册地址
server-addr: 121.89.211.230:8848
namespace: 172469
config:
# 配置中心地址
server-addr: 121.89.211.230:8848
namespace: 172469
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -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";
}

View File

@ -15,11 +15,9 @@ spring:
discovery:
# 服务注册地址
server-addr: 121.89.211.230:8848
namespace: 172469
config:
# 配置中心地址
server-addr: 121.89.211.230:8848
namespace: 172469
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -76,12 +76,6 @@ public class ModelsKafkaMessage {
// message.getMessageProperties().setMessageId(UUID.randomUUID().toString());
// return message;
// });
try {
sleep(100);
} catch (Exception e) {
throw new VehicleException("睡眠失败" + e);
}
}
});
}

View File

@ -1,6 +1,7 @@
package com.couplet.analyze.msg.service.impl;
import com.alibaba.fastjson.JSON;
import com.couplet.analyze.common.contents.AnalyzeEventContents;
import com.couplet.analyze.msg.contents.StateConstant;
import com.couplet.analyze.msg.domain.CoupletMsgData;
import com.couplet.analyze.msg.service.IncidentService;
@ -26,7 +27,7 @@ import java.util.concurrent.TimeUnit;
* @Date: 2024/4/2
* @Description:
*/
@Service("breakdown")
@Service(AnalyzeEventContents.BREAKDOWN)
public class BreakdownServiceImpl extends KeyExpirationEventMessageListener implements IncidentService {
/**
@ -93,7 +94,7 @@ public class BreakdownServiceImpl extends KeyExpirationEventMessageListener impl
*/
@Override
public String getName() {
return "breakdown";
return AnalyzeEventContents.BREAKDOWN;
}
public void scheduledRedis() {

View File

@ -1,6 +1,7 @@
package com.couplet.analyze.msg.service.impl;
import com.alibaba.fastjson.JSON;
import com.couplet.analyze.common.contents.AnalyzeEventContents;
import com.couplet.analyze.msg.domain.CoupletMsgData;
import com.couplet.analyze.msg.service.IncidentService;
import com.couplet.common.core.text.Convert;
@ -22,7 +23,7 @@ import java.util.Set;
* @Date: 2024/4/2
* @Description:
*/
@Service("electronic_fence")
@Service(AnalyzeEventContents.ELECTRONIC_FENCE)
@Log4j2
public class ElectronicFenceServiceImpl implements IncidentService {
@ -86,7 +87,7 @@ public class ElectronicFenceServiceImpl implements IncidentService {
*/
@Override
public String getName() {
return "electronic-fence";
return AnalyzeEventContents.ELECTRONIC_FENCE;
}

View File

@ -1,5 +1,6 @@
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.mapper.IncidentMapper;
import com.couplet.analyze.msg.service.IncidentService;
@ -18,7 +19,7 @@ import java.util.concurrent.TimeUnit;
* @Date: 2024/4/2
* @Description:
*/
@Service("real_time_data")
@Service(AnalyzeEventContents.REAL_TIME_DATA)
@Log4j2
public class RealTimeDataServiceImpl implements IncidentService {
@ -37,7 +38,8 @@ public class RealTimeDataServiceImpl implements IncidentService {
* @param coupletMsgData
*/
@Override
public void incident(CoupletMsgData coupletMsgData) {
public synchronized void incident(CoupletMsgData coupletMsgData) {
log.info("实时数据事件开始.....");
@ -69,6 +71,6 @@ public class RealTimeDataServiceImpl implements IncidentService {
*/
@Override
public String getName() {
return "real-time-data";
return AnalyzeEventContents.REAL_TIME_DATA;
}
}

View File

@ -1,5 +1,6 @@
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.mapper.IncidentMapper;
import com.couplet.analyze.msg.service.IncidentService;
@ -12,7 +13,7 @@ import org.springframework.stereotype.Service;
* @Date: 2024/4/2
* @Description:
*/
@Service("stored_event")
@Service(AnalyzeEventContents.STORED_EVENT)
@Log4j2
public class StoredEventServiceImpl implements IncidentService {
@Autowired
@ -36,6 +37,6 @@ public class StoredEventServiceImpl implements IncidentService {
*/
@Override
public String getName() {
return "stored-event";
return AnalyzeEventContents.STORED_EVENT;
}
}

View File

@ -15,11 +15,9 @@ spring:
discovery:
# 服务注册地址
server-addr: 121.89.211.230:8848
namespace: 172469
config:
# 配置中心地址
server-addr: 121.89.211.230:8848
namespace: 172469
# 配置文件格式
file-extension: yml
# 共享配置
@ -50,9 +48,3 @@ logging:
mybatis-plus:
configuration:
map-underscore-to-camel-case: true
# RabbitMQ配置
mq:
queueName: queue
exchangeName: exchange
routingKey: routingKey

View File

@ -16,11 +16,9 @@ spring:
discovery:
# 服务注册地址
server-addr: 121.89.211.230:8848
namespace: 172469
config:
# 配置中心地址
server-addr: 121.89.211.230:8848
namespace: 172469
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -15,11 +15,9 @@ spring:
discovery:
# 服务注册地址
server-addr: 121.89.211.230:8848
namespace: 172469
config:
# 配置中心地址
server-addr: 121.89.211.230:8848
namespace: 172469
# 配置文件格式
file-extension: yml
# 共享配置
@ -38,7 +36,7 @@ mqtt:
# broker: mqtt://115.159.47.13:1883
username:
password:
clientId: liuyunhu
clientId: xiaoYao
qos: 0
topic: liuyunhu
topic: xiaoYao