|
@@ -8,8 +8,10 @@ import com.lantone.qc.pub.util.StringUtil;
|
|
|
import com.lantone.qc.trans.changx.util.CxXmlUtil;
|
|
|
import com.lantone.qc.trans.taizhou.util.TzXmlUtil;
|
|
|
|
|
|
+import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Set;
|
|
|
|
|
|
/**
|
|
|
* @Description:
|
|
@@ -23,6 +25,7 @@ public class OrdinaryAssistant {
|
|
|
Map<String, String> sourceMap_ = MapUtil.copyMap((Map) sourceMap);
|
|
|
String[] arry = null;
|
|
|
String sourceKey = null, targetKey;
|
|
|
+ Set<String> removeKey = new HashSet<>();
|
|
|
for (String keyContrast : keyContrasts) {
|
|
|
arry = keyContrast.split("=");
|
|
|
sourceKey = arry[0];
|
|
@@ -32,9 +35,16 @@ public class OrdinaryAssistant {
|
|
|
targetKey = arry[1];
|
|
|
}
|
|
|
retMap.put(targetKey, sourceMap_.get(sourceKey));
|
|
|
- sourceMap_.remove(sourceKey);
|
|
|
+ removeKey.add(sourceKey);
|
|
|
+// sourceMap_.remove(sourceKey); // 如果直接remove,多个标准key对应xml中同一个key就会出问题
|
|
|
+ }
|
|
|
+ // retMap.putAll(sourceMap_); //如果key相同会覆盖之前的值,存在bug
|
|
|
+ Set<String> keySet = retMap.keySet();
|
|
|
+ for (String key : sourceMap_.keySet()) {
|
|
|
+ if (!keySet.contains(key) && !removeKey.contains(key)) { // 如果之前已放过key就不用放了
|
|
|
+ retMap.put(key, sourceMap_.get(key));
|
|
|
+ }
|
|
|
}
|
|
|
- retMap.putAll(sourceMap_);
|
|
|
return retMap;
|
|
|
}
|
|
|
|