Commit ece47945 by dong

fix

parent 2b494819
......@@ -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"
......
......@@ -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 = IndustryChain1.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 = IndustryChain1.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 = IndustryChain1.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 = IndustryChain1.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 = IndustryChain1.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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment