|
@@ -46,9 +46,20 @@ public class PersonMergeV2Impl implements RelationService {
|
|
|
long start = System.currentTimeMillis();
|
|
|
Session session = driver.session();
|
|
|
//1.查询关联人员
|
|
|
+// final String query_cql = "\nWITH {batch_list} AS batch_list \n" +
|
|
|
+// "UNWIND batch_list AS row \n" +
|
|
|
+// "MATCH (p:" + CompanyEnum.Lable.PERSON.code + "{person_id: row.person_id})-[*0..4]-(q:" + CompanyEnum.Lable.PERSON.code + "{name:row.name})\n" +
|
|
|
+// "WHERE ID(p) <> ID(q)\n" +
|
|
|
+// "WITH p.person_id as person_id, p as first_node, apoc.coll.sort(collect(distinct ID(p)) + collect(distinct ID(q))) as all_ids\n" +
|
|
|
+// "UNWIND all_ids as all_id\n" +
|
|
|
+// "MATCH(m:" + CompanyEnum.Lable.PERSON.code + ")\n" +
|
|
|
+// "WHERE ID(m) = all_id\n" +
|
|
|
+// "WITH person_id, first_node, m as other_node\n" +
|
|
|
+// "RETURN first_node.person_id as new_human_pid, first_node.name as new_human_name, other_node.person_id as old_human_pid, other_node.name as old_human_name" + "\n";
|
|
|
+
|
|
|
final String query_cql = "\nWITH {batch_list} AS batch_list \n" +
|
|
|
"UNWIND batch_list AS row \n" +
|
|
|
- "MATCH (p:" + CompanyEnum.Lable.PERSON.code + "{person_id: row.person_id})-[*0..3]-(q:" + CompanyEnum.Lable.PERSON.code + "{name:row.name})\n" +
|
|
|
+ "MATCH (p:" + CompanyEnum.Lable.PERSON.code + "{person_id: row.person_id})-[r]-(c:"+CompanyEnum.Lable.COMPANY.code+"{company_id:row.company_id})-[*0..3]-(q:" + CompanyEnum.Lable.PERSON.code + "{name:row.name})\n" +
|
|
|
"WHERE ID(p) <> ID(q)\n" +
|
|
|
"WITH p.person_id as person_id, p as first_node, apoc.coll.sort(collect(distinct ID(p)) + collect(distinct ID(q))) as all_ids\n" +
|
|
|
"UNWIND all_ids as all_id\n" +
|
|
@@ -57,6 +68,7 @@ public class PersonMergeV2Impl implements RelationService {
|
|
|
"WITH person_id, first_node, m as other_node\n" +
|
|
|
"RETURN first_node.person_id as new_human_pid, first_node.name as new_human_name, other_node.person_id as old_human_pid, other_node.name as old_human_name" + "\n";
|
|
|
|
|
|
+
|
|
|
log.info("query size: {}, cql:{}", batch_list.size(), query_cql);
|
|
|
|
|
|
List<Map<String, String>> mergeData = trans(esQueryService.queryByDsl(getMergePerson(session, query_cql, new HashMap<String, Object>() {{
|