|
@@ -92,6 +92,91 @@ public class DataFormat {
|
|
|
return tempIndex == str.length() ? str : str.substring(0, tempIndex);
|
|
|
}
|
|
|
|
|
|
+// public static void main(String[] args) {
|
|
|
+// String xx = "BPM\\r\\n.V/1LWNZ\\r\\n.J/R/13203/0/13MAR/1143L/MBWNZ\\r\\n.F/CA8531/13MAR/TSN/Y\\r\\n.U/ULD000282//X/Y/TSN\\r\\n.B/OFF/3999159951001\\r\\n.I/G54873/13MAR/CGD/J\\r\\n.S/Y/19C/C/045//Y\\r\\n.P/WANGDONGHONG\\r\\n.L/NY51JP\\r\\n.R/+ACT/OL/B/S/3\\r\\nENDBPM";
|
|
|
+//
|
|
|
+// HashMap<String, String> objectObjectHashMap = new HashMap<>();
|
|
|
+// objectObjectHashMap.put("dataType", "dataType");
|
|
|
+// objectObjectHashMap.put("dataState", "dataState");
|
|
|
+// objectObjectHashMap.put(".B1", "abnormalState");
|
|
|
+// objectObjectHashMap.put(".B2", "luggageNum");
|
|
|
+// objectObjectHashMap.put(".N/1", "luggageNum");
|
|
|
+// objectObjectHashMap.put(".C/", "groupName");
|
|
|
+// objectObjectHashMap.put(".D/1", "checkInLocation");
|
|
|
+// objectObjectHashMap.put(".D/2", "checkInLocationDescription");
|
|
|
+// objectObjectHashMap.put(".D/3.D/4", "checkInDate");
|
|
|
+// objectObjectHashMap.put(".D/5", "transportMedium");
|
|
|
+// objectObjectHashMap.put(".D/6", "transportID");
|
|
|
+// objectObjectHashMap.put(".E/", "specialType");
|
|
|
+// objectObjectHashMap.put(".F/1", "flightNo");
|
|
|
+// objectObjectHashMap.put(".F/2", "flightDate");
|
|
|
+// objectObjectHashMap.put(".F/3", "target_airport");
|
|
|
+// objectObjectHashMap.put(".F/4", "passenger_cabin");
|
|
|
+// objectObjectHashMap.put(".G/1", "groundtransportationDateStar");
|
|
|
+// objectObjectHashMap.put(".G/2", "groundtransportationDateEnd");
|
|
|
+// objectObjectHashMap.put(".G/3", "groundtransportationAddress");
|
|
|
+// objectObjectHashMap.put(".H/1", "doTerminal");
|
|
|
+// objectObjectHashMap.put(".H/2", "operationArea");
|
|
|
+// objectObjectHashMap.put(".H/3", "operatingPosition");
|
|
|
+// objectObjectHashMap.put(".I/1", "inflightNo");
|
|
|
+// objectObjectHashMap.put(".I/2", "inflightDate");
|
|
|
+// objectObjectHashMap.put(".I/3", "inairport");
|
|
|
+// objectObjectHashMap.put(".I/4", "inpassenger_cabin");
|
|
|
+// objectObjectHashMap.put(".J/1", "secondary_code");
|
|
|
+// objectObjectHashMap.put(".J/2", "agentNumber");
|
|
|
+// objectObjectHashMap.put(".J/3", "device_ID");
|
|
|
+// objectObjectHashMap.put(".J/4.J/5", "processing_time");
|
|
|
+// objectObjectHashMap.put(".J/6", "location_code");
|
|
|
+// objectObjectHashMap.put(".J/7", "to_location_code");
|
|
|
+// objectObjectHashMap.put(".J/8", "location_describe");
|
|
|
+// objectObjectHashMap.put(".J/9", "to_location_describe");
|
|
|
+// objectObjectHashMap.put(".L/", "PNRNO");
|
|
|
+// objectObjectHashMap.put(".O/1", "transferFlightNO");
|
|
|
+// objectObjectHashMap.put(".O/2", "transferFlightDate");
|
|
|
+// objectObjectHashMap.put(".O/3", "transferAirport");
|
|
|
+// objectObjectHashMap.put(".P/", "passengerName");
|
|
|
+// objectObjectHashMap.put(".Q/", "loadNumber");
|
|
|
+// objectObjectHashMap.put(".R/", "luggage_describe");
|
|
|
+// objectObjectHashMap.put(".S/4", "checkin_number");
|
|
|
+// objectObjectHashMap.put(".S/5", "security_number");
|
|
|
+// objectObjectHashMap.put(".S/6", "passengerinfoState");
|
|
|
+// objectObjectHashMap.put(".S/7", "cantransportation");
|
|
|
+// objectObjectHashMap.put(".S/8", "activeState");
|
|
|
+// objectObjectHashMap.put(".S/1", "canLoad");
|
|
|
+// objectObjectHashMap.put(".S/2", "seatNum");
|
|
|
+// objectObjectHashMap.put(".S/3", "passengerState");
|
|
|
+// objectObjectHashMap.put(".T/", "printerID");
|
|
|
+// objectObjectHashMap.put(".U/1", "container_ID");
|
|
|
+// objectObjectHashMap.put(".U/2", "loadAddress");
|
|
|
+// objectObjectHashMap.put(".U/3", "luggageType");
|
|
|
+// objectObjectHashMap.put(".V/2", "sourceAirport");
|
|
|
+// objectObjectHashMap.put(".V/1", "sourceSign");
|
|
|
+// objectObjectHashMap.put(".V/3", "sourceOther");
|
|
|
+// objectObjectHashMap.put("creation_time", "creation_time");
|
|
|
+// objectObjectHashMap.put("dataObjectId", "dataObjectId");
|
|
|
+// objectObjectHashMap.put("sourceData", "sourceData");
|
|
|
+// objectObjectHashMap.put(".W/2", "luggageCount");
|
|
|
+// objectObjectHashMap.put(".W/3", "luggageWeight");
|
|
|
+// objectObjectHashMap.put(".W/1", "weightUnit");
|
|
|
+// objectObjectHashMap.put(".W/5", "luggageSize");
|
|
|
+// objectObjectHashMap.put(".W/9", "externalFeatures");
|
|
|
+// objectObjectHashMap.put(".X/1", "securityInspectionDescription");
|
|
|
+// objectObjectHashMap.put(".X/2", "securityInspectionResults");
|
|
|
+// objectObjectHashMap.put(".X/3", "reasonsForSecurity");
|
|
|
+// objectObjectHashMap.put(".X/4", "securityInspectionMethod");
|
|
|
+// objectObjectHashMap.put(".Y/1", "frequentflyerNO");
|
|
|
+// objectObjectHashMap.put(".Y/2", "frequentflyerGrade");
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// System.out.println(typeBToMap(xx,"11111111111111",objectObjectHashMap));
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
public static Map<String, Object> typeBToMap(String typeStr, String dataObjectId, Map<String, String> transMaps) {
|
|
|
try {
|
|
|
if (MapTools.isBlank(typeStr)) {
|
|
@@ -131,13 +216,13 @@ public class DataFormat {
|
|
|
luggageNumList.add(luggageNum);//添加到行李牌号数组 3666149457,3666149458
|
|
|
}
|
|
|
} else {//
|
|
|
- luggageState = MapTools.isBlank(colValue) ? colValue.substring(0, 3) : null;//更新行李状态
|
|
|
+ luggageState = MapTools.isNotBlank(colValue) ? colValue.substring(0, 3) : null;//更新行李状态
|
|
|
}
|
|
|
}
|
|
|
for (String luggageNum : luggageNumList) {//循环行李牌号数组
|
|
|
Map<String, Object> luggageMap = new HashMap<>();
|
|
|
luggageMap.put("luggageNum", luggageNum);
|
|
|
- luggageMap.put("luggageState", luggageState);
|
|
|
+ luggageMap.put("abnormalState", luggageState);
|
|
|
luggageList.add(luggageMap);//追加到行李数组中{行李牌号,行李状态}
|
|
|
}
|
|
|
}
|
|
@@ -172,6 +257,10 @@ public class DataFormat {
|
|
|
signDataMap.put(transMaps.get(rowType + "3"), colValue);//写入当前行MAP{"对应数据库字段名",值(不覆盖)}
|
|
|
}
|
|
|
}
|
|
|
+ if (colNum == 1) {
|
|
|
+ String temp = colValue.substring(2);
|
|
|
+ signDataMap.put(transMaps.get(rowType + "1"), colValue.substring(0, 2) + ((MapTools.isNumber(temp.substring(temp.length() - 1)) ? String.format("%4s", temp) : String.format("%5s", temp)).replace(" ", "0")));//写入当前行MAP{"对应数据库字段名",值(不覆盖)}
|
|
|
+ }
|
|
|
}
|
|
|
if ((rowType + "" + colNum).equals(".J/5") || (rowType + "" + colNum).equals(".D/4")) {
|
|
|
colValue = TypeBDateChange(null, colValue);
|
|
@@ -273,10 +362,10 @@ public class DataFormat {
|
|
|
returnDataList.add(specialHandler(tempDataMap, dataObjectId)); //只有容器没有行李:整箱操作
|
|
|
} else {
|
|
|
for (Map<String, Object> tempLuggageMap : luggageList) {//循环行李数组
|
|
|
- if (containerNum == 0 && containerList.size() > 1 && tempLuggageMap.get("luggageState") == null) {//只添加.B行李
|
|
|
+ if (containerNum == 0 && containerList.size() > 1 && tempLuggageMap.get("abnormalState") == null) {//只添加.B行李
|
|
|
continue;
|
|
|
}
|
|
|
- if (containerNum != 0 && containerList.size() > 1 && tempLuggageMap.get("luggageState") != null) {//只添加.N行李
|
|
|
+ if (containerNum != 0 && containerList.size() > 1 && tempLuggageMap.get("abnormalState") != null) {//只添加.N行李
|
|
|
continue;
|
|
|
}
|
|
|
HashMap<String, Object> objectObjectHashMap = new HashMap<>();
|
|
@@ -312,9 +401,11 @@ public class DataFormat {
|
|
|
* //读取时间:如果有J则J否则如果有D则D否则接收时间
|
|
|
* //当前结果:如果有dataState则dataState否则有B则B否则有X则X
|
|
|
*
|
|
|
- * @param inMap
|
|
|
* @return
|
|
|
*/
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public static Map<String, Object> specialHandler(HashMap<String, Object> inMap, String dataObjectId) {
|
|
|
String outAirport = inMap.containsKey("flightNo") ? "sourceAirport" : (inMap.containsKey("inairport") ? "inairport" : null);
|
|
|
if (MapTools.isNotBlank(outAirport)) {
|
|
@@ -327,22 +418,14 @@ public class DataFormat {
|
|
|
|
|
|
String carrierFlights = inMap.containsKey("flightNo") ? "flightNo" : (inMap.containsKey("inflightNo") ? "inflightNo" : null);
|
|
|
if (MapTools.isNotBlank(carrierFlights)) {
|
|
|
- Object tempCarrierFlights= inMap.get(carrierFlights);
|
|
|
- if (Objects.nonNull(tempCarrierFlights)){
|
|
|
- carrierFlights = tempCarrierFlights.toString();
|
|
|
- if (carrierFlights.substring(2).replaceAll("\\D+","").length()<4){
|
|
|
- carrierFlights = carrierFlights.substring(0,2) + "0"+ carrierFlights.substring(2);
|
|
|
- }
|
|
|
- inMap.put("carrierFlights", carrierFlights);
|
|
|
- }
|
|
|
-// inMap.put("carrierFlights", );
|
|
|
+ inMap.put("carrierFlights", inMap.get(carrierFlights));
|
|
|
}
|
|
|
String carrierFlightsDate = inMap.containsKey("flightDate") ? "flightDate" : (inMap.containsKey("inflightDate") ? "inflightDate" : null);
|
|
|
if (MapTools.isNotBlank(carrierFlightsDate)) {
|
|
|
inMap.put("carrierFlightsDate", inMap.get(carrierFlightsDate));
|
|
|
}
|
|
|
|
|
|
- String readAddess = inMap.containsKey("location_code") ? "location_code" : (inMap.containsKey("checkInLocation") ? "checkInLocation" : inMap.containsKey("operationArea") ? "operationArea" : (inMap.containsKey("location_describe")?"location_describe":null));
|
|
|
+ String readAddess = inMap.containsKey("location_code") ? "location_code" : (inMap.containsKey("checkInLocation") ? "checkInLocation" : inMap.containsKey("operationArea") ? "operationArea" : (inMap.containsKey("location_describe") ? "location_describe" : null));
|
|
|
if (MapTools.isNotBlank(readAddess)) {
|
|
|
inMap.put("readAddess", inMap.get(readAddess));
|
|
|
}
|