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
b6cfee50
Commit
b6cfee50
authored
Mar 28, 2023
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20230328
parent
4c60aeda
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
4 deletions
+54
-4
apps/view_atlas/view.py
+54
-4
No files found.
apps/view_atlas/view.py
View file @
b6cfee50
...
@@ -1108,6 +1108,42 @@ def search_enterprise():
...
@@ -1108,6 +1108,42 @@ def search_enterprise():
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
'查询出错!'
)
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
'查询出错!'
)
def
get_company_li
(
product
):
res_two_li
=
[]
res_three_li
=
[]
product_id
=
IndustryChain
.
query
.
filter_by
(
industry_name
=
product
)
.
first
()
.
id
product_li
=
[{
"chain_name"
:
product
,
"chain_name_id"
:
product_id
}]
chain_one_obj_list
=
IndustryChain
.
query
.
filter_by
(
relate_id
=
product_id
)
.
all
()
res_one_li
=
[{
"chain_name"
:
chain_one_obj
.
industry_name
,
"chain_name_id"
:
chain_one_obj
.
id
}
for
chain_one_obj
in
chain_one_obj_list
]
for
res_one
in
res_one_li
:
chain_two_obj_list
=
IndustryChain
.
query
.
filter_by
(
relate_id
=
res_one
[
"chain_name_id"
])
.
all
()
res_two
=
[{
"chain_name"
:
chain_one_obj
.
industry_name
,
"chain_name_id"
:
chain_one_obj
.
id
}
for
chain_one_obj
in
chain_two_obj_list
]
res_two_li
.
extend
(
res_two
)
res_one_li
.
extend
(
res_two
)
for
res_two
in
res_two_li
:
chain_three_obj_list
=
IndustryChain
.
query
.
filter_by
(
relate_id
=
res_two
[
"chain_name_id"
])
.
all
()
res_three
=
[{
"chain_name"
:
chain_one_obj
.
industry_name
,
"chain_name_id"
:
chain_one_obj
.
id
}
for
chain_one_obj
in
chain_three_obj_list
]
res_three_li
.
extend
(
res_three
)
res_one_li
.
extend
(
res_three
)
print
(
res_one_li
)
for
res_three
in
res_three_li
:
chain_four_obj_list
=
IndustryChain
.
query
.
filter_by
(
relate_id
=
res_three
[
"chain_name_id"
])
.
all
()
res_four
=
[{
"chain_name"
:
chain_one_obj
.
industry_name
,
"chain_name_id"
:
chain_one_obj
.
id
}
for
chain_one_obj
in
chain_four_obj_list
]
res_one_li
.
extend
(
res_four
)
res_one_li
.
extend
(
product_li
)
return
[
res_one
[
"chain_name"
]
for
res_one
in
res_one_li
]
# 点击产业联动显示企业
# 点击产业联动显示企业
@api_atlas.route
(
'/industry/enterprise'
,
methods
=
[
'POST'
])
@api_atlas.route
(
'/industry/enterprise'
,
methods
=
[
'POST'
])
# @login_required
# @login_required
...
@@ -1135,12 +1171,8 @@ def industry_enterprise():
...
@@ -1135,12 +1171,8 @@ def industry_enterprise():
Company
.
company_name
.
like
(
'
%
{}
%
'
.
format
(
company_name
))
if
company_name
else
text
(
''
),
Company
.
company_name
.
like
(
'
%
{}
%
'
.
format
(
company_name
))
if
company_name
else
text
(
''
),
Company
.
status
==
status
if
status
else
text
(
''
)
Company
.
status
==
status
if
status
else
text
(
''
)
)
)
# if industry_level == 1:
company
=
company
.
filter
(
Company
.
c_type
==
inid
)
company
=
company
.
filter
(
Company
.
c_type
==
inid
)
# else:
if
product
:
company
=
company
.
filter
(
Company
.
product_all
.
like
(
"
%
{}
%
"
.
format
(
product
)))
company
=
company
.
filter
(
company
=
company
.
filter
(
Company
.
high_new
==
'1'
if
aptitude
==
'高新技术企业'
else
text
(
''
),
Company
.
high_new
==
'1'
if
aptitude
==
'高新技术企业'
else
text
(
''
),
Company
.
tbe
==
'1'
if
aptitude
==
'科技型中小企业'
else
text
(
''
),
Company
.
tbe
==
'1'
if
aptitude
==
'科技型中小企业'
else
text
(
''
),
...
@@ -1154,6 +1186,24 @@ def industry_enterprise():
...
@@ -1154,6 +1186,24 @@ def industry_enterprise():
Company
.
serve
==
'1'
if
aptitude
==
'限额以上服务业'
else
text
(
''
),
Company
.
serve
==
'1'
if
aptitude
==
'限额以上服务业'
else
text
(
''
),
Company
.
chain_master
==
'1'
if
aptitude
==
'链主企业'
else
text
(
''
),
Company
.
chain_master
==
'1'
if
aptitude
==
'链主企业'
else
text
(
''
),
)
)
if
product
:
# 点击上级环节,展示本级所有企业
product_li
=
get_company_li
(
product
)
company1
=
[]
for
product
in
product_li
:
company2
=
''
company2
=
company
.
filter
(
Company
.
product_all
.
like
(
"
%
{}
%
"
.
format
(
product
))
)
.
all
()
company1
+=
company2
size
=
len
(
set
(
company1
))
company1
=
sorted
(
company1
,
key
=
lambda
x
:
x
.
hots
,
reverse
=
True
)
companys
=
company1
[(
page
-
1
)
*
perpage
:
page
*
perpage
]
# companys = company1.order_by(Company.hots.desc()).paginate(page, perpage).items # 企业热度倒序
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
# 企业热度倒序
...
...
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