整合提交数据后数据处理接口

This commit is contained in:
王思川 2021-12-28 10:47:22 +08:00
parent 1badc458ce
commit c38e56c322
2 changed files with 40 additions and 3 deletions

View File

@ -49,7 +49,7 @@ class InputForm:
Returns:
评分执行结果
"""
if exec_general_rating_scripts(self.cid):
if exec_general_rating_scripts(self.cid)[0]:
return "评分成功,请前往主页查看", 200
else:
return "评分失败,请检查数据,或联系管理员", 210

View File

@ -236,7 +236,23 @@ def exec_general_rating_scripts(cid):
# 生成报告
def gen_report():
pass
url = "http://139.9.249.34:51012/tfse_rating/report/gen_general_rating_report"
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']
}
res = requests.post(url, headers=headers, data=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 gen_certified():
@ -244,4 +260,25 @@ def exec_general_rating_scripts(cid):
# 生成企业主页数据
def company_index():
pass
url = "http://139.9.249.34:51011/etl_tfse/company/company_index_etl"
token = "dmfd7FshT!5Wng9^gcCcQV7T6FBnVgl4"
headers = {'token': token, "Content-Type": "application/json;charset=UTF-8"}
data = {
"rid": rating_inputs['评价ID']
}
res = requests.post(url, headers=headers, data=data)
if res.status_code == 200:
return True
else:
return False
if not general_model():
return False, "打分失败"
if not gen_report():
return False, "生成综合信用评价报告失败"
if not company_index():
return False, "准备企业主页数据失败"
return True, "执行成功"