update 生成证书加入ESG评价流程

This commit is contained in:
P3ngSaM 2022-03-01 09:56:33 +08:00
parent 44b02a56bd
commit 46289fd850
1 changed files with 24 additions and 0 deletions

View File

@ -240,6 +240,27 @@ def exec_esg_rating_scripts(cid):
else: else:
return False return False
# 生成证书
def gen_certified():
url = "http://139.9.249.34:51012/tfse_rating/certificate/generate_certificate"
token = "X0gSlC!YE8jmr2jJr&ilcjS83j!tsoh5"
headers = {'token': token, "Content-Type": "application/json;charset=UTF-8"}
data = {
"company": rating_inputs['企业名称'],
"cid": rating_inputs['企业ID'],
"rid": rating_inputs['评价ID'],
"type": "esg"
}
res = requests.post(url, headers=headers, data=json.dumps(data))
if res.status_code == 200:
update_data = {
"证书fid": json.loads(res.text)['result']['FileID']
}
update_rating_records({"评价ID": rid}, update_data)
return True
else:
return False
# 生成企业主页数据 # 生成企业主页数据
def esg_index(): def esg_index():
url = "http://139.9.249.34:51011/etl_tfse/company/esg_index_etl" url = "http://139.9.249.34:51011/etl_tfse/company/esg_index_etl"
@ -260,6 +281,9 @@ def exec_esg_rating_scripts(cid):
if not gen_report(): if not gen_report():
return False, "生成报告失败" return False, "生成报告失败"
if not gen_certified():
return False, "生成证书失败"
if not esg_index(): if not esg_index():
return False, "准备主页数据失败" return False, "准备主页数据失败"