feat():新增数据预警
parent
1960d9dd90
commit
761a186777
|
@ -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);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package com.muyu.event.domian;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 数据添加实体类
|
||||
* @author 刘武
|
||||
|
|
|
@ -12,6 +12,6 @@ public interface IncidentService {
|
|||
|
||||
void warnEventProcess(JSONObject jsonObject) throws Exception;
|
||||
|
||||
void eventAlarmProcessing(JSONObject jsonObject) throws Exception;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -40,8 +40,6 @@ public class IncidentServiceImpl implements IncidentService {
|
|||
private static int DURATION_SECONDS = 5;
|
||||
private static List<JSONObject> receivedStrings = new ArrayList<>();
|
||||
private static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
private static int elapsedSeconds = 0;
|
||||
private static String file="elapsed";
|
||||
private static List<MessageTemplateType> 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<SysCarVo> carVoList = sysCarCacheService.get(sysCarCacheService.keyPre());
|
||||
//这辆车的信息
|
||||
SysCar carByVin = null;
|
||||
Map<String, SysCarVo> carMap = carVoList.stream()
|
||||
.collect(Collectors.toMap(SysCarVo::getCarVin, Function.identity()));
|
||||
//获取到了这个车辆的信息
|
||||
carByVin = carMap.get(carVin);
|
||||
Long carTypeId = carByVin.getCarTypeId();
|
||||
//车辆绑定的报警规则
|
||||
List<SysCarFault> sysCarFaults = sysCarFaultCacheService.get(sysCarFaultCacheService.keyPre());
|
||||
//车辆的所有报警规则都重新存储在sysCarFaultList里面
|
||||
List<SysCarFault> sysCarFaultList=null;
|
||||
SysCar finalCarByVin = carByVin;
|
||||
sysCarFaults.forEach(sysCarFault -> {
|
||||
if(sysCarFault.getCarTypeId().equals(carTypeId)){
|
||||
sysCarFaultList.add(sysCarFault);
|
||||
}
|
||||
});
|
||||
//报文模版
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue