From c8bd39ba4f8f48fc5f3f9eb125e36ad7c2724999 Mon Sep 17 00:00:00 2001 From: P3ngSaM <61768364+P3ngSaM@users.noreply.github.com> Date: Wed, 16 Mar 2022 15:43:48 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BF=AE=E6=94=B9=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=9B=9E=E6=95=B0=E6=8D=AE=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manage/rating/scripts.py | 59 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/Manage/rating/scripts.py b/Manage/rating/scripts.py index 5c61153..d82f2ec 100644 --- a/Manage/rating/scripts.py +++ b/Manage/rating/scripts.py @@ -158,5 +158,60 @@ def get_company_process_script(types, rid, cid): Returns: result dict 流程数据 """ - data = find_data("评价", types, {"评价ID": rid, "企业ID": cid}) - return data + process_01 = ['问卷填报', '财务数据填报', '清洗风险数据'] + process_02 = ['数据填报', '清洗风险数据'] + process_03 = ['模型打分', '报告生成', '证书生成'] + process_04 = ['综合信用评价主页', '财务要素评价主页', '公司风险分析主页', '分析指标明细主页'] + process_05 = ['主页ESG数据生成'] + + def handle_process(data): + """ + 综合评价流程 + """ + result = list() + insert_01 = dict() + insert_02 = dict() + insert_03 = dict() + for k, v in data.items(): + if k in process_01: + insert_01[k] = v + elif k in process_03: + insert_02[k] = v + elif k in process_04: + insert_03[k] = v + result.append(insert_01) + result.append(insert_02) + result.append(insert_03) + return result + + def handle_esg_process(data): + """ + 综合评价流程 + """ + result = list() + insert_01 = dict() + insert_02 = dict() + insert_03 = dict() + for k, v in data.items(): + if k in process_02: + insert_01[k] = v + elif k in process_03: + insert_02[k] = v + elif k in process_05: + insert_03[k] = v + result.append(insert_01) + result.append(insert_02) + result.append(insert_03) + return result + + records = find_data("评价", types, {"评价ID": rid, "企业ID": cid}) + if len(records) > 0: + process = records[0]['评价流程'] + if types == '综合评价流程': + info = handle_process(process) + else: + info = handle_esg_process(process) + + return info + else: + return {}