feat: 准备弄提交报销单接口
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user