diff --git a/App/Router/RatingFlowRouter.py b/App/Router/RatingFlowRouter.py index 2fd505e..92ef3bb 100644 --- a/App/Router/RatingFlowRouter.py +++ b/App/Router/RatingFlowRouter.py @@ -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