| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- package com.uas.report.service;
- import java.util.List;
- import java.util.Map;
- import javax.servlet.http.HttpServletResponse;
- import org.springframework.web.multipart.MultipartFile;
- /**
- * 文件操作
- *
- * @author sunyj
- * @since 2016年11月2日 下午2:36:46
- */
- public interface FileService {
- /**
- * 自动对新部署的账套进行下载模板、解压、配置路径等操作
- *
- * @param userNames
- * 账套名称,多个账套以英文逗号隔开
- * @return 部署结果
- */
- public String autoDeploy(String userNames);
- /**
- * 上传文件
- *
- * @param userName
- * 账套名,文件上传至相应账套路径下
- * @param file
- * 上传的文件
- * @return 上传结果
- */
- public String upload(String userName, String fileType, MultipartFile file);
- /**
- * 获取账套下的模板路径
- *
- * @param userName
- * 账套名称
- * @param reportName
- * 模板名称
- * @return 模板路径
- */
- public String getJrxmlFilePath(String userName, String reportName);
- /**
- * 获取账套路径
- *
- * @param userName
- * 账套名称
- * @return 账套路径
- */
- public String getMasterPath(String userName);
- /**
- * 获取标准模板
- *
- * @return 标准模板数据
- */
- public byte[] getStandardJrxmls();
- /**
- * 获取账套下的所有资源
- *
- * @param userName
- * 账套名称
- * @return 账套下所有资源的压缩包路径
- */
- public String getZip(String userName);
- /**
- * 下载文件
- *
- * @param filePath
- * 文件路径
- * @param isAbsolutePath
- * 文件路径是否为绝对路径
- * @param response
- */
- public void download(String filePath, Boolean isAbsolutePath, HttpServletResponse response);
- /**
- * 账套下的某个文件(夹)
- *
- * @param userName
- * 账套名称
- * @param fileRelativePath
- * 文件(夹)在账套下的相对路径
- * @return 文件(夹)路径
- */
- public String delete(String userName, String fileRelativePath);
- /**
- * 递归删除文件(夹)
- *
- * @param filePath
- * 文件(夹)路径
- * @return 文件(夹)路径
- */
- public String delete(String filePath);
- /**
- * 列出本地资源根路径下指定路径的文件信息
- *
- * @param fileRelativePath
- * 指定的相对路径
- * @return 文件信息,包括name(String)、lastModified(String)、size(Long)、relativePath(
- * String)、isDirectory(Boolean)
- */
- public List<Map<String, Object>> listFiles(String fileRelativePath);
- /**
- * 判断文件是否有效(文件存在并且未过有效期,并且比模板新)
- *
- * @param filePath
- * 所指定的文件绝对路径
- * @param jrxmlFilePath
- * 文件对应的模板路径
- * @return 是否有效
- */
- public boolean isFileValid(String filePath, String jrxmlFilePath);
- /**
- * 根据报表名、账套名等生成文件名(文件名:reportName + hashCode)
- *
- * @param userName
- * 不为null;当前账套用户名
- * @param profile
- * 可为null;用于标识请求源(B2C、B2B)是正式、测试还是开发版本:prod、test、dev
- * @param reportName
- * 不为null;需要预览的报表的名称,不带任何后缀(如预览采购单,即为"Purchase")
- * @param whereCondition
- * 可为null;where之后的条件(包括where)
- * @param otherParameters
- * 可为null;若模板已指定需要的参数,则不可为null;其他参数,区别于whereCondition,
- * 报表某些字段的值取决于这些参数; JSON格式,数据为键值对
- * @param exportFileType
- * 导出为文件时,文件的格式(pdf、xls、xls_with_only_data等)
- * @return 生成的文件名(不含后缀名)
- */
- public String generateFileName(String userName, String profile, String reportName, String whereCondition,
- String otherParameters, String exportFileType);
- /**
- * 获取给定的pdf文件的页数
- *
- * @param pdfFilePath
- * 给定的pdf文件绝对路径
- * @return pdf文件的页数
- */
- public int getPageSize(String pdfFilePath);
- /**
- * 利用给定的pdf文件在同级目录下生成多个分页的pdf文件(一页对应一个文件)
- *
- * @param pdfFilePath
- * 给定的pdf文件绝对路径
- */
- public void createPagedPdfFiles(String pdfFilePath);
- }
|