Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mancheng
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mancheng
Commits
d270132f
Commit
d270132f
authored
Feb 25, 2022
by
赵宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20220225
parent
cfceef30
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
apps/utils/neo4j_conn.py
+4
-3
apps/view_atlas/view_es_con.py
+3
-3
No files found.
apps/utils/neo4j_conn.py
View file @
d270132f
...
@@ -3,9 +3,10 @@ from py2neo import Graph
...
@@ -3,9 +3,10 @@ from py2neo import Graph
def
conn_neo4j
():
def
conn_neo4j
():
# graph = Graph("http://localhost:7474", username="neo4j", password="123456") # 本地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: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,测试是借用
graph1
=
Graph
(
"http://39.100.39.50:7475"
,
username
=
"neo4j"
,
return
graph
password
=
"century-english-almanac-havana-golf-9040"
)
# 太原的neo4j,测试是借用
return
graph
,
graph1
def
neo4j_dict
():
def
neo4j_dict
():
...
...
apps/view_atlas/view_es_con.py
View file @
d270132f
...
@@ -7,7 +7,7 @@ from apps.utils.response_code import RET
...
@@ -7,7 +7,7 @@ from apps.utils.response_code import RET
from
apps.utils.neo4j_conn
import
conn_neo4j
from
apps.utils.neo4j_conn
import
conn_neo4j
from
..models
import
Enterprise
from
..models
import
Enterprise
graph
=
conn_neo4j
()
graph
,
graph1
=
conn_neo4j
()
def
deleteDuplicate
(
li
):
def
deleteDuplicate
(
li
):
...
@@ -133,7 +133,7 @@ def findCenterProducts(product_name):
...
@@ -133,7 +133,7 @@ def findCenterProducts(product_name):
else
:
else
:
sql
=
"match (n)-[r]->(m) WHERE m.name='{}' return n.name,r.type"
.
format
(
product_name
)
sql
=
"match (n)-[r]->(m) WHERE m.name='{}' return n.name,r.type"
.
format
(
product_name
)
# print(sql)
# print(sql)
res
=
graph
.
run
(
sql
)
.
data
()
res
=
graph
1
.
run
(
sql
)
.
data
()
final_result
=
[]
# 最终产品集
final_result
=
[]
# 最终产品集
for
i
in
res
:
for
i
in
res
:
if
check
(
i
[
"n.name"
]):
# 判断是否有上下游关系(添加到最终产品集)
if
check
(
i
[
"n.name"
]):
# 判断是否有上下游关系(添加到最终产品集)
...
@@ -240,7 +240,7 @@ def findUDP(product_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 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
(
"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
)
product_name
,
product_name
,
product_name
,
product_name
)
res_product
=
graph
.
run
(
sql_all
)
.
data
()
res_product
=
graph
1
.
run
(
sql_all
)
.
data
()
res_product
=
trans_formet
(
product_name
,
res_product
)
res_product
=
trans_formet
(
product_name
,
res_product
)
products
=
list
()
products
=
list
()
for
i
in
res_product
:
for
i
in
res_product
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment