package com.mortals.xhx.base.system.upload.service;

import com.mortals.framework.service.IService;
import com.mortals.framework.service.IUser;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

/**
 * <p>Title: 上传文件</p>
 * <p>Description: UploadService service接口 </p>
 * <p>Copyright: Copyright &reg;  </p>
 * <p>Company: </p>
 *
 * @author
 * @version 1.0.0
 */

public interface UploadService extends IService {

    /**
     * 保存文件
     *
     * @param file
     * @param prePath
     * @param user
     * @return 文件路径（非全路径）
     */
    String saveFileUpload(MultipartFile file, String prePath, IUser user);


    /**
     * 获取文件全路径
     *
     * @param filePath
     * @return
     */
    String getFilePath(String filePath);


    /**
     * 通用下载请求
     *
     * @param fileName 文件名称
     * @param delete   是否删除
     */
    void fileDownload(String fileName, Boolean delete, HttpServletResponse response);


    void preview(String fileName, HttpServletResponse response);


    void uploadDownload(String fileName, HttpServletResponse response);

    void deleteFile(String fileName);

}