diff --git a/esg/esg_impl.py b/esg/esg_impl.py index f2167ae..f9e905d 100644 --- a/esg/esg_impl.py +++ b/esg/esg_impl.py @@ -240,6 +240,27 @@ def exec_esg_rating_scripts(cid): else: 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(): 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(): return False, "生成报告失败" + if not gen_certified(): + return False, "生成证书失败" + if not esg_index(): return False, "准备主页数据失败"