feat: 预览接口支持token校验用户是否有企标权限
This commit is contained in:
+8
-11
@@ -1,6 +1,7 @@
|
||||
package com.jero.modules.system.controller;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -12,6 +13,7 @@ import com.jero.common.util.*;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
import com.jero.modules.system.util.SysWaterMarkUtil;
|
||||
import com.jero.modules.system.util.UserUtils;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -155,17 +157,7 @@ public class CommonController {
|
||||
downloadAndViewWithWaterMark(id, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 预览图片
|
||||
*
|
||||
* @param id 传入文件id
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@GetMapping(value = "/view/{id}")
|
||||
public void view(@PathVariable String id, HttpServletRequest request, HttpServletResponse response) {
|
||||
downloadAndViewWithWaterMark(id, response);
|
||||
}
|
||||
|
||||
|
||||
private void downloadAndView(@PathVariable String id, HttpServletResponse response) {
|
||||
// 查询数据表数据是否存在
|
||||
@@ -251,6 +243,11 @@ public class CommonController {
|
||||
if (null == ossFile) {
|
||||
throw new JeroBootException("文件不存在..");
|
||||
}
|
||||
// 如果是企标的文件则需要判断当前登录人是否有查看权限,如果没有则需要返回没有权限的文件
|
||||
if (StrUtil.isBlank(ossFile.getStandardId())) {
|
||||
String userId = UserUtils.getUserId();
|
||||
|
||||
}
|
||||
String fileUrl = ossFile.getUrl();
|
||||
// minio 下载
|
||||
// 通过MinioUtil查询时 只需要桶后面的路径
|
||||
|
||||
Reference in New Issue
Block a user