Commit d0593b51 by dong

fix20230316

parent 5f2a1393
...@@ -686,7 +686,6 @@ def company_detail(): ...@@ -686,7 +686,6 @@ def company_detail():
except: except:
return jsonify(code=RET.SESSIONERR, msg="请重新登录!") return jsonify(code=RET.SESSIONERR, msg="请重新登录!")
# 校验参数完整性 # 校验参数完整性
if not all([id]): if not all([id]):
return jsonify(code=RET.PARAMERR, msg="参数不完整") return jsonify(code=RET.PARAMERR, msg="参数不完整")
...@@ -698,159 +697,59 @@ def company_detail(): ...@@ -698,159 +697,59 @@ def company_detail():
company_ids = [coms.id for coms in user.company] company_ids = [coms.id for coms in user.company]
else: else:
company_ids = [] company_ids = []
# 工商状况-查询行政许可数据
data_info1 = EnterpriseLicence.query.filter_by(ent_id=id).all()
# 工商状况-查询税务信用数据
data_info2 = EnterpriseTaxInfo.query.filter_by(ent_id=id).all()
# 工商状况-查询进出口信用数据
data_info3 = EnterpriseInoutInfo.query.filter_by(ent_id=id).all()
# 工商状况-查询供应商数据信息
data_info4 = EnterpriseSupplier.query.filter_by(ent_id=id).all()
# 工商状况-查询客户数据信息
data_info5 = EnterpriseClient.query.filter_by(ent_id=id).all()
# 企业风险-查询股权出质数据信息
data_info6 = EnterpriseEquity.query.filter_by(ent_id=id).all()
# 企业风险-查询股权质押数据信息
data_info7 = EnterpriseEquity.query.filter_by(ent_id=id).all()
# 企业风险-查询行政处罚数据信息
data_info8 = EnterprisePunish.query.filter_by(ent_id=id).all()
# 知识产权-查询专利信息数据信息
data_info9 = EnterprisePatent.query.filter_by(ent_id=id).all()
# 供应链图谱数据
# 供应链地图
supplier = CompanySupplier.query.filter_by(ent_id=id).all()
if company: if company:
province = company.province if company.province else "" province = company.province if company.province else ""
city = company.city if company.city else "" city = company.city if company.city else ""
if city == province: if city == province:
city = '' city = ''
district = company.district if company.district else "" district = company.district if company.district else ""
data = {"select1_info": {"id": company.id, data = {"id": company.id,
"name": company.company_name, # 企业名 "name": company.company_name, # 企业名
"telephone": company.telephone if company.telephone else "", # 电话 "telephone": company.telephone if company.telephone else "", # 电话
"web_site": company.web_site if company.web_site else "", # 网址 "web_site": company.web_site if company.web_site else "", # 网址
"email": company.email if company.email else "", # 邮箱 "email": company.email if company.email else "", # 邮箱
"address": company.address if company.address else "", # 地址 "address": company.address if company.address else "", # 地址
"collect": "1" if company.id in company_ids else "2", # 关注状态码1关注,2未关注 "collect": "1" if company.id in company_ids else "2", # 关注状态码1关注,2未关注
"choice": "1", # 1太原企业,2全国企业 "choice": "1", # 1太原企业,2全国企业
"location": province + city + district, "location": province + city + district,
"jwd": {"lng": company.lng if company.lng else "", # 经度 "jwd": {"lng": company.lng if company.lng else "", # 经度
"lat": company.lat if company.lat else ""}, # 维度 "lat": company.lat if company.lat else ""}, # 维度
"info": company.company_info if company.company_info else "", # 企业信息 "info": company.company_info if company.company_info else "", # 企业信息
"business_scope": company.business_scope if company.business_scope else "", "business_scope": company.business_scope if company.business_scope else "",
# 经营范围 # 经营范围
# "high_new": "高新技术企业" if company.high_new else "", # 高新技术企业 # "high_new": "高新技术企业" if company.high_new else "", # 高新技术企业
"legal": company.legal if company.legal else "", # 法定代表人 "legal": company.legal if company.legal else "", # 法定代表人
"status": company.status if company.status else "", # 状态 "status": company.status if company.status else "", # 状态
"build_date": str(company.build_date)[:10] if company.build_date else "", # 创建时间 "build_date": str(company.build_date)[:10] if company.build_date else "", # 创建时间
"capital": company.capital if company.capital else "", # 注册资本 "capital": company.capital if company.capital else "", # 注册资本
"social_code": company.social_code if company.social_code else "", # 统一社会信用代码 "social_code": company.social_code if company.social_code else "", # 统一社会信用代码
# "taking": company.takingn if company.takingn else "", # 营收 (万元) # "taking": company.takingn if company.takingn else "", # 营收 (万元)
"bao": company.bao_num if company.bao_num else "", # 参保人数 "bao": company.bao_num if company.bao_num else "", # 参保人数
"entype": company.entype if company.entype else "", # 企业类型 "entype": company.entype if company.entype else "", # 企业类型
"industry": company.company_industry if company.company_industry else "", # 所属行业 "industry": company.company_industry if company.company_industry else "", # 所属行业
"scope": company.business_scope if company.business_scope else "", # 企业经营范围 "scope": company.business_scope if company.business_scope else "", # 企业经营范围
# "collect": "1", # "collect": "1",
# "choice": "3" # "choice": "3"
"tax_code": company.tax_code if company.tax_code else "", "tax_code": company.tax_code if company.tax_code else "",
"register_code": company.register_code if company.register_code else "", "register_code": company.register_code if company.register_code else "",
"high_new": '高新技术企业' if company.high_new == '1' else "", "high_new": '高新技术企业' if company.high_new == '1' else "",
"tbe": '科技型中小企业' if company.tbe == '1' else "", "tbe": '科技型中小企业' if company.tbe == '1' else "",
# "fianacing": '融资企业' if company.fianacing == '1'' else "", # "fianacing": '融资企业' if company.fianacing == '1'' else "",
"quoted_company": '上市企业' if company.quoted_company == '1' else "", "quoted_company": '上市企业' if company.quoted_company == '1' else "",
# "patent": '专利企业' if company.patent == '1'' else "", # "patent": '专利企业' if company.patent == '1'' else "",
"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 "",
"scale": '规模以上企业' if company.scale == '1' else "", "scale": '规模以上企业' if company.scale == '1' else "",
"chain_master": '链主企业' if company.chain_master == '1' else "", "chain_master": '链主企业' if company.chain_master == '1' else "",
},
# 经营状况数据封装
"select2_info": {
"label1": [{
"label1_name": '行政许可',
"licence_no": data.licence_no,
"licence_name": data.licence_name,
"from_date": data.from_date,
"end_date": data.end_date,
"license_org": data.license_org,
"licence_content": data.licence_content,
"source": data.source} for data in data_info1 if data_info1],
"label2": [{
"label2_name": '税务信用',
"name": data.name,
"year": data.year,
"id_number": data.id_number,
"grade": data.grade,
"eval_department": data.eval_department,
"type": data.type,
"business_id": data.business_id} for data in data_info2 if data_info2],
"label3": [{
"label3_name": '进出口信用',
"customs_registered_address": data.customs_registered_address,
"management_category": data.management_category,
"record_date": data.record_date,
"industry_category": data.industry_category} for data in data_info3 if data_info3],
"label4": [{
"label4_name": '供应商',
"supplier_name": data.supplier_name,
"ratio": data.ratio,
"amount": data.amount,
"pub_date": data.pub_date,
"sources": data.sources,
"relation": data.relation} for data in data_info4 if data_info4],
"label5": [{
"label5_name": '客户',
"client_name": data.client_name,
"ratio": data.ratio,
"amount": data.amount,
"pub_date": data.pub_date,
"sources": data.sources,
"relation": data.relation} for data in data_info5 if data_info5],
"label6": [{
"label5_name": '行政处罚',
"pub_date": data.pub_date,
"punish_no": data.punish_no,
"punish_reason": data.punish_reason,
"punish_content": data.punish_content,
"punish_org": data.punish_org,
"sources": data.sources} for data in data_info7 if data_info7],
"label7": [{
"label5_name": '资质证书',
"start_date": data.start_date,
"type": data.type,
"cert_name": data.cert_name,
"cert_no": data.cert_no,
"end_date": data.end_date} for data in data_info8 if data_info8],
"label8": [{
"label1_name": '股权出质',
"reg_number": data.reg_number,
"pledgor": data.pledgor,
"target_company": data.target_company,
"pledgee": data.pledgee,
"amount": data.amount,
"pub_date": data.pub_date,
"status": data.status
} for data in data_info6 if data_info6],
"label9": [{
"label_name": '专利信息',
"name": data.name,
"type": data.type,
"status": data.status,
"apply_number": data.apply_number,
"apply_date": data.apply_date,
"pub_number": data.pub_number,
"pub_date": data.pub_date,
"inventor": data.inventor
} for data in data_info9 if data_info9]
}
} }
else: else:
return jsonify(code=RET.NODATA, msg="查无数据") return jsonify(code=RET.NODATA, msg="查无数据")
except Exception as e: except Exception as e:
...@@ -964,9 +863,11 @@ def get_enterprise_licence(): ...@@ -964,9 +863,11 @@ def get_enterprise_licence():
try: try:
enterprise = Enterprise.query.get(id) enterprise = Enterprise.query.get(id)
company_id = enterprise.company_id company_id = enterprise.company_id
if not company_id:
return jsonify(RET.NODATA, msg='无关联信息')
data_info1 = EnterpriseLicence.query.filter_by(ent_id=company_id).all() data_info1 = EnterpriseLicence.query.filter_by(ent_id=company_id).all()
if not data_info1: if not data_info1:
return jsonify(code=RET.PARAMERR, msg="行政许可无数据") return jsonify(code=RET.NODATA, msg="行政许可无数据")
data = [{ data = [{
"label1_name": '行政许可', "label1_name": '行政许可',
...@@ -1006,9 +907,11 @@ def get_enterprise_taxInfo(): ...@@ -1006,9 +907,11 @@ def get_enterprise_taxInfo():
try: try:
enterprise = Enterprise.query.get(id) enterprise = Enterprise.query.get(id)
company_id = enterprise.company_id company_id = enterprise.company_id
if not company_id:
return jsonify(RET.NODATA, msg='无关联信息')
data_info2 = EnterpriseTaxInfo.query.filter_by(ent_id=company_id).all() data_info2 = EnterpriseTaxInfo.query.filter_by(ent_id=company_id).all()
if not data_info2: if not data_info2:
return jsonify(code=RET.NODATA, msg="税务信用无数据") return jsonify(code=RET.NODATA, NODATA="税务信用无数据")
data = [{ data = [{
"label2_name": '税务信用', "label2_name": '税务信用',
...@@ -1048,10 +951,12 @@ def get_enterprise_inoutInfo(): ...@@ -1048,10 +951,12 @@ def get_enterprise_inoutInfo():
try: try:
enterprise = Enterprise.query.get(id) enterprise = Enterprise.query.get(id)
company_id = enterprise.company_id company_id = enterprise.company_id
if not company_id:
return jsonify(RET.NODATA, msg='无关联信息')
# 工商状况-查询行政许可数据 # 工商状况-查询行政许可数据
data_info3 = EnterpriseInoutInfo.query.filter_by(ent_id=company_id).all() data_info3 = EnterpriseInoutInfo.query.filter_by(ent_id=company_id).all()
if not data_info3: if data_info3:
return jsonify(code=RET.PARAMERR, msg="进出口信用无数据") return jsonify(code=RET.NODATA, msg="进出口信用无数据")
data = [{ data = [{
"label3_name": '进出口信用', "label3_name": '进出口信用',
"customs_registered_address": data.customs_registered_address, "customs_registered_address": data.customs_registered_address,
...@@ -1087,9 +992,11 @@ def get_enterprise_supplier(): ...@@ -1087,9 +992,11 @@ def get_enterprise_supplier():
try: try:
enterprise = Enterprise.query.get(id) enterprise = Enterprise.query.get(id)
company_id = enterprise.company_id company_id = enterprise.company_id
if not company_id:
return jsonify(RET.NODATA, msg='无关联信息')
data_info4 = EnterpriseSupplier.query.filter_by(ent_id=company_id).all() data_info4 = EnterpriseSupplier.query.filter_by(ent_id=company_id).all()
if not data_info4: if not data_info4:
return jsonify(code=RET.PARAMERR, msg="供应商无数据") return jsonify(code=RET.NODATA, msg="供应商无数据")
data = [{ data = [{
"label4_name": '供应商', "label4_name": '供应商',
"supplier_name": data.supplier_name, "supplier_name": data.supplier_name,
...@@ -1127,9 +1034,11 @@ def get_enterprise_client(): ...@@ -1127,9 +1034,11 @@ def get_enterprise_client():
try: try:
enterprise = Enterprise.query.get(id) enterprise = Enterprise.query.get(id)
company_id = enterprise.company_id company_id = enterprise.company_id
if not company_id:
return jsonify(RET.NODATA, msg='无关联信息')
data_info5 = EnterpriseClient.query.filter_by(ent_id=company_id).all() data_info5 = EnterpriseClient.query.filter_by(ent_id=company_id).all()
if not data_info5: if not data_info5:
return jsonify(code=RET.PARAMERR, msg="客户无数据") return jsonify(code=RET.NODATA, msg="客户无数据")
data = [{ data = [{
"label5_name": '客户', "label5_name": '客户',
"client_name": data.client_name, "client_name": data.client_name,
...@@ -1167,9 +1076,11 @@ def get_enterprise_equity(): ...@@ -1167,9 +1076,11 @@ def get_enterprise_equity():
try: try:
enterprise = Enterprise.query.get(id) enterprise = Enterprise.query.get(id)
company_id = enterprise.company_id company_id = enterprise.company_id
if not company_id:
return jsonify(RET.NODATA, msg='无关联信息')
data_info6 = EnterpriseEquity.query.filter_by(ent_id=company_id).all() data_info6 = EnterpriseEquity.query.filter_by(ent_id=company_id).all()
if not data_info6: if not data_info6:
return jsonify(code=RET.PARAMERR, msg="股权出质无数据") return jsonify(code=RET.NODATA, msg="股权出质无数据")
data = [{ data = [{
"label1_name": '股权出质', "label1_name": '股权出质',
"reg_number": data.reg_number, "reg_number": data.reg_number,
...@@ -1209,10 +1120,12 @@ def get_enterprise_punish(): ...@@ -1209,10 +1120,12 @@ def get_enterprise_punish():
try: try:
enterprise = Enterprise.query.get(id) enterprise = Enterprise.query.get(id)
company_id = enterprise.company_id company_id = enterprise.company_id
if not company_id:
return jsonify(RET.NODATA, msg='无关联信息')
# 工商状况-查询行政许可数据 # 工商状况-查询行政许可数据
data_info7 = EnterprisePunish.query.filter_by(ent_id=company_id).all() data_info7 = EnterprisePunish.query.filter_by(ent_id=company_id).all()
if not data_info7: if data_info7:
return jsonify(code=RET.PARAMERR, msg="行政处罚无数据") return jsonify(code=RET.NODATA, msg="行政处罚无数据")
data = [{ data = [{
"label5_name": '行政处罚', "label5_name": '行政处罚',
"pub_date": data.pub_date, "pub_date": data.pub_date,
...@@ -1250,9 +1163,11 @@ def get_enterprise_certificate(): ...@@ -1250,9 +1163,11 @@ def get_enterprise_certificate():
try: try:
enterprise = Enterprise.query.get(id) enterprise = Enterprise.query.get(id)
company_id = enterprise.company_id company_id = enterprise.company_id
if not company_id:
return jsonify(RET.NODATA, msg='无关联信息')
data_info8 = EnterpriseCertificate.query.filter_by(ent_id=company_id).all() data_info8 = EnterpriseCertificate.query.filter_by(ent_id=company_id).all()
if not data_info8: if not data_info8:
return jsonify(code=RET.PARAMERR, msg="资质证书无数据") return jsonify(code=RET.NODATA, msg="资质证书无数据")
data = [{ data = [{
"label5_name": '资质证书', "label5_name": '资质证书',
"start_date": data.start_date, "start_date": data.start_date,
...@@ -1289,9 +1204,11 @@ def get_enterprise_patent(): ...@@ -1289,9 +1204,11 @@ def get_enterprise_patent():
try: try:
enterprise = Enterprise.query.get(id) enterprise = Enterprise.query.get(id)
company_id = enterprise.company_id company_id = enterprise.company_id
if not company_id:
return jsonify(RET.NODATA, msg='无关联信息')
data_info9 = EnterprisePatent.query.filter_by(ent_id=company_id).all() data_info9 = EnterprisePatent.query.filter_by(ent_id=company_id).all()
if not data_info9: if not data_info9:
return jsonify(code=RET.PARAMERR, msg="专利信息无数据") return jsonify(code=RET.NODATA, msg="专利信息无数据")
data = [{ data = [{
"label_name": '专利信息', "label_name": '专利信息',
"name": data.name, "name": data.name,
......
"""
更新企业是否为链主字段
"""
# # -*- coding:utf-8 -*-
import threading
import pandas as pd
from apps.models import IndustryChain, Enterprise, Company
from manager import app
from apps import db
"""
根据资质计算企业的热度,并提交保存
"""
# 读取链主企业文件
xl_path = "无标题.xlsx"
data = pd.read_excel(xl_path)
# com_li = []
# for i in range(len(data)):
# com_name = str(data.loc[i, "企业名称"])
# com_li.append(com_name)
def handle():
with app.app_context():
for i in range(len(data)):
com_name = str(data.loc[i, "company_name"])
ent_id = str(data.loc[i, "ent_id"])
company_obj = Company.query.filter_by(company_name=com_name).first()
if company_obj:
company_obj.company_id = ent_id
db.session.commit()
print('已完成,一共{}个'.format(i))
if __name__ == '__main__':
t = threading.Thread(target=handle)
t.start()
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