changes 导入excel数据/外部评级bug
This commit is contained in:
parent
be444a7f6b
commit
e1471c9996
|
@ -252,6 +252,17 @@ def func(rating_flow_id: str, year: int, db: Session = Depends(get_db), mongodb:
|
||||||
if not data_table:
|
if not data_table:
|
||||||
raise HTTPException(status_code=404, detail="数据表不存在")
|
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: 填报数据
|
||||||
input_data = dict()
|
input_data = dict()
|
||||||
fmt_years = ['{}00'.format(int(rf_item.report_date.__str__()[:4]) - i) for i in range(year)]
|
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:
|
if not empty_row:
|
||||||
continue
|
continue
|
||||||
for column in empty_row.keys():
|
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
|
return input_data
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue