From 761a186777534e8f40b7c0e6ab10cac36975ff8d Mon Sep 17 00:00:00 2001 From: Number7 <1845377266@qq.com> Date: Fri, 11 Oct 2024 19:54:43 +0800 Subject: [PATCH] =?UTF-8?q?feat():=E6=96=B0=E5=A2=9E=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=A2=84=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../muyu/event/consumer/MessageConsumer.java | 2 +- .../muyu/event/domian/AddCarInformation.java | 2 -- .../muyu/event/service/IncidentService.java | 2 +- .../service/impl/IncidentServiceImpl.java | 26 ------------------- 4 files changed, 2 insertions(+), 30 deletions(-) diff --git a/cloud-modules/cloud-event/src/main/java/com/muyu/event/consumer/MessageConsumer.java b/cloud-modules/cloud-event/src/main/java/com/muyu/event/consumer/MessageConsumer.java index 7caad4b..06bbfed 100644 --- a/cloud-modules/cloud-event/src/main/java/com/muyu/event/consumer/MessageConsumer.java +++ b/cloud-modules/cloud-event/src/main/java/com/muyu/event/consumer/MessageConsumer.java @@ -46,11 +46,11 @@ public class MessageConsumer implements ApplicationRunner { log.info("value:{}",value); eventPublisher.publishEvent(jsonObject); try { + //数据预警 incidentService.warnEventProcess(jsonObject); } catch (Exception e) { throw new RuntimeException(e); } - }); } } diff --git a/cloud-modules/cloud-event/src/main/java/com/muyu/event/domian/AddCarInformation.java b/cloud-modules/cloud-event/src/main/java/com/muyu/event/domian/AddCarInformation.java index de8df2f..170a480 100644 --- a/cloud-modules/cloud-event/src/main/java/com/muyu/event/domian/AddCarInformation.java +++ b/cloud-modules/cloud-event/src/main/java/com/muyu/event/domian/AddCarInformation.java @@ -1,8 +1,6 @@ package com.muyu.event.domian; - import com.muyu.common.core.annotation.Excel; import lombok.Data; - /** * 数据添加实体类 * @author 刘武 diff --git a/cloud-modules/cloud-event/src/main/java/com/muyu/event/service/IncidentService.java b/cloud-modules/cloud-event/src/main/java/com/muyu/event/service/IncidentService.java index 60c8c0e..60f8061 100644 --- a/cloud-modules/cloud-event/src/main/java/com/muyu/event/service/IncidentService.java +++ b/cloud-modules/cloud-event/src/main/java/com/muyu/event/service/IncidentService.java @@ -12,6 +12,6 @@ public interface IncidentService { void warnEventProcess(JSONObject jsonObject) throws Exception; - void eventAlarmProcessing(JSONObject jsonObject) throws Exception; + } diff --git a/cloud-modules/cloud-event/src/main/java/com/muyu/event/service/impl/IncidentServiceImpl.java b/cloud-modules/cloud-event/src/main/java/com/muyu/event/service/impl/IncidentServiceImpl.java index b205563..7936d17 100644 --- a/cloud-modules/cloud-event/src/main/java/com/muyu/event/service/impl/IncidentServiceImpl.java +++ b/cloud-modules/cloud-event/src/main/java/com/muyu/event/service/impl/IncidentServiceImpl.java @@ -40,8 +40,6 @@ public class IncidentServiceImpl implements IncidentService { private static int DURATION_SECONDS = 5; private static List receivedStrings = new ArrayList<>(); private static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); - private static int elapsedSeconds = 0; - private static String file="elapsed"; private static List messageTemplateTypes=null; private static Long msgTypeId=null; //滑窗时间 @@ -150,29 +148,5 @@ public class IncidentServiceImpl implements IncidentService { } } } - @Override - public void eventAlarmProcessing(JSONObject jsonObject) throws Exception { - String carVin = (String) jsonObject.get("carVin"); - //车辆缓存配置 - List carVoList = sysCarCacheService.get(sysCarCacheService.keyPre()); - //这辆车的信息 - SysCar carByVin = null; - Map carMap = carVoList.stream() - .collect(Collectors.toMap(SysCarVo::getCarVin, Function.identity())); - //获取到了这个车辆的信息 - carByVin = carMap.get(carVin); - Long carTypeId = carByVin.getCarTypeId(); - //车辆绑定的报警规则 - List sysCarFaults = sysCarFaultCacheService.get(sysCarFaultCacheService.keyPre()); - //车辆的所有报警规则都重新存储在sysCarFaultList里面 - List sysCarFaultList=null; - SysCar finalCarByVin = carByVin; - sysCarFaults.forEach(sysCarFault -> { - if(sysCarFault.getCarTypeId().equals(carTypeId)){ - sysCarFaultList.add(sysCarFault); - } - }); - //报文模版 - } }