package com.vci.web.service; import com.vci.pagemodel.VciFileObjectVO; import com.vci.starter.web.exception.VciBaseException; import com.vci.starter.web.pagemodel.BaseResult; import net.lingala.zip4j.core.ZipFile; import net.lingala.zip4j.io.ZipOutputStream; import java.util.Collection; import java.util.Map; /** * 文件下载的服务接口 * 是指把文件从文件存储服务上下载,不是直接下载到浏览器 * @author weidy * @date 2020/3/12 */ public interface VciFileDownloadServiceI { /** * 根据主键下载文件,会下载到默认的临时文件夹下 * @param fileOid 文件的主键 * @return 文件在本地的全路径,注意以http://或者以https://开头的不会下载,需要自行判断 * @throws VciBaseException 参数为空或者文件出错的时候会抛出异常 */ String downloadFileByOid(String fileOid) throws VciBaseException; /** * 根据主键下载文件 * @param clientPath 客户端的文件夹 * @param fileOid 文件的主键 * @return 文件在本地的全路径,注意以http://或者以https://开头的不会下载,需要自行判断 * @throws VciBaseException 参数为空或者文件出错的时候会抛出异常 */ String downloadFileByOid(String clientPath, String fileOid) throws VciBaseException; /** * 根据主键批量下载文件,会下载到默认的临时文件夹下 * @param fileOidCollection 文件集合 * @return key是文件的主键,value是文件在本地的全路径,注意以http://或者以https://开头的不会下载,需要自行判断 * @throws VciBaseException 参数为空或者文件出错的时候会抛出异常 */ Map batchDownloadFileByOids(Collection fileOidCollection) throws VciBaseException; /** * 根据主键批量下载文件 * @param clientPath 客户端的文件夹 * @param fileOidCollection 文件集合 * @return key是文件的主键,value是文件在本地的全路径,注意以http://或者以https://开头的不会下载,需要自行判断 * @throws VciBaseException 参数为空或者文件出错的时候会抛出异常 */ Map batchDownloadFileByOids(String clientPath, Collection fileOidCollection) throws VciBaseException; /** * 根据主键批量下载文件,下载模型文件不能用这个方法 * @param clientPath 客户端的文件夹 * @param fileOidCollection 文件集合 * @param sameFileUseOidFolder 当相同文件时,使用主键来做文件夹区分 * @return key是文件的主键,value是文件在本地的全路径,注意以http://或者以https://开头的不会下载,需要自行判断 * @throws VciBaseException 参数为空或者文件出错的时候会抛出异常 */ Map batchDownloadFileByOids(String clientPath, Collection fileOidCollection,boolean sameFileUseOidFolder) throws VciBaseException; /** * 根据文件对象下载文件 * @param fileObjectVO 文件的显示对象 * @return 文件在本地的全路径,注意以http://或者以https://开头的不会下载,需要自行判断 * @throws VciBaseException 参数为空或者文件出错的时候会抛出异常 */ String downloadFileByFileObject(VciFileObjectVO fileObjectVO) throws VciBaseException; /** * 根据文件对象下载文件 * @param clientPath 客户端的文件夹 * @param fileObjectVO 文件的显示对象 * @return 文件在本地的全路径,注意以http://或者以https://开头的不会下载,需要自行判断 * @throws VciBaseException 参数为空或者文件出错的时候会抛出异常 */ String downloadFileByFileObject(String clientPath,VciFileObjectVO fileObjectVO) throws VciBaseException; /** * 根据主键批量下载文件,会下载到默认的文件夹下 * @param fileObjectVOCollection 文件显示对象集合 * @return key是文件的主键,value是文件在本地的全路径,注意以http://或者以https://开头的不会下载,需要自行判断 * @throws VciBaseException 参数为空或者文件出错的时候会抛出异常 */ Map batchDownloadFileByFileObject( Collection fileObjectVOCollection) throws VciBaseException; /** * 根据主键批量下载文件 * @param clientPath 客户端的文件夹 * @param fileObjectVOCollection 文件显示对象集合 * @return key是文件的主键,value是文件在本地的全路径,注意以http://或者以https://开头的不会下载,需要自行判断 * @throws VciBaseException 参数为空或者文件出错的时候会抛出异常 */ Map batchDownloadFileByFileObject(String clientPath, Collection fileObjectVOCollection) throws VciBaseException; /** * 下载文件到zip文件中 * @param zipFileName zip文件文件路径 * @param fileOid 文件主键 * @throws VciBaseException 查询出错的时候会抛出异常 */ void downloadZipFileByOids(String zipFileName, String fileOid) throws VciBaseException; /** * 下载文件到zip文件中 * @param zipFile zip文件 * @param fileOid 文件主键 * @throws VciBaseException 查询出错的时候会抛出异常 */ void downloadZipFileByOids(ZipFile zipFile, String fileOid) throws VciBaseException; /** * 下载文件到zip文件中 * @param zipOutputStream zip文件输出流 * @param fileOid 文件主键 * @throws VciBaseException 查询出错的时候会抛出异常 */ void downloadZipStreamByOids(ZipOutputStream zipOutputStream, String fileOid) throws VciBaseException; /** * 下载文件到zip文件中 * @param zipFileName zip文件名称 * @param fileOidCollection 文件主键集合 * @throws VciBaseException 查询出错的时候会抛出异常 */ void downloadZipFileByOids(String zipFileName, Collection fileOidCollection) throws VciBaseException; /** * 下载文件到zip文件中 * @param zipFile zip文件 * @param fileOidCollection 文件主键集合 * @throws VciBaseException 查询出错的时候会抛出异常 */ void downloadZipFileByOids(ZipFile zipFile, Collection fileOidCollection) throws VciBaseException; /** * 下载文件到zip文件中 * @param zipOutputStream zip文件输出流 * @param fileOidCollection 文件主键集合 * @throws VciBaseException 查询出错的时候会抛出异常 */ void downloadZipStreamByOids(ZipOutputStream zipOutputStream, Collection fileOidCollection) throws VciBaseException; /** * 下载文件到zip文件中,下载模型文件切记不要用这个 * @param zipFile zip文件 * @param fileOidCollection 文件主键集合 * @param sameFileUseOidFolder 当相同文件时,使用主键来做文件夹区分 * @throws VciBaseException 查询出错的时候会抛出异常 */ void downloadZipFileByOids(ZipFile zipFile, Collection fileOidCollection,boolean sameFileUseOidFolder) throws VciBaseException; /** * 下载文件到zip文件中,下载模型文件切记不要用这个 * @param zipOutputStream zip文件输出流 * @param fileOidCollection 文件主键集合 * @param sameFileUseOidFolder 当相同文件时,使用主键来做文件夹区分 * @throws VciBaseException 查询出错的时候会抛出异常 */ void downloadZipStreamByOids(ZipOutputStream zipOutputStream, Collection fileOidCollection,boolean sameFileUseOidFolder) throws VciBaseException; /** * 分片下载文件 * @param fileOid 文件主键 * @param offSet 偏移量 * @return 数据的二进制信息 * @throws VciBaseException 下载的时候出现错误的时候会抛出异常 */ BaseResult sectionDownloadByFileOid(String fileOid, long offSet) throws VciBaseException; /** * 删除文件 * @param fileOidCollection 文件主键集合 * @return 执行结果 * @throws VciBaseException 载的时候出现错误的时候会抛出异常 */ BaseResult deleteFile(Collection fileOidCollection) throws VciBaseException; /** * 使用卷服务上的文件路径来下载 * @param filePath 卷服务里的路径,主要是xxx:yyy的方式 * @return 下载后的地址 * @throws VciBaseException 下载出错会抛出异常 */ String downloadFileByPath(String filePath) throws VciBaseException; }