feat:() 优化数据处理
parent
d472b8d326
commit
c0800ce466
|
@ -0,0 +1,4 @@
|
||||||
|
com.muyu.cloud.common.many.datasource.ManyDataSource
|
||||||
|
com.muyu.cloud.common.many.datasource.role.DynamicDataSource
|
||||||
|
com.muyu.cloud.common.saas.interceptor.WebMvcSaaSConfig
|
||||||
|
com.muyu.cloud.common.saas.interceptor.SaaSInterceptor
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.muyu.processing.listener;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.muyu.domain.FenceGroup;
|
||||||
|
import com.muyu.processing.basic.EventCustom;
|
||||||
|
import com.muyu.processing.basic.EventListener;
|
||||||
|
import com.muyu.processing.utils.CacheUtil;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏判定
|
||||||
|
* @Author:杨鹏
|
||||||
|
* @Package:com.muyu.processing.listener
|
||||||
|
* @Project:cloud-vehicle
|
||||||
|
* @name:FenceListener
|
||||||
|
* @Date:2024/10/9 11:17
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
public class FenceListener implements EventListener {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CacheUtil cacheUtil;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(EventCustom event) {
|
||||||
|
try {
|
||||||
|
log.info("事件开始");
|
||||||
|
JSONObject data = event.getData();
|
||||||
|
String vin = (String) data.get("VIN码");
|
||||||
|
Double longitude = (Double) data.get("longitude");
|
||||||
|
Double latitude = (Double) data.get("latitude");
|
||||||
|
HashMap<String, Object> map = (HashMap<String, Object>) cacheUtil.get(vin);
|
||||||
|
if (map != null) {
|
||||||
|
ArrayList<Point> points = new ArrayList<>();
|
||||||
|
FenceGroup fenceGroup = new FenceGroup();
|
||||||
|
Point testPoint = new Point(); // 应该在第一个围栏内
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
log.error("事件发送错误",e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onApplicationEvent(EventCustom event) {
|
||||||
|
onEvent(event);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.muyu.processing.listener;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.muyu.domain.WarnRule;
|
||||||
|
import com.muyu.processing.basic.EventCustom;
|
||||||
|
import com.muyu.processing.basic.EventListener;
|
||||||
|
import com.muyu.processing.utils.CacheUtil;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断故障信息
|
||||||
|
* @Author:杨鹏
|
||||||
|
* @Package:com.muyu.processing.listener
|
||||||
|
* @Project:cloud-vehicle
|
||||||
|
* @name:IdentifyingFailuresListener
|
||||||
|
* @Date:2024/10/9 11:20
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
public class IdentifyingFailuresListener implements EventListener {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CacheUtil cacheUtil;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(EventCustom 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 faultCondition = (WarnRule) map.get("warnRule");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("事件发生错误",e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onApplicationEvent(EventCustom event) {
|
||||||
|
this.onEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue