Commit d270132f by 赵宇

fix20220225

parent cfceef30
......@@ -3,9 +3,10 @@ from py2neo import Graph
def conn_neo4j():
# graph = Graph("http://localhost:7474", username="neo4j", password="123456") # 本地neo4j
# graph = Graph("http://39.100.39.50:7476", username="neo4j", password="123456") # 50服务器上的neo4j时使用
graph = Graph("http://39.100.39.50:7475", username="neo4j", password="century-english-almanac-havana-golf-9040") # 太原的neo4j,测试是借用
return graph
graph = Graph("http://39.100.39.50:7476", username="neo4j", password="123456") # 50服务器上的neo4j时使用
graph1 = Graph("http://39.100.39.50:7475", username="neo4j",
password="century-english-almanac-havana-golf-9040") # 太原的neo4j,测试是借用
return graph, graph1
def neo4j_dict():
......
......@@ -7,7 +7,7 @@ from apps.utils.response_code import RET
from apps.utils.neo4j_conn import conn_neo4j
from ..models import Enterprise
graph = conn_neo4j()
graph, graph1 = conn_neo4j()
def deleteDuplicate(li):
......@@ -133,7 +133,7 @@ def findCenterProducts(product_name):
else:
sql = "match (n)-[r]->(m) WHERE m.name='{}' return n.name,r.type".format(product_name)
# print(sql)
res = graph.run(sql).data()
res = graph1.run(sql).data()
final_result = [] # 最终产品集
for i in res:
if check(i["n.name"]): # 判断是否有上下游关系(添加到最终产品集)
......@@ -240,7 +240,7 @@ def findUDP(product_name): # 对中间产品进行上下游产品查询
"match (n) -[r:`上游行业`]->(m) WHERE n.name='{}' return n.name as bname,r.type,m.name as sname UNION " \
"match (n) -[r:`下游行业`]->(m) WHERE m.name='{}' return n.name as bname,r.type,m.name as sname ".format(
product_name, product_name, product_name, product_name)
res_product = graph.run(sql_all).data()
res_product = graph1.run(sql_all).data()
res_product = trans_formet(product_name, res_product)
products = list()
for i in res_product:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment