parent
8e2ba733d9
commit
e8ed8e0f6e
|
@ -0,0 +1,47 @@
|
||||||
|
package com.muyu.carData.listener;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.muyu.carData.event.EsSaveEvent;
|
||||||
|
import com.muyu.carData.event.EventListener;
|
||||||
|
import com.muyu.carData.util.CacheUtil;
|
||||||
|
import com.muyu.domain.WarnRule;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警信息监听器
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Log4j2
|
||||||
|
public class FaultWarningListener implements EventListener {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CacheUtil cacheUtil;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(EsSaveEvent event) {
|
||||||
|
try {
|
||||||
|
log.info("事件开始");
|
||||||
|
JSONObject data = event.getData();
|
||||||
|
String vin = (String) data.get("VIN");
|
||||||
|
HashMap<String, Object> map = (HashMap<String, Object>) cacheUtil.get(vin);
|
||||||
|
if (map != null) {
|
||||||
|
WarnRule warnRule = (WarnRule) map.get("warnRule");
|
||||||
|
Long maxValue = warnRule.getMaxValue();
|
||||||
|
Long minValue = warnRule.getMinValue();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("事件发送错误",e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onApplicationEvent(EsSaveEvent event) {
|
||||||
|
onEvent(event);
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,6 +16,9 @@ import java.awt.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏区域判定
|
||||||
|
*/
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@Component
|
@Component
|
||||||
public class FenceListener implements EventListener {
|
public class FenceListener implements EventListener {
|
||||||
|
|
Loading…
Reference in New Issue