18339543638 před 2 roky
rodič
revize
9294058eef

+ 6 - 1
tr-modules/tr-module-system/src/main/java/cn/tr/module/sys/storage/service/impl/StorageFileServiceImpl.java

@@ -14,7 +14,6 @@ import cn.tr.core.exception.TRExcCode;
 import cn.tr.core.utils.JsonUtils;
 import cn.tr.module.api.sys.storage.StoragePojo;
 import cn.tr.module.sys.storage.dto.SysStorageConfigDTO;
-import cn.tr.module.sys.storage.dto.SysStorageConfigQueryDTO;
 import cn.tr.module.sys.storage.dto.SysStorageRecordDTO;
 import cn.tr.module.sys.storage.mapper.SysStorageRecordMapper;
 import cn.tr.module.sys.storage.properties.TrStorageProperties;
@@ -125,6 +124,9 @@ public class StorageFileServiceImpl implements IStorageFileService {
     @Override
     public String obtainDownloadPath(String recordId) throws Exception {
         SysStorageRecordDTO record = storageRecordService.selectSysStorageRecordById(recordId);
+        if(ObjectUtil.isNull(record)){
+            throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0404);
+        }
         FileClient fileClient = getClient(record.getConfigId());
         return fileClient.downUrl(record.getBizName());
     }
@@ -132,6 +134,9 @@ public class StorageFileServiceImpl implements IStorageFileService {
     @Override
     public byte[] obtainContent(String recordId) throws Exception {
         SysStorageRecordDTO record = storageRecordService.selectSysStorageRecordById(recordId);
+        if(ObjectUtil.isNull(record)){
+            throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0404);
+        }
         FileClient fileClient = getClient(record.getConfigId());
         return fileClient.getContent(record.getBizName()).getContent();
     }