| | |
| | | import com.ruoyi.system.service.OaApprovalApplicationStorageService; |
| | | import com.ruoyi.system.service.TDeptService; |
| | | import com.ruoyi.system.vo.asset.OaApprovalApplicationStoragePageVO; |
| | | import com.ruoyi.system.vo.asset.OaApprovalApplicationStorageGeneralDetailVO; |
| | | import com.ruoyi.system.vo.asset.OaApprovalApplicationStoragePropertyDetailVO; |
| | | import com.ruoyi.system.vo.asset.OaApprovalApplicationStorageVehicleDetailVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | |
| | | @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(); |
| | | } |
| | |
| | | @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(); |
| | | } |
| | |
| | | @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(); |
| | | } |
| | |
| | | return R.ok(page); |
| | | } |
| | | |
| | | @ApiOperation("删除资产入库申请") |
| | | @DeleteMapping("/{id}") |
| | | @Log(title = "资产入库申请-删除", businessType = BusinessType.DELETE) |
| | | public R<Void> delete(@PathVariable Integer id) { |
| | | oaApprovalApplicationStorageService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation("获取通用资产入库申请详情") |
| | | @GetMapping("/detail/general/{id}") |
| | | public R<OaApprovalApplicationStorageGeneralDetailVO> getGeneralDetail(@PathVariable Integer id) { |
| | | OaApprovalApplicationStorageGeneralDetailVO detail = oaApprovalApplicationStorageService.getGeneralDetail(id); |
| | | return R.ok(detail); |
| | | } |
| | | |
| | | @ApiOperation("获取房产资产入库申请详情") |
| | | @GetMapping("/detail/property/{id}") |
| | | public R<OaApprovalApplicationStoragePropertyDetailVO> getPropertyDetail(@PathVariable Integer id) { |
| | | OaApprovalApplicationStoragePropertyDetailVO detail = oaApprovalApplicationStorageService.getPropertyDetail(id); |
| | | return R.ok(detail); |
| | | } |
| | | |
| | | @ApiOperation("获取车辆资产入库申请详情") |
| | | @GetMapping("/detail/vehicle/{id}") |
| | | public R<OaApprovalApplicationStorageVehicleDetailVO> getVehicleDetail(@PathVariable Integer id) { |
| | | OaApprovalApplicationStorageVehicleDetailVO detail = oaApprovalApplicationStorageService.getVehicleDetail(id); |
| | | return R.ok(detail); |
| | | } |
| | | |
| | | /** |
| | | * 校验位置类型与相关名称/地址 |
| | | */ |