Commit f64005c1 by dong

fix

parent 39c464bd
...@@ -115,7 +115,7 @@ class Enterprise(db.Model): ...@@ -115,7 +115,7 @@ class Enterprise(db.Model):
parti_year = db.Column(db.Integer, doc='高新企业注册年份', comment='高新企业注册年份') # 高新企业注册年份 parti_year = db.Column(db.Integer, doc='高新企业注册年份', comment='高新企业注册年份') # 高新企业注册年份
tbe = db.Column(db.String(32), doc='是否科技型中小企业', comment='是否科技型中小企业') # 是否科技型中小企业 tbe = db.Column(db.String(32), doc='是否科技型中小企业', comment='是否科技型中小企业') # 是否科技型中小企业
tbe_sjmy = db.Column(db.String(32), doc='是否为省级民营科技企业', comment='是否为省级民营科技企业') # 省级民营科技企业 tbe_sjmy = db.Column(db.String(32), doc='是否为省级民营科技企业', comment='是否为省级民营科技企业') # 省级民营科技企业
zjtg = db.Column(db.String(32), doc='是否为专精特新企业', comment='是否为专精特新企业') # 山西专精特工企业 zjtg = db.Column(db.String(32), doc='是否为专精特新企业', comment='是否为专精特新企业') # 专精特工企业
zjtg_gjjxjr = db.Column(db.String(32), doc='是否为国家级专精特新小巨人企业', comment='是否为国家级专精特新小巨人企业') # 国家级专精特新小巨人企业 zjtg_gjjxjr = db.Column(db.String(32), doc='是否为国家级专精特新小巨人企业', comment='是否为国家级专精特新小巨人企业') # 国家级专精特新小巨人企业
zjtg_sjxjr = db.Column(db.String(32), doc='是否为省级专精特新小巨人企业', comment='是否为省级专精特新小巨人企业') # 省级专精特新小巨人企业 zjtg_sjxjr = db.Column(db.String(32), doc='是否为省级专精特新小巨人企业', comment='是否为省级专精特新小巨人企业') # 省级专精特新小巨人企业
fianacing = db.Column(db.String(32), doc='是否为有融资企业', comment='是否为有融资企业') # 是否为有融资企业 fianacing = db.Column(db.String(32), doc='是否为有融资企业', comment='是否为有融资企业') # 是否为有融资企业
...@@ -158,7 +158,7 @@ class Enterprise(db.Model): ...@@ -158,7 +158,7 @@ class Enterprise(db.Model):
f_name = db.Column(db.String(255), doc='父行业类名', comment='父行业类名') # 父行业类名 f_name = db.Column(db.String(255), doc='父行业类名', comment='父行业类名') # 父行业类名
f_type = db.Column(db.Integer, index=True, doc='父行业类id', comment='父行业类id') # 父行业类id f_type = db.Column(db.Integer, index=True, doc='父行业类id', comment='父行业类id') # 父行业类id
sxonhun = db.Column(db.String(32), comment='是否山西100强') # 是否山西100强 sxonhun = db.Column(db.String(32), comment='是否100强') # 是否100强
scale = db.Column(db.String(32), comment='规模以上企业') # 规模以上企业 scale = db.Column(db.String(32), comment='规模以上企业') # 规模以上企业
serve = db.Column(db.String(32), comment='限额以上服务业') # 限额以上服务业 serve = db.Column(db.String(32), comment='限额以上服务业') # 限额以上服务业
...@@ -220,7 +220,7 @@ class Enterprise1(db.Model): ...@@ -220,7 +220,7 @@ class Enterprise1(db.Model):
parti_year = db.Column(db.Integer, doc='高新企业注册年份', comment='高新企业注册年份') # 高新企业注册年份 parti_year = db.Column(db.Integer, doc='高新企业注册年份', comment='高新企业注册年份') # 高新企业注册年份
tbe = db.Column(db.String(32), doc='是否科技型中小企业', comment='是否科技型中小企业') # 是否科技型中小企业 tbe = db.Column(db.String(32), doc='是否科技型中小企业', comment='是否科技型中小企业') # 是否科技型中小企业
tbe_sjmy = db.Column(db.String(32), doc='是否为省级民营科技企业', comment='是否为省级民营科技企业') # 省级民营科技企业 tbe_sjmy = db.Column(db.String(32), doc='是否为省级民营科技企业', comment='是否为省级民营科技企业') # 省级民营科技企业
zjtg = db.Column(db.String(32), doc='是否为专精特新企业', comment='是否为专精特新企业') # 山西专精特工企业 zjtg = db.Column(db.String(32), doc='是否为专精特新企业', comment='是否为专精特新企业') # 专精特工企业
zjtg_gjjxjr = db.Column(db.String(32), doc='是否为国家级专精特新小巨人企业', comment='是否为国家级专精特新小巨人企业') # 国家级专精特新小巨人企业 zjtg_gjjxjr = db.Column(db.String(32), doc='是否为国家级专精特新小巨人企业', comment='是否为国家级专精特新小巨人企业') # 国家级专精特新小巨人企业
zjtg_sjxjr = db.Column(db.String(32), doc='是否为省级专精特新小巨人企业', comment='是否为省级专精特新小巨人企业') # 省级专精特新小巨人企业 zjtg_sjxjr = db.Column(db.String(32), doc='是否为省级专精特新小巨人企业', comment='是否为省级专精特新小巨人企业') # 省级专精特新小巨人企业
fianacing = db.Column(db.String(32), doc='是否为有融资企业', comment='是否为有融资企业') # 是否为有融资企业 fianacing = db.Column(db.String(32), doc='是否为有融资企业', comment='是否为有融资企业') # 是否为有融资企业
...@@ -263,7 +263,7 @@ class Enterprise1(db.Model): ...@@ -263,7 +263,7 @@ class Enterprise1(db.Model):
f_name = db.Column(db.String(255), doc='父行业类名', comment='父行业类名') # 父行业类名 f_name = db.Column(db.String(255), doc='父行业类名', comment='父行业类名') # 父行业类名
f_type = db.Column(db.Integer, index=True, doc='父行业类id', comment='父行业类id') # 父行业类id f_type = db.Column(db.Integer, index=True, doc='父行业类id', comment='父行业类id') # 父行业类id
sxonhun = db.Column(db.String(32), comment='是否山西100强') # 是否山西100强 sxonhun = db.Column(db.String(32), comment='是否100强') # 是否100强
scale = db.Column(db.String(32), comment='规模以上企业') # 规模以上企业 scale = db.Column(db.String(32), comment='规模以上企业') # 规模以上企业
serve = db.Column(db.String(32), comment='限额以上服务业') # 限额以上服务业 serve = db.Column(db.String(32), comment='限额以上服务业') # 限额以上服务业
...@@ -338,8 +338,8 @@ class Company(db.Model): ...@@ -338,8 +338,8 @@ class Company(db.Model):
induzone = db.Column(db.String(255), doc='所在园区', comment='所在园区') # 所在园区 induzone = db.Column(db.String(255), doc='所在园区', comment='所在园区') # 所在园区
company_info = db.Column(db.Text, doc='公司简介', comment='公司简介') # 公司简介 company_info = db.Column(db.Text, doc='公司简介', comment='公司简介') # 公司简介
sxmon = db.Column(db.String(32), doc='是否山西民营100强', comment='是否山西民营100强') # 是否山西民营100强(2019年) sxmon = db.Column(db.String(32), doc='是否民营100强', comment='是否民营100强') # 是否民营100强(2019年)
zjtg = db.Column(db.String(32), doc='是否为山西专精特新企业', comment='是否为山西专精特新企业') # 山西专精特工企业 zjtg = db.Column(db.String(32), doc='是否为专精特新企业', comment='是否为专精特新企业') # 专精特工企业
zjtg_gjjxjr = db.Column(db.String(32), doc='是否为国家级专精特新小巨人企业', comment='是否为国家级专精特新小巨人企业') # 国家级专精特新小巨人企业 zjtg_gjjxjr = db.Column(db.String(32), doc='是否为国家级专精特新小巨人企业', comment='是否为国家级专精特新小巨人企业') # 国家级专精特新小巨人企业
zjtg_sjxjr = db.Column(db.String(32), doc='是否为省级专精特新小巨人企业', comment='是否为省级专精特新小巨人企业') # 省级专精特新小巨人企业 zjtg_sjxjr = db.Column(db.String(32), doc='是否为省级专精特新小巨人企业', comment='是否为省级专精特新小巨人企业') # 省级专精特新小巨人企业
unicorn = db.Column(db.String(32), doc='独角兽企业', comment='独角兽企业') # 独角兽企业 unicorn = db.Column(db.String(32), doc='独角兽企业', comment='独角兽企业') # 独角兽企业
...@@ -348,7 +348,7 @@ class Company(db.Model): ...@@ -348,7 +348,7 @@ class Company(db.Model):
isfive = db.Column(db.String(32), doc='是否中国500强', comment='是否中国500强') # 是否中国500强 isfive = db.Column(db.String(32), doc='是否中国500强', comment='是否中国500强') # 是否中国500强
istyfive = db.Column(db.String(32), doc='是否2020中国500强', comment='是否2020中国500强') # 是否2020中国500强 istyfive = db.Column(db.String(32), doc='是否2020中国500强', comment='是否2020中国500强') # 是否2020中国500强
quotedate = db.Column(db.DateTime, doc='上市时间', comment='上市时间') # 上市时间 quotedate = db.Column(db.DateTime, doc='上市时间', comment='上市时间') # 上市时间
sxonhun = db.Column(db.String(32), doc='是否山西100强', comment='是否山西100强') # 是否山西100强 sxonhun = db.Column(db.String(32), doc='是否100强', comment='是否100强') # 是否100强
product_all = db.Column(db.String(255), doc='公司拥有产品', comment='公司拥有产品') # 公司拥有产品 product_all = db.Column(db.String(255), doc='公司拥有产品', comment='公司拥有产品') # 公司拥有产品
scale = db.Column(db.String(32), doc='规模以上企业', comment='规模以上企业') # 规模以上企业 scale = db.Column(db.String(32), doc='规模以上企业', comment='规模以上企业') # 规模以上企业
...@@ -1579,10 +1579,10 @@ class ProjectManagement(db.Model): ...@@ -1579,10 +1579,10 @@ class ProjectManagement(db.Model):
investor_address = db.Column(db.String(30), comment='投资方联系地址') investor_address = db.Column(db.String(30), comment='投资方联系地址')
# 项目化管理-山西省地市指标表 # 项目化管理-省地市指标表
class ShanxiTarget(db.Model): class ShanxiTarget(db.Model):
__tablename_ = "shanxi_target" __tablename_ = "shanxi_target"
__table_args__ = ({'comment': '项目化管理-山西省地市指标表'}) # 添加表注释 __table_args__ = ({'comment': '项目化管理-省地市指标表'}) # 添加表注释
id = db.Column(db.Integer, primary_key=True, autoincrement=True, comment='主键id') id = db.Column(db.Integer, primary_key=True, autoincrement=True, comment='主键id')
is_delete = db.Column(db.Integer, comment='逻辑删除') is_delete = db.Column(db.Integer, comment='逻辑删除')
data_time = db.Column(db.String(30), comment='数据年份') data_time = db.Column(db.String(30), comment='数据年份')
......
...@@ -360,13 +360,10 @@ def create_body(page, page_size, args_query, args_term): ...@@ -360,13 +360,10 @@ def create_body(page, page_size, args_query, args_term):
"from": page, "from": page,
"size": page_size, "size": page_size,
"sort": [{"host": {"order": "desc"}}], "sort": [{"host": {"order": "desc"}}],
# "sort": [],
"aggs": {}, "aggs": {},
"_source": [ "_source": [
"mysql_id", 'province', 'company_name', 'city', 'district', 'build_date', 'legal', 'capital', 'entype', 'address', "mysql_id", 'province', 'company_name', 'city', 'district', 'build_date', 'legal', 'capital', 'entype', 'address',
'telephone', 'telephone', "high_new", "tbe", "fianacing", "quoted_company", "foreign_investment", "patent", "dengl", "unicorn",
"high_new", "tbe", "fianacing", "quoted_company", "foreign_investment", "patent", "dengl", "unicorn",
"isfive" "isfive"
], ],
"highlight": { "highlight": {
...@@ -382,7 +379,6 @@ def create_body(page, page_size, args_query, args_term): ...@@ -382,7 +379,6 @@ def create_body(page, page_size, args_query, args_term):
for k, v in args_term.items(): for k, v in args_term.items():
body["query"]["bool"]["must"].append({"match": {"{}".format(k): "{}".format(v)}}) body["query"]["bool"]["must"].append({"match": {"{}".format(k): "{}".format(v)}})
# print(body)
return body return body
......
...@@ -993,8 +993,8 @@ def search_enterprise(): ...@@ -993,8 +993,8 @@ def search_enterprise():
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(''),
Company.quoted_company == '1' if aptitude == '上市企业' else text(''), Company.quoted_company == '1' if aptitude == '上市企业' else text(''),
Company.sxmon == '1' if aptitude == '山西民营100强' else text(''), Company.sxmon == '1' if aptitude == '民营100强' else text(''),
Company.zjtg == '1' if aptitude == '山西专精特新企业' else text(''), Company.zjtg == '1' if aptitude == '专精特新企业' else text(''),
Company.unicorn == '1' if aptitude == '独角兽企业' else text(''), Company.unicorn == '1' if aptitude == '独角兽企业' else text(''),
Company.dengl == '1' if aptitude == '瞪羚' else text(''), Company.dengl == '1' if aptitude == '瞪羚' else text(''),
Company.isfive == '1' if aptitude == '中国500强' else text(''), Company.isfive == '1' if aptitude == '中国500强' else text(''),
...@@ -1010,8 +1010,8 @@ def search_enterprise(): ...@@ -1010,8 +1010,8 @@ def search_enterprise():
"aptitude": ["高新技术企业" if company_obj.high_new == '1' else "aptitude": ["高新技术企业" if company_obj.high_new == '1' else
"科技型中小企业" if company_obj.tbe == '1' else "科技型中小企业" if company_obj.tbe == '1' else
"上市企业" if company_obj.quoted_company == '1' else "上市企业" if company_obj.quoted_company == '1' else
"山西民营100强" if company_obj.sxmon == '1' else "民营100强" if company_obj.sxmon == '1' else
"山西专精特新企业" if company_obj.zjtg == '1' else "专精特新企业" if company_obj.zjtg == '1' else
"独角兽企业" if company_obj.unicorn == '1' else "独角兽企业" if company_obj.unicorn == '1' else
"瞪羚企业" if company_obj.dengl == '1' else "瞪羚企业" if company_obj.dengl == '1' else
"中国500强" if company_obj.isfive == '1' else "中国500强" if company_obj.isfive == '1' else
...@@ -1143,8 +1143,8 @@ def industry_enterprise(): ...@@ -1143,8 +1143,8 @@ def industry_enterprise():
"high_new": '高新技术企业' if i.high_new == '1' else '', "high_new": '高新技术企业' if i.high_new == '1' else '',
"tbe": '科技型中小企业' if i.tbe == '1' else '', "tbe": '科技型中小企业' if i.tbe == '1' else '',
"quoted_company": '上市企业' if i.quoted_company == '1' else '', "quoted_company": '上市企业' if i.quoted_company == '1' else '',
"sxmon": '山西民营100强' if i.sxmon == '1' else '', "sxmon": '民营100强' if i.sxmon == '1' else '',
"zjtg": '山西专精特新企业' if i.zjtg == '1' else '', "zjtg": '专精特新企业' if i.zjtg == '1' else '',
"unicorn": '独角兽企业' if i.unicorn == '1' else '', "unicorn": '独角兽企业' if i.unicorn == '1' else '',
"dengl": '瞪羚企业' if i.dengl == '1' else '', "dengl": '瞪羚企业' if i.dengl == '1' else '',
"isfive": '中国500强' if i.isfive == '1' else '', "isfive": '中国500强' if i.isfive == '1' else '',
......
...@@ -499,7 +499,7 @@ def showListb(): ...@@ -499,7 +499,7 @@ def showListb():
# "quoted_company": "上市企业" if i.public_sector != "空" else "", # "quoted_company": "上市企业" if i.public_sector != "空" else "",
"quoted_company": "上市企业" if i.quoted_company == "1" else "", "quoted_company": "上市企业" if i.quoted_company == "1" else "",
"scale": "规模以上企业" if i.scale == "1" else "", "scale": "规模以上企业" if i.scale == "1" else "",
"zjtg": "山西专精特新企业" if i.zjtg == "1" else "", "zjtg": "专精特新企业" if i.zjtg == "1" else "",
"high_new": "高新技术企业" if i.high_new == "1" else "", "high_new": "高新技术企业" if i.high_new == "1" else "",
"tbe": "科技型中小企业" if i.tbe == "1" else "", "tbe": "科技型中小企业" if i.tbe == "1" else "",
"dengl": "瞪羚企业" if i.dengl == "1" else "", "dengl": "瞪羚企业" if i.dengl == "1" else "",
...@@ -588,7 +588,7 @@ def company_detail(): ...@@ -588,7 +588,7 @@ def company_detail():
"unicorn": '独角兽企业' if company.unicorn == '1' else "", "unicorn": '独角兽企业' if company.unicorn == '1' else "",
"dengl": '瞪羚企业' if company.dengl == '1' else "", "dengl": '瞪羚企业' if company.dengl == '1' else "",
"isfive": '中国500强' if company.isfive == '1' else "", "isfive": '中国500强' if company.isfive == '1' else "",
"zjtg": '山西专精特新企业' if company.zjtg == '1' else "", "zjtg": '专精特新企业' if company.zjtg == '1' else "",
"zjtg_gjjxjr": '国家级专精特新小巨人企业' if company.zjtg_gjjxjr == '1' else "", "zjtg_gjjxjr": '国家级专精特新小巨人企业' if company.zjtg_gjjxjr == '1' else "",
"zjtg_sjxjr": '省级专精特新小巨人企业' if company.zjtg_sjxjr == '1' else "", "zjtg_sjxjr": '省级专精特新小巨人企业' if company.zjtg_sjxjr == '1' else "",
"tbe_sjmy": '省级民营科技企业' if company.tbe_sjmy == '1' else "", "tbe_sjmy": '省级民营科技企业' if company.tbe_sjmy == '1' else "",
......
...@@ -387,8 +387,8 @@ def search_enterprise(): ...@@ -387,8 +387,8 @@ def search_enterprise():
Enterprise.high_new == '1' if aptitude == '高新技术企业' else text(''), Enterprise.high_new == '1' if aptitude == '高新技术企业' else text(''),
Enterprise.tbe == '1' if aptitude == '科技型中小企业' else text(''), Enterprise.tbe == '1' if aptitude == '科技型中小企业' else text(''),
Enterprise.quoted_company == '1' if aptitude == '上市企业' else text(''), Enterprise.quoted_company == '1' if aptitude == '上市企业' else text(''),
Enterprise.sxmon == '1' if aptitude == '山西民营100强' else text(''), Enterprise.sxmon == '1' if aptitude == '民营100强' else text(''),
Enterprise.zjtg == '1' if aptitude == '山西专精特新企业' else text(''), Enterprise.zjtg == '1' if aptitude == '专精特新企业' else text(''),
Enterprise.unicorn == '1' if aptitude == '独角兽企业' else text(''), Enterprise.unicorn == '1' if aptitude == '独角兽企业' else text(''),
Enterprise.dengl == '1' if aptitude == '瞪羚' else text(''), Enterprise.dengl == '1' if aptitude == '瞪羚' else text(''),
Enterprise.isfive == '1' if aptitude == '中国500强' else text(''), Enterprise.isfive == '1' if aptitude == '中国500强' else text(''),
...@@ -406,8 +406,8 @@ def search_enterprise(): ...@@ -406,8 +406,8 @@ def search_enterprise():
"aptitude": ["高新技术企业" if enterprise_obj.high_new == '1' else "aptitude": ["高新技术企业" if enterprise_obj.high_new == '1' else
"科技型中小企业" if enterprise_obj.tbe == '1' else "科技型中小企业" if enterprise_obj.tbe == '1' else
"上市企业" if enterprise_obj.quoted_company == '1' else "上市企业" if enterprise_obj.quoted_company == '1' else
"山西民营100强" if enterprise_obj.sxmon == '1' else "民营100强" if enterprise_obj.sxmon == '1' else
"山西专精特新企业" if enterprise_obj.zjtg == '1' else "专精特新企业" if enterprise_obj.zjtg == '1' else
"独角兽企业" if enterprise_obj.unicorn == '1' else "独角兽企业" if enterprise_obj.unicorn == '1' else
"瞪羚企业" if enterprise_obj.dengl == '1' else "瞪羚企业" if enterprise_obj.dengl == '1' else
"中国500强" if enterprise_obj.isfive == '1' else "中国500强" if enterprise_obj.isfive == '1' else
...@@ -527,7 +527,7 @@ def attract_enterprise(): ...@@ -527,7 +527,7 @@ def attract_enterprise():
enterprise = [enter for enter in enterprise if enter.chain_master == '1'] enterprise = [enter for enter in enterprise if enter.chain_master == '1']
if qualificat == '高新技术企业': if qualificat == '高新技术企业':
enterprise = [enter for enter in enterprise if enter.high_new == '1'] enterprise = [enter for enter in enterprise if enter.high_new == '1']
if qualificat == '山西专精特新企业': if qualificat == '专精特新企业':
enterprise = [enter for enter in enterprise if enter.zjtg == '1'] enterprise = [enter for enter in enterprise if enter.zjtg == '1']
if qualificat == '独角兽企业': if qualificat == '独角兽企业':
enterprise = [enter for enter in enterprise if enter.unicorn == '1'] enterprise = [enter for enter in enterprise if enter.unicorn == '1']
...@@ -537,7 +537,7 @@ def attract_enterprise(): ...@@ -537,7 +537,7 @@ def attract_enterprise():
enterprise = [enter for enter in enterprise if enter.tbe == '1'] enterprise = [enter for enter in enterprise if enter.tbe == '1']
if qualificat == '规模以上企业': if qualificat == '规模以上企业':
enterprise = [enter for enter in enterprise if enter.scale == '1'] enterprise = [enter for enter in enterprise if enter.scale == '1']
if qualificat == '山西100强企业': if qualificat == '100强企业':
enterprise = [enter for enter in enterprise if enter.sxonhun == '1'] enterprise = [enter for enter in enterprise if enter.sxonhun == '1']
if qualificat == '限额以上服务业企业': if qualificat == '限额以上服务业企业':
enterprise = [enter for enter in enterprise if enter.serve == '1'] enterprise = [enter for enter in enterprise if enter.serve == '1']
...@@ -554,11 +554,11 @@ def attract_enterprise(): ...@@ -554,11 +554,11 @@ def attract_enterprise():
"上市企业" if i.quoted_company == '1' else '', "上市企业" if i.quoted_company == '1' else '',
"链主企业" if i.chain_master == '1' else '', "链主企业" if i.chain_master == '1' else '',
"高新技术企业" if i.high_new == '1' else '', "高新技术企业" if i.high_new == '1' else '',
"山西专精特新企业" if i.zjtg == '1' else '', "专精特新企业" if i.zjtg == '1' else '',
"独角兽企业" if i.unicorn == '1' else '', "独角兽企业" if i.unicorn == '1' else '',
"瞪羚企业" if i.dengl == '1' else '', "瞪羚企业" if i.dengl == '1' else '',
"科技型中小企业" if i.tbe == '1' else '', "科技型中小企业" if i.tbe == '1' else '',
"山西民营100强" if i.sxonhun == '1' else '', "民营100强" if i.sxonhun == '1' else '',
"规模以上企业" if i.scale == '1' else '', "规模以上企业" if i.scale == '1' else '',
"限额以上服务业" if i.serve == '1' else '', "限额以上服务业" if i.serve == '1' else '',
...@@ -579,8 +579,8 @@ def attract_enterprise(): ...@@ -579,8 +579,8 @@ def attract_enterprise():
# 全国企业列表(Es) # 全国企业列表(Es)
@api_map.route('/AttractEnterpriseEs', methods=['POST']) @api_map.route('/AttractEnterprise1', methods=['POST'])
def attract_enterprise_es(): def attract_enterprise_es1():
req_dict = request.get_json() req_dict = request.get_json()
inid = req_dict.get("inid") # 行业id inid = req_dict.get("inid") # 行业id
company_name = req_dict.get("company_name") # 产业产品名称筛选 company_name = req_dict.get("company_name") # 产业产品名称筛选
...@@ -612,33 +612,32 @@ def attract_enterprise_es(): ...@@ -612,33 +612,32 @@ def attract_enterprise_es():
if company_name: if company_name:
args_query["company_name"] = company_name args_query["company_name"] = company_name
if inid:
args_term['c_type'] = inid
if entype: if entype:
args_term['entype'] = entype args_term['entype'] = entype
if quoted: if quoted:
args_term['public_id'] = quoted args_term['public_id'] = quoted
if product:
args_term['product'] = product
# 公司资质
if qualificat: if qualificat:
if qualificat == 1: if qualificat == "中国500强":
args_term['isfive'] = 1 args_term['isfive'] = 1
if qualificat == 2: if qualificat == "上市企业":
args_term['quoted_company'] = 1 args_term['quoted_company'] = 1
if qualificat == 3: if qualificat == "独角兽企业":
args_term['fianacing'] = 1
if qualificat == 4:
args_term['high_new'] = 1
if qualificat == 5:
args_term['tbe'] = 1
if qualificat == 6:
args_term['dengl'] = 1
if qualificat == 7:
args_term['unicorn'] = 1 args_term['unicorn'] = 1
if qualificat == "瞪羚企业":
args_term['dengl'] = 1
if qualificat == "规上企业":
args_term['scale'] = 1
if qualificat == "科技型中小企业":
args_term['tbe'] = 1
if qualificat == "高新技术企业":
args_term['high_new'] = 1
if qualificat == "专精特新企业":
args_term['zjtg'] = 1
if qualificat == "外资企业":
args_term['foreign_investment'] = 1
# 省 # 省
if province: if province:
args_term['province'] = province args_term['province'] = province
...@@ -649,81 +648,222 @@ def attract_enterprise_es(): ...@@ -649,81 +648,222 @@ def attract_enterprise_es():
if district: if district:
args_term['district'] = district args_term['district'] = district
# # 成立时间
# if yearid:
# args_term['yearid'] = yearid
# # 融资轮次
# if roundid:
# args_term['roundid'] = roundid
# # 企业状态
# if status:
# args_term['status'] = status
# # 企业规模
# if scale_range:
# args_term['scale_range'] = scale_range
# # 公司类型
# if entypeid:
# args_term['entypeid'] = entypeid
body = create_body(page, perpage, args_query, args_term) body = create_body(page, perpage, args_query, args_term)
if not company_name: if not company_name:
del body["query"]["bool"]["must"][0] del body["query"]["bool"]["must"][0]
if inid in range(1, 10) and not product:
f_c_type = {
"multi_match": {
"query": inid,
"fields": ["c_type", "c_type1", "c_type2"]
}
}
body["query"]["bool"]["must"].append(f_c_type)
if product:
product = {
"multi_match": {
"query": product,
"fields": ["product_all", "product_all1", "product_all2"]
}
}
body["query"]["bool"]["must"].append(product)
try: try:
es = Elasticsearch([{'host': '39.100.39.50', 'port': 9200}]) es = Elasticsearch([{'host': '39.100.39.50', 'port': 9200}])
# data = es.search(index="jincheng_pictext_index_202301131004_a6181e52", body=body) data = es.search(index="mancheng_enterperise", body=body)
data = es.search(index="jincheng_pictext_index_202303161620_76c624b8", body=body) df = []
data_list = []
# print(data_list)
size = data["hits"]['total'] size = data["hits"]['total']
# 数据的列表添加进去 # 数据的列表添加进去
for i in data["hits"]['hits']: for i in data["hits"]['hits']:
if company_name: if company_name:
# 判断高亮,然后添加 # 判断高亮,然后添加
data_list.append({ df.append({
"id": i["_source"]["mysql_id"], "id": i["_source"]["mysql_id"],
"company": i["highlight"]["company_name"][0] if "company_name" in i["highlight"] else i["_source"][ "company_name": i["highlight"]["company_name"][0] if "company_name" in i["highlight"] else i["_source"][
"company_name"], "company_name"],
"area": i["_source"]["province"] + i["_source"]["city"] + i["_source"]["district"], "aptitude": list(filter(None, [
"createtime": i["_source"]["build_date"], "中国500强" if i["_source"]["isfive"] == '1' else '',
"legal": i["_source"]["legal"], "上市企业" if i["_source"]["quoted_company"] == "1" else '',
"capital": i["_source"]["capital"], "独角兽企业" if i["_source"]["unicorn"] == "1" else '',
"entype": i["_source"]["entype"], "瞪羚企业" if i["_source"]["dengl"] == "1" else '',
"address": i["_source"]["address"], "规上企业" if i["_source"]["scale"] == "1" else '',
"telephone": i["_source"]["telephone"], "科技型中小企业" if i["_source"]["tbe"] == "1" else '',
"high_new": '高新技术企业' if i["_source"]["high_new"] == "1" else '', "高新技术企业" if i["_source"]["high_new"] == "1" else '',
"tbe": '科技型中小企业' if i["_source"]["tbe"] == "1" else '', "专精特新企业" if i["_source"]["zjtg"] == "1" else '',
"fianacing": '融资企业' if i["_source"]["fianacing"] == "1" else '', "外资企业" if i["_source"]["foreign_investment"] == "1" else '']))})
"quoted_company": '上市企业' if i["_source"]["quoted_company"] == "1" else '',
"dengl": '瞪羚企业' if i["_source"]["dengl"] == "1" else '',
"unicorn": '独角兽企业' if i["_source"]["unicorn"] == "1" else '',
"isfive": '500强企业' if i["_source"]["isfive"] == '1' else '',
})
else: else:
data_list.append({ df.append({
"id": i["_source"]["mysql_id"], "id": i["_source"]["mysql_id"],
"company": i["_source"]["company_name"], "company_name": i["_source"]["company_name"],
"area": i["_source"]["province"] + i["_source"]["city"] + i["_source"]["district"], "aptitude": list(filter(None, [
"createtime": i["_source"]["build_date"], "中国500强" if i["_source"]["isfive"] == '1' else '',
"legal": i["_source"]["legal"], "上市企业" if i["_source"]["quoted_company"] == "1" else '',
"capital": i["_source"]["capital"], "独角兽企业" if i["_source"]["unicorn"] == "1" else '',
"entype": i["_source"]["entype"], "瞪羚企业" if i["_source"]["dengl"] == "1" else '',
"address": i["_source"]["address"], "规上企业" if i["_source"]["scale"] == "1" else '',
"telephone": i["_source"]["telephone"], "科技型中小企业" if i["_source"]["tbe"] == "1" else '',
"high_new": '高新技术企业' if i["_source"]["high_new"] == "1" else '', "高新技术企业" if i["_source"]["high_new"] == "1" else '',
"tbe": '科技型中小企业' if i["_source"]["tbe"] == "1" else '', "专精特新企业" if i["_source"]["zjtg"] == "1" else '',
"fianacing": '融资企业' if i["_source"]["fianacing"] == "1" else '', "外资企业" if i["_source"]["foreign_investment"] == "1" else '']))})
"quoted_company": '上市企业' if i["_source"]["quoted_company"] == "1" else '',
"dengl": '瞪羚企业' if i["_source"]["dengl"] == "1" else '',
"unicorn": '独角兽企业' if i["_source"]["unicorn"] == "1" else '',
"isfive": '500强企业' if i["_source"]["isfive"] == '1' else '',
})
except Exception as e: except Exception as e:
current_app.logger.error(e) current_app.logger.error(e)
return jsonify(code=RET.DBERR, msg="es数据库错误") return jsonify(code=RET.DBERR, msg="es数据库错误")
data = { data = {"size": size, "df": df}
"data": data_list, "size": size return jsonify(code=RET.OK, msg="查找成功", data=data)
}
return jsonify(code=RET.OK, msg="查找成功", data=data)
\ No newline at end of file # 全国企业列表(Es)
# @api_map.route('/AttractEnterpriseEs', methods=['POST'])
# def attract_enterprise_es():
# req_dict = request.get_json()
# inid = req_dict.get("inid") # 行业id
# company_name = req_dict.get("company_name") # 产业产品名称筛选
# entype = req_dict.get("entype") # 企业类型id
# qualificat = req_dict.get("qualificat") # 企业资质id
# quoted = req_dict.get("quoted") # 上市板块(A股,1)(创业股,2)(港股,3)(新三股,4)(新四股,5)(中小板,6)
# product = req_dict.get("product") # 产业产品选择
#
# area = req_dict.get("area") # ["省","市","区"]
# province = area[0]
# city = area[1]
# district = area[2]
# page = req_dict.get("page") # 分页页码
# perpage = req_dict.get("perpage") # 分页大小
# if not all([page, perpage]):
# return jsonify(code=RET.PARAMERR, msg="参数不完整")
#
# # 页数
# if not page:
# page = 1
# page = int(page)
# page = (page - 1) * perpage
#
# args_query = dict() # 查询字段
# args_term = dict() # 条件字典
#
# args_query["company_name"] = "公司"
# # 搜索框
# if company_name:
# args_query["company_name"] = company_name
#
# if inid:
# args_term['c_type'] = inid
#
# if entype:
# args_term['entype'] = entype
#
# if quoted:
# args_term['public_id'] = quoted
#
# if product:
# args_term['product'] = product
# # 公司资质
# if qualificat:
# if qualificat == 1:
# args_term['isfive'] = 1
# if qualificat == 2:
# args_term['quoted_company'] = 1
# if qualificat == 3:
# args_term['fianacing'] = 1
# if qualificat == 4:
# args_term['high_new'] = 1
# if qualificat == 5:
# args_term['tbe'] = 1
# if qualificat == 6:
# args_term['dengl'] = 1
# if qualificat == 7:
# args_term['unicorn'] = 1
# # 省
# if province:
# args_term['province'] = province
# # 市
# if city:
# args_term['city'] = city
# # 区
# if district:
# args_term['district'] = district
#
# # # 成立时间
# # if yearid:
# # args_term['yearid'] = yearid
# # # 融资轮次
# # if roundid:
# # args_term['roundid'] = roundid
# # # 企业状态
# # if status:
# # args_term['status'] = status
# # # 企业规模
# # if scale_range:
# # args_term['scale_range'] = scale_range
# # # 公司类型
# # if entypeid:
# # args_term['entypeid'] = entypeid
#
# body = create_body(page, perpage, args_query, args_term)
# if not company_name:
# del body["query"]["bool"]["must"][0]
#
# try:
# es = Elasticsearch([{'host': '39.100.39.50', 'port': 9200}])
#
# # data = es.search(index="jincheng_pictext_index_202301131004_a6181e52", body=body)
# data = es.search(index="jincheng_pictext_index_202303161620_76c624b8", body=body)
# data_list = []
# # print(data_list)
# size = data["hits"]['total']
#
# # 数据的列表添加进去
# for i in data["hits"]['hits']:
# if company_name:
# # 判断高亮,然后添加
# data_list.append({
# "id": i["_source"]["mysql_id"],
# "company": i["highlight"]["company_name"][0] if "company_name" in i["highlight"] else i["_source"][
# "company_name"],
# "area": i["_source"]["province"] + i["_source"]["city"] + i["_source"]["district"],
# "createtime": i["_source"]["build_date"],
# "legal": i["_source"]["legal"],
# "capital": i["_source"]["capital"],
# "entype": i["_source"]["entype"],
# "address": i["_source"]["address"],
# "telephone": i["_source"]["telephone"],
# "high_new": '高新技术企业' if i["_source"]["high_new"] == "1" else '',
# "tbe": '科技型中小企业' if i["_source"]["tbe"] == "1" else '',
# "fianacing": '融资企业' if i["_source"]["fianacing"] == "1" else '',
# "quoted_company": '上市企业' if i["_source"]["quoted_company"] == "1" else '',
# "dengl": '瞪羚企业' if i["_source"]["dengl"] == "1" else '',
# "unicorn": '独角兽企业' if i["_source"]["unicorn"] == "1" else '',
# "isfive": '500强企业' if i["_source"]["isfive"] == '1' else '',
# })
# else:
# data_list.append({
# "id": i["_source"]["mysql_id"],
# "company": i["_source"]["company_name"],
# "area": i["_source"]["province"] + i["_source"]["city"] + i["_source"]["district"],
# "createtime": i["_source"]["build_date"],
# "legal": i["_source"]["legal"],
# "capital": i["_source"]["capital"],
# "entype": i["_source"]["entype"],
# "address": i["_source"]["address"],
# "telephone": i["_source"]["telephone"],
# "high_new": '高新技术企业' if i["_source"]["high_new"] == "1" else '',
# "tbe": '科技型中小企业' if i["_source"]["tbe"] == "1" else '',
# "fianacing": '融资企业' if i["_source"]["fianacing"] == "1" else '',
# "quoted_company": '上市企业' if i["_source"]["quoted_company"] == "1" else '',
# "dengl": '瞪羚企业' if i["_source"]["dengl"] == "1" else '',
# "unicorn": '独角兽企业' if i["_source"]["unicorn"] == "1" else '',
# "isfive": '500强企业' if i["_source"]["isfive"] == '1' else '',
# })
# except Exception as e:
# current_app.logger.error(e)
# return jsonify(code=RET.DBERR, msg="es数据库错误")
# data = {
# "data": data_list, "size": size
# }
# return jsonify(code=RET.OK, msg="查找成功", data=data)
\ No newline at end of file
...@@ -1143,8 +1143,8 @@ def search_enterprise(): ...@@ -1143,8 +1143,8 @@ def search_enterprise():
Enterprise.high_new == '1' if aptitude == '高新技术企业' else text(''), Enterprise.high_new == '1' if aptitude == '高新技术企业' else text(''),
Enterprise.tbe == '1' if aptitude == '科技型中小企业' else text(''), Enterprise.tbe == '1' if aptitude == '科技型中小企业' else text(''),
Enterprise.quoted_company == '1' if aptitude == '上市企业' else text(''), Enterprise.quoted_company == '1' if aptitude == '上市企业' else text(''),
Enterprise.sxmon == '1' if aptitude == '山西民营100强' else text(''), Enterprise.sxmon == '1' if aptitude == '民营100强' else text(''),
Enterprise.zjtg == '1' if aptitude == '山西专精特新企业' else text(''), Enterprise.zjtg == '1' if aptitude == '专精特新企业' else text(''),
Enterprise.unicorn == '1' if aptitude == '独角兽企业' else text(''), Enterprise.unicorn == '1' if aptitude == '独角兽企业' else text(''),
Enterprise.dengl == '1' if aptitude == '瞪羚' else text(''), Enterprise.dengl == '1' if aptitude == '瞪羚' else text(''),
Enterprise.isfive == '1' if aptitude == '中国500强' else text(''), Enterprise.isfive == '1' if aptitude == '中国500强' else text(''),
...@@ -1162,8 +1162,8 @@ def search_enterprise(): ...@@ -1162,8 +1162,8 @@ def search_enterprise():
"aptitude": ["高新技术企业" if enterprise_obj.high_new == '1' else "aptitude": ["高新技术企业" if enterprise_obj.high_new == '1' else
"科技型中小企业" if enterprise_obj.tbe == '1' else "科技型中小企业" if enterprise_obj.tbe == '1' else
"上市企业" if enterprise_obj.quoted_company == '1' else "上市企业" if enterprise_obj.quoted_company == '1' else
"山西民营100强" if enterprise_obj.sxmon == '1' else "民营100强" if enterprise_obj.sxmon == '1' else
"山西专精特新企业" if enterprise_obj.zjtg == '1' else "专精特新企业" if enterprise_obj.zjtg == '1' else
"独角兽企业" if enterprise_obj.unicorn == '1' else "独角兽企业" if enterprise_obj.unicorn == '1' else
"瞪羚企业" if enterprise_obj.dengl == '1' else "瞪羚企业" if enterprise_obj.dengl == '1' else
"中国500强" if enterprise_obj.isfive == '1' else "中国500强" if enterprise_obj.isfive == '1' else
......
...@@ -871,8 +871,8 @@ def get_collect(): ...@@ -871,8 +871,8 @@ def get_collect():
"high_new": '高新技术企业' if i.high_new == '1' else '', "high_new": '高新技术企业' if i.high_new == '1' else '',
"tbe": '科技型中小企业' if i.tbe == '1' else '', "tbe": '科技型中小企业' if i.tbe == '1' else '',
"quoted_company": '上市企业' if i.quoted_company == '1' else '', "quoted_company": '上市企业' if i.quoted_company == '1' else '',
"sxmon": '山西民营100强' if i.sxmon == '1' else '', "sxmon": '民营100强' if i.sxmon == '1' else '',
"zjtg": '山西专精特新企业' if i.zjtg == '1' else '', "zjtg": '专精特新企业' if i.zjtg == '1' else '',
"unicorn": '独角兽企业' if i.unicorn == '1' else '', "unicorn": '独角兽企业' if i.unicorn == '1' else '',
"dengl": '瞪羚企业' if i.dengl == '1' else '', "dengl": '瞪羚企业' if i.dengl == '1' else '',
"isfive": '中国500强' if i.isfive == '1' else '', "isfive": '中国500强' if i.isfive == '1' else '',
...@@ -891,8 +891,8 @@ def get_collect(): ...@@ -891,8 +891,8 @@ def get_collect():
"high_new": '高新技术企业' if i.high_new == '1' else '', "high_new": '高新技术企业' if i.high_new == '1' else '',
"tbe": '科技型中小企业' if i.tbe == '1' else '', "tbe": '科技型中小企业' if i.tbe == '1' else '',
"quoted_company": '上市企业' if i.quoted_company == '1' else '', "quoted_company": '上市企业' if i.quoted_company == '1' else '',
"sxmon": '山西民营100强' if i.sxmon == '1' else '', "sxmon": '民营100强' if i.sxmon == '1' else '',
"zjtg": '山西专精特新企业' if i.zjtg == '1' else '', "zjtg": '专精特新企业' if i.zjtg == '1' else '',
"unicorn": '独角兽企业' if i.unicorn == '1' else '', "unicorn": '独角兽企业' if i.unicorn == '1' else '',
"dengl": '瞪羚企业' if i.dengl == '1' else '', "dengl": '瞪羚企业' if i.dengl == '1' else '',
"isfive": '中国500强' if i.isfive == '1' else '', "isfive": '中国500强' if i.isfive == '1' else '',
...@@ -927,8 +927,8 @@ def get_collect(): ...@@ -927,8 +927,8 @@ def get_collect():
"high_new": '高新技术企业' if i.high_new == '1' else '', "high_new": '高新技术企业' if i.high_new == '1' else '',
"tbe": '科技型中小企业' if i.tbe == '1' else '', "tbe": '科技型中小企业' if i.tbe == '1' else '',
"quoted_company": '上市企业' if i.quoted_company == '1' else '', "quoted_company": '上市企业' if i.quoted_company == '1' else '',
"sxmon": '山西民营100强' if i.sxmon == '1' else '', "sxmon": '民营100强' if i.sxmon == '1' else '',
"zjtg": '山西专精特新企业' if i.zjtg == '1' else '', "zjtg": '专精特新企业' if i.zjtg == '1' else '',
"unicorn": '独角兽企业' if i.unicorn == '1' else '', "unicorn": '独角兽企业' if i.unicorn == '1' else '',
"dengl": '瞪羚企业' if i.dengl == '1' else '', "dengl": '瞪羚企业' if i.dengl == '1' else '',
"isfive": '中国500强' if i.isfive == '1' else '', "isfive": '中国500强' if i.isfive == '1' else '',
...@@ -948,8 +948,8 @@ def get_collect(): ...@@ -948,8 +948,8 @@ def get_collect():
"high_new": '高新技术企业' if i.high_new == '1' else '', "high_new": '高新技术企业' if i.high_new == '1' else '',
"tbe": '科技型中小企业' if i.tbe == '1' else '', "tbe": '科技型中小企业' if i.tbe == '1' else '',
"quoted_company": '上市企业' if i.quoted_company == '1' else '', "quoted_company": '上市企业' if i.quoted_company == '1' else '',
"sxmon": '山西民营100强' if i.sxmon == '1' else '', "sxmon": '民营100强' if i.sxmon == '1' else '',
"zjtg": '山西专精特新企业' if i.zjtg == '1' else '', "zjtg": '专精特新企业' if i.zjtg == '1' else '',
"unicorn": '独角兽企业' if i.unicorn == '1' else '', "unicorn": '独角兽企业' if i.unicorn == '1' else '',
"dengl": '瞪羚企业' if i.dengl == '1' else '', "dengl": '瞪羚企业' if i.dengl == '1' else '',
"isfive": '中国500强' if i.isfive == '1' else '', "isfive": '中国500强' if i.isfive == '1' else '',
......
...@@ -458,14 +458,14 @@ def company_detail(): ...@@ -458,14 +458,14 @@ def company_detail():
'融资企业' if company_obj.fianacing == '1' else '', '融资企业' if company_obj.fianacing == '1' else '',
'上市企业' if company_obj.quoted_company == '1' else '', '上市企业' if company_obj.quoted_company == '1' else '',
'专利企业' if company_obj.patent == '1' else '', '专利企业' if company_obj.patent == '1' else '',
'山西民营100强' if company_obj.sxmon == '1' else '', '民营100强' if company_obj.sxmon == '1' else '',
'山西专精特新企业' if company_obj.zjtg == '1' else '', '专精特新企业' if company_obj.zjtg == '1' else '',
'国家级专精特新小巨人企业' if company_obj.zjtg_gjjxjr == '1' else '', '国家级专精特新小巨人企业' if company_obj.zjtg_gjjxjr == '1' else '',
'省级专精特新小巨人企业' if company_obj.zjtg_sjxjr == '1' else '', '省级专精特新小巨人企业' if company_obj.zjtg_sjxjr == '1' else '',
'独角兽企业' if company_obj.unicorn == '1' else '', '独角兽企业' if company_obj.unicorn == '1' else '',
'瞪羚企业' if company_obj.dengl == '1' else '', '瞪羚企业' if company_obj.dengl == '1' else '',
'中国500强' if company_obj.isfive == '1' else '', '中国500强' if company_obj.isfive == '1' else '',
'山西100强' if company_obj.sxonhun == '1' else '', '100强' if company_obj.sxonhun == '1' else '',
'规模以上企业' if company_obj.scale == '1' else '', '规模以上企业' if company_obj.scale == '1' else '',
'限额以上服务业' if company_obj.serve == '1' else '', '限额以上服务业' if company_obj.serve == '1' else '',
'链主企业' if company_obj.chain_master == '1' else '' '链主企业' if company_obj.chain_master == '1' else ''
......
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