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 {}