private List<String> getPackageCode(String dataUcp) throws IOException {
List<String> packageCode = new ArrayList<>();
HashMap<String,Object> hashMap = objectMapper.readValue(dataUcp, HashMap.class);
//遍歷map 2 3 那層
for (Map.Entry<String, Object> stringObjectEntry : hashMap.entrySet()) {
//獲取 2 3 那層内部
HashMap<String,Object> value = (HashMap<String,Object>)stringObjectEntry.getValue();
//獲取 modelRanges層
HashMap<String,Object> rangeMaps = (HashMap<String, Object>) value.get("modelRanges");
//遍歷 modelRanges層 獲取 地盤代號内部數據
for (Map.Entry<String, Object> objectEntry : rangeMaps.entrySet()) {
HashMap<String, Object> rangeValueMaps = (HashMap<String, Object>) objectEntry.getValue();
//獲取models 層數據
HashMap<String, Object> modelsMaps = (HashMap<String, Object>)rangeValueMaps.get("models");
for (Map.Entry<String, Object> modelsValue : modelsMaps.entrySet()) {
HashMap<String, Object> modelsValueMaps = (HashMap<String, Object>) modelsValue.getValue();
//獲取transmissionVariants數據
HashMap<String, Object> transmissionMaps = (HashMap<String, Object>) modelsValueMaps.get("transmissionVariants");
for (Map.Entry<String, Object> transmissionValue : transmissionMaps.entrySet()) {
HashMap<String, Object> value1 = (HashMap<String, Object>) transmissionValue.getValue();
HashMap<String, Object> additionalData = (HashMap<String, Object>) value1.get("additionalData");
for (Map.Entry<String, Object> additional : additionalData.entrySet()) {
HashMap<String, Object> value2 = (HashMap<String, Object>) additional.getValue();
HashMap<String, Object> lines = (HashMap<String, Object>) value2.get("lines");
for (Map.Entry<String, Object> line : lines.entrySet()) {
HashMap<String, Object> agModelMaps = (HashMap<String, Object>) line.getValue();
String modelCode = (String) agModelMaps.get("agModelCode");
packageCode.add(modelCode+"_"+line.getKey());
}
}
}
}
}
}
return packageCode;
}