changes 导入excel数据/外部评级bug

This commit is contained in:
P3ngSaM 2023-01-03 15:04:09 +08:00
parent be444a7f6b
commit e1471c9996
1 changed files with 13 additions and 1 deletions

View File

@ -252,6 +252,17 @@ def func(rating_flow_id: str, year: int, db: Session = Depends(get_db), mongodb:
if not data_table:
raise HTTPException(status_code=404, detail="数据表不存在")
# 获取指标表index_table
index_table = scorecard.get('index_table')
if not index_table:
raise HTTPException(status_code=404, detail="指标表不存在")
route_table = dict()
for index in index_table:
if index.get('计算请求'):
for param in index.get('指标参数'):
param_name = param.get('参数')
route_table[param_name] = param.get('加载路径')
# 填报数据格式; 注: 只有结构没有数据; input_data: 填报数据
input_data = dict()
fmt_years = ['{}00'.format(int(rf_item.report_date.__str__()[:4]) - i) for i in range(year)]
@ -285,7 +296,8 @@ def func(rating_flow_id: str, year: int, db: Session = Depends(get_db), mongodb:
if not empty_row:
continue
for column in empty_row.keys():
input_data[sheet_name][fmt_year][column] = data_row.get(column)
column_name = route_table.get(column)[2]
input_data[sheet_name][fmt_year][column] = data_row.get(column_name)
return input_data