文档库--预览修改
This commit is contained in:
+8
-4
@@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import com.jero.common.api.vo.Result;
|
import com.jero.common.api.vo.Result;
|
||||||
import com.jero.common.constant.CommonConstant;
|
import com.jero.common.constant.CommonConstant;
|
||||||
import com.jero.common.system.api.ISysBaseAPI;
|
import com.jero.common.system.api.ISysBaseAPI;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
@@ -254,15 +255,18 @@ public class CommonController {
|
|||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/download/**")
|
@GetMapping(value = "/download/{id}")
|
||||||
public void downLoad(String id,HttpServletRequest request, HttpServletResponse response) {
|
public void downLoad(@PathVariable("id") String id,HttpServletRequest request, HttpServletResponse response) {
|
||||||
id = id.split(".")[0];
|
if(StringUtils.isBlank(id)){
|
||||||
|
throw new JeroBootException("参数信息不全");
|
||||||
|
}
|
||||||
|
id = id.split("\\.")[0];
|
||||||
// 查询数据表数据是否存在
|
// 查询数据表数据是否存在
|
||||||
LambdaQueryWrapper<OSSFile> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<OSSFile> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(OSSFile::getId,id);
|
queryWrapper.eq(OSSFile::getId,id);
|
||||||
OSSFile ossFile = ossFileService.getOne(queryWrapper);
|
OSSFile ossFile = ossFileService.getOne(queryWrapper);
|
||||||
if( null == ossFile){
|
if( null == ossFile){
|
||||||
throw new JeroBootException("文件不存在..");
|
throw new JeroBootException("文件不存在");
|
||||||
}
|
}
|
||||||
InputStream inputStream = null;
|
InputStream inputStream = null;
|
||||||
OutputStream outputStream = null;
|
OutputStream outputStream = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user