From 995293880f5ca5c05ca94e53f5dac213b0155e3a Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期二, 23 九月 2025 13:57:09 +0800 Subject: [PATCH] 审批模块接口代码 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/OaApprovalApplicationStorageController.java | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/OaApprovalApplicationStorageController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/OaApprovalApplicationStorageController.java index 89ae307..92e6aad 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/OaApprovalApplicationStorageController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/OaApprovalApplicationStorageController.java @@ -58,6 +58,16 @@ @Log(title = "通用资产入库申请-提交", businessType = BusinessType.INSERT) public R<Void> submitGeneralAssetStorage(@Valid @RequestBody OaApprovalApplicationStorageGeneralDTO dto) { validateAddress(dto); + // 校验每条明细的权属单位/部门名称是否存在 + for (OaApprovalApplicationStorageGeneralDTO.GeneralAssetItemDTO item : dto.getAssetItems()) { + if (StringUtils.isEmpty(item.getOwnershipDeptName())) { + throw new ServiceException("权属单位/部门名称不能为空"); + } + TDept owner = deptService.lambdaQuery().eq(TDept::getDeptName, item.getOwnershipDeptName()).one(); + if (owner == null) { + throw new ServiceException("权属单位/部门不存在: " + item.getOwnershipDeptName()); + } + } oaApprovalApplicationStorageService.submitGeneralAssetStorage(dto); return R.ok(); } @@ -67,6 +77,15 @@ @Log(title = "房产资产入库申请-提交", businessType = BusinessType.INSERT) public R<Void> submitPropertyAssetStorage(@Valid @RequestBody OaApprovalApplicationStoragePropertyDTO dto) { validateAddress(dto); + for (OaApprovalApplicationStoragePropertyDTO.PropertyAssetItemDTO item : dto.getAssetItems()) { + if (StringUtils.isEmpty(item.getOwnershipDeptName())) { + throw new ServiceException("权属单位/部门名称不能为空"); + } + TDept owner = deptService.lambdaQuery().eq(TDept::getDeptName, item.getOwnershipDeptName()).one(); + if (owner == null) { + throw new ServiceException("权属单位/部门不存在: " + item.getOwnershipDeptName()); + } + } oaApprovalApplicationStorageService.submitPropertyAssetStorage(dto); return R.ok(); } @@ -76,6 +95,15 @@ @Log(title = "车辆资产入库申请-提交", businessType = BusinessType.INSERT) public R<Void> submitVehicleAssetStorage(@Valid @RequestBody OaApprovalApplicationStorageVehicleDTO dto) { validateAddress(dto); + for (OaApprovalApplicationStorageVehicleDTO.VehicleAssetItemDTO item : dto.getAssetItems()) { + if (StringUtils.isEmpty(item.getOwnershipDeptName())) { + throw new ServiceException("权属单位/部门名称不能为空"); + } + TDept owner = deptService.lambdaQuery().eq(TDept::getDeptName, item.getOwnershipDeptName()).one(); + if (owner == null) { + throw new ServiceException("权属单位/部门不存在: " + item.getOwnershipDeptName()); + } + } oaApprovalApplicationStorageService.submitVehicleAssetStorage(dto); return R.ok(); } -- Gitblit v1.7.1