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
78b500fc
Commit
78b500fc
authored
Apr 12, 2023
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20230411
parent
c53e9a4f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
17 deletions
+11
-17
apps/view_atlas/view.py
+9
-15
apps/view_map/view.py
+2
-2
No files found.
apps/view_atlas/view.py
View file @
78b500fc
...
@@ -280,21 +280,21 @@ def find_up_thr1(chain_id, industry_type, industry_id, flag):
...
@@ -280,21 +280,21 @@ def find_up_thr1(chain_id, industry_type, industry_id, flag):
res_one
=
[{
"chain_name"
:
chain_one_obj
.
industry_name
,
res_one
=
[{
"chain_name"
:
chain_one_obj
.
industry_name
,
"chain_name_id"
:
chain_one_obj
.
id
"chain_name_id"
:
chain_one_obj
.
id
}
for
chain_one_obj
in
chain_one_obj_list
]
}
for
chain_one_obj
in
chain_one_obj_list
]
for
pname_one
in
res_one
:
# 一级节点
for
pname_one
in
res_one
:
# 一级节点
one_id_li
=
[]
one_id_li
=
[]
chain_name1
=
pname_one
[
"chain_name"
]
chain_name1
=
pname_one
[
"chain_name"
]
total_count
=
0
if
chain_name1
==
'数字技术应用'
:
print
()
# 一级的企业数量
# 一级的企业数量
id_list
,
company_count
=
get_count
(
chain_id
,
industry_id
,
chain_name1
,
flag
)
id_list
,
company_count
=
get_count
(
chain_id
,
industry_id
,
chain_name1
,
flag
)
one_id_li
.
extend
(
id_list
)
one_id_li
.
extend
(
id_list
)
# total_count += company_count
# 一级
# 一级
node_one
=
{
node_one
=
{
"node"
:
"{}"
.
format
(
chain_name1
),
"node"
:
"{}"
.
format
(
chain_name1
),
"level"
:
2
,
"level"
:
2
,
"company_count"
:
0
,
"company_count"
:
0
,
# "enterprise_count": total_count,
"enterprise_count"
:
company_count
,
"enterprise_count"
:
company_count
,
"subNodeList"
:
[]
"subNodeList"
:
[]
}
}
...
@@ -308,11 +308,8 @@ def find_up_thr1(chain_id, industry_type, industry_id, flag):
...
@@ -308,11 +308,8 @@ def find_up_thr1(chain_id, industry_type, industry_id, flag):
two_id_li
=
[]
two_id_li
=
[]
chain_name2
=
pname_two
[
"chain_name"
]
chain_name2
=
pname_two
[
"chain_name"
]
id_list
,
company_count
=
get_count
(
chain_id
,
industry_id
,
chain_name2
,
flag
)
id_list
,
company_count
=
get_count
(
chain_id
,
industry_id
,
chain_name2
,
flag
)
two_id_li
.
extend
(
id_list
)
one_id_li
.
extend
(
two_id_li
)
one_id_li
.
extend
(
two_id_li
)
# total_count += company_count
# 二级
# 二级
node_two
=
{
node_two
=
{
"node"
:
"{}"
.
format
(
chain_name2
),
"node"
:
"{}"
.
format
(
chain_name2
),
...
@@ -333,20 +330,18 @@ def find_up_thr1(chain_id, industry_type, industry_id, flag):
...
@@ -333,20 +330,18 @@ def find_up_thr1(chain_id, industry_type, industry_id, flag):
three_id_li
.
extend
(
id_list
)
three_id_li
.
extend
(
id_list
)
two_id_li
.
extend
(
three_id_li
)
two_id_li
.
extend
(
three_id_li
)
one_id_li
.
extend
(
two_id_li
)
one_id_li
.
extend
(
two_id_li
)
# total_count += company_count
# 三级
# 三级
node_thr
=
{
node_thr
=
{
"node"
:
"{}"
.
format
(
chain_name3
),
"node"
:
"{}"
.
format
(
chain_name3
),
"level"
:
4
,
"level"
:
4
,
"company_count"
:
len
(
set
(
three_id_li
)
),
"company_count"
:
len
(
three_id_li
),
"enterprise_count"
:
company_count
,
"enterprise_count"
:
company_count
,
"subNodeList"
:
[]
"subNodeList"
:
[]
}
}
node_two
[
"subNodeList"
]
.
append
(
node_thr
)
node_two
[
"subNodeList"
]
.
append
(
node_thr
)
node_two
.
update
({
"company_count"
:
len
(
set
(
two_id_li
))})
node_two
.
update
({
"company_count"
:
len
(
set
(
two_id_li
))})
node_one
[
"subNodeList"
]
.
append
(
node_two
)
node_one
[
"subNodeList"
]
.
append
(
node_two
)
# node_one.update({"company_count": len(set(one_id_li)), "enterprise_count": total_count})
node_one
.
update
({
"company_count"
:
len
(
set
(
one_id_li
))})
node_one
.
update
({
"company_count"
:
len
(
set
(
one_id_li
))})
data
[
"subNodeList"
]
.
append
(
node_one
)
data
[
"subNodeList"
]
.
append
(
node_one
)
return
data
return
data
...
@@ -1123,7 +1118,7 @@ def get_product_li(product, inid):
...
@@ -1123,7 +1118,7 @@ def get_product_li(product, inid):
}
for
chain_one_obj
in
chain_one_obj_list
]
}
for
chain_one_obj
in
chain_one_obj_list
]
for
res_one
in
res_one_li
:
for
res_one
in
res_one_li
:
chain_two_obj_list
=
IndustryChain
.
query
.
filter_by
(
relate_id
=
res_one
[
"chain_name_id"
])
.
all
()
chain_two_obj_list
=
IndustryChain
.
query
.
filter_by
(
relate_id
=
res_one
[
"chain_name_id"
]
,
chain_id
=
inid
)
.
all
()
res_two
=
[{
"chain_name"
:
chain_one_obj
.
industry_name
,
res_two
=
[{
"chain_name"
:
chain_one_obj
.
industry_name
,
"chain_name_id"
:
chain_one_obj
.
id
"chain_name_id"
:
chain_one_obj
.
id
}
for
chain_one_obj
in
chain_two_obj_list
]
}
for
chain_one_obj
in
chain_two_obj_list
]
...
@@ -1131,7 +1126,7 @@ def get_product_li(product, inid):
...
@@ -1131,7 +1126,7 @@ def get_product_li(product, inid):
res_one_li
.
extend
(
res_two
)
res_one_li
.
extend
(
res_two
)
for
res_two
in
res_two_li
:
for
res_two
in
res_two_li
:
chain_three_obj_list
=
IndustryChain
.
query
.
filter_by
(
relate_id
=
res_two
[
"chain_name_id"
])
.
all
()
chain_three_obj_list
=
IndustryChain
.
query
.
filter_by
(
relate_id
=
res_two
[
"chain_name_id"
]
,
chain_id
=
inid
)
.
all
()
res_three
=
[{
"chain_name"
:
chain_one_obj
.
industry_name
,
res_three
=
[{
"chain_name"
:
chain_one_obj
.
industry_name
,
"chain_name_id"
:
chain_one_obj
.
id
"chain_name_id"
:
chain_one_obj
.
id
}
for
chain_one_obj
in
chain_three_obj_list
]
}
for
chain_one_obj
in
chain_three_obj_list
]
...
@@ -1139,7 +1134,7 @@ def get_product_li(product, inid):
...
@@ -1139,7 +1134,7 @@ def get_product_li(product, inid):
res_one_li
.
extend
(
res_three
)
res_one_li
.
extend
(
res_three
)
print
(
res_one_li
)
print
(
res_one_li
)
for
res_three
in
res_three_li
:
for
res_three
in
res_three_li
:
chain_four_obj_list
=
IndustryChain
.
query
.
filter_by
(
relate_id
=
res_three
[
"chain_name_id"
])
.
all
()
chain_four_obj_list
=
IndustryChain
.
query
.
filter_by
(
relate_id
=
res_three
[
"chain_name_id"
]
,
chain_id
=
inid
)
.
all
()
res_four
=
[{
"chain_name"
:
chain_one_obj
.
industry_name
,
res_four
=
[{
"chain_name"
:
chain_one_obj
.
industry_name
,
"chain_name_id"
:
chain_one_obj
.
id
"chain_name_id"
:
chain_one_obj
.
id
}
for
chain_one_obj
in
chain_four_obj_list
]
}
for
chain_one_obj
in
chain_four_obj_list
]
...
@@ -1198,6 +1193,7 @@ def industry_enterprise():
...
@@ -1198,6 +1193,7 @@ def industry_enterprise():
for
product
in
product_li
:
for
product
in
product_li
:
company2
=
''
company2
=
''
company2
=
company
.
filter
(
company2
=
company
.
filter
(
Company
.
c_type
==
inid
,
Company
.
product_all
.
like
(
"
%
{}
%
"
.
format
(
product
))
Company
.
product_all
.
like
(
"
%
{}
%
"
.
format
(
product
))
)
.
all
()
)
.
all
()
company1
+=
company2
company1
+=
company2
...
@@ -1205,8 +1201,6 @@ def industry_enterprise():
...
@@ -1205,8 +1201,6 @@ def industry_enterprise():
size
=
len
(
company1
)
size
=
len
(
company1
)
company1
=
sorted
(
company1
,
key
=
lambda
x
:
x
.
hots
,
reverse
=
True
)
# 排序
company1
=
sorted
(
company1
,
key
=
lambda
x
:
x
.
hots
,
reverse
=
True
)
# 排序
companys
=
company1
[(
page
-
1
)
*
perpage
:
page
*
perpage
]
# 分页
companys
=
company1
[(
page
-
1
)
*
perpage
:
page
*
perpage
]
# 分页
# companys = company1.order_by(Company.hots.desc()).paginate(page, perpage).items # 企业热度倒序
else
:
else
:
size
=
company
.
count
()
size
=
company
.
count
()
companys
=
company
.
order_by
(
Company
.
hots
.
desc
())
.
paginate
(
page
,
perpage
)
.
items
# 企业热度倒序
companys
=
company
.
order_by
(
Company
.
hots
.
desc
())
.
paginate
(
page
,
perpage
)
.
items
# 企业热度倒序
...
...
apps/view_map/view.py
View file @
78b500fc
...
@@ -121,7 +121,7 @@ def attract_map():
...
@@ -121,7 +121,7 @@ def attract_map():
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
df
)
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
df
)
if
province
and
city
and
district
:
# 区数据
if
province
and
city
and
district
:
# 区数据
if
product
:
if
product
:
num
=
len
([
company
for
company
in
company1
if
company
.
province
==
province
and
company
.
city
==
city
and
company
.
district
==
dis
])
num
=
len
([
company
for
company
in
company1
if
company
.
province
==
province
and
company
.
city
==
city
and
company
.
district
==
dis
trict
])
else
:
else
:
num
=
enterprise
.
filter_by
(
province
=
province
,
city
=
city
,
district
=
district
)
.
count
()
num
=
enterprise
.
filter_by
(
province
=
province
,
city
=
city
,
district
=
district
)
.
count
()
district_data
=
Enterprise
.
query
.
filter_by
(
province
=
province
,
city
=
city
,
district
=
district
)
.
first
()
district_data
=
Enterprise
.
query
.
filter_by
(
province
=
province
,
city
=
city
,
district
=
district
)
.
first
()
...
@@ -415,7 +415,7 @@ def search_enterprise():
...
@@ -415,7 +415,7 @@ def search_enterprise():
def
get_enterprise_num
(
product
,
inid
):
def
get_enterprise_num
(
product
,
inid
):
indu_obj_li
=
get_product_li
(
product
)
indu_obj_li
=
get_product_li
(
product
,
inid
)
# total_enterprise_num = 0
# total_enterprise_num = 0
company
=
[]
company
=
[]
for
indu_name
in
indu_obj_li
:
for
indu_name
in
indu_obj_li
:
...
...
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