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
6eb6e279
Commit
6eb6e279
authored
Nov 12, 2023
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
9627c9a6
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
158 additions
and
180 deletions
+158
-180
apps/utils/industry_enterprise_num.py
+17
-19
apps/view_atlas/view.py
+86
-86
apps/view_map/view.py
+3
-3
apps/view_radar/view.py
+52
-72
No files found.
apps/utils/industry_enterprise_num.py
View file @
6eb6e279
# # # -*- coding:utf-8 -*-
# # # -*- coding:utf-8 -*-
# import threading
# import threading
# from apps.models import IndustryChain
1
, Enterprise
# from apps.models import IndustryChain, Enterprise
# from manager import app
# from manager import app
# from apps import db
# from apps import db
#
#
#
#
# """
# """
# IndustryChain
1
或者Enterprise数据表更新后,
# IndustryChain或者Enterprise数据表更新后,
# 计算产业环节相关企业的数量并填充到IndustryChain
1
的enterprise_num字段中。
# 计算产业环节相关企业的数量并填充到IndustryChain的enterprise_num字段中。
# """
# """
#
#
#
#
# def handle():
# def handle():
# with app.app_context():
# with app.app_context():
# industry_obj_list = IndustryChain
1
.query.all()
# industry_obj_list = IndustryChain.query.all()
# print(industry_obj_list)
# print(industry_obj_list)
# # 读取industry_chain数据表的产业名称
# # 读取industry_chain数据表的产业名称
# for industry_obj in industry_obj_list:
# for industry_obj in industry_obj_list:
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
# continue
# continue
#
#
# else:
# else:
# indu_obj_li = IndustryChain
1.query.filter(IndustryChain1
.relate_id == indu_id).all()
# indu_obj_li = IndustryChain
.query.filter(IndustryChain
.relate_id == indu_id).all()
# for indu_obj in indu_obj_li:
# for indu_obj in indu_obj_li:
# indu_name = indu_obj.industry_name
# indu_name = indu_obj.industry_name
# print("正在查询【{}】的相关企业......".format(indu_name))
# print("正在查询【{}】的相关企业......".format(indu_name))
...
@@ -59,29 +59,29 @@
...
@@ -59,29 +59,29 @@
# # -*- coding:utf-8 -*-
# # -*- coding:utf-8 -*-
import
threading
import
threading
from
apps.models
import
IndustryChain
1
,
Enterprise
from
apps.models
import
IndustryChain
,
Enterprise
from
manager
import
app
from
manager
import
app
from
apps
import
db
from
apps
import
db
"""
"""
IndustryChain
1
或者Enterprise数据表更新后,
IndustryChain或者Enterprise数据表更新后,
计算产业环节相关企业去重后的数量并填充到IndustryChain
1
的enterprise_num字段中。
计算产业环节相关企业去重后的数量并填充到IndustryChain的enterprise_num字段中。
"""
"""
def
get_product_li
(
product
,
chain_id
):
def
get_product_li
(
product
,
chain_id
):
res_two_li
=
[]
res_two_li
=
[]
res_three_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
}]
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
,
res_one_li
=
[{
"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
res_one
in
res_one_li
:
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
,
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
]
...
@@ -89,7 +89,7 @@ def get_product_li(product, chain_id):
...
@@ -89,7 +89,7 @@ def get_product_li(product, chain_id):
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
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
,
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
]
...
@@ -97,7 +97,7 @@ def get_product_li(product, chain_id):
...
@@ -97,7 +97,7 @@ def get_product_li(product, chain_id):
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
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
,
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
]
...
@@ -108,19 +108,17 @@ def get_product_li(product, chain_id):
...
@@ -108,19 +108,17 @@ def get_product_li(product, chain_id):
def
handle
():
def
handle
():
with
app
.
app_context
():
with
app
.
app_context
():
industry_obj_list
=
IndustryChain
1
.
query
.
all
()
industry_obj_list
=
IndustryChain
.
query
.
all
()
# industry_obj_list = IndustryChain
1.query.filter(IndustryChain1
.id == 604).all()
# industry_obj_list = IndustryChain
.query.filter(IndustryChain
.id == 604).all()
# print(industry_obj_list)
# print(industry_obj_list)
# 读取industry_chain数据表的产业名称
# 读取industry_chain数据表的产业名称
for
industry_obj
in
industry_obj_list
:
for
industry_obj
in
industry_obj_list
:
industry_name
=
industry_obj
.
industry_name
industry_name
=
industry_obj
.
industry_name
# 读取全国企业表,模糊匹配product_all字段
# 读取全国企业表,模糊匹配product_all字段
if
industry_name
in
[
"钢铁"
,
"光机电"
,
"煤层气"
,
"装备制造"
,
"铸造"
,
if
industry_name
in
[
"生活用纸"
,
"文化旅游"
,
"轨道交通装备"
,
"新材料"
,
"生物医药健康"
,
"煤化工"
,
"新材料"
,
"绿色建材"
,
"医药"
,
"丝麻纺织服装"
,
"教育和体育"
,
"现代商贸物流"
,
"食品加工"
,
"电力电气"
]:
"现代服务业"
,
"数字经济"
,
"文化旅游"
]:
continue
continue
else
:
else
:
chain_id
=
industry_obj
.
chain_id
chain_id
=
industry_obj
.
chain_id
indu_obj_li
=
get_product_li
(
industry_name
,
chain_id
)
indu_obj_li
=
get_product_li
(
industry_name
,
chain_id
)
...
...
apps/view_atlas/view.py
View file @
6eb6e279
...
@@ -92,86 +92,86 @@ def get_cluster():
...
@@ -92,86 +92,86 @@ def get_cluster():
# 获取新表的产业集群名称
# 获取新表的产业集群名称
@api_atlas.route
(
'/IndustryCluster'
,
methods
=
[
'POST'
])
# @login_required
def
industry_cluster
():
'''
行业id->行业链标题-》上中下游-》查询数值
:return:
'''
req_dict
=
request
.
get_json
()
# inid = req_dict.get("inid") # 二级行业id(二级行业显示链图)
industry_name
=
req_dict
[
'industry_name'
]
# 二级行业id(二级行业显示链图)
# 校验参数完整性
if
not
all
([
industry_name
]):
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"参数不完整"
)
try
:
# name_query = "jc" + str(inid) + str(district)
# if redis_store.get(name_query) is not None:
# data = json.loads(redis_store.get(name_query))
# return jsonify(code=RET.OK, msg="获取成功", data=data)
# 行业使用名
# industryName = Industry.query.filter_by(oname=industry_name).first().oname
# ptp = neo4j_dict()
# if industryName in ptp:
# industryName = ptp[industryName]
result
=
{
"industryChain"
:
industry_name
,
"nodeList"
:
[
find_up_thr
(
industry_name
,
"上游行业"
),
find_up_thr
(
industry_name
,
"中游行业"
),
find_up_thr
(
industry_name
,
"下游行业"
)]
}
# redis缓存
# redis_store.set(name_query, json.dumps(result))
# redis_store.expire(name_query, 30 * 24 * 3600)
# print("redis")
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
"数据异常"
)
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
result
)
# @api_atlas.route('/IndustryCluster', methods=['POST'])
# @api_atlas.route('/IndustryCluster', methods=['POST'])
# # @login_required
# def industry_cluster():
# def industry_cluster():
# req_dic = request.get_json()
# '''
# industry_name = req_dic['industry_name']
# 行业id->行业链标题-》上中下游-》查询数值
# flag = req_dic['flag']
# :return:
# '''
# req_dict = request.get_json()
# # inid = req_dict.get("inid") # 二级行业id(二级行业显示链图)
# industry_name = req_dict['industry_name'] # 二级行业id(二级行业显示链图)
#
# # 校验参数完整性
# if not all([industry_name]):
# return jsonify(code=RET.PARAMERR, msg="参数不完整")
#
#
# try:
# try:
# industry_obj = IndustryChain.query.filter_by(industry_name=industry_name).first()
# # name_query = "jc" + str(inid) + str(district)
# industry_id = industry_obj.id
# # if redis_store.get(name_query) is not None:
# chain_id = industry_obj.chain_id
# # data = json.loads(redis_store.get(name_query))
# # return jsonify(code=RET.OK, msg="获取成功", data=data)
#
#
#
if flag == 2:
#
# 行业使用名
#
# 查询redis
#
# industryName = Industry.query.filter_by(oname=industry_name).first().oname
#
result = redis_store.get('chain_id_{}'.format(industry_id)
)
#
# ptp = neo4j_dict(
)
#
if result
:
#
# if industryName in ptp
:
#
return jsonify(code=RET.OK, msg="获取成功", data=json.loads(result))
#
# industryName = ptp[industryName]
# result = {
# result = {
# "industryChain": industry_name,
# "industryChain": industry_name,
# "nodeList": [find_up_thr
1(chain_id, 1, industry_id, flag
),
# "nodeList": [find_up_thr
(industry_name, "上游行业"
),
# find_up_thr
1(chain_id, 2, industry_id, flag
),
# find_up_thr
(industry_name, "中游行业"
),
# find_up_thr
1(chain_id, 3, industry_id, flag
)]
# find_up_thr
(industry_name, "下游行业"
)]
# }
# }
# # redis缓存
# # redis_store.set(name_query, json.dumps(result))
# # redis_store.expire(name_query, 30 * 24 * 3600)
# # print("redis")
# except Exception as e:
# except Exception as e:
# current_app.logger.error(e)
# current_app.logger.error(e)
# return jsonify(code=RET.DBERR, msg="数据异常")
# return jsonify(code=RET.DBERR, msg="数据异常")
# if flag == 2:
# try:
# redis_store.setex("chain_id_%s" % industry_id, constants.INDUSTRY_ENTERPRISE_REDIS_EXPIRES,
# json.dumps(result))
# # 保存发送给这个手机号的记录,防止用户在60s内再次出发发送短信的操作
# # redis_store.setex("send_sms_code_%s" % mobile, constants.SEND_SMS_CODE_INTERVAL, 1)
# except Exception as e:
# current_app.logger.error(e)
# return jsonify(code=RET.DBERR, msg="保存产业/企业数量信息异常")
#
# return jsonify(code=RET.OK, msg="获取成功", data=result)
# return jsonify(code=RET.OK, msg="获取成功", data=result)
@api_atlas.route
(
'/IndustryCluster'
,
methods
=
[
'POST'
])
def
industry_cluster
():
req_dic
=
request
.
get_json
()
industry_name
=
req_dic
[
'industry_name'
]
flag
=
req_dic
[
'flag'
]
try
:
industry_obj
=
IndustryChain
.
query
.
filter_by
(
industry_name
=
industry_name
)
.
first
()
industry_id
=
industry_obj
.
id
chain_id
=
industry_obj
.
chain_id
if
flag
==
2
:
# 查询redis
result
=
redis_store
.
get
(
'chain_id_{}'
.
format
(
industry_id
))
if
result
:
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
json
.
loads
(
result
))
result
=
{
"industryChain"
:
industry_name
,
"nodeList"
:
[
find_up_thr1
(
chain_id
,
1
,
industry_id
,
flag
),
find_up_thr1
(
chain_id
,
2
,
industry_id
,
flag
),
find_up_thr1
(
chain_id
,
3
,
industry_id
,
flag
)]
}
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
"数据异常"
)
if
flag
==
2
:
try
:
redis_store
.
setex
(
"chain_id_
%
s"
%
industry_id
,
constants
.
INDUSTRY_ENTERPRISE_REDIS_EXPIRES
,
json
.
dumps
(
result
))
# 保存发送给这个手机号的记录,防止用户在60s内再次出发发送短信的操作
# redis_store.setex("send_sms_code_%s" % mobile, constants.SEND_SMS_CODE_INTERVAL, 1)
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
"保存产业/企业数量信息异常"
)
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
result
)
def
get_count
(
chain_id
,
industry_id
,
chain_name
,
flag
):
def
get_count
(
chain_id
,
industry_id
,
chain_name
,
flag
):
company_count
=
''
company_count
=
''
id_list
=
[]
id_list
=
[]
...
@@ -1104,29 +1104,29 @@ def industry_enterprise():
...
@@ -1104,29 +1104,29 @@ def industry_enterprise():
Company
.
chain_master
==
'1'
if
aptitude
==
'链主企业'
else
text
(
''
),
Company
.
chain_master
==
'1'
if
aptitude
==
'链主企业'
else
text
(
''
),
)
)
# if product:
# # 点击上级环节,展示本级所有企业
# product_li = get_product_li(product, inid)
# company1 = []
# for product in product_li:
# company2 = company.filter(
# Company.c_type == inid,
# Company.product_all.like("%{}%".format(product))
# ).all()
# company1 += company2
# company1 = set(company1)
# size = len(company1)
# company1 = sorted(company1, key=lambda x: x.hots, reverse=True) # 排序
# companys = company1[(page - 1) * perpage:page * perpage] # 分页
# else:
# size = company.count()
# companys = company.order_by(Company.hots.desc()).paginate(page, perpage).items # 企业热度倒序
if
product
:
if
product
:
company
=
Company
.
query
.
filter
(
# 点击上级环节,展示本级所有企业
Company
.
product_all
.
like
(
'
%
{}
%
'
.
format
(
product
))
product_li
=
get_product_li
(
product
,
inid
)
)
company1
=
[]
for
product
in
product_li
:
company2
=
company
.
filter
(
Company
.
c_type
==
inid
,
Company
.
product_all
.
like
(
"
%
{}
%
"
.
format
(
product
))
)
.
all
()
company1
+=
company2
company1
=
set
(
company1
)
size
=
len
(
company1
)
company1
=
sorted
(
company1
,
key
=
lambda
x
:
x
.
hots
,
reverse
=
True
)
# 排序
companys
=
company1
[(
page
-
1
)
*
perpage
:
page
*
perpage
]
# 分页
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
# 企业热度倒序
# if product:
# company = Company.query.filter(
# Company.product_all.like('%{}%'.format(product))
# )
# size = company.count()
# companys = company.order_by(Company.hots.desc()).paginate(page, perpage).items # 企业热度倒序
df
=
[{
"id"
:
i
.
id
,
df
=
[{
"id"
:
i
.
id
,
"company_name"
:
i
.
company_name
,
"company_name"
:
i
.
company_name
,
...
...
apps/view_map/view.py
View file @
6eb6e279
...
@@ -419,10 +419,10 @@ def search_enterprise():
...
@@ -419,10 +419,10 @@ def search_enterprise():
def
get_enterprise_num
(
product
,
inid
):
def
get_enterprise_num
(
product
,
inid
):
#
indu_obj_li = get_product_li(product, inid)
indu_obj_li
=
get_product_li
(
product
,
inid
)
# total_enterprise_num = 0
# total_enterprise_num = 0
indu_obj_li
=
[]
#
indu_obj_li = []
indu_obj_li
.
append
(
product
)
#
indu_obj_li.append(product)
company
=
[]
company
=
[]
for
indu_name
in
indu_obj_li
:
for
indu_name
in
indu_obj_li
:
# indu_name = indu_obj.industry_name
# indu_name = indu_obj.industry_name
...
...
apps/view_radar/view.py
View file @
6eb6e279
...
@@ -1220,64 +1220,51 @@ def radar_enums():
...
@@ -1220,64 +1220,51 @@ def radar_enums():
company
=
[]
company
=
[]
if
product
:
if
product
:
# 有可能会变成模糊查询
indu_obj_li
=
get_product_li
(
product
,
inid
)
# enterprise = enterprise.filter(or_(
for
indu_name
in
indu_obj_li
:
# Enterprise.product_all.like("%{}%".format(product)),
# 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))
# 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
# indu_name = indu_obj.industry_name
# print("正在查询【{}】的相关企业......".format(indu_name))
# print("正在查询【{}】的相关企业......".format(indu_name))
# indu_obj = Industry.query.get(inid)
# indu_name = indu_obj.name
company1
=
Enterprise
.
query
.
filter
(
company1
=
Enterprise
.
query
.
filter
(
Enterprise
.
c_type
==
inid
,
Enterprise
.
c_type
==
inid
,
Enterprise
.
product_all
.
like
(
"
%
{}
%
"
.
format
(
product
))
Enterprise
.
product_all
.
like
(
"
%
{}
%
"
.
format
(
indu_name
))
)
.
all
()
)
.
all
()
company
+=
company1
company
+=
company1
# print(company1)
# print(company1)
company2
=
Enterprise
.
query
.
filter
(
company2
=
Enterprise
.
query
.
filter
(
Enterprise
.
c_type1
==
inid
,
Enterprise
.
c_type1
==
inid
,
Enterprise
.
product_all1
.
like
(
"
%
{}
%
"
.
format
(
product
))
Enterprise
.
product_all1
.
like
(
"
%
{}
%
"
.
format
(
indu_name
))
)
.
all
()
)
.
all
()
company
+=
company2
company
+=
company2
# print(company2)
# print(company2)
company3
=
Enterprise
.
query
.
filter
(
company3
=
Enterprise
.
query
.
filter
(
Enterprise
.
c_type2
==
inid
,
Enterprise
.
c_type2
==
inid
,
Enterprise
.
product_all2
.
like
(
"
%
{}
%
"
.
format
(
product
))
Enterprise
.
product_all2
.
like
(
"
%
{}
%
"
.
format
(
indu_name
))
)
.
all
()
)
.
all
()
company
+=
company3
company
+=
company3
# print("产品【{}】已完成, 共有{}家相关企业。".format(indu_name, len(company1 + company2 + company3)))
company
=
list
(
set
(
company
))
company
=
list
(
set
(
company
))
size
=
len
(
company
)
size
=
len
(
company
)
# company1 = Enterprise.query.filter(
# Enterprise.c_type == inid,
# Enterprise.product_all.like("%{}%".format(product))
# ).all()
# company += company1
# # print(company1)
# company2 = Enterprise.query.filter(
# Enterprise.c_type1 == inid,
# Enterprise.product_all1.like("%{}%".format(product))
# ).all()
# company += company2
# # print(company2)
# company3 = Enterprise.query.filter(
# Enterprise.c_type2 == inid,
# Enterprise.product_all2.like("%{}%".format(product))
# ).all()
# company += company3
#
# company = list(set(company))
# size = len(company)
nums_all
=
size
if
size
else
enterprise
.
count
()
# 企业总数
nums_all
=
size
if
size
else
enterprise
.
count
()
# 企业总数
...
@@ -1507,55 +1494,48 @@ def newList1():
...
@@ -1507,55 +1494,48 @@ def newList1():
enterprise
=
enterprise
.
filter_by
(
district
=
district
)
enterprise
=
enterprise
.
filter_by
(
district
=
district
)
company
=
[]
company
=
[]
if
product
:
if
product
:
# enterprise = enterprise.filter(or_(
indu_obj_li
=
get_product_li
(
product
,
inid
)
# Enterprise.product_all.like("%{}%".format(product)),
for
indu_name
in
indu_obj_li
:
# Enterprise.product_all1.like("%{}%".format(product)),
# indu_name = indu_obj.industry_name
# Enterprise.product_all2.like("%{}%".format(product))
# 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_obj = Industry.query.get(inid)
# indu_name = indu_obj.name
company1
=
Enterprise
.
query
.
filter
(
company1
=
Enterprise
.
query
.
filter
(
Enterprise
.
c_type
==
inid
,
Enterprise
.
c_type
==
inid
,
Enterprise
.
product_all
.
like
(
"
%
{}
%
"
.
format
(
product
))
Enterprise
.
product_all
.
like
(
"
%
{}
%
"
.
format
(
indu_name
))
)
.
all
()
)
.
all
()
company
+=
company1
company
+=
company1
# print(company1)
# print(company1)
company2
=
Enterprise
.
query
.
filter
(
company2
=
Enterprise
.
query
.
filter
(
Enterprise
.
c_type1
==
inid
,
Enterprise
.
c_type1
==
inid
,
Enterprise
.
product_all1
.
like
(
"
%
{}
%
"
.
format
(
product
))
Enterprise
.
product_all1
.
like
(
"
%
{}
%
"
.
format
(
indu_name
))
)
.
all
()
)
.
all
()
company
+=
company2
company
+=
company2
# print(company2)
# print(company2)
company3
=
Enterprise
.
query
.
filter
(
company3
=
Enterprise
.
query
.
filter
(
Enterprise
.
c_type2
==
inid
,
Enterprise
.
c_type2
==
inid
,
Enterprise
.
product_all2
.
like
(
"
%
{}
%
"
.
format
(
product
))
Enterprise
.
product_all2
.
like
(
"
%
{}
%
"
.
format
(
indu_name
))
)
.
all
()
)
.
all
()
company
+=
company3
company
+=
company3
company
=
set
(
company
)
company
=
set
(
company
)
# company1 = Enterprise.query.filter(
# Enterprise.c_type == inid,
# Enterprise.product_all.like("%{}%".format(product))
# ).all()
# company += company1
# # print(company1)
# company2 = Enterprise.query.filter(
# Enterprise.c_type1 == inid,
# Enterprise.product_all1.like("%{}%".format(product))
# ).all()
# company += company2
# # print(company2)
# company3 = Enterprise.query.filter(
# Enterprise.c_type2 == inid,
# Enterprise.product_all2.like("%{}%".format(product))
# ).all()
# company += company3
# company = set(company)
if
name
:
if
name
:
enterprise
=
enterprise
.
filter
(
Enterprise
.
company_name
.
like
(
"
%
{}
%
"
.
format
(
name
)))
enterprise
=
enterprise
.
filter
(
Enterprise
.
company_name
.
like
(
"
%
{}
%
"
.
format
(
name
)))
if
select
==
"1"
:
# 瞪羚
if
select
==
"1"
:
# 瞪羚
...
...
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