2018-01-17 17:51:53 +08:00
|
|
|
|
package cn.keking.service.impl;
|
|
|
|
|
|
|
2018-03-25 13:26:51 +08:00
|
|
|
|
import cn.keking.model.FileAttribute;
|
2018-01-17 17:51:53 +08:00
|
|
|
|
import cn.keking.service.FilePreview;
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import org.springframework.ui.Model;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Created by kl on 2018/1/17.
|
|
|
|
|
|
* Content :其他文件
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Service
|
|
|
|
|
|
public class OtherFilePreviewImpl implements FilePreview {
|
2020-12-27 14:47:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
2018-01-17 17:51:53 +08:00
|
|
|
|
@Override
|
2019-06-17 14:21:16 +08:00
|
|
|
|
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
|
2020-12-27 14:47:28 +08:00
|
|
|
|
return this.notSupportedFile(model,fileAttribute,"系统还不支持该格式文件的在线预览");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 通用的预览失败,导向到不支持的文件响应页面
|
|
|
|
|
|
*
|
|
|
|
|
|
* @return 页面
|
|
|
|
|
|
*/
|
|
|
|
|
|
public String notSupportedFile(Model model, FileAttribute fileAttribute, String errMsg) {
|
|
|
|
|
|
model.addAttribute("fileType", fileAttribute.getSuffix());
|
|
|
|
|
|
model.addAttribute("msg", errMsg);
|
|
|
|
|
|
return NOT_SUPPORTED_FILE_PAGE;
|
2018-01-17 17:51:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|