| | |
| | | package com.iplatform.base; |
| | | |
| | | import com.iplatform.base.config.FileProperties; |
| | | import com.iplatform.core.BeanContextAware; |
| | | import com.walker.file.FileInfo; |
| | | import com.walker.file.FileStoreType; |
| | |
| | | |
| | | protected FileInfo uploadFileToRemote(InputStream inputStream |
| | | , String fileName, String groupId, long fileSize, Integer businessType, String owner) throws Exception{ |
| | | String remoteFileStoreType = this.getArgumentVariable(ArgumentsConstants.CONFIG_UPLOAD_TYPE).getStringValue(); |
| | | if(StringUtils.isEmpty(remoteFileStoreType)){ |
| | | throw new PlatformRuntimeException("平台未配置任何远程存储类别:" + ArgumentsConstants.CONFIG_UPLOAD_TYPE); |
| | | } |
| | | // 2023-07-03,如果配置远程上传为本地 |
| | | if(this.acquireFileOperateSpi().isRemoteAsLocal()){ |
| | | return this.acquireFileOperateSpi().uploadFileToLocal(inputStream, fileName, groupId, fileSize, businessType, owner); |
| | | } |
| | | |
| | | FileStoreType fileStoreType = FileStoreType.getType(remoteFileStoreType); |
| | | // String remoteFileStoreType = this.getArgumentVariable(ArgumentsConstants.CONFIG_UPLOAD_TYPE).getStringValue(); |
| | | // if(StringUtils.isEmpty(remoteFileStoreType)){ |
| | | // throw new PlatformRuntimeException("平台未配置任何远程存储类别:" + ArgumentsConstants.CONFIG_UPLOAD_TYPE); |
| | | // } |
| | | // FileStoreType fileStoreType = FileStoreType.getType(remoteFileStoreType); |
| | | String ossType = BeanContextAware.getBeanByType(FileProperties.class).getOssType(); |
| | | if(StringUtils.isEmpty(ossType)){ |
| | | throw new PlatformRuntimeException("平台未配置任何ossType"); |
| | | } |
| | | |
| | | FileStoreType fileStoreType = FileStoreType.getType(ossType); |
| | | if(fileStoreType == FileStoreType.Ftp){ |
| | | return this.acquireFileOperateSpi().uploadFileToFtp(inputStream, fileName, groupId, fileSize, businessType, owner); |
| | | } else { |
| | | return this.acquireFileOperateSpi().uploadFileToOss(inputStream, fileName, groupId, fileSize, businessType, owner, fileStoreType); |
| | | } |
| | | } |
| | | |
| | | protected FileInfo[] uploadFileToRemote(InputStream[] inputStream |
| | | , String[] fileName, String groupId, long[] fileSize, Integer businessType, String owner) throws Exception{ |
| | | String remoteFileStoreType = this.getArgumentVariable(ArgumentsConstants.CONFIG_UPLOAD_TYPE).getStringValue(); |
| | | if(StringUtils.isEmpty(remoteFileStoreType)){ |
| | | throw new PlatformRuntimeException("平台未配置任何远程存储类别:" + ArgumentsConstants.CONFIG_UPLOAD_TYPE); |
| | | } |
| | | // String remoteFileStoreType = this.getArgumentVariable(ArgumentsConstants.CONFIG_UPLOAD_TYPE).getStringValue(); |
| | | // if(StringUtils.isEmpty(remoteFileStoreType)){ |
| | | // throw new PlatformRuntimeException("平台未配置任何远程存储类别:" + ArgumentsConstants.CONFIG_UPLOAD_TYPE); |
| | | // } |
| | | // FileStoreType fileStoreType = FileStoreType.getType(remoteFileStoreType); |
| | | // 2023-07-03,如果配置远程上传为本地 |
| | | if(this.acquireFileOperateSpi().isRemoteAsLocal()){ |
| | | return this.acquireFileOperateSpi().uploadFileToLocal(inputStream, fileName, groupId, fileSize, businessType, owner); |
| | | } |
| | | |
| | | FileStoreType fileStoreType = FileStoreType.getType(remoteFileStoreType); |
| | | String ossType = BeanContextAware.getBeanByType(FileProperties.class).getOssType(); |
| | | if(StringUtils.isEmpty(ossType)){ |
| | | throw new PlatformRuntimeException("平台未配置任何ossType"); |
| | | } |
| | | |
| | | FileStoreType fileStoreType = FileStoreType.getType(ossType); |
| | | if(fileStoreType == FileStoreType.Ftp){ |
| | | return this.acquireFileOperateSpi().uploadFileToFtp(inputStream, fileName, groupId, fileSize, businessType, owner); |
| | | } else { |