Commit a42ddc99 by dong

fix20230310

parent 0b1a12e9
...@@ -441,11 +441,12 @@ def attract_enterprise(): ...@@ -441,11 +441,12 @@ def attract_enterprise():
Enterprise.dengl == '1' if qualificat == '瞪羚企业' else text(''), Enterprise.dengl == '1' if qualificat == '瞪羚企业' else text(''),
Enterprise.isfive == '1' if qualificat == '中国500强企业' else text(''), Enterprise.isfive == '1' if qualificat == '中国500强企业' else text(''),
Enterprise.scale == '1' if qualificat == '规模以上企业' else text(''), Enterprise.scale == '1' if qualificat == '规模以上企业' else text(''),
Enterprise.chain_master == '1' if qualificat == '链主企业' else text(''),
Enterprise.serve == '1' if qualificat == '限额以上服务业企业' else text('') Enterprise.serve == '1' if qualificat == '限额以上服务业企业' else text('')
) )
size = enterprise_obj.count() size = enterprise_obj.count()
enterprise_obj_list = enterprise_obj.order_by(Company.hots.desc()).paginate(page, perpage).items enterprise_obj_list = enterprise_obj.order_by(Enterprise.hots.desc()).paginate(page, perpage).items
df = [{"id": i.id, df = [{"id": i.id,
"company_name": i.company_name, "company_name": i.company_name,
...@@ -458,6 +459,7 @@ def attract_enterprise(): ...@@ -458,6 +459,7 @@ def attract_enterprise():
"瞪羚" if i.dengl == '1' else '', "瞪羚" if i.dengl == '1' else '',
"中国500强" if i.isfive == '1' else '', "中国500强" if i.isfive == '1' else '',
"规模以上企业" if i.scale == '1' else '', "规模以上企业" if i.scale == '1' else '',
"链主企业" if i.chain_master == '1' else '',
"限额以上服务业" if i.serve == '1' else ''])) "限额以上服务业" if i.serve == '1' else '']))
} for i in enterprise_obj_list] } for i in enterprise_obj_list]
data = {"size": size, "df": df} data = {"size": size, "df": df}
......
...@@ -1190,14 +1190,12 @@ def newList1(): ...@@ -1190,14 +1190,12 @@ def newList1():
if district: if district:
enterprise = enterprise.filter_by(district=district) enterprise = enterprise.filter_by(district=district)
if product: if product:
# 有可能会变成模糊查询
enterprise = enterprise.filter(or_( enterprise = enterprise.filter(or_(
Enterprise.product_all.like("%{}%".format(product)), Enterprise.product_all.like("%{}%".format(product)),
Enterprise.product_all1.like("%{}%".format(product)), Enterprise.product_all1.like("%{}%".format(product)),
Enterprise.product_all2.like("%{}%".format(product)) Enterprise.product_all2.like("%{}%".format(product))
)) ))
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": # 瞪羚
remind = "瞪羚企业" remind = "瞪羚企业"
......
...@@ -12,13 +12,19 @@ from apps import db ...@@ -12,13 +12,19 @@ from apps import db
def handle(): def handle():
with app.app_context(): with app.app_context():
company_obj_list = Company.query.all() # company_obj_list = Company.query.all()
# company_obj_list = Enterprise.query.all()
# print(company_obj_list) # print(company_obj_list)
# 读取企业数据表的资质 # 读取企业数据表的资质
i = 1 i = 1
for company_obj in company_obj_list: # for company_obj in company_obj_list:
for id in range(16, 5944047):
company_obj = Enterprise.query.get(id)
if not company_obj:
continue
grade_li = [] grade_li = []
# if company_obj.company_name == '山西永硕新材料科技有限公司': # if company_obj.company_name == '山东中联佳裕软件股份有限公司':
# print('--') # print('--')
if company_obj.isfive and company_obj.isfive == '1': # 五百强 if company_obj.isfive and company_obj.isfive == '1': # 五百强
grade_li.append(5) grade_li.append(5)
...@@ -70,7 +76,7 @@ def handle(): ...@@ -70,7 +76,7 @@ def handle():
total_grede = 0 total_grede = 0
company_obj.hots = total_grede company_obj.hots = total_grede
db.session.commit() db.session.commit()
print(str(round(i / len(company_obj_list) * 100, 2)) + '%') print(str(i / 5944031 * 100) + '%')
i += 1 i += 1
......
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