From 7d77386b3a9764243cd32170fa56b37465e0b8d0 Mon Sep 17 00:00:00 2001 From: lijiayao <13831655+xiao-yao-charge-forward@user.noreply.gitee.com> Date: Mon, 8 Apr 2024 20:41:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- couplet-auth/src/main/resources/bootstrap.yml | 2 -- .../analyze/common/contents/AnalyzeEventContents.java | 6 +++--- couplet-gateway/src/main/resources/bootstrap.yml | 2 -- .../com/couplet/analyze/msg/model/ModelsKafkaMessage.java | 6 ------ .../analyze/msg/service/impl/BreakdownServiceImpl.java | 5 +++-- .../msg/service/impl/ElectronicFenceServiceImpl.java | 5 +++-- .../analyze/msg/service/impl/RealTimeDataServiceImpl.java | 8 +++++--- .../analyze/msg/service/impl/StoredEventServiceImpl.java | 5 +++-- .../couplet-analyze-msg/src/main/resources/bootstrap.yml | 8 -------- .../couplet-business/src/main/resources/bootstrap.yml | 2 -- .../src/main/resources/bootstrap.yml | 6 ++---- 11 files changed, 19 insertions(+), 36 deletions(-) diff --git a/couplet-auth/src/main/resources/bootstrap.yml b/couplet-auth/src/main/resources/bootstrap.yml index 68c3c25..427f682 100644 --- a/couplet-auth/src/main/resources/bootstrap.yml +++ b/couplet-auth/src/main/resources/bootstrap.yml @@ -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 # 共享配置 diff --git a/couplet-common/couplet-common-event/src/main/java/com/couplet/analyze/common/contents/AnalyzeEventContents.java b/couplet-common/couplet-common-event/src/main/java/com/couplet/analyze/common/contents/AnalyzeEventContents.java index 7e76640..22a5cd8 100644 --- a/couplet-common/couplet-common-event/src/main/java/com/couplet/analyze/common/contents/AnalyzeEventContents.java +++ b/couplet-common/couplet-common-event/src/main/java/com/couplet/analyze/common/contents/AnalyzeEventContents.java @@ -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"; } diff --git a/couplet-gateway/src/main/resources/bootstrap.yml b/couplet-gateway/src/main/resources/bootstrap.yml index 6dc39fe..091e68a 100644 --- a/couplet-gateway/src/main/resources/bootstrap.yml +++ b/couplet-gateway/src/main/resources/bootstrap.yml @@ -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 # 共享配置 diff --git a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/model/ModelsKafkaMessage.java b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/model/ModelsKafkaMessage.java index 004249f..8e64a8f 100644 --- a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/model/ModelsKafkaMessage.java +++ b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/model/ModelsKafkaMessage.java @@ -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); - } } }); } diff --git a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/BreakdownServiceImpl.java b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/BreakdownServiceImpl.java index 88e6fa3..f754efb 100644 --- a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/BreakdownServiceImpl.java +++ b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/BreakdownServiceImpl.java @@ -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() { diff --git a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/ElectronicFenceServiceImpl.java b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/ElectronicFenceServiceImpl.java index 63a232c..cadfc55 100644 --- a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/ElectronicFenceServiceImpl.java +++ b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/ElectronicFenceServiceImpl.java @@ -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; } diff --git a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/RealTimeDataServiceImpl.java b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/RealTimeDataServiceImpl.java index daf4aec..130b7a8 100644 --- a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/RealTimeDataServiceImpl.java +++ b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/RealTimeDataServiceImpl.java @@ -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; } } diff --git a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/StoredEventServiceImpl.java b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/StoredEventServiceImpl.java index f7504b8..852edfb 100644 --- a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/StoredEventServiceImpl.java +++ b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/StoredEventServiceImpl.java @@ -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; } } diff --git a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/resources/bootstrap.yml b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/resources/bootstrap.yml index 183987e..9b0c2eb 100644 --- a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/resources/bootstrap.yml +++ b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/resources/bootstrap.yml @@ -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 diff --git a/couplet-modules/couplet-business/src/main/resources/bootstrap.yml b/couplet-modules/couplet-business/src/main/resources/bootstrap.yml index b88e464..d900876 100644 --- a/couplet-modules/couplet-business/src/main/resources/bootstrap.yml +++ b/couplet-modules/couplet-business/src/main/resources/bootstrap.yml @@ -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 # 共享配置 diff --git a/couplet-modules/couplet-modules-onLine/src/main/resources/bootstrap.yml b/couplet-modules/couplet-modules-onLine/src/main/resources/bootstrap.yml index 2d20009..fc1f9a1 100644 --- a/couplet-modules/couplet-modules-onLine/src/main/resources/bootstrap.yml +++ b/couplet-modules/couplet-modules-onLine/src/main/resources/bootstrap.yml @@ -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