指标计算
This commit is contained in:
parent
b970249c76
commit
32e52b938f
|
@ -181,10 +181,10 @@ def func(rating_flow_id: str, db: Session = Depends(get_db), mongodb: MongoHelpe
|
||||||
raise HTTPException(status_code=404, detail="RatingFlow Not Found")
|
raise HTTPException(status_code=404, detail="RatingFlow Not Found")
|
||||||
|
|
||||||
# 获取填报数据; input_data: 填报数据对象
|
# 获取填报数据; input_data: 填报数据对象
|
||||||
input_data = None
|
nodes_item = dict()
|
||||||
for node in rf_item.nodes:
|
for node in rf_item.nodes:
|
||||||
if node.node_name == "填报数据":
|
nodes_item.update({node.node_name: node.id})
|
||||||
input_data = get_rating_node_data(db=db, mongodb=mongodb, _id=node.id)
|
input_data = get_rating_node_data(db=db, mongodb=mongodb, _id=nodes_item.get("填报数据"))
|
||||||
if not input_data:
|
if not input_data:
|
||||||
raise HTTPException(status_code=404, detail="InputData Not Found")
|
raise HTTPException(status_code=404, detail="InputData Not Found")
|
||||||
|
|
||||||
|
@ -254,7 +254,27 @@ def func(rating_flow_id: str, db: Session = Depends(get_db), mongodb: MongoHelpe
|
||||||
# 更新指标数值
|
# 更新指标数值
|
||||||
index_values.update({index.get("指标"): index_value})
|
index_values.update({index.get("指标"): index_value})
|
||||||
|
|
||||||
return index_values
|
# 构造完整返回体; bacp_body: BACP结构表
|
||||||
|
rank_table = scorecard.get("rank_table")
|
||||||
|
if not rank_table:
|
||||||
|
raise HTTPException(status_code=404, detail="RankTable Not Found")
|
||||||
|
index_weights = rank_table.get("指标及权重")
|
||||||
|
if not index_weights:
|
||||||
|
raise HTTPException(status_code=400, detail="RankTable Not Complete")
|
||||||
|
index_items = index_weights.copy()
|
||||||
|
for index_item in index_items:
|
||||||
|
index_item.update({"数值": index_values.get(index_item.get("指标"))})
|
||||||
|
index_item.update({"得分": None})
|
||||||
|
bacp_body = {
|
||||||
|
"bacp_score": None,
|
||||||
|
"bacp_level": None,
|
||||||
|
"bacp_index_items": index_items
|
||||||
|
}
|
||||||
|
|
||||||
|
# 保存流程节点数据
|
||||||
|
Crud.save_rating_flow_node(db=db, mongodb=mongodb, node_id=nodes_item.get("基本信用状况"), data=bacp_body.copy())
|
||||||
|
|
||||||
|
return bacp_body
|
||||||
|
|
||||||
|
|
||||||
@router.post("/import/index_score", summary="导入定性定量得分", tags=["评级节点"])
|
@router.post("/import/index_score", summary="导入定性定量得分", tags=["评级节点"])
|
||||||
|
|
Loading…
Reference in New Issue