济菏高速数据中心代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

300 lines
15 KiB

package com.zc.business.enums;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
/**
* @author 王思祥
* @ClassName ValueConverter
*/
//感知事件与交通主子类转换
public class ValueConverter {
//懒加载类来实现延迟初始化
private static class ValueMappingHolder {
// 静态映射,用于存储转换关系 事件主类转换
private static final Map<Integer, Integer> valueMappingHost = new HashMap<>();
// 静态映射,用于存储转换关系 事件子类转换(注:子类7和10子类不能转需要前端自传)
private static final Map<String, String> valueMappingSon = new HashMap<>();
// 静态映射,用于存储转换关系 事件源转换
private static final Map<Integer, Integer> valueMappingSource = new HashMap<>();
// 事件来源名称
private static final Map<String, String> eventSourceName = new HashMap<>();
// 事件类型名称
private static final Map<String, String> eventTypeName = new HashMap<>();
// 事件字段
private static final Map<String, String> eventLabel = new HashMap<>();
static {
valueMappingSource.put(1,5);
valueMappingSource.put(4,10);
valueMappingSource.put(7,13);
valueMappingSource.put(2,8);
valueMappingSource.put(3,9);
valueMappingSource.put(5,11);
valueMappingSource.put(6,12);
valueMappingHost.put(1, 4);
valueMappingHost.put(2, 5);
valueMappingHost.put(3, 5);
valueMappingHost.put(4, 2);
valueMappingHost.put(5, 11);
valueMappingHost.put(6, 6);
valueMappingHost.put(7, 7);
valueMappingHost.put(8, 10);
valueMappingHost.put(9, 1);
valueMappingHost.put(10, 1);
valueMappingHost.put(11, 2);
valueMappingHost.put(99, 11);
valueMappingSon.put("1-1", "4-1");
valueMappingSon.put("1-2", "4-1");
valueMappingSon.put("2-1", "5-1");
valueMappingSon.put("2-2", "5-1");
valueMappingSon.put("3-1", "5-3");
valueMappingSon.put("3-2", "5-2");
valueMappingSon.put("3-3", "5-2");
valueMappingSon.put("4-1", "2-1");
valueMappingSon.put("4-2", "2-1");
valueMappingSon.put("4-3", "2-1");
valueMappingSon.put("4-4", "2-1");
valueMappingSon.put("4-5", "2-1");
valueMappingSon.put("4-6", "2-1");
valueMappingSon.put("4-7", "2-1");
valueMappingSon.put("4-8", "2-1");
valueMappingSon.put("4-9", "2-1");
valueMappingSon.put("4-10", "2-1");
valueMappingSon.put("5-1", "11-1");
valueMappingSon.put("5-2", "11-1");
valueMappingSon.put("5-3", "11-1");
valueMappingSon.put("5-4", "11-1");
valueMappingSon.put("5-5", "11-1");
valueMappingSon.put("5-6", "11-1");
valueMappingSon.put("5-7", "11-1");
valueMappingSon.put("6-1", "6-1");
valueMappingSon.put("6-2", "6-5");
valueMappingSon.put("6-3", "6-5");
valueMappingSon.put("6-4", "6-3");
valueMappingSon.put("8-1", "10-1");
valueMappingSon.put("8-2", "10-9");
valueMappingSon.put("8-3", "10-4");
valueMappingSon.put("8-4", "10-3");
valueMappingSon.put("8-5", "10-9");
valueMappingSon.put("8-6", "10-8");
valueMappingSon.put("8-7", "10-9");
valueMappingSon.put("8-8", "10-7");
valueMappingSon.put("8-9", "10-9");
valueMappingSon.put("8-10", "10-3");
valueMappingSon.put("9-1", "1-3");
valueMappingSon.put("9-2", "1-3");
valueMappingSon.put("9-3", "1-3");
valueMappingSon.put("11-1", "2-1");
valueMappingSon.put("11-2", "2-1");
valueMappingSon.put("11-3", "2-1");
valueMappingSon.put("99-1", "11-1");
eventSourceName.put("1","96659");
eventSourceName.put("2","交警转接");
eventSourceName.put("3","道路巡查");
eventSourceName.put("4","视频巡查");
eventSourceName.put("5","视频AI");
eventSourceName.put("6","一键救援");
eventSourceName.put("7","其他");
eventSourceName.put("8","雷达识别");
eventSourceName.put("9","锥桶");
eventSourceName.put("10","护栏碰撞");
eventSourceName.put("11","扫码报警");
eventSourceName.put("12","非机预警");
eventSourceName.put("13","气象检测器");
eventTypeName.put("1","交通事故");
eventTypeName.put("2","车辆故障");
eventTypeName.put("3","交通管制");
eventTypeName.put("4","交通拥堵");
eventTypeName.put("5","非法上路");
eventTypeName.put("6","路障清除");
eventTypeName.put("7","施工建设");
eventTypeName.put("8","服务区异常");
eventTypeName.put("9","设施设备隐患");
eventTypeName.put("10","异常天气");
eventTypeName.put("11","其他事件");
eventLabel.put("id","事件编号");
eventLabel.put("deptId","所属部门");
eventLabel.put("stakeMark","桩号");
eventLabel.put("direction","方向");
eventLabel.put("userId","处理人员");
eventLabel.put("startTime","开始时间");
eventLabel.put("endTime","结束时间");
eventLabel.put("estimatedEndTime","预计解除时间");
eventLabel.put("eventLevel","事件等级");
// eventLabel.put("eventType","事件类型");
eventLabel.put("eventSubclass","事件子类");
eventLabel.put("eventCause","事件原因");
eventLabel.put("description","描述");
eventLabel.put("eventState","状态");
eventLabel.put("eventSource","来源");
// eventLabel.put("eventNature","事件性质");
eventLabel.put("eventSourceTips","来源补充说明");
eventLabel.put("occurrenceTime","发生时间");
// eventLabel.put("isPerceived","是否感知事件");
eventLabel.put("lang","影响车道");
eventLabel.put("roadName","高速名称");
eventLabel.put("eventTitle","时间标题");
eventLabel.put("remark","备注");
eventLabel.put("dcEventAbnormalWeather.weatherSituation","天气情况");
eventLabel.put("dcEventAbnormalWeather.emergencyLevel","紧急级别");
eventLabel.put("dcEventAbnormalWeather.endStakeMark","终止桩号");
eventLabel.put("dcEventAbnormalWeather.numericalValue","异常天气数值");
eventLabel.put("dcEventAccident.reporterName","报警人姓名");
eventLabel.put("dcEventAccident.reporterPhoneNumber","报警人电话");
eventLabel.put("dcEventAccident.locationType","地点");
eventLabel.put("dcEventAccident.trafficJam","压车(公里)");
eventLabel.put("dcEventAccident.weatherCondition","天气情况");
eventLabel.put("dcEventAccident.impactLevel","影响");
eventLabel.put("dcEventAccident.isReverseCargo","是否倒货");
eventLabel.put("dcEventAccident.isMaintenance","是否养护事故");
eventLabel.put("dcEventAccident.policeContact","交警电话");
eventLabel.put("dcEventAccident.towingServiceContact","清障电话");
eventLabel.put("dcEventAccident.congestionAhead","前方是否拥堵");
eventLabel.put("dcEventAccident.atIntersection","是否分岔口");
eventLabel.put("dcEventAccident.onCurve","是否处在弯道");
eventLabel.put("dcEventAccident.spillageItem","洒落物名称");
eventLabel.put("dcEventAccident.vehicleOwnerPhone","车主电话");
eventLabel.put("dcEventAccident.smallCar","小型车(辆)");
eventLabel.put("dcEventAccident.trucks","货车(辆)");
eventLabel.put("dcEventAccident.buses","客车(辆)");
eventLabel.put("dcEventAccident.tankers","罐车(辆)");
eventLabel.put("dcEventAccident.minorInjuries","轻伤(人)");
eventLabel.put("dcEventAccident.seriousInjuries","重伤(人)");
eventLabel.put("dcEventAccident.fatalities","死亡(人)");
eventLabel.put("dcEventAccident.isPrivate","私密事件");
eventLabel.put("dcEventAccident.facilityId","设施关联");
// eventLabel.put("dcEventAccident.rampId","匝道id");
eventLabel.put("dcEventAccident.location","地点");
eventLabel.put("dcEventConstruction.controlMode","管制方式");
eventLabel.put("dcEventConstruction.locationType","地点类型");
eventLabel.put("dcEventConstruction.specialPlaceDescription","特殊地点描述");
eventLabel.put("dcEventConstruction.specialConstruction","专项施工");
eventLabel.put("dcEventConstruction.otherConstructionName","其他施工名称");
eventLabel.put("dcEventConstruction.constructionMeasurement","施工措施");
// eventLabel.put("dcEventConstruction.facilityId","设施id");
eventLabel.put("dcEventConstruction.exitsInlets","出入口");
eventLabel.put("dcEventConstruction.laneOccupancy","占用车道");
eventLabel.put("dcEventConstruction.trafficCondition","通行情况");
eventLabel.put("dcEventConstruction.constructionMethod","施工方式");
eventLabel.put("dcEventConstruction.localRoadName","地方道路名称");
eventLabel.put("dcEventConstruction.endStakeMark","结束桩号");
eventLabel.put("dcEventConstruction.location","地点");
eventLabel.put("dcEventServiceArea.exitsInlets","出入口");
eventLabel.put("dcEventServiceArea.facilityId","服务区");
eventLabel.put("dcEventServiceArea.disableFacility","停用设施");
eventLabel.put("dcEventTrafficCongestion.congestionMileage","拥堵里程(公里)");
eventLabel.put("dcEventTrafficCongestion.maxCongestionMileage","最大拥堵里程(公里)");
eventLabel.put("dcEventTrafficCongestion.congestionCause","拥堵原因");
// eventLabel.put("dcEventTrafficCongestion.facilityId","设施id");
// eventLabel.put("dcEventTrafficCongestion.rampId","匝道");
eventLabel.put("dcEventTrafficCongestion.location","地点");
eventLabel.put("dcEventTrafficCongestion.detailedReasons","详细原因");
eventLabel.put("dcEventTrafficCongestion.locationType","地点类型");
eventLabel.put("dcEventTrafficCongestion.locationDescription","地点描述");
eventLabel.put("dcEventTrafficCongestion.endStakeMark","终止桩号");
eventLabel.put("dcEventVehicleAccident.reporterName","报警人姓名");
eventLabel.put("dcEventVehicleAccident.reporterPhoneNumber","报警人电话");
eventLabel.put("dcEventVehicleAccident.locationType","地点方式");
eventLabel.put("dcEventVehicleAccident.trafficJam","压车(公里)");
eventLabel.put("dcEventVehicleAccident.weatherCondition","天气情况");
eventLabel.put("dcEventVehicleAccident.congestionAhead","前方是否拥堵");
eventLabel.put("dcEventVehicleAccident.atIntersection","是否分岔口");
eventLabel.put("dcEventVehicleAccident.onCurve","是否处在弯道");
eventLabel.put("dcEventVehicleAccident.smallCar","小型车(辆)");
eventLabel.put("dcEventVehicleAccident.trucks","货车(辆)");
eventLabel.put("dcEventVehicleAccident.buses","客车(辆)");
eventLabel.put("dcEventVehicleAccident.tankers","罐车(辆)");
eventLabel.put("dcEventVehicleAccident.minorInjuries","轻伤(人)");
eventLabel.put("dcEventVehicleAccident.seriousInjuries","重伤(人)");
eventLabel.put("dcEventVehicleAccident.fatalities","死亡(人)");
eventLabel.put("dcEventVehicleAccident.isPrivate","私密事件");
eventLabel.put("dcEventVehicleAccident.facilityId","地点");
// eventLabel.put("dcEventVehicleAccident.rampId","匝道");
eventLabel.put("dcEventVehicleAccident.location","地点");
eventLabel.put("dcEventTrafficControl.controlType","管制分类");
eventLabel.put("dcEventTrafficControl.controlCause","管制原因");
eventLabel.put("dcEventTrafficControl.exitsInlets","出入口");
// eventLabel.put("dcEventTrafficControl.facilityId","设施id");
// eventLabel.put("dcEventTrafficControl.rampId","匝道");
eventLabel.put("dcEventTrafficControl.causeType","原因类型");
eventLabel.put("dcEventTrafficControl.measure","措施");
eventLabel.put("dcEventTrafficControl.classify","分类");
eventLabel.put("dcEventTrafficControl.limitedType","限制类型");
// eventLabel.put("dcEventTrafficControl.vehicleType","车辆类型");
}
}
// 提供一个静态方法来获取映射关系
public static Map<Integer, Integer> getValueMappingHost() {
return ValueMappingHolder.valueMappingHost;
}
public static Map<String, String> getValueMappingSon() {
return ValueMappingHolder.valueMappingSon;
}
public static Map<Integer, Integer> getValueMappingSource() {
return ValueMappingHolder.valueMappingSource;
}
public static Map<String, String> getEventSourceName() {
return ValueMappingHolder.eventSourceName;
}
public static Map<String, String> getEventTypeName() {
return ValueMappingHolder.eventTypeName;
}
public static Map<String, String> getEventLabel() {
return ValueMappingHolder.eventLabel;
}
/**
* 根据输入值返回转换后的值
* 如果输入值不在映射中,则返回输入值本身
* @param inputValue 输入值
* @return 转换后的值或输入值本身
*/
public static int convertValueHost(int inputValue) {
Map<Integer, Integer> mapping = getValueMappingHost();
return mapping.getOrDefault(inputValue, inputValue);
}
public static String convertValueSon(String inputValue) {
Map<String, String> mapping = getValueMappingSon();
return mapping.getOrDefault(inputValue, inputValue);
}
public static int convertValueSource(int inputValue) {
Map<Integer, Integer> mapping = getValueMappingSource();
return mapping.getOrDefault(inputValue, inputValue);
}
public static String eventSourceName(String inputValue) {
Map<String, String> mapping = getEventSourceName();
return mapping.getOrDefault(inputValue, inputValue);
}
public static String eventTypeName(String inputValue) {
Map<String, String> mapping = getEventTypeName();
return mapping.getOrDefault(inputValue, inputValue);
}
public static String eventLabel(String inputValue) {
Map<String, String> mapping = getEventLabel();
return mapping.getOrDefault(inputValue, "");
}
//测试
// @Test
// public void text(){
// int i=5;
// int i1 = ValueConverter.convertValueSource(i);
// System.out.println(i1+"--------------");
// }
}