From c804d03d3fe80c6babb4110c1a3d3e1373b5cc34 Mon Sep 17 00:00:00 2001 From: martsforever Date: Sun, 24 Aug 2025 01:31:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8D=95=E7=8B=AC=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=B7=B2=E8=8A=B1=E8=B4=B9=E7=9A=84=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E4=BB=A5=E5=8F=8A=E9=A2=84=E7=AE=97=E4=BD=99=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/add_approve_route.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/controller/add_approve_route.py b/app/controller/add_approve_route.py index 92aebf7..2a2a5ab 100644 --- a/app/controller/add_approve_route.py +++ b/app/controller/add_approve_route.py @@ -8,6 +8,7 @@ from app.model.ProjectModel import ProjectModel, ProjectService from app.model.ReimburseModel import ReimburseService from app.utils.db_utils import AsyncSessionDep + def add_approve_route(app: FastAPI): # 提交报销单接口 @app.post('/submit_reimburse') @@ -31,6 +32,9 @@ def add_approve_route(app: FastAPI): project_cls_list = (await session.execute(ProjectService.select_cls().where(ProjectModel.id.in_(proj_id_list)))).scalars().all() project_dict_list = [item.model_dump() for item in project_cls_list] for dict_item in project_dict_list: + # 已花费金额 dict_item['spent'] = result[dict_item['id']] + # 剩余金额 + dict_item['balance'] = Decimal(dict_item['budget']) - Decimal(dict_item['spent']) return project_dict_list