Commit fa4970f7 by 赵宇

fix

parent 5d0ea281
......@@ -26,32 +26,35 @@ def get_all_enterprise():
return jsonify(code=RET.PARAMERR, msg="参数不完整")
try:
enterprise_all_counts = len(Enterprise.query.all())
# print(enterprise_all_counts)
enterprise_list = Enterprise.query.paginate(page, perpage).items
# counts = len(enterprise_list)
# print(enterprise_list)
if enterprise_list:
data = [{"id": enterprise.id,
"company": enterprise.company_name, # 企业名
"area": enterprise.city + enterprise.district,
"createtime": enterprise.build_date,
"legal": enterprise.legal,
"capital": enterprise.capital,
"entype": enterprise.entype,
"address": enterprise.address,
"telephone": enterprise.telephone,
"fianacing": '融资企业' if enterprise.fianacing == "1" else '',
"quoted_company": '上市企业' if enterprise.quoted_company == "1" else '',
"high_new": '高新技术企业' if enterprise.high_new == '1' else "-",
"tbe": '科技型中小企业' if enterprise.tbe == '1' else "-",
"quoted_enterprise": '上市企业' if enterprise.quoted_company == '1' else "-",
"unicorn": '独角兽企业' if enterprise.unicorn == '1' else "-",
"dengl": '瞪羚' if enterprise.dengl == '1' else "-",
"isfive": '中国500强' if enterprise.isfive == '1' else "-",
"zjtg": '专精特新企业' if enterprise.zjtg == '1' else "-",
"zjtg_gjjxjr": '国家级专精特新小巨人企业' if enterprise.zjtg_gjjxjr == '1' else "-",
"zjtg_sjxjr": '省级专精特新小巨人企业' if enterprise.zjtg_sjxjr == '1' else "-",
"tbe_sjmy": '省级民营科技企业' if enterprise.tbe_sjmy == '1' else "-",
} for enterprise in enterprise_list]
data = {"data": [{"id": enterprise.id,
"company": enterprise.company_name, # 企业名
"area": enterprise.city + enterprise.district,
"createtime": enterprise.build_date,
"legal": enterprise.legal,
"capital": enterprise.capital,
"entype": enterprise.entype,
"address": enterprise.address,
"telephone": enterprise.telephone,
"fianacing": '融资企业' if enterprise.fianacing == "1" else '',
"quoted_company": '上市企业' if enterprise.quoted_company == "1" else '',
"high_new": '高新技术企业' if enterprise.high_new == '1' else "",
"tbe": '科技型中小企业' if enterprise.tbe == '1' else "",
"quoted_enterprise": '上市企业' if enterprise.quoted_company == '1' else "",
"unicorn": '独角兽企业' if enterprise.unicorn == '1' else "",
"dengl": '瞪羚' if enterprise.dengl == '1' else "",
"isfive": '中国500强' if enterprise.isfive == '1' else "",
"zjtg": '专精特新企业' if enterprise.zjtg == '1' else "",
"zjtg_gjjxjr": '国家级专精特新小巨人企业' if enterprise.zjtg_gjjxjr == '1' else "",
"zjtg_sjxjr": '省级专精特新小巨人企业' if enterprise.zjtg_sjxjr == '1' else "",
"tbe_sjmy": '省级民营科技企业' if enterprise.tbe_sjmy == '1' else "",
} for enterprise in enterprise_list], "size": enterprise_all_counts}
else:
return jsonify(code=RET.NODATA, msg="查无数据")
except Exception as e:
......
......@@ -406,7 +406,8 @@ def industry_policy():
"""产业政策数据"""
req_dict = request.get_json()
inid = req_dict.get("inid") # 行业id
industry_level = req_dict.get("industry_level") # 行业等级,(父行业高端设备等五个为"1",子行业为"2")
industry_level = req_dict.get("industry_level") # 行业等级,(父行业高端设备等五个为1,子行业为2)
policy_level = req_dict.get("policy_level") # 政策等级,(国家级为1,省级为2,市级为3,区县为4,开发区为5)
page = req_dict.get("page") # 分页页码
perpage = req_dict.get("perpage") # 分页大小
......@@ -417,15 +418,49 @@ def industry_policy():
indu_policy = ''
size = ''
name = Industry.query.filter_by(nid=inid).first().oname # 获取导航对应的真名
print(name)
if industry_level == 1:
indu_policy = InduPolicy.query.filter(InduPolicy.navigator.like("%{}%".format(name)))
size = indu_policy.count() # 分页总数
indu_policy = indu_policy.paginate(page, perpage).items
if policy_level == 1: # 国家级
indu_policy = InduPolicy.query.filter(InduPolicy.navigator.like("%{}%".format(name)), InduPolicy.level=="国家级")
size = indu_policy.count() # 分页总数
indu_policy = indu_policy.paginate(page, perpage).items
if policy_level == 2: # 省级
indu_policy = InduPolicy.query.filter(InduPolicy.navigator.like("%{}%".format(name)), InduPolicy.level=="省级")
size = indu_policy.count() # 分页总数
indu_policy = indu_policy.paginate(page, perpage).items
if policy_level == 3: # 市级
indu_policy = InduPolicy.query.filter(InduPolicy.navigator.like("%{}%".format(name)), InduPolicy.level=="市级")
size = indu_policy.count() # 分页总数
indu_policy = indu_policy.paginate(page, perpage).items
if policy_level == 4: # 区县
indu_policy = InduPolicy.query.filter(InduPolicy.navigator.like("%{}%".format(name)), InduPolicy.level=="区县")
size = indu_policy.count() # 分页总数
indu_policy = indu_policy.paginate(page, perpage).items
if policy_level == 5: # 开发区
indu_policy = InduPolicy.query.filter(InduPolicy.navigator.like("%{}%".format(name)), InduPolicy.level=="开发区")
size = indu_policy.count() # 分页总数
indu_policy = indu_policy.paginate(page, perpage).items
if industry_level == 2:
indu_policy = InduPolicy.query.filter(InduPolicy.navigat.like("%{}%".format(name)))
size = indu_policy.count() # 分页总数
indu_policy = indu_policy.paginate(page, perpage).items
if policy_level == 1: # 国家级
indu_policy = InduPolicy.query.filter(InduPolicy.navigat.like("%{}%".format(name)), InduPolicy.level=="国家级")
size = indu_policy.count() # 分页总数
indu_policy = indu_policy.paginate(page, perpage).items
if policy_level == 2: # 省级
indu_policy = InduPolicy.query.filter(InduPolicy.navigat.like("%{}%".format(name)), InduPolicy.level=="省级")
size = indu_policy.count() # 分页总数
indu_policy = indu_policy.paginate(page, perpage).items
if policy_level == 3: # 市级
indu_policy = InduPolicy.query.filter(InduPolicy.navigat.like("%{}%".format(name)), InduPolicy.level=="市级")
size = indu_policy.count() # 分页总数
indu_policy = indu_policy.paginate(page, perpage).items
if policy_level == 4: # 区县
indu_policy = InduPolicy.query.filter(InduPolicy.navigat.like("%{}%".format(name)), InduPolicy.level=="区县")
size = indu_policy.count() # 分页总数
indu_policy = indu_policy.paginate(page, perpage).items
if policy_level == 5: # 开发区
indu_policy = InduPolicy.query.filter(InduPolicy.navigat.like("%{}%".format(name)), InduPolicy.level=="开发区")
size = indu_policy.count() # 分页总数
indu_policy = indu_policy.paginate(page, perpage).items
except Exception as e:
current_app.logger.error(e)
return jsonify(code=RET.DBERR, msg="数据库查询错误")
......
......@@ -112,29 +112,32 @@ def menu():
count_all = company.count()
if count_all == 0:
count_all = 1
count_mcq = company.filter_by(f_type=1).count() # 煤层气
count_gjd = company.filter_by(f_type=3).count() # 光机电
count_mtmhg = company.filter_by(f_type=4).count() # 煤炭煤化工
count_gtzz = company.filter_by(f_type=2).count() # 钢铁铸造
count_qyly = company.filter_by(f_type=5).count() # 文旅康养
# count_xdfu = company.filter_by(f_type=6).count() # 现代服务业
# count_qt = count_all - count_mcq - count_gjd - count_mtmhg - count_gtzz - count_qyly - count_xdfu
count_qt = count_all - count_mcq - count_gjd - count_mtmhg - count_gtzz - count_qyly
mcq = int(count_mcq / count_all * 100)
count_ctys = company.filter_by(f_type=1).count() # 传统优势产业集群
count_gjd = company.filter_by(f_type=2).count() # 光机电产业集群
count_mcq = company.filter_by(f_type=3).count() # 煤层气产业集群
count_wlky = company.filter_by(f_type=4).count() # 文旅康养产业集群
count_xdfw = company.filter_by(f_type=5).count() # 现代服务业产业集群
count_szjj = company.filter_by(f_type=6).count() # 数字经济产业集群
count_qt = count_all - count_mcq - count_gjd - count_wlky - count_xdfw - count_szjj
ctys = int(count_ctys / count_all * 100)
gjd = int(count_gjd / count_all * 100)
mtmhg = int(count_mtmhg / count_all * 100)
gtzz = int(count_gtzz / count_all * 100)
qyly = int(count_qyly / count_all * 100)
mcq = int(count_mcq / count_all * 100)
wlky = int(count_wlky / count_all * 100)
xdfw = int(count_xdfw / count_all * 100)
szjj = int(count_szjj / count_all * 100)
# xdfu = int(count_xdfu / count_all * 100)
# qt = 100 - mcq - gjd - mtmhg - gtzz - qyly - xdfu
qt = 100 - mcq - gjd - mtmhg - gtzz - qyly
qt = 100 - ctys - gjd - mcq - wlky - xdfw - szjj
# 产业结构分布
industry = [
{"per": mcq, "name": "煤层气", "count": count_mcq}, # {百分比,value}
{"per": gjd, "name": "光机电", "count": count_gjd},
{"per": mtmhg, "name": "煤炭煤化工", "count": count_mtmhg},
{"per": gtzz, "name": "钢铁铸造", "count": count_gtzz},
{"per": qyly, "name": "文旅康养", "count": count_qyly},
{"per": ctys, "name": "传统优势产业集群", "count": count_ctys}, # {百分比,value}
{"per": gjd, "name": "光机电产业集群", "count": count_gjd},
{"per": mcq, "name": "煤层气产业集群", "count": count_mcq},
{"per": wlky, "name": "文旅康养产业集群", "count": count_wlky},
{"per": xdfw, "name": "现代服务业产业集群", "count": count_xdfw},
{"per": szjj, "name": "数字经济产业集群", "count": count_szjj},
{"per": qt, "name": "其他", "count": count_qt},
]
......@@ -152,7 +155,7 @@ def menu():
return jsonify(code=RET.DBERR, msg="数据库错误")
# 招商引资作战图、项目数量/金额分布图
# 招商引资作战图、已开工项目产业分布/已开工项目到位资金产业分布
@api_attract.route("/project", methods=["POST"])
def project():
req_dict = request.get_json()
......@@ -225,8 +228,8 @@ def project():
data = {
"project_map": project_map, # 招商引资作战图
"industry_nums": industry_nums, # 已签约项目数量产业分布图
"industry_money": industry_money, # 已签约项目投资金额产业分布图
"industry_nums": industry_nums, # 已开工项目产业分布
"industry_money": industry_money, # 已开工项目产业分布
}
return jsonify(code=RET.OK, msg="获取成功", data=data)
......@@ -444,18 +447,21 @@ def showListb():
data = [{
"id": i.id,
"name": i.company_name,
"industry": i.company_industry if i.company_industry else "-",
"product": i.product if i.product else "-",
"build_date": "-",
"capital": i.capital if i.capital else "-",
"isfive": "500强企业" if i.isfive == "1" else "",
"quoted_company": i.public_sector if i.public_sector != "空" else "",
"industry": i.company_industry if i.company_industry else "",
"product": i.product if i.product else "",
"build_date": "",
"capital": i.capital if i.capital else "",
"isfive": "中国500强企业" if i.isfive == "1" else "",
"quoted_company": "上市企业" if i.public_sector != "空" 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 "",
"tbe": "科技型中小企业" if i.tbe == "1" else "",
"dengl": "瞪羚企业" if i.dengl == "1" else "",
"unicorn": "独角兽企业" if i.unicorn == "1" else "",
"zjtg_gjjxjr": '国家级专精特新小巨人企业' if i.zjtg_gjjxjr == '1' else "",
"zjtg_sjxjr": '省级专精特新小巨人企业' if i.zjtg_sjxjr == '1' else "",
"tbe_sjmy": '省级民营科技企业' if i.tbe_sjmy == '1' else "",
} for i in company]
data = {"data_list": data, "size": size}
return jsonify(code=RET.OK, msg="查找成功", data=data)
......@@ -536,14 +542,13 @@ def company_detail():
"quoted_company": '上市企业' if company.quoted_company == '1' else "",
# "patent": '专利企业' if company.patent == '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 "",
"zjtg": '山西专精特新企业' if company.zjtg == '1' else "",
"zjtg_gjjxjr": '国家级专精特新小巨人企业' if company.zjtg_gjjxjr == '1' else "",
"zjtg_sjxjr": '省级专精特新小巨人企业' if company.zjtg_sjxjr == '1' else "",
"tbe_sjmy": '省级民营科技企业' if company.tbe_sjmy == '1' else "",
"scale": '规模以上企业' if company.tbe_sjmy == '1' else "",
},
# 经营状况数据封装
"select2_info": {
......@@ -696,43 +701,42 @@ def enterprise_detail():
if enterprise:
data = {"select1_info": {"id": enterprise.id,
"enterprise_name": enterprise.company_name, # 企业名
"telephone": enterprise.telephone if enterprise.telephone else "-", # 电话
"web_site": enterprise.web_site if enterprise.web_site else "-", # 网址
"email": enterprise.email if enterprise.email else "-", # 邮箱
"address": enterprise.address if enterprise.address else "-", # 地址
"jwd": {"lng": enterprise.lng if enterprise.lng else "-", # 经度
"lat": enterprise.lat if enterprise.lat else "-"}, # 维度
"enterprise_info": enterprise.company_info if enterprise.company_info else "-", # 企业信息
"business_scope": enterprise.business_scope if enterprise.business_scope else "-",
"telephone": enterprise.telephone if enterprise.telephone else "", # 电话
"web_site": enterprise.web_site if enterprise.web_site else "", # 网址
"email": enterprise.email if enterprise.email else "", # 邮箱
"address": enterprise.address if enterprise.address else "", # 地址
"jwd": {"lng": enterprise.lng if enterprise.lng else "", # 经度
"lat": enterprise.lat if enterprise.lat else ""}, # 维度
"enterprise_info": enterprise.company_info if enterprise.company_info else "", # 企业信息
"business_scope": enterprise.business_scope if enterprise.business_scope else "",
# 经营范围
# "high_new": "高新技术企业" if enterprise.high_new else "-", # 高新技术企业
"legal": enterprise.legal if enterprise.legal else "-", # 法定代表人
"status": enterprise.status if enterprise.status else "-", # 状态
"build_date": str(enterprise.build_date)[:10] if enterprise.build_date else "-", # 创建时间
"capital": enterprise.capital if enterprise.capital else "-", # 注册资本
"social_code": enterprise.social_code if enterprise.social_code else "-", # 统一社会信用代码
# "taking": enterprise.takingn if enterprise.takingn else "-", # 营收 (万元)
"bao": enterprise.bao_num if enterprise.bao_num else "-", # 参保人数
"entype": enterprise.entype if enterprise.entype else "-", # 企业类型
"industry": enterprise.company_industry if enterprise.company_industry else "-", # 所属行业
"scope": enterprise.business_scope if enterprise.business_scope else "-", # 企业经营范围
# "collect": "1",
# "choice": "3"
"tax_code": enterprise.tax_code if enterprise.tax_code else "-",
"register_code": enterprise.register_code if enterprise.register_code else "-",
"high_new": '高新技术企业' if enterprise.high_new == '1' else "-",
"tbe": '科技型中小企业' if enterprise.tbe == '1' else "-",
# "fianacing": '融资企业' if enterprise.fianacing == '1'' else "-",
"quoted_enterprise": '上市企业' if enterprise.quoted_company == '1' else "-",
# "patent": '专利企业' if enterprise.patent == '1'' else "-",
"unicorn": '独角兽企业' if enterprise.unicorn == '1' else "-",
"dengl": '瞪羚' if enterprise.dengl == '1' else "-",
"isfive": '中国500强' if enterprise.isfive == '1' else "-",
"zjtg": '专精特新企业' if enterprise.zjtg == '1' else "-",
"zjtg_gjjxjr": '国家级专精特新小巨人企业' if enterprise.zjtg_gjjxjr == '1' else "-",
"zjtg_sjxjr": '省级专精特新小巨人企业' if enterprise.zjtg_sjxjr == '1' else "-",
"tbe_sjmy": '省级民营科技企业' if enterprise.tbe_sjmy == '1' else "-",
# "high_new": "高新技术企业" if enterprise.high_new else "", # 高新技术企业
"legal": enterprise.legal if enterprise.legal else "", # 法定代表人
"status": enterprise.status if enterprise.status else "", # 状态
"build_date": str(enterprise.build_date)[:10] if enterprise.build_date else "", # 创建时间
"capital": enterprise.capital if enterprise.capital else "", # 注册资本
"social_code": enterprise.social_code if enterprise.social_code else "", # 统一社会信用代码
# "taking": enterprise.takingn if enterprise.takingn else "", # 营收 (万元)
"bao": enterprise.bao_num if enterprise.bao_num else "", # 参保人数
"entype": enterprise.entype if enterprise.entype else "", # 企业类型
"industry": enterprise.company_industry if enterprise.company_industry else "", # 所属行业
"scope": enterprise.business_scope if enterprise.business_scope else "", # 企业经营范围
"tax_code": enterprise.tax_code if enterprise.tax_code else "",
"register_code": enterprise.register_code if enterprise.register_code else "",
"high_new": '高新技术企业' if enterprise.high_new == '1' else "",
"tbe": '科技型中小企业' if enterprise.tbe == '1' else "",
# "fianacing": '融资企业' if enterprise.fianacing == '1'' else "",
"quoted_enterprise": '上市企业' if enterprise.quoted_company == '1' else "",
# "patent": '专利企业' if enterprise.patent == '1'' else "",
"unicorn": '独角兽企业' if enterprise.unicorn == '1' else "",
"dengl": '瞪羚' if enterprise.dengl == '1' else "",
"isfive": '中国500强' if enterprise.isfive == '1' else "",
"zjtg": '专精特新企业' if enterprise.zjtg == '1' else "",
"zjtg_gjjxjr": '国家级专精特新小巨人企业' if enterprise.zjtg_gjjxjr == '1' else "",
"zjtg_sjxjr": '省级专精特新小巨人企业' if enterprise.zjtg_sjxjr == '1' else "",
"tbe_sjmy": '省级民营科技企业' if enterprise.tbe_sjmy == '1' else "",
},
# 经营状况数据封装
"select2_info": {
......
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