代码优化
This commit is contained in:
parent
b379e983da
commit
33106201f6
@ -1,6 +1,7 @@
|
|||||||
package com.qiwenshare.file.component;
|
package com.qiwenshare.file.component;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.qiwenshare.common.constant.FileConstant;
|
import com.qiwenshare.common.constant.FileConstant;
|
||||||
import com.qiwenshare.common.util.DateUtil;
|
import com.qiwenshare.common.util.DateUtil;
|
||||||
@ -295,14 +296,20 @@ public class FileDealComp {
|
|||||||
String extractionCode,
|
String extractionCode,
|
||||||
String token,
|
String token,
|
||||||
long userFileId) {
|
long userFileId) {
|
||||||
|
log.info("权限检查开始:shareBatchNum:{}, extractionCode:{}, token:{}, userFileId{}" , shareBatchNum, extractionCode, token, userFileId);
|
||||||
UserFile userFile = userFileService.getById(userFileId);
|
UserFile userFile = userFileService.getById(userFileId);
|
||||||
|
log.debug(JSON.toJSONString(userFile));
|
||||||
if ("undefined".equals(shareBatchNum) || StringUtils.isEmpty(shareBatchNum)) {
|
if ("undefined".equals(shareBatchNum) || StringUtils.isEmpty(shareBatchNum)) {
|
||||||
|
|
||||||
UserBean sessionUserBean = userService.getUserBeanByToken(token);
|
UserBean sessionUserBean = userService.getUserBeanByToken(token);
|
||||||
|
log.debug(JSON.toJSONString("当前登录session用户:" + sessionUserBean));
|
||||||
if (sessionUserBean == null) {
|
if (sessionUserBean == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
log.debug("文件所属用户id:" + userFile.getUserId());
|
||||||
|
log.debug("登录用户id:" + sessionUserBean.getUserId());
|
||||||
if (userFile.getUserId() != sessionUserBean.getUserId()) {
|
if (userFile.getUserId() != sessionUserBean.getUserId()) {
|
||||||
|
log.debug("用户id不一致,权限校验失败:");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -45,7 +45,7 @@ import static com.qiwenshare.common.util.FileUtil.getFileExtendsByType;
|
|||||||
@Tag(name = "file", description = "该接口为文件接口,主要用来做一些文件的基本操作,如创建目录,删除,移动,复制等。")
|
@Tag(name = "file", description = "该接口为文件接口,主要用来做一些文件的基本操作,如创建目录,删除,移动,复制等。")
|
||||||
@RestController
|
@RestController
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequestMapping({"/file", "/api/file"})
|
@RequestMapping("/file")
|
||||||
public class FileController {
|
public class FileController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -39,7 +39,7 @@ import java.util.Map;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Tag(name = "filetransfer", description = "该接口为文件传输接口,主要用来做文件的上传和下载")
|
@Tag(name = "filetransfer", description = "该接口为文件传输接口,主要用来做文件的上传和下载")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping({"/filetransfer", "/api/filetransfer"})
|
@RequestMapping("/filetransfer")
|
||||||
public class FiletransferController {
|
public class FiletransferController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@ -180,6 +180,7 @@ public class FiletransferController {
|
|||||||
previewDTO.getExtractionCode(),
|
previewDTO.getExtractionCode(),
|
||||||
previewDTO.getToken(),
|
previewDTO.getToken(),
|
||||||
previewDTO.getUserFileId());
|
previewDTO.getUserFileId());
|
||||||
|
|
||||||
if (!authResult) {
|
if (!authResult) {
|
||||||
log.error("没有权限预览!!!");
|
log.error("没有权限预览!!!");
|
||||||
return;
|
return;
|
||||||
|
@ -28,7 +28,7 @@ import java.util.List;
|
|||||||
@Tag(name = "recoveryfile", description = "文件删除后会进入回收站,该接口主要是对回收站文件进行管理")
|
@Tag(name = "recoveryfile", description = "文件删除后会进入回收站,该接口主要是对回收站文件进行管理")
|
||||||
@RestController
|
@RestController
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequestMapping({"/recoveryfile", "/api/recoveryfile"})
|
@RequestMapping("/recoveryfile")
|
||||||
public class RecoveryFileController {
|
public class RecoveryFileController {
|
||||||
@Resource
|
@Resource
|
||||||
IRecoveryFileService recoveryFileService;
|
IRecoveryFileService recoveryFileService;
|
||||||
|
@ -32,7 +32,7 @@ import java.util.*;
|
|||||||
@Tag(name = "share", description = "该接口为文件分享接口")
|
@Tag(name = "share", description = "该接口为文件分享接口")
|
||||||
@RestController
|
@RestController
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequestMapping({"/share", "/api/share"})
|
@RequestMapping("/api/share")
|
||||||
public class ShareController {
|
public class ShareController {
|
||||||
|
|
||||||
public static final String CURRENT_MODULE = "文件分享";
|
public static final String CURRENT_MODULE = "文件分享";
|
||||||
|
@ -28,7 +28,7 @@ import java.util.Map;
|
|||||||
@Tag(name = "user", description = "该接口为用户接口,主要做用户登录,注册和校验token")
|
@Tag(name = "user", description = "该接口为用户接口,主要做用户登录,注册和校验token")
|
||||||
@RestController
|
@RestController
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequestMapping({"/user", "/api/user"})
|
@RequestMapping("/user")
|
||||||
public class UserController {
|
public class UserController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -72,7 +72,6 @@ public class FiletransferService implements IFiletransferService {
|
|||||||
@Override
|
@Override
|
||||||
public void uploadFile(HttpServletRequest request, UploadFileDTO uploadFileDto, Long userId) {
|
public void uploadFile(HttpServletRequest request, UploadFileDTO uploadFileDto, Long userId) {
|
||||||
|
|
||||||
|
|
||||||
UploadFile uploadFile = new UploadFile();
|
UploadFile uploadFile = new UploadFile();
|
||||||
uploadFile.setChunkNumber(uploadFileDto.getChunkNumber());
|
uploadFile.setChunkNumber(uploadFileDto.getChunkNumber());
|
||||||
uploadFile.setChunkSize(uploadFileDto.getChunkSize());
|
uploadFile.setChunkSize(uploadFileDto.getChunkSize());
|
||||||
|
@ -34,7 +34,7 @@ spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.Ph
|
|||||||
|
|
||||||
#静态资源指定
|
#静态资源指定
|
||||||
spring.mvc.static-path-pattern=/**
|
spring.mvc.static-path-pattern=/**
|
||||||
spring.web.resources.static-locations=classpath:/static,file:${qiwen-file.local-storage-path}
|
spring.web.resources.static-locations=classpath:/static
|
||||||
|
|
||||||
#上传下载
|
#上传下载
|
||||||
spring.servlet.multipart.max-file-size=2048MB
|
spring.servlet.multipart.max-file-size=2048MB
|
||||||
@ -92,9 +92,11 @@ spring.redis.timeout=5000
|
|||||||
|
|
||||||
spring.data.elasticsearch.client.reactive.endpoints=127.0.0.1:9200
|
spring.data.elasticsearch.client.reactive.endpoints=127.0.0.1:9200
|
||||||
spring.elasticsearch.rest.uris=127.0.0.1:9200
|
spring.elasticsearch.rest.uris=127.0.0.1:9200
|
||||||
|
spring.elasticsearch.rest.username=
|
||||||
|
spring.elasticsearch.rest.password=
|
||||||
|
|
||||||
|
|
||||||
# 当前部署外网IP,用于office预览
|
# 当前部署外网IP,用于office预览
|
||||||
deployment.host: 172.17.242.97:${server.port}
|
deployment.host: 172.16.100.53:${server.port}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ files.docservice.edited-docs=.docx|.xlsx|.csv|.pptx|.txt
|
|||||||
files.docservice.convert-docs=.docm|.dotx|.dotm|.dot|.doc|.odt|.fodt|.ott|.xlsm|.xltx|.xltm|.xlt|.xls|.ods|.fods|.ots|.pptm|.ppt|.ppsx|.ppsm|.pps|.potx|.potm|.pot|.odp|.fodp|.otp|.rtf|.mht|.html|.htm|.xml|.epub|.fb2
|
files.docservice.convert-docs=.docm|.dotx|.dotm|.dot|.doc|.odt|.fodt|.ott|.xlsm|.xltx|.xltm|.xlt|.xls|.ods|.fods|.ots|.pptm|.ppt|.ppsx|.ppsm|.pps|.potx|.potm|.pot|.odp|.fodp|.otp|.rtf|.mht|.html|.htm|.xml|.epub|.fb2
|
||||||
files.docservice.timeout=120000
|
files.docservice.timeout=120000
|
||||||
|
|
||||||
files.docservice.url.site=http://172.17.242.97:80/
|
files.docservice.url.site=http://172.16.100.53:80/
|
||||||
files.docservice.url.converter=ConvertService.ashx
|
files.docservice.url.converter=ConvertService.ashx
|
||||||
files.docservice.url.command=coauthoring/CommandService.ashx
|
files.docservice.url.command=coauthoring/CommandService.ashx
|
||||||
files.docservice.url.api=web-apps/apps/api/documents/api.js
|
files.docservice.url.api=web-apps/apps/api/documents/api.js
|
||||||
|
Loading…
Reference in New Issue
Block a user