From 03587b58b343956f910a653c37b9a7bcd84e4af9 Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期五, 19 九月 2025 18:54:03 +0800 Subject: [PATCH] 资产管理-资产领用列表 阿里云OSS文件上传 --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OaApprovalApplicationStorageServiceImpl.java | 361 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 328 insertions(+), 33 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OaApprovalApplicationStorageServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OaApprovalApplicationStorageServiceImpl.java index f56632b..a197e1c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OaApprovalApplicationStorageServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OaApprovalApplicationStorageServiceImpl.java @@ -20,6 +20,7 @@ import com.ruoyi.system.model.OaApprovalApplicationStorage; import com.ruoyi.system.model.OaApprovalApplications; import com.ruoyi.system.model.OaApprovalFlowNode; +import com.ruoyi.system.query.OaApprovalApplicationStoragePageQuery; import com.ruoyi.system.service.AssetGeneralExtService; import com.ruoyi.system.service.AssetMainService; import com.ruoyi.system.service.AssetPropertyExtService; @@ -33,7 +34,10 @@ import com.ruoyi.system.service.OaApprovalFlowNodeService; import com.ruoyi.system.service.OaApprovalTodoService; import com.ruoyi.system.service.TDeptService; +import com.ruoyi.system.vo.asset.OaApprovalApplicationStorageGeneralDetailVO; import com.ruoyi.system.vo.asset.OaApprovalApplicationStoragePageVO; +import com.ruoyi.system.vo.asset.OaApprovalApplicationStoragePropertyDetailVO; +import com.ruoyi.system.vo.asset.OaApprovalApplicationStorageVehicleDetailVO; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -44,6 +48,8 @@ import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * <p> @@ -141,8 +147,7 @@ */ private void saveGeneralAssets(List<OaApprovalApplicationStorageGeneralDTO.GeneralAssetItemDTO> assetItems, Integer applicationId, Integer assetTypeId, LocalDate storageDate, OaApprovalApplicationStorageGeneralDTO baseDto) { List<AssetMain> allAssetMains = new ArrayList<>(); - List<AssetGeneralExt> allGeneralExts = new ArrayList<>(); - + for (OaApprovalApplicationStorageGeneralDTO.GeneralAssetItemDTO item : assetItems) { // 根据数量创建对应数量的资产记录 int quantity = item.getQuantity().intValue(); @@ -157,19 +162,6 @@ // 批量保存资产主表数据 assetMainService.saveBatch(allAssetMains); - - // 为每个资产主表记录创建对应的扩展信息 - int assetMainIndex = 0; - for (OaApprovalApplicationStorageGeneralDTO.GeneralAssetItemDTO item : assetItems) { - int quantity = item.getQuantity().intValue(); - for (int i = 0; i < quantity; i++) { - AssetGeneralExt generalExt = buildAssetGeneralExt(item, allAssetMains.get(assetMainIndex).getId()); - allGeneralExts.add(generalExt); - assetMainIndex++; - } - } - - assetGeneralExtService.saveBatch(allGeneralExts); } /** @@ -253,12 +245,21 @@ assetMain.setAssetOriginalCode(item.getAssetOriginalCode()); assetMain.setAssetCode(generateAssetCode(assetTypeId, storageDate)); // 系统生成资产编码 assetMain.setAssetName(item.getAssetName()); + assetMain.setCategory(item.getCategory()); assetMain.setSpecificationModel(item.getSpecificationModel()); assetMain.setAssetTypeId(assetTypeId); assetMain.setMeasurementUnit(item.getMeasurementUnit()); assetMain.setUnitPrice(item.getUnitPrice()); assetMain.setUsefulLife(item.getUsefulLife()); - assetMain.setOwnershipDeptId(item.getOwnershipDeptId()); + // 根据权属单位/部门名称填充ID + if (item.getOwnershipDeptName() != null && !item.getOwnershipDeptName().isEmpty()) { + TDept ownerDept = tDeptService.lambdaQuery() + .eq(TDept::getDeptName, item.getOwnershipDeptName()) + .one(); + if (ownerDept != null) { + assetMain.setOwnershipDeptId(ownerDept.getId()); + } + } assetMain.setUserName(item.getUserName()); // 根据整单 addressType 写入使用部门ID或仓库ID applyAddressToAssetMain(assetMain, baseDto.getAddressType(), baseDto.getUseDeptName(), baseDto.getWarehouseName(), baseDto.getAddress()); @@ -283,12 +284,20 @@ assetMain.setAssetOriginalCode(item.getAssetOriginalCode()); assetMain.setAssetCode(generateAssetCode(assetTypeId, storageDate)); assetMain.setAssetName(item.getAssetName()); + assetMain.setCategory(item.getCategory()); assetMain.setSpecificationModel(item.getSpecificationModel()); assetMain.setAssetTypeId(assetTypeId); assetMain.setMeasurementUnit(item.getMeasurementUnit()); assetMain.setUnitPrice(item.getUnitPrice()); assetMain.setUsefulLife(item.getUsefulLife()); - assetMain.setOwnershipDeptId(item.getOwnershipDeptId()); + if (item.getOwnershipDeptName() != null && !item.getOwnershipDeptName().isEmpty()) { + TDept ownerDept = tDeptService.lambdaQuery() + .eq(TDept::getDeptName, item.getOwnershipDeptName()) + .one(); + if (ownerDept != null) { + assetMain.setOwnershipDeptId(ownerDept.getId()); + } + } assetMain.setUserName(item.getUserName()); applyAddressToAssetMain(assetMain, baseDto.getAddressType(), baseDto.getUseDeptName(), baseDto.getWarehouseName(), baseDto.getAddress()); assetMain.setAssetMainType(baseDto.getAddressType()); @@ -312,12 +321,20 @@ assetMain.setAssetOriginalCode(item.getAssetOriginalCode()); assetMain.setAssetCode(generateAssetCode(assetTypeId, storageDate)); assetMain.setAssetName(item.getAssetName()); + assetMain.setCategory(item.getCategory()); assetMain.setSpecificationModel(item.getSpecificationModel()); assetMain.setAssetTypeId(assetTypeId); assetMain.setMeasurementUnit(item.getMeasurementUnit()); assetMain.setUnitPrice(item.getUnitPrice()); assetMain.setUsefulLife(item.getUsefulLife()); - assetMain.setOwnershipDeptId(item.getOwnershipDeptId()); + if (item.getOwnershipDeptName() != null && !item.getOwnershipDeptName().isEmpty()) { + TDept ownerDept = tDeptService.lambdaQuery() + .eq(TDept::getDeptName, item.getOwnershipDeptName()) + .one(); + if (ownerDept != null) { + assetMain.setOwnershipDeptId(ownerDept.getId()); + } + } assetMain.setUserName(item.getUserName()); applyAddressToAssetMain(assetMain, baseDto.getAddressType(), baseDto.getUseDeptName(), baseDto.getWarehouseName(), baseDto.getAddress()); assetMain.setAssetMainType(baseDto.getAddressType()); @@ -378,16 +395,6 @@ private AssetGeneralExt buildAssetGeneralExt(OaApprovalApplicationStorageGeneralDTO.GeneralAssetItemDTO item, Integer assetMainId) { AssetGeneralExt generalExt = new AssetGeneralExt(); generalExt.setAssetMainId(assetMainId); - generalExt.setSupplierName(item.getSupplierName()); - generalExt.setPurchaseDate(item.getPurchaseDate()); - generalExt.setWarrantyPeriod(item.getWarrantyPeriod()); - generalExt.setWarrantyExpireDate(item.getWarrantyExpireDate()); - generalExt.setDepreciationMethod(item.getDepreciationMethod()); - generalExt.setDepreciationRate(item.getDepreciationRate()); - generalExt.setNetValue(item.getNetValue()); - generalExt.setMaintenanceCycle(item.getMaintenanceCycle()); - generalExt.setLastMaintenanceDate(item.getLastMaintenanceDate()); - generalExt.setNextMaintenanceDate(item.getNextMaintenanceDate()); generalExt.setDisabled(false); return generalExt; } @@ -409,7 +416,7 @@ propertyExt.setDetailedLocation(item.getDetailedLocation()); propertyExt.setProvincialPlatformValue(item.getProvincialPlatformValue()); propertyExt.setResettlementSituation(item.getResettlementSituation()); - propertyExt.setIsMortgaged(item.getIsMortgaged()); + propertyExt.setMortgaged(item.getMortgaged()); propertyExt.setTenantName(item.getTenantName()); propertyExt.setRentalAmount(item.getRentalAmount()); propertyExt.setLeaseStartDate(item.getLeaseStartDate()); @@ -467,7 +474,7 @@ applications.setApplicantName(generalDTO.getApplicantName()); applications.setDeptId(generalDTO.getDeptId()); applications.setDeptName(generalDTO.getDeptName()); - applications.setApplicationDate(generalDTO.getApplicationDate()); + applications.setApplicationDate(LocalDate.now()); applications.setApplicationReason(generalDTO.getApplicationReason()); applications.setAttachmentUrl(generalDTO.getAttachmentUrl()); } else if (dto instanceof OaApprovalApplicationStoragePropertyDTO) { @@ -476,7 +483,7 @@ applications.setApplicantName(propertyDTO.getApplicantName()); applications.setDeptId(propertyDTO.getDeptId()); applications.setDeptName(propertyDTO.getDeptName()); - applications.setApplicationDate(propertyDTO.getApplicationDate()); + applications.setApplicationDate(LocalDate.now()); applications.setApplicationReason(propertyDTO.getApplicationReason()); applications.setAttachmentUrl(propertyDTO.getAttachmentUrl()); } else if (dto instanceof OaApprovalApplicationStorageVehicleDTO) { @@ -485,7 +492,7 @@ applications.setApplicantName(vehicleDTO.getApplicantName()); applications.setDeptId(vehicleDTO.getDeptId()); applications.setDeptName(vehicleDTO.getDeptName()); - applications.setApplicationDate(vehicleDTO.getApplicationDate()); + applications.setApplicationDate(LocalDate.now()); applications.setApplicationReason(vehicleDTO.getApplicationReason()); applications.setAttachmentUrl(vehicleDTO.getAttachmentUrl()); } @@ -572,8 +579,296 @@ } @Override - public IPage<OaApprovalApplicationStoragePageVO> getPageList(com.ruoyi.system.query.OaApprovalApplicationStoragePageQuery pageQuery) { + public IPage<OaApprovalApplicationStoragePageVO> getPageList(OaApprovalApplicationStoragePageQuery pageQuery) { Page<OaApprovalApplicationStoragePageVO> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize()); return this.baseMapper.selectApplicationStoragePage(page, pageQuery); } + + @Override + public OaApprovalApplicationStorageGeneralDetailVO getGeneralDetail(Integer storageId) { + OaApprovalApplicationStorage storage = this.getById(storageId); + if (storage == null) { + throw new ServiceException("入库申请不存在"); + } + OaApprovalApplications app = oaApprovalApplicationsService.getById(storage.getApprovalApplicationId()); + if (app == null) { + throw new ServiceException("审批主记录不存在"); + } + + OaApprovalApplicationStorageGeneralDetailVO vo = new OaApprovalApplicationStorageGeneralDetailVO(); + fillBaseFields(vo, app, storage); + + List<AssetMain> mains = assetMainService.lambdaQuery() + .eq(AssetMain::getApprovalApplicationId, app.getId()) + .eq(AssetMain::getAssetTypeId, storage.getAssetTypeId()) + .list(); + setAddressInfo(vo, mains); + + if (!CollectionUtils.isEmpty(mains)) { + List<Integer> mainIds = mains.stream().map(AssetMain::getId).collect(Collectors.toList()); + // 批量查询权属部门,避免循环内查询 + List<Integer> ownerIds = mains.stream().map(AssetMain::getOwnershipDeptId) + .filter(id -> id != null).distinct().collect(Collectors.toList()); + Map<Integer, TDept> ownerDeptMap = ownerIds.isEmpty() ? java.util.Collections.emptyMap() + : tDeptService.listByIds(ownerIds).stream().collect(Collectors.toMap(TDept::getId, d -> d)); + + List<OaApprovalApplicationStorageGeneralDetailVO.GeneralAssetItemVO> items = mains.stream().map(m -> { + OaApprovalApplicationStorageGeneralDetailVO.GeneralAssetItemVO item = new OaApprovalApplicationStorageGeneralDetailVO.GeneralAssetItemVO(); + item.setAssetOriginalCode(m.getAssetOriginalCode()); + item.setAssetName(m.getAssetName()); + item.setSpecificationModel(m.getSpecificationModel()); + item.setMeasurementUnit(m.getMeasurementUnit()); + item.setQuantity(m.getQuantity()); + item.setUnitPrice(m.getUnitPrice()); + item.setUsefulLife(m.getUsefulLife()); + if (m.getOwnershipDeptId() != null) { + TDept dept = ownerDeptMap.get(m.getOwnershipDeptId()); + item.setOwnerShipDeptName(dept != null ? dept.getDeptName() : null); + } + item.setUserName(m.getUserName()); + item.setAssetStatus(m.getAssetStatus()); + item.setRemarks(m.getRemarks()); + item.setAccountingStatus(m.getAccountingStatus()); + item.setAccountingDate(m.getAccountingDate()); + item.setAccountingVoucherNo(m.getAccountingVoucherNo()); + item.setAccountingSubject(m.getAccountingSubject()); + item.setAccountingAmount(m.getAccountingAmount()); + return item; + }).collect(Collectors.toList()); + vo.setAssetItems(items); + } + return vo; + } + + @Override + public OaApprovalApplicationStoragePropertyDetailVO getPropertyDetail(Integer storageId) { + OaApprovalApplicationStorage storage = this.getById(storageId); + if (storage == null) { + throw new ServiceException("入库申请不存在"); + } + OaApprovalApplications app = oaApprovalApplicationsService.getById(storage.getApprovalApplicationId()); + if (app == null) { + throw new ServiceException("审批主记录不存在"); + } + + OaApprovalApplicationStoragePropertyDetailVO vo = new OaApprovalApplicationStoragePropertyDetailVO(); + fillBaseFields(vo, app, storage); + + List<AssetMain> mains = assetMainService.lambdaQuery() + .eq(AssetMain::getApprovalApplicationId, app.getId()) + .eq(AssetMain::getAssetTypeId, storage.getAssetTypeId()) + .list(); + setAddressInfo(vo, mains); + + if (!CollectionUtils.isEmpty(mains)) { + List<Integer> mainIds = mains.stream().map(AssetMain::getId).collect(Collectors.toList()); + List<AssetPropertyExt> exts = assetPropertyExtService.lambdaQuery().in(AssetPropertyExt::getAssetMainId, mainIds).list(); + Map<Integer, AssetPropertyExt> extMap = exts.stream().collect(Collectors.toMap(AssetPropertyExt::getAssetMainId, e -> e)); + // 批量查询权属部门 + List<Integer> ownerIds = mains.stream().map(AssetMain::getOwnershipDeptId) + .filter(id -> id != null).distinct().collect(Collectors.toList()); + Map<Integer, TDept> ownerDeptMap = ownerIds.isEmpty() ? java.util.Collections.emptyMap() + : tDeptService.listByIds(ownerIds).stream().collect(Collectors.toMap(TDept::getId, d -> d)); + + List<OaApprovalApplicationStoragePropertyDetailVO.PropertyAssetItemVO> items = mains.stream().map(m -> { + OaApprovalApplicationStoragePropertyDetailVO.PropertyAssetItemVO item = new OaApprovalApplicationStoragePropertyDetailVO.PropertyAssetItemVO(); + item.setAssetOriginalCode(m.getAssetOriginalCode()); + item.setAssetName(m.getAssetName()); + item.setSpecificationModel(m.getSpecificationModel()); + item.setMeasurementUnit(m.getMeasurementUnit()); + item.setQuantity(m.getQuantity()); + item.setUnitPrice(m.getUnitPrice()); + item.setUsefulLife(m.getUsefulLife()); + if (m.getOwnershipDeptId() != null) { + TDept dept = ownerDeptMap.get(m.getOwnershipDeptId()); + item.setOwnerShipDeptName(dept != null ? dept.getDeptName() : null); + } + item.setUserName(m.getUserName()); + item.setAssetStatus(m.getAssetStatus()); + item.setRemarks(m.getRemarks()); + item.setAccountingStatus(m.getAccountingStatus()); + item.setAccountingDate(m.getAccountingDate()); + item.setAccountingVoucherNo(m.getAccountingVoucherNo()); + item.setAccountingSubject(m.getAccountingSubject()); + item.setAccountingAmount(m.getAccountingAmount()); + AssetPropertyExt ext = extMap.get(m.getId()); + if (ext != null) { + item.setRegion(ext.getRegion()); + item.setDesignPurpose(ext.getDesignPurpose()); + item.setBuilding(ext.getBuilding()); + item.setRoomNumber(ext.getRoomNumber()); + item.setConstructionArea(ext.getConstructionArea()); + item.setStructureType(ext.getStructureType()); + item.setCertificateNumber(ext.getCertificateNumber()); + item.setCompletionDate(ext.getCompletionDate()); + item.setDetailedLocation(ext.getDetailedLocation()); + item.setProvincialPlatformValue(ext.getProvincialPlatformValue()); + item.setResettlementSituation(ext.getResettlementSituation()); + item.setMortgaged(ext.getMortgaged()); + item.setTenantName(ext.getTenantName()); + item.setRentalAmount(ext.getRentalAmount()); + item.setLeaseStartDate(ext.getLeaseStartDate()); + item.setLeaseEndDate(ext.getLeaseEndDate()); + } + return item; + }).collect(Collectors.toList()); + vo.setAssetItems(items); + } + return vo; + } + + @Override + public OaApprovalApplicationStorageVehicleDetailVO getVehicleDetail(Integer storageId) { + OaApprovalApplicationStorage storage = this.getById(storageId); + if (storage == null) { + throw new ServiceException("入库申请不存在"); + } + OaApprovalApplications app = oaApprovalApplicationsService.getById(storage.getApprovalApplicationId()); + if (app == null) { + throw new ServiceException("审批主记录不存在"); + } + + OaApprovalApplicationStorageVehicleDetailVO vo = new OaApprovalApplicationStorageVehicleDetailVO(); + fillBaseFields(vo, app, storage); + + List<AssetMain> mains = assetMainService.lambdaQuery() + .eq(AssetMain::getApprovalApplicationId, app.getId()) + .eq(AssetMain::getAssetTypeId, storage.getAssetTypeId()) + .list(); + setAddressInfo(vo, mains); + + if (!CollectionUtils.isEmpty(mains)) { + List<Integer> mainIds = mains.stream().map(AssetMain::getId).collect(Collectors.toList()); + List<AssetVehicleExt> exts = assetVehicleExtService.lambdaQuery().in(AssetVehicleExt::getAssetMainId, mainIds).list(); + Map<Integer, AssetVehicleExt> extMap = exts.stream().collect(Collectors.toMap(AssetVehicleExt::getAssetMainId, e -> e)); + // 批量查询权属部门 + List<Integer> ownerIds = mains.stream().map(AssetMain::getOwnershipDeptId) + .filter(id -> id != null).distinct().collect(Collectors.toList()); + Map<Integer, TDept> ownerDeptMap = ownerIds.isEmpty() ? java.util.Collections.emptyMap() + : tDeptService.listByIds(ownerIds).stream().collect(Collectors.toMap(TDept::getId, d -> d)); + + List<OaApprovalApplicationStorageVehicleDetailVO.VehicleAssetItemVO> items = mains.stream().map(m -> { + OaApprovalApplicationStorageVehicleDetailVO.VehicleAssetItemVO item = new OaApprovalApplicationStorageVehicleDetailVO.VehicleAssetItemVO(); + item.setAssetOriginalCode(m.getAssetOriginalCode()); + item.setAssetName(m.getAssetName()); + item.setSpecificationModel(m.getSpecificationModel()); + item.setMeasurementUnit(m.getMeasurementUnit()); + item.setQuantity(m.getQuantity()); + item.setUnitPrice(m.getUnitPrice()); + item.setUsefulLife(m.getUsefulLife()); + if (m.getOwnershipDeptId() != null) { + TDept dept = ownerDeptMap.get(m.getOwnershipDeptId()); + item.setOwnerShipDeptName(dept != null ? dept.getDeptName() : null); + } + item.setUserName(m.getUserName()); + item.setAssetStatus(m.getAssetStatus()); + item.setRemarks(m.getRemarks()); + item.setAccountingStatus(m.getAccountingStatus()); + item.setAccountingDate(m.getAccountingDate()); + item.setAccountingVoucherNo(m.getAccountingVoucherNo()); + item.setAccountingSubject(m.getAccountingSubject()); + item.setAccountingAmount(m.getAccountingAmount()); + AssetVehicleExt ext = extMap.get(m.getId()); + if (ext != null) { + item.setLicensePlate(ext.getLicensePlate()); + item.setVinCode(ext.getVinCode()); + item.setEngineNumber(ext.getEngineNumber()); + item.setDisplacement(ext.getDisplacement()); + item.setStaffingSituation(ext.getStaffingSituation()); + item.setOrigin(ext.getOrigin()); + item.setAcquisitionDate(ext.getAcquisitionDate()); + item.setPropertyRightForm(ext.getPropertyRightForm()); + } + return item; + }).collect(Collectors.toList()); + vo.setAssetItems(items); + } + return vo; + } + + private void fillBaseFields(Object vo, OaApprovalApplications app, OaApprovalApplicationStorage storage) { + if (vo instanceof OaApprovalApplicationStorageGeneralDetailVO) { + OaApprovalApplicationStorageGeneralDetailVO v = (OaApprovalApplicationStorageGeneralDetailVO) vo; + v.setDeptId(app.getDeptId()); + v.setDeptName(app.getDeptName()); + v.setApplicantUserId(app.getApplicantUserId()); + v.setApplicantName(app.getApplicantName()); + v.setApplicationDate(app.getApplicationDate()); + v.setApplicationReason(app.getApplicationReason()); + v.setAttachmentUrl(app.getAttachmentUrl()); + v.setTitle(storage.getTitle()); + v.setAssetTypeId(storage.getAssetTypeId()); + v.setStorageType(storage.getStorageType()); + v.setStorageTime(storage.getStorageTime()); + } else if (vo instanceof OaApprovalApplicationStoragePropertyDetailVO) { + OaApprovalApplicationStoragePropertyDetailVO v = (OaApprovalApplicationStoragePropertyDetailVO) vo; + v.setDeptId(app.getDeptId()); + v.setDeptName(app.getDeptName()); + v.setApplicantUserId(app.getApplicantUserId()); + v.setApplicantName(app.getApplicantName()); + v.setApplicationDate(app.getApplicationDate()); + v.setApplicationReason(app.getApplicationReason()); + v.setAttachmentUrl(app.getAttachmentUrl()); + v.setTitle(storage.getTitle()); + v.setAssetTypeId(storage.getAssetTypeId()); + v.setStorageType(storage.getStorageType()); + v.setStorageTime(storage.getStorageTime()); + } else if (vo instanceof OaApprovalApplicationStorageVehicleDetailVO) { + OaApprovalApplicationStorageVehicleDetailVO v = (OaApprovalApplicationStorageVehicleDetailVO) vo; + v.setDeptId(app.getDeptId()); + v.setDeptName(app.getDeptName()); + v.setApplicantUserId(app.getApplicantUserId()); + v.setApplicantName(app.getApplicantName()); + v.setApplicationDate(app.getApplicationDate()); + v.setApplicationReason(app.getApplicationReason()); + v.setAttachmentUrl(app.getAttachmentUrl()); + v.setTitle(storage.getTitle()); + v.setAssetTypeId(storage.getAssetTypeId()); + v.setStorageType(storage.getStorageType()); + v.setStorageTime(storage.getStorageTime()); + } + } + + private void setAddressInfo(Object vo, List<AssetMain> mains) { + if (CollectionUtils.isEmpty(mains)) { + return; + } + AssetMain sample = mains.get(0); + Integer addressType = null; + String useDeptName = null; + String warehouseName = null; + String address = null; + if (sample.getUseDeptId() != null) { + addressType = 0; + TDept dept = tDeptService.getById(sample.getUseDeptId()); + useDeptName = dept != null ? dept.getDeptName() : null; + } else if (sample.getWarehouseId() != null) { + addressType = 1; + AssetWarehouse wh = assetWarehouseService.getById(sample.getWarehouseId()); + warehouseName = wh != null ? wh.getWarehouseName() : null; + } else if (sample.getAddress() != null && !sample.getAddress().isEmpty()) { + addressType = 2; + address = sample.getAddress(); + } + + if (vo instanceof OaApprovalApplicationStorageGeneralDetailVO) { + OaApprovalApplicationStorageGeneralDetailVO v = (OaApprovalApplicationStorageGeneralDetailVO) vo; + v.setAddressType(addressType); + v.setUseDeptName(useDeptName); + v.setWarehouseName(warehouseName); + v.setAddress(address); + } else if (vo instanceof OaApprovalApplicationStoragePropertyDetailVO) { + OaApprovalApplicationStoragePropertyDetailVO v = (OaApprovalApplicationStoragePropertyDetailVO) vo; + v.setAddressType(addressType); + v.setUseDeptName(useDeptName); + v.setWarehouseName(warehouseName); + v.setAddress(address); + } else if (vo instanceof OaApprovalApplicationStorageVehicleDetailVO) { + OaApprovalApplicationStorageVehicleDetailVO v = (OaApprovalApplicationStorageVehicleDetailVO) vo; + v.setAddressType(addressType); + v.setUseDeptName(useDeptName); + v.setWarehouseName(warehouseName); + v.setAddress(address); + } + } } -- Gitblit v1.7.1