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
ece47945
Commit
ece47945
authored
Nov 08, 2023
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
2b494819
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
14 deletions
+58
-14
apps/models.py
+0
-2
apps/view_radar/view.py
+58
-12
No files found.
apps/models.py
View file @
ece47945
...
...
@@ -59,7 +59,6 @@ class IndustryChain1(db.Model):
enterprise_num
=
db
.
Column
(
db
.
Integer
,
comment
=
'相关全企业表数量'
)
# 全国企业
class
Enterprise
(
db
.
Model
):
__tablename__
=
"enterprise"
...
...
@@ -271,7 +270,6 @@ class Enterprise1(db.Model):
__table_args__
=
({
'comment'
:
'全国企业表'
})
# 添加表注释
# 晋城企业表
class
Company
(
db
.
Model
):
__tablename__
=
"company"
...
...
apps/view_radar/view.py
View file @
ece47945
...
...
@@ -1226,10 +1226,37 @@ def radar_enums():
# ))
company
=
[]
indu_obj_li
=
get_product_li
(
product
,
inid
)
for
indu_name
in
indu_obj_li
:
# indu_obj_li = get_product_li(product, inid)
# for indu_name in indu_obj_li:
# # indu_name = indu_obj.industry_name
# # print("正在查询【{}】的相关企业......".format(indu_name))
# company1 = Enterprise.query.filter(
# Enterprise.c_type == inid,
# Enterprise.product_all.like("%{}%".format(indu_name))
# ).all()
# company += company1
# # print(company1)
# company2 = Enterprise.query.filter(
# Enterprise.c_type1 == inid,
# Enterprise.product_all1.like("%{}%".format(indu_name))
# ).all()
# company += company2
# # print(company2)
# company3 = Enterprise.query.filter(
# Enterprise.c_type2 == inid,
# Enterprise.product_all2.like("%{}%".format(indu_name))
# ).all()
# company += company3
# # print("产品【{}】已完成, 共有{}家相关企业。".format(indu_name, len(company1 + company2 + company3)))
#
# company = list(set(company))
# size = len(company)
# indu_obj_li = get_product_li(product, inid)
# for indu_name in indu_obj_li:
# indu_name = indu_obj.industry_name
# print("正在查询【{}】的相关企业......".format(indu_name))
indu_obj
=
Industry
.
query
.
get
(
inid
)
indu_name
=
indu_obj
.
name
company1
=
Enterprise
.
query
.
filter
(
Enterprise
.
c_type
==
inid
,
Enterprise
.
product_all
.
like
(
"
%
{}
%
"
.
format
(
indu_name
))
...
...
@@ -1247,7 +1274,6 @@ def radar_enums():
Enterprise
.
product_all2
.
like
(
"
%
{}
%
"
.
format
(
indu_name
))
)
.
all
()
company
+=
company3
# print("产品【{}】已完成, 共有{}家相关企业。".format(indu_name, len(company1 + company2 + company3)))
company
=
list
(
set
(
company
))
size
=
len
(
company
)
...
...
@@ -1298,15 +1324,15 @@ def radar_enums():
def
get_product_li
(
product
,
chain_id
):
res_two_li
=
[]
res_three_li
=
[]
product_id
=
IndustryChain
1
.
query
.
filter_by
(
industry_name
=
product
,
chain_id
=
chain_id
)
.
first
()
.
id
product_id
=
IndustryChain
.
query
.
filter_by
(
industry_name
=
product
,
chain_id
=
chain_id
)
.
first
()
.
id
product_li
=
[{
"chain_name"
:
product
,
"chain_name_id"
:
product_id
}]
chain_one_obj_list
=
IndustryChain
1
.
query
.
filter_by
(
relate_id
=
product_id
,
chain_id
=
chain_id
)
.
all
()
chain_one_obj_list
=
IndustryChain
.
query
.
filter_by
(
relate_id
=
product_id
,
chain_id
=
chain_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
1
.
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"
])
.
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
]
...
...
@@ -1314,7 +1340,7 @@ def get_product_li(product, chain_id):
res_one_li
.
extend
(
res_two
)
for
res_two
in
res_two_li
:
chain_three_obj_list
=
IndustryChain
1
.
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"
])
.
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
]
...
...
@@ -1322,7 +1348,7 @@ def get_product_li(product, chain_id):
res_one_li
.
extend
(
res_three
)
# print(res_one_li)
for
res_three
in
res_three_li
:
chain_four_obj_list
=
IndustryChain
1
.
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"
])
.
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
]
...
...
@@ -1485,10 +1511,30 @@ def newList1():
# Enterprise.product_all1.like("%{}%".format(product)),
# Enterprise.product_all2.like("%{}%".format(product))
# ))
indu_obj_li
=
get_product_li
(
product
,
inid
)
for
indu_name
in
indu_obj_li
:
# indu_name = indu_obj.industry_name
# print("正在查询【{}】的相关企业......".format(indu_name))
# indu_obj_li = get_product_li(product, inid)
# for indu_name in indu_obj_li:
# # indu_name = indu_obj.industry_name
# # print("正在查询【{}】的相关企业......".format(indu_name))
# company1 = Enterprise.query.filter(
# Enterprise.c_type == inid,
# Enterprise.product_all.like("%{}%".format(indu_name))
# ).all()
# company += company1
# # print(company1)
# company2 = Enterprise.query.filter(
# Enterprise.c_type1 == inid,
# Enterprise.product_all1.like("%{}%".format(indu_name))
# ).all()
# company += company2
# # print(company2)
# company3 = Enterprise.query.filter(
# Enterprise.c_type2 == inid,
# Enterprise.product_all2.like("%{}%".format(indu_name))
# ).all()
# company += company3
# company = set(company)
indu_name
=
Industry
.
query
.
get
(
inid
)
company1
=
Enterprise
.
query
.
filter
(
Enterprise
.
c_type
==
inid
,
Enterprise
.
product_all
.
like
(
"
%
{}
%
"
.
format
(
indu_name
))
...
...
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