Commit 39c464bd by dong

fix

parent 618da54c
...@@ -455,7 +455,7 @@ def get_enterprise_num(product, inid): ...@@ -455,7 +455,7 @@ def get_enterprise_num(product, inid):
return company, size return company, size
全国企业列表 # 全国企业列表
@api_map.route('/AttractEnterprise', methods=['POST']) @api_map.route('/AttractEnterprise', methods=['POST'])
def attract_enterprise(): def attract_enterprise():
''' '''
...@@ -579,301 +579,151 @@ def attract_enterprise(): ...@@ -579,301 +579,151 @@ def attract_enterprise():
# 全国企业列表(Es) # 全国企业列表(Es)
# @api_map.route('/AttractEnterprise', methods=['POST']) @api_map.route('/AttractEnterpriseEs', methods=['POST'])
# def attract_enterprise(): def attract_enterprise_es():
# 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") # 产业产品名称筛选
# entype = req_dict.get("entype") # 企业类型id entype = req_dict.get("entype") # 企业类型id
# qualificat = req_dict.get("qualificat") # 企业资质id qualificat = req_dict.get("qualificat") # 企业资质id
# quoted = req_dict.get("quoted") # 上市板块(A股,1)(创业股,2)(港股,3)(新三股,4)(新四股,5)(中小板,6) quoted = req_dict.get("quoted") # 上市板块(A股,1)(创业股,2)(港股,3)(新三股,4)(新四股,5)(中小板,6)
# product = req_dict.get("product") # 产业产品选择 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 entype:
# args_term['entype'] = entype
#
# if quoted:
# args_term['public_id'] = quoted
#
# if qualificat:
# if qualificat == "中国500强":
# args_term['isfive'] = 1
# if qualificat == "上市企业":
# args_term['quoted_company'] = 1
# if qualificat == "独角兽企业":
# 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['zjtx'] = 1
# if qualificat == "外资企业":
# args_term['foreign_investment'] = 1
#
# # 省
# if province:
# args_term['province'] = province
# # 市
# if city:
# args_term['city'] = city
# # 区
# if district:
# args_term['district'] = district
#
# body = create_body(page, perpage, args_query, args_term)
# if not company_name:
# del body["query"]["bool"]["must"][0]
#
# if inid in range(1, 9) and not product:
# f_c_type = {
# "multi_match": {
# "query": inid,
# "fields": ["f_type", "f_type1", "f_type2"]
# }
# }
# body["query"]["bool"]["must"].append(f_c_type)
# elif inid 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)
# else:
# pass
#
# if product:
# product = {
# "multi_match": {
# "query": product,
# "fields": ["product_all", "product_all1", "product_all2"]
# }
# }
# body["query"]["bool"]["must"].append(product)
#
# try:
# es = Elasticsearch([{'host': '39.100.39.50', 'port': 9200}])
#
# data = es.search(index="mancheng_enterperise", body=body)
# df = []
# size = data["hits"]['total']
#
# # 数据的列表添加进去
# for i in data["hits"]['hits']:
# if company_name:
# # 判断高亮,然后添加
# df.append({
# "id": i["_source"]["mysql_id"],
# "company_name": i["highlight"]["company_name"][0] if "company_name" in i["highlight"] else i["_source"][
# "company_name"],
# "aptitude": list(filter(None, [
# "中国500强" if i["_source"]["isfive"] == '1' else '',
# "上市企业" if i["_source"]["quoted_company"] == "1" else '',
# "独角兽企业" if i["_source"]["unicorn"] == "1" else '',
# "瞪羚企业" if i["_source"]["dengl"] == "1" else '',
# "规上企业" if i["_source"]["scale"] == "1" else '',
# "科技型中小企业" if i["_source"]["tbe"] == "1" else '',
# "高新技术企业" if i["_source"]["high_new"] == "1" else '',
# "专精特新企业" if i["_source"]["zjtx"] == "1" else '',
# "外资企业" if i["_source"]["foreign_investment"] == "1" else '']))})
#
# else:
# df.append({
# "id": i["_source"]["mysql_id"],
# "company_name": i["_source"]["company_name"],
# "aptitude": list(filter(None, [
# "中国500强" if i["_source"]["isfive"] == '1' else '',
# "上市企业" if i["_source"]["quoted_company"] == "1" else '',
# "独角兽企业" if i["_source"]["unicorn"] == "1" else '',
# "瞪羚企业" if i["_source"]["dengl"] == "1" else '',
# "规上企业" if i["_source"]["scale"] == "1" else '',
# "科技型中小企业" if i["_source"]["tbe"] == "1" else '',
# "高新技术企业" if i["_source"]["high_new"] == "1" else '',
# "专精特新企业" if i["_source"]["zjtx"] == "1" else '',
# "外资企业" if i["_source"]["foreign_investment"] == "1" else '']))})
#
# except Exception as e:
# current_app.logger.error(e)
# return jsonify(code=RET.DBERR, msg="es数据库错误")
# data = {"size": size, "df": df}
# return jsonify(code=RET.OK, msg="查找成功", data=data)
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="参数不完整")
# # 全国企业列表(Es) # 页数
# @api_map.route('/AttractEnterpriseEs', methods=['POST']) if not page:
# def attract_enterprise_es(): page = 1
# req_dict = request.get_json() page = int(page)
# inid = req_dict.get("inid") # 行业id page = (page - 1) * perpage
# company_name = req_dict.get("company_name") # 产业产品名称筛选
# entype = req_dict.get("entype") # 企业类型id args_query = dict() # 查询字段
# qualificat = req_dict.get("qualificat") # 企业资质id args_term = dict() # 条件字典
# quoted = req_dict.get("quoted") # 上市板块(A股,1)(创业股,2)(港股,3)(新三股,4)(新四股,5)(中小板,6)
# product = req_dict.get("product") # 产业产品选择 args_query["company_name"] = "公司"
# # 搜索框
# area = req_dict.get("area") # ["省","市","区"] if company_name:
# province = area[0] args_query["company_name"] = company_name
# city = area[1]
# district = area[2] if inid:
# page = req_dict.get("page") # 分页页码 args_term['c_type'] = inid
# perpage = req_dict.get("perpage") # 分页大小
# if not all([page, perpage]): if entype:
# return jsonify(code=RET.PARAMERR, msg="参数不完整") args_term['entype'] = entype
#
# # 页数 if quoted:
# if not page: args_term['public_id'] = quoted
# page = 1
# page = int(page) if product:
# page = (page - 1) * perpage args_term['product'] = product
# # 公司资质
# args_query = dict() # 查询字段 if qualificat:
# args_term = dict() # 条件字典 if qualificat == 1:
# args_term['isfive'] = 1
# args_query["company_name"] = "公司" if qualificat == 2:
# # 搜索框 args_term['quoted_company'] = 1
# if company_name: if qualificat == 3:
# args_query["company_name"] = company_name args_term['fianacing'] = 1
# if qualificat == 4:
# if inid: args_term['high_new'] = 1
# args_term['c_type'] = inid if qualificat == 5:
# args_term['tbe'] = 1
# if entype: if qualificat == 6:
# args_term['entype'] = entype args_term['dengl'] = 1
# if qualificat == 7:
# if quoted: args_term['unicorn'] = 1
# args_term['public_id'] = quoted # 省
# if province:
# if product: args_term['province'] = province
# args_term['product'] = product # 市
# # 公司资质 if city:
# if qualificat: args_term['city'] = city
# if qualificat == 1: # 区
# args_term['isfive'] = 1 if district:
# if qualificat == 2: args_term['district'] = district
# args_term['quoted_company'] = 1
# if qualificat == 3: # # 成立时间
# args_term['fianacing'] = 1 # if yearid:
# if qualificat == 4: # args_term['yearid'] = yearid
# args_term['high_new'] = 1 # # 融资轮次
# if qualificat == 5: # if roundid:
# args_term['tbe'] = 1 # args_term['roundid'] = roundid
# if qualificat == 6: # # 企业状态
# args_term['dengl'] = 1 # if status:
# if qualificat == 7: # args_term['status'] = status
# args_term['unicorn'] = 1 # # 企业规模
# # 省 # if scale_range:
# if province: # args_term['scale_range'] = scale_range
# args_term['province'] = province # # 公司类型
# # 市 # if entypeid:
# if city: # args_term['entypeid'] = entypeid
# args_term['city'] = city
# # 区 body = create_body(page, perpage, args_query, args_term)
# if district: if not company_name:
# args_term['district'] = district del body["query"]["bool"]["must"][0]
#
# # # 成立时间 try:
# # if yearid: es = Elasticsearch([{'host': '39.100.39.50', 'port': 9200}])
# # args_term['yearid'] = yearid
# # # 融资轮次 # data = es.search(index="jincheng_pictext_index_202301131004_a6181e52", body=body)
# # if roundid: data = es.search(index="jincheng_pictext_index_202303161620_76c624b8", body=body)
# # args_term['roundid'] = roundid data_list = []
# # # 企业状态 # print(data_list)
# # if status: size = data["hits"]['total']
# # args_term['status'] = status
# # # 企业规模 # 数据的列表添加进去
# # if scale_range: for i in data["hits"]['hits']:
# # args_term['scale_range'] = scale_range if company_name:
# # # 公司类型 # 判断高亮,然后添加
# # if entypeid: data_list.append({
# # args_term['entypeid'] = entypeid "id": i["_source"]["mysql_id"],
# "company": i["highlight"]["company_name"][0] if "company_name" in i["highlight"] else i["_source"][
# body = create_body(page, perpage, args_query, args_term) "company_name"],
# if not company_name: "area": i["_source"]["province"] + i["_source"]["city"] + i["_source"]["district"],
# del body["query"]["bool"]["must"][0] "createtime": i["_source"]["build_date"],
# "legal": i["_source"]["legal"],
# try: "capital": i["_source"]["capital"],
# es = Elasticsearch([{'host': '39.100.39.50', 'port': 9200}]) "entype": i["_source"]["entype"],
# "address": i["_source"]["address"],
# # data = es.search(index="jincheng_pictext_index_202301131004_a6181e52", body=body) "telephone": i["_source"]["telephone"],
# data = es.search(index="jincheng_pictext_index_202303161620_76c624b8", body=body) "high_new": '高新技术企业' if i["_source"]["high_new"] == "1" else '',
# data_list = [] "tbe": '科技型中小企业' if i["_source"]["tbe"] == "1" else '',
# # print(data_list) "fianacing": '融资企业' if i["_source"]["fianacing"] == "1" else '',
# size = data["hits"]['total'] "quoted_company": '上市企业' if i["_source"]["quoted_company"] == "1" else '',
# "dengl": '瞪羚企业' if i["_source"]["dengl"] == "1" else '',
# # 数据的列表添加进去 "unicorn": '独角兽企业' if i["_source"]["unicorn"] == "1" else '',
# for i in data["hits"]['hits']: "isfive": '500强企业' if i["_source"]["isfive"] == '1' else '',
# if company_name: })
# # 判断高亮,然后添加 else:
# data_list.append({ data_list.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": i["_source"]["company_name"],
# "company_name"], "area": i["_source"]["province"] + i["_source"]["city"] + i["_source"]["district"],
# "area": i["_source"]["province"] + i["_source"]["city"] + i["_source"]["district"], "createtime": i["_source"]["build_date"],
# "createtime": i["_source"]["build_date"], "legal": i["_source"]["legal"],
# "legal": i["_source"]["legal"], "capital": i["_source"]["capital"],
# "capital": i["_source"]["capital"], "entype": i["_source"]["entype"],
# "entype": i["_source"]["entype"], "address": i["_source"]["address"],
# "address": i["_source"]["address"], "telephone": i["_source"]["telephone"],
# "telephone": i["_source"]["telephone"], "high_new": '高新技术企业' if i["_source"]["high_new"] == "1" else '',
# "high_new": '高新技术企业' if i["_source"]["high_new"] == "1" else '', "tbe": '科技型中小企业' if i["_source"]["tbe"] == "1" else '',
# "tbe": '科技型中小企业' if i["_source"]["tbe"] == "1" else '', "fianacing": '融资企业' if i["_source"]["fianacing"] == "1" else '',
# "fianacing": '融资企业' if i["_source"]["fianacing"] == "1" else '', "quoted_company": '上市企业' if i["_source"]["quoted_company"] == "1" else '',
# "quoted_company": '上市企业' if i["_source"]["quoted_company"] == "1" else '', "dengl": '瞪羚企业' if i["_source"]["dengl"] == "1" else '',
# "dengl": '瞪羚企业' if i["_source"]["dengl"] == "1" else '', "unicorn": '独角兽企业' if i["_source"]["unicorn"] == "1" else '',
# "unicorn": '独角兽企业' if i["_source"]["unicorn"] == "1" else '', "isfive": '500强企业' if i["_source"]["isfive"] == '1' else '',
# "isfive": '500强企业' if i["_source"]["isfive"] == '1' else '', })
# }) except Exception as e:
# else: current_app.logger.error(e)
# data_list.append({ return jsonify(code=RET.DBERR, msg="es数据库错误")
# "id": i["_source"]["mysql_id"], data = {
# "company": i["_source"]["company_name"], "data": data_list, "size": size
# "area": i["_source"]["province"] + i["_source"]["city"] + i["_source"]["district"], }
# "createtime": i["_source"]["build_date"], return jsonify(code=RET.OK, msg="查找成功", data=data)
# "legal": i["_source"]["legal"], \ No newline at end of file
# "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
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