Ver código fonte

Merge branch 'dev' of http://192.168.1.245:11111/jinjilong/onlineEducation-fwd into dev

honorfire 8 meses atrás
pai
commit
4c446c474b

+ 520 - 1
snowy-plugin/snowy-plugin-disk/snowy-plugin-disk-func/src/main/java/vip/xiaonuo/disk/controller/FileController.java

@@ -147,6 +147,85 @@ public class FileController {
         }
     }
 
+
+
+
+
+
+
+    @Operation(summary = "创建文件", description = "创建文件", tags = {"file"})
+    @ResponseBody
+    @RequestMapping(value = "/createCommonFile", method = RequestMethod.POST)
+    public RestResult<Object> createCommonFile(@Valid @RequestBody CreateFileDTO createFileDTO) {
+
+        try {
+
+            String userId = "common";
+            String filePath = createFileDTO.getFilePath();
+            String fileName = createFileDTO.getFileName();
+            String extendName = createFileDTO.getExtendName();
+            List<UserFile> userFiles = userFileService.selectSameUserFile(fileName, filePath, extendName, userId);
+            if (userFiles != null && !userFiles.isEmpty()) {
+                return RestResult.fail().message("同名文件已存在");
+            }
+            String uuid = UUID.randomUUID().toString().replaceAll("-", "");
+
+            String templateFilePath = "";
+            if ("docx".equals(extendName)) {
+                templateFilePath = "template/Word.docx";
+            } else if ("xlsx".equals(extendName)) {
+                templateFilePath = "template/Excel.xlsx";
+            } else if ("pptx".equals(extendName)) {
+                templateFilePath = "template/PowerPoint.pptx";
+            } else if ("txt".equals(extendName)) {
+                templateFilePath = "template/Text.txt";
+            } else if ("drawio".equals(extendName)) {
+                templateFilePath = "template/Drawio.drawio";
+            }
+            String url2 = ClassUtils.getDefaultClassLoader().getResource("static/" + templateFilePath).getPath();
+            url2 = URLDecoder.decode(url2, "UTF-8");
+            FileInputStream fileInputStream = new FileInputStream(url2);
+            Copier copier = ufopFactory.getCopier();
+            CopyFile copyFile = new CopyFile();
+            copyFile.setExtendName(extendName);
+            String fileUrl = copier.copy(fileInputStream, copyFile);
+
+            FileBean fileBean = new FileBean();
+            fileBean.setFileId(IdUtil.getSnowflakeNextIdStr());
+            fileBean.setFileSize(0L);
+            fileBean.setFileUrl(fileUrl);
+            fileBean.setStorageType(storageType);
+            fileBean.setIdentifier(uuid);
+            fileBean.setCreateTime(DateUtil.getCurrentTime());
+            fileBean.setCreateUserId(StpLoginUserUtil.getLoginUser().getId());
+            fileBean.setFileStatus(1);
+            boolean saveFlag = fileService.save(fileBean);
+            UserFile userFile = new UserFile();
+            if (saveFlag) {
+                userFile.setUserFileId(IdUtil.getSnowflakeNextIdStr());
+                userFile.setUserId(userId);
+                userFile.setFileName(fileName);
+                userFile.setFilePath(filePath);
+                userFile.setDeleteFlag(0);
+                userFile.setIsDir(0);
+                userFile.setExtendName(extendName);
+                userFile.setUploadTime(DateUtil.getCurrentTime());
+                userFile.setFileId(fileBean.getFileId());
+                userFile.setCreateTime(DateUtil.getCurrentTime());
+                userFile.setCreateUserId(SessionUtil.getUserId());
+                userFileService.save(userFile);
+            }
+            return RestResult.success().message("文件创建成功");
+        } catch (Exception e) {
+            log.error(e.getMessage());
+            return RestResult.fail().message(e.getMessage());
+        }
+    }
+
+
+
+
+
     @Operation(summary = "创建文件夹", description = "目录(文件夹)的创建", tags = {"file"})
     @RequestMapping(value = "/createFold", method = RequestMethod.POST)
     @MyLog(operation = "创建文件夹", module = CURRENT_MODULE)
@@ -171,6 +250,38 @@ public class FileController {
         return RestResult.success();
     }
 
+
+
+    @Operation(summary = "创建文件夹", description = "目录(文件夹)的创建", tags = {"file"})
+    @RequestMapping(value = "/createCommonFold", method = RequestMethod.POST)
+    @MyLog(operation = "创建文件夹", module = CURRENT_MODULE)
+    @ResponseBody
+    public RestResult<String> createCommonFold(@Valid @RequestBody CreateFoldDTO createFoldDto) {
+
+//        String userId = SessionUtil.getSession().getUserId();
+        String userId = "common";
+        String filePath = createFoldDto.getFilePath();
+
+
+        boolean isDirExist = fileDealComp.isDirExist(createFoldDto.getFileName(), createFoldDto.getFilePath(), userId);
+
+        if (isDirExist) {
+            return RestResult.fail().message("同名文件夹已存在");
+        }
+
+        UserFile userFile = QiwenFileUtil.getQiwenDir(userId, filePath, createFoldDto.getFileName());
+
+        userFileService.save(userFile);
+        fileDealComp.uploadESByUserFileId(userFile.getUserFileId());
+        return RestResult.success();
+    }
+
+
+
+
+
+
+
     @Operation(summary = "文件搜索", description = "文件搜索", tags = {"file"})
     @GetMapping(value = "/search")
     @MyLog(operation = "文件搜索", module = CURRENT_MODULE)
@@ -236,6 +347,79 @@ public class FileController {
     }
 
 
+
+
+
+
+
+    @Operation(summary = "文件搜索", description = "文件搜索", tags = {"file"})
+    @GetMapping(value = "/searchCommon")
+    @MyLog(operation = "文件搜索", module = CURRENT_MODULE)
+    @ResponseBody
+    public RestResult<SearchFileVO> searchCommon(SearchFileDTO searchFileDTO) {
+        String userId = "common";
+
+        int currentPage = (int)searchFileDTO.getCurrentPage() - 1;
+        int pageCount = (int)(searchFileDTO.getPageCount() == 0 ? 10 : searchFileDTO.getPageCount());
+
+        SearchResponse<FileSearch> search = null;
+        try {
+            search = elasticsearchClient.search(s -> s
+                            .index("filesearch")
+                            .query(_1 -> _1
+                                    .bool(_2 -> _2
+                                            .must(_3 -> _3
+                                                    .bool(_4 -> _4
+                                                            .should(_5 -> _5
+                                                                    .match(_6 -> _6
+                                                                            .field("fileName")
+                                                                            .query(searchFileDTO.getFileName())))
+                                                            .should(_5 -> _5
+                                                                    .wildcard(_6 -> _6
+                                                                            .field("fileName")
+                                                                            .wildcard("*" + searchFileDTO.getFileName() + "*")))
+                                                            .should(_5 -> _5
+                                                                    .match(_6 -> _6
+                                                                            .field("content")
+                                                                            .query(searchFileDTO.getFileName())))
+                                                            .should(_5 -> _5
+                                                                    .wildcard(_6 -> _6
+                                                                            .field("content")
+                                                                            .wildcard("*" + searchFileDTO.getFileName() + "*")))
+                                                    ))
+                                            .must(_3 -> _3
+                                                    .term(_4 -> _4
+                                                            .field("userId")
+                                                            .value(userId)))
+                                    ))
+                            .from(currentPage)
+                            .size(pageCount)
+                            .highlight(h -> h
+                                    .fields("fileName", f -> f.type("plain")
+                                            .preTags("<span class='keyword'>").postTags("</span>"))
+                                    .encoder(HighlighterEncoder.Html))
+                    ,
+                    FileSearch.class);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        List<SearchFileVO> searchFileVOList = new ArrayList<>();
+        for (Hit<FileSearch> hit : search.hits().hits()) {
+            SearchFileVO searchFileVO = new SearchFileVO();
+            BeanUtil.copyProperties(hit.source(), searchFileVO);
+            searchFileVO.setHighLight(hit.highlight());
+            searchFileVOList.add(searchFileVO);
+            asyncTaskComp.checkESUserFileId(searchFileVO.getUserFileId());
+        }
+        return RestResult.success().dataList(searchFileVOList, searchFileVOList.size());
+    }
+
+
+
+
+
+
     @Operation(summary = "文件重命名", description = "文件重命名", tags = {"file"})
     @RequestMapping(value = "/renamefile", method = RequestMethod.POST)
     @MyLog(operation = "文件重命名", module = CURRENT_MODULE)
@@ -270,6 +454,51 @@ public class FileController {
         return RestResult.success();
     }
 
+
+
+
+
+
+
+    @Operation(summary = "文件重命名", description = "文件重命名", tags = {"file"})
+    @RequestMapping(value = "/renameCommonfile", method = RequestMethod.POST)
+    @MyLog(operation = "文件重命名", module = CURRENT_MODULE)
+    @ResponseBody
+    public RestResult<String> renameCommonfile(@RequestBody RenameFileDTO renameFileDto) {
+
+        String userId ="common";
+        UserFile userFile = userFileService.getById(renameFileDto.getUserFileId());
+
+        List<UserFile> userFiles = userFileService.selectUserFileByNameAndPath(renameFileDto.getFileName(), userFile.getFilePath(), userId);
+        if (userFiles != null && !userFiles.isEmpty()) {
+            return RestResult.fail().message("同名文件已存在");
+        }
+
+        LambdaUpdateWrapper<UserFile> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
+        lambdaUpdateWrapper.set(UserFile::getFileName, renameFileDto.getFileName())
+                .set(UserFile::getUploadTime, DateUtil.getCurrentTime())
+                .eq(UserFile::getUserFileId, renameFileDto.getUserFileId());
+        userFileService.update(lambdaUpdateWrapper);
+        if (1 == userFile.getIsDir()) {
+            List<UserFile> list = userFileService.selectUserFileByLikeRightFilePath(new QiwenFile(userFile.getFilePath(), userFile.getFileName(), true).getPath(), userId);
+
+            for (UserFile newUserFile : list) {
+                String escapedPattern = Pattern.quote(new QiwenFile(userFile.getFilePath(), userFile.getFileName(), userFile.getIsDir() == 1).getPath());
+                newUserFile.setFilePath(newUserFile.getFilePath().replaceFirst(escapedPattern,
+                        new QiwenFile(userFile.getFilePath(), renameFileDto.getFileName(), userFile.getIsDir() == 1).getPath()));
+                userFileService.updateById(newUserFile);
+            }
+        }
+        fileDealComp.uploadESByUserFileId(renameFileDto.getUserFileId());
+        return RestResult.success();
+    }
+
+
+
+
+
+
+
     @Operation(summary = "获取文件列表", description = "用来做前台列表展示", tags = {"file"})
     @RequestMapping(value = "/getfilelist", method = RequestMethod.GET)
     @ResponseBody
@@ -289,6 +518,28 @@ public class FileController {
     }
 
 
+    @Operation(summary = "获取公共资源库文件列表", description = "用来做前台列表展示", tags = {"file"})
+    @RequestMapping(value = "/getcommonfilelist", method = RequestMethod.GET)
+    @ResponseBody
+    public RestResult<FileListVO> getcommonfilelist(
+            @Parameter(description = "文件类型", required = true) String fileType,
+            @Parameter(description = "文件路径", required = true) String filePath,
+            @Parameter(description = "当前页", required = true) long currentPage,
+            @Parameter(description = "页面数量", required = true) long pageCount
+    ){
+        String userId = "common";
+        if ("0".equals(fileType)) {
+            IPage<FileListVO> fileList = userFileService.userFileList(userId, filePath, currentPage, pageCount);
+            return RestResult.success().dataList(fileList.getRecords(), fileList.getTotal());
+        } else {
+            IPage<FileListVO> fileList = userFileService.getFileByFileType(Integer.valueOf(fileType), currentPage, pageCount, userId);
+            return RestResult.success().dataList(fileList.getRecords(), fileList.getTotal());
+        }
+    }
+
+
+
+
     @Operation(summary = "批量删除文件", description = "批量删除文件", tags = {"file"})
     @RequestMapping(value = "/batchdeletefile", method = RequestMethod.POST)
     @MyLog(operation = "批量删除文件", module = CURRENT_MODULE)
@@ -308,6 +559,33 @@ public class FileController {
         return RestResult.success().message("批量删除文件成功");
     }
 
+
+
+    @Operation(summary = "批量删除文件", description = "批量删除文件", tags = {"file"})
+    @RequestMapping(value = "/batchdeleteCommonfile", method = RequestMethod.POST)
+    @MyLog(operation = "批量删除文件", module = CURRENT_MODULE)
+    @ResponseBody
+    public RestResult<String> batchdeleteCommonfile(@RequestBody BatchDeleteFileDTO batchDeleteFileDto) {
+        String userFileIds = "common";
+        String[] userFileIdList = userFileIds.split(",");
+        userFileService.update(new UpdateWrapper<UserFile>().lambda().set(UserFile::getDeleteFlag, 1).in(UserFile::getUserFileId, Arrays.asList(userFileIdList)));
+        for (String userFileId : userFileIdList) {
+            executor.execute(()->{
+                userFileService.deleteUserFile(userFileId, SessionUtil.getUserId());
+            });
+
+            fileDealComp.deleteESByUserFileId(userFileId);
+        }
+
+        return RestResult.success().message("批量删除文件成功");
+    }
+
+
+
+
+
+
+
     @Operation(summary = "删除文件", description = "可以删除文件或者目录", tags = {"file"})
     @RequestMapping(value = "/deletefile", method = RequestMethod.POST)
     @MyLog(operation = "删除文件", module = CURRENT_MODULE)
@@ -323,6 +601,23 @@ public class FileController {
 
     }
 
+
+    @Operation(summary = "删除文件", description = "可以删除文件或者目录", tags = {"file"})
+    @RequestMapping(value = "/deleteCommonfile", method = RequestMethod.POST)
+    @MyLog(operation = "删除文件", module = CURRENT_MODULE)
+    @ResponseBody
+    public RestResult deleteCommonFile(@RequestBody DeleteFileDTO deleteFileDto) {
+        String userId = "common";
+        userFileService.deleteUserFile(deleteFileDto.getUserFileId(), userId);
+        fileDealComp.deleteESByUserFileId(deleteFileDto.getUserFileId());
+
+        return RestResult.success();
+
+    }
+
+
+
+
     @Operation(summary = "解压文件", description = "解压文件。", tags = {"file"})
     @RequestMapping(value = "/unzipfile", method = RequestMethod.POST)
     @MyLog(operation = "解压文件", module = CURRENT_MODULE)
@@ -339,12 +634,30 @@ public class FileController {
 
     }
 
+
+
+    @Operation(summary = "解压文件", description = "解压文件。", tags = {"file"})
+    @RequestMapping(value = "/unzipCommonFile", method = RequestMethod.POST)
+    @MyLog(operation = "解压文件", module = CURRENT_MODULE)
+    @ResponseBody
+    public RestResult<String> unzipCommonFile(@RequestBody UnzipFileDTO unzipFileDto) {
+
+        try {
+            fileService.unzipFile(unzipFileDto.getUserFileId(), unzipFileDto.getUnzipMode(), unzipFileDto.getFilePath());
+        } catch (QiwenException e) {
+            return RestResult.fail().message(e.getMessage());
+        }
+
+        return RestResult.success();
+
+    }
+
     @Operation(summary = "文件复制", description = "可以复制文件或者目录", tags = {"file"})
     @RequestMapping(value = "/copyfile", method = RequestMethod.POST)
     @MyLog(operation = "文件复制", module = CURRENT_MODULE)
     @ResponseBody
     public RestResult<String> copyFile(@RequestBody CopyFileDTO copyFileDTO) {
-        String userId = SessionUtil.getUserId();
+        String userId = StpLoginUserUtil.getLoginUser().getId();
         String filePath = copyFileDTO.getFilePath();
         String userFileIds = copyFileDTO.getUserFileIds();
         String[] userFileIdArr = userFileIds.split(",");
@@ -367,6 +680,40 @@ public class FileController {
 
     }
 
+
+    @Operation(summary = "文件复制", description = "可以复制文件或者目录", tags = {"file"})
+    @RequestMapping(value = "/copyCommonfile", method = RequestMethod.POST)
+    @MyLog(operation = "文件复制", module = CURRENT_MODULE)
+    @ResponseBody
+    public RestResult<String> copyCommonfile(@RequestBody CopyFileDTO copyFileDTO) {
+        String userId = "common";
+        String filePath = copyFileDTO.getFilePath();
+        String userFileIds = copyFileDTO.getUserFileIds();
+        String[] userFileIdArr = userFileIds.split(",");
+        for (String userFileId : userFileIdArr) {
+            UserFile userFile = userFileService.getById(userFileId);
+            String oldfilePath = userFile.getFilePath();
+            String fileName = userFile.getFileName();
+            if (userFile.isDirectory()) {
+                QiwenFile qiwenFile = new QiwenFile(oldfilePath, fileName, true);
+                if (filePath.startsWith(qiwenFile.getPath() + QiwenFile.separator) || filePath.equals(qiwenFile.getPath())) {
+                    return RestResult.fail().message("原路径与目标路径冲突,不能复制");
+                }
+            }
+
+            userFileService.userFileCopy(userId, userFileId, filePath);
+            fileDealComp.deleteRepeatSubDirFile(filePath, userId);
+        }
+
+        return RestResult.success();
+
+    }
+
+
+
+
+
+
     @Operation(summary = "文件移动", description = "可以移动文件或者目录", tags = {"file"})
     @RequestMapping(value = "/movefile", method = RequestMethod.POST)
     @MyLog(operation = "文件移动", module = CURRENT_MODULE)
@@ -394,6 +741,40 @@ public class FileController {
 
     }
 
+
+
+    @Operation(summary = "文件移动", description = "可以移动文件或者目录", tags = {"file"})
+    @RequestMapping(value = "/moveCommonFile", method = RequestMethod.POST)
+    @MyLog(operation = "文件移动", module = CURRENT_MODULE)
+    @ResponseBody
+    public RestResult<String> moveCommonFile(@RequestBody MoveFileDTO moveFileDto) {
+
+//        JwtUser sessionUserBean =  SessionUtil.getSession();
+        String userId ="common";
+        UserFile userFile = userFileService.getById(moveFileDto.getUserFileId());
+        String oldfilePath = userFile.getFilePath();
+        String newfilePath = moveFileDto.getFilePath();
+        String fileName = userFile.getFileName();
+        String extendName = userFile.getExtendName();
+        if (StringUtil.isEmpty(extendName)) {
+            QiwenFile qiwenFile = new QiwenFile(oldfilePath, fileName, true);
+            if (newfilePath.startsWith(qiwenFile.getPath() + QiwenFile.separator) || newfilePath.equals(qiwenFile.getPath())) {
+                return RestResult.fail().message("原路径与目标路径冲突,不能移动");
+            }
+        }
+
+        userFileService.updateFilepathByUserFileId(moveFileDto.getUserFileId(), newfilePath, userId);
+
+        fileDealComp.deleteRepeatSubDirFile(newfilePath, userId);
+        return RestResult.success();
+
+    }
+
+
+
+
+
+
     @Operation(summary = "批量移动文件", description = "可以同时选择移动多个文件或者目录", tags = {"file"})
     @RequestMapping(value = "/batchmovefile", method = RequestMethod.POST)
     @MyLog(operation = "批量移动文件", module = CURRENT_MODULE)
@@ -423,6 +804,39 @@ public class FileController {
 
     }
 
+
+
+
+    @Operation(summary = "批量移动文件", description = "可以同时选择移动多个文件或者目录", tags = {"file"})
+    @RequestMapping(value = "/batchmoveCommonFile", method = RequestMethod.POST)
+    @MyLog(operation = "批量移动文件", module = CURRENT_MODULE)
+    @ResponseBody
+    public RestResult<String> batchmoveCommonFile(@RequestBody BatchMoveFileDTO batchMoveFileDto) {
+
+        String userId = "common";
+
+        String newfilePath = batchMoveFileDto.getFilePath();
+
+        String userFileIds = batchMoveFileDto.getUserFileIds();
+        String[] userFileIdArr = userFileIds.split(",");
+
+        for (String userFileId : userFileIdArr) {
+            UserFile userFile = userFileService.getById(userFileId);
+            if (StringUtil.isEmpty(userFile.getExtendName())) {
+                QiwenFile qiwenFile = new QiwenFile(userFile.getFilePath(), userFile.getFileName(), true);
+                if (newfilePath.startsWith(qiwenFile.getPath() + QiwenFile.separator) || newfilePath.equals(qiwenFile.getPath())) {
+                    return RestResult.fail().message("原路径与目标路径冲突,不能移动");
+                }
+            }
+            userFileService.updateFilepathByUserFileId(userFile.getUserFileId(), newfilePath, userId);
+        }
+
+        return RestResult.success().data("批量移动文件成功");
+
+    }
+
+
+
     @Operation(summary = "获取文件树", description = "文件移动的时候需要用到该接口,用来展示目录树", tags = {"file"})
     @RequestMapping(value = "/getfiletree", method = RequestMethod.GET)
     @ResponseBody
@@ -469,6 +883,61 @@ public class FileController {
 
     }
 
+
+
+
+
+
+    @Operation(summary = "获取文件树", description = "文件移动的时候需要用到该接口,用来展示目录树", tags = {"file"})
+    @RequestMapping(value = "/getCommonFileTree", method = RequestMethod.GET)
+    @ResponseBody
+    public RestResult<TreeNode> getCommonFileTree() {
+        RestResult<TreeNode> result = new RestResult<TreeNode>();
+
+        String userId = "common";
+        List<UserFile> userFileList = userFileService.selectFilePathTreeByUserId(userId);
+        TreeNode resultTreeNode = new TreeNode();
+        resultTreeNode.setLabel(QiwenFile.separator);
+        resultTreeNode.setId(0L);
+        long id = 1;
+        for (int i = 0; i < userFileList.size(); i++){
+            UserFile userFile = userFileList.get(i);
+            QiwenFile qiwenFile = new QiwenFile(userFile.getFilePath(), userFile.getFileName(), false);
+            String filePath = qiwenFile.getPath();
+
+            Queue<String> queue = new LinkedList<>();
+
+            String[] strArr = filePath.split(QiwenFile.separator);
+            for (int j = 0; j < strArr.length; j++){
+                if (!"".equals(strArr[j]) && strArr[j] != null){
+                    queue.add(strArr[j]);
+                }
+
+            }
+            if (queue.size() == 0){
+                continue;
+            }
+
+            resultTreeNode = fileDealComp.insertTreeNode(resultTreeNode, id++, QiwenFile.separator, queue);
+
+
+        }
+        List<TreeNode> treeNodeList = resultTreeNode.getChildren();
+        Collections.sort(treeNodeList, (o1, o2) -> {
+            long i = o1.getId() - o2.getId();
+            return (int) i;
+        });
+        result.setSuccess(true);
+        result.setData(resultTreeNode);
+        return result;
+
+    }
+
+
+
+
+
+
     @Operation(summary = "修改文件", description = "支持普通文本类文件的修改", tags = {"file"})
     @RequestMapping(value = "/update", method = RequestMethod.POST)
     @ResponseBody
@@ -505,6 +974,48 @@ public class FileController {
         return RestResult.success().message("修改文件成功");
     }
 
+
+
+    @Operation(summary = "修改文件", description = "支持普通文本类文件的修改", tags = {"file"})
+    @RequestMapping(value = "/updateCommon", method = RequestMethod.POST)
+    @ResponseBody
+    public RestResult<String> updateCommon(@RequestBody UpdateFileDTO updateFileDTO) {
+//        JwtUser sessionUserBean =  SessionUtil.getSession();
+        String userId = "common";
+        UserFile userFile = userFileService.getById(updateFileDTO.getUserFileId());
+        FileBean fileBean = fileService.getById(userFile.getFileId());
+        Long pointCount = fileService.getFilePointCount(userFile.getFileId());
+        String fileUrl = fileBean.getFileUrl();
+        if (pointCount > 1) {
+            fileUrl = fileDealComp.copyFile(fileBean, userFile);
+        }
+        String content = updateFileDTO.getFileContent();
+        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(content.getBytes());
+        try {
+            int fileSize = byteArrayInputStream.available();
+            fileDealComp.saveFileInputStream(fileBean.getStorageType(), fileUrl, byteArrayInputStream);
+
+            String md5Str = fileDealComp.getIdentifierByFile(fileUrl, fileBean.getStorageType());
+
+            fileService.updateFileDetail(userFile.getUserFileId(), md5Str, fileSize);
+
+
+        } catch (Exception e) {
+            throw new QiwenException(999999, "修改文件异常");
+        } finally {
+            try {
+                byteArrayInputStream.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return RestResult.success().message("修改文件成功");
+    }
+
+
+
+
+
     @Operation(summary = "查询文件详情", description = "查询文件详情", tags = {"file"})
     @RequestMapping(value = "/detail", method = RequestMethod.GET)
     @ResponseBody
@@ -516,5 +1027,13 @@ public class FileController {
 
 
 
+    @Operation(summary = "查询文件详情", description = "查询文件详情", tags = {"file"})
+    @RequestMapping(value = "/detailCommon", method = RequestMethod.GET)
+    @ResponseBody
+    public RestResult<FileDetailVO> detailCommon(
+            @Parameter(description = "用户文件Id", required = true) String userFileId){
+        FileDetailVO vo = fileService.getFileDetail(userFileId);
+        return RestResult.success().data(vo);
+    }
 
 }

+ 18 - 0
snowy-plugin/snowy-plugin-disk/snowy-plugin-disk-func/src/main/java/vip/xiaonuo/disk/controller/FiletransferController.java

@@ -81,6 +81,24 @@ public class FiletransferController {
 
     }
 
+
+    @Operation(summary = "极速上传", description = "校验文件MD5判断文件是否存在,如果存在直接上传成功并返回skipUpload=true,如果不存在返回skipUpload=false需要再次调用该接口的POST方法", tags = {"filetransfer"})
+    @RequestMapping(value = "/uploadcommonfile", method = RequestMethod.GET)
+    @MyLog(operation = "极速上传", module = CURRENT_MODULE)
+    @ResponseBody
+    public RestResult<UploadFileVo> uploadcommonfile(UploadFileDTO uploadFileDto) {
+        String userId = "common";
+
+        boolean isCheckSuccess = storageService.checkStorage(userId, uploadFileDto.getTotalSize());
+        if (!isCheckSuccess) {
+            return RestResult.fail().message("存储空间不足");
+        }
+        UploadFileVo uploadFileVo = filetransferService.uploadFileSpeed(userId,uploadFileDto);
+        return RestResult.success().data(uploadFileVo);
+
+    }
+
+
     @Operation(summary = "上传文件", description = "真正的上传文件接口", tags = {"filetransfer"})
     @RequestMapping(value = "/uploadfile", method = RequestMethod.POST)
     @MyLog(operation = "上传文件", module = CURRENT_MODULE)

+ 2 - 1
snowy-plugin/snowy-plugin-disk/snowy-plugin-disk-func/src/main/java/vip/xiaonuo/disk/util/QiwenFileUtil.java

@@ -3,6 +3,7 @@ package vip.xiaonuo.disk.util;
 import cn.hutool.core.util.IdUtil;
 import com.qiwenshare.common.util.DateUtil;
 import com.qiwenshare.common.util.security.SessionUtil;
+import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
 import vip.xiaonuo.disk.domain.UserFile;
 import vip.xiaonuo.disk.io.QiwenFile;
 
@@ -19,7 +20,7 @@ public class QiwenFileUtil {
         userFile.setExtendName(null);
         userFile.setIsDir(1);
         userFile.setUploadTime(DateUtil.getCurrentTime());
-        userFile.setCreateUserId(SessionUtil.getUserId());
+        userFile.setCreateUserId(StpLoginUserUtil.getLoginUser().getId());
         userFile.setCreateTime(DateUtil.getCurrentTime());
         userFile.setDeleteFlag(0);
         userFile.setDeleteBatchNum(null);