|
@@ -200,13 +200,27 @@ public class CustomerApiController {
|
|
|
jsonObject = JSON.parseObject(result);
|
|
|
JSONObject hitsobject = (JSONObject) jsonObject.get("hits");
|
|
|
JSONArray array = JSON.parseArray(hitsobject.get("hits").toString());
|
|
|
- List relationship = new ArrayList<>();
|
|
|
+ Set<Map<String, String>> relationship = new HashSet<>();
|
|
|
for (int i = 0; i <array.size() ; i++) {
|
|
|
JSONObject json = (JSONObject)array.get(i);
|
|
|
- Map mp = new HashMap();
|
|
|
- mp.put("id",json.getString("_id"));
|
|
|
- mp.putAll(JSON.parseObject(json.getString("_source"),Map.class));
|
|
|
- relationship.add(mp);
|
|
|
+ JSONObject shipSource = JSON.parseObject(json.getString("_source"));
|
|
|
+ if (shipSource.containsKey("rstype")
|
|
|
+ && shipSource.containsKey("indid1")
|
|
|
+ && shipSource.containsKey("name1")
|
|
|
+ && shipSource.containsKey("role1")
|
|
|
+ && shipSource.containsKey("indid2")
|
|
|
+ && shipSource.containsKey("name2")
|
|
|
+ && shipSource.containsKey("role2")) {
|
|
|
+ Map<String, String> mp = new HashMap<>(8);
|
|
|
+ mp.put("rstype", shipSource.getString("rstype"));
|
|
|
+ mp.put("indid1", shipSource.getString("indid1"));
|
|
|
+ mp.put("name1", shipSource.getString("name1"));
|
|
|
+ mp.put("role1", shipSource.getString("role1"));
|
|
|
+ mp.put("indid2", shipSource.getString("indid2"));
|
|
|
+ mp.put("name2", shipSource.getString("name2"));
|
|
|
+ mp.put("role2", shipSource.getString("role2"));
|
|
|
+ relationship.add(mp);
|
|
|
+ }
|
|
|
}
|
|
|
map.put("relationship",relationship);
|
|
|
query =new HashMap();
|