From 7e8f53dd54c0727fc6cb1327b6a68dbf7d68ab82 Mon Sep 17 00:00:00 2001 From: martsforever Date: Sun, 24 Aug 2025 12:18:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=87=86=E5=A4=87=E5=BC=84=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E6=8A=A5=E9=94=80=E5=8D=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/add_approve_route.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/controller/add_approve_route.py b/app/controller/add_approve_route.py index ebbd8da..d041143 100644 --- a/app/controller/add_approve_route.py +++ b/app/controller/add_approve_route.py @@ -1,6 +1,6 @@ from fastapi import FastAPI -from app.model.ReimburseModel import ReimburseService +from app.model.ReimburseModel import ReimburseService, ReimburseModel from app.utils.db_utils import AsyncSessionDep @@ -10,7 +10,7 @@ def add_approve_route(app: FastAPI): async def submit_reimburse(reimburse: dict, session: AsyncSessionDep): reimburse_id = reimburse.get('id') # 先查一遍报销单信息 - reimburse_cls = await ReimburseService.query_item(session=session, row_dict={"id": reimburse_id}) + reimburse_cls: ReimburseModel = await ReimburseService.query_item(session=session, row_dict={"id": reimburse_id}) # 1. 没有审批单—— # 2. 审批单为审批中状态——不处理 @@ -18,6 +18,15 @@ def add_approve_route(app: FastAPI): # 4. 审批单为已驳回状态—— # 5. 审批单为已撤回状态—— + # 2,3 的情况下不再提交报销单 + + if reimburse_cls.approve: + if reimburse_cls.approve.status == 'approving': + return {"message": "报销单已提交审批,请勿重复提交!"} + if reimburse_cls.approve.status == 'approved': + return {"message": "报销单已通过审批,请勿重复提交!"} + + # 1,4,5 的情况下新建审批单 # 新建审批单,走审批流程 print(reimburse_cls.amount)