From d1cde06e49a7399e13004575541146b8249d6f42 Mon Sep 17 00:00:00 2001 From: Renpc-kilig <308442850@qq.com> Date: Fri, 17 Feb 2023 18:03:07 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/FileUploadServiceImpl.java | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/main/java/cn/com/tenlion/systemoa/service/fileupload/impl/FileUploadServiceImpl.java b/src/main/java/cn/com/tenlion/systemoa/service/fileupload/impl/FileUploadServiceImpl.java index db09ef0..8ab2bfe 100644 --- a/src/main/java/cn/com/tenlion/systemoa/service/fileupload/impl/FileUploadServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systemoa/service/fileupload/impl/FileUploadServiceImpl.java @@ -359,7 +359,7 @@ public class FileUploadServiceImpl extends DefaultBaseService implements IFileUp if("公共文档".equals(typeBelong)) { params.remove("creator"); List list = fileUploadDao.list(params); - if(null != list && list.size() > 0) { + if (null != list && list.size() > 0) { Iterator iterator = list.iterator(); while (iterator.hasNext()) { FileUploadDTO fileUploadDTO = iterator.next(); @@ -371,18 +371,18 @@ public class FileUploadServiceImpl extends DefaultBaseService implements IFileUp FileCatalogueDTO fileCatalogueDTO = fileCatalogueService.get(params); // 若文档类型创建者和当前登录用户一致,则授权操作权限 - if(creator.equals(fileCatalogueDTO.getCreator())) { + if (creator.equals(fileCatalogueDTO.getCreator())) { fileUploadDTO.setOperationRole("1"); - }else { + } else { // 获取操作权限 params.put("fileCatalogueId", fileCatalogueDTO.getFileCatalogueId()); - if(typeRoleService.hasRole(params)) { + if (typeRoleService.hasRole(params)) { fileUploadDTO.setOperationRole("1"); } } // 若文档类型不是公共文档,则移除数据 - if(null != fileCatalogueDTO) { + if (null != fileCatalogueDTO) { if (!"1".equals(fileCatalogueDTO.getType())) { iterator.remove(); continue; @@ -416,13 +416,13 @@ public class FileUploadServiceImpl extends DefaultBaseService implements IFileUp fileUploadDTO.setCatalogueType("公共文档"); } fileUploadDTOList.addAll(list); - }else { + } else if (null == token) { fileUploadDTOList = new ArrayList<>(); FileUploadDTO fileUploadDTO = new FileUploadDTO(); fileUploadDTO.setOperationRole("0"); FileCatalogueDTO fileCatalogueDTO = fileCatalogueService.get(params.get("fileTypeId").toString()); // 若文档类型创建者和当前登录用户一致,则授权操作权限 - if(null != fileCatalogueDTO) { + if (null != fileCatalogueDTO) { if (creator.equals(fileCatalogueDTO.getCreator())) { fileUploadDTO.setOperationRole("1"); } else { @@ -436,24 +436,26 @@ public class FileUploadServiceImpl extends DefaultBaseService implements IFileUp fileUploadDTOList.add(fileUploadDTO); } - if(null == fileUploadDTOList || fileUploadDTOList.size() < 1) { - fileUploadDTOList = new ArrayList<>(); - FileUploadDTO fileUploadDTO = new FileUploadDTO(); - fileUploadDTO.setOperationRole("0"); - FileCatalogueDTO fileCatalogueDTO = fileCatalogueService.get(params.get("fileTypeId").toString()); - // 若文档类型创建者和当前登录用户一致,则授权操作权限 - if(null != fileCatalogueDTO) { - if (creator.equals(fileCatalogueDTO.getCreator())) { - fileUploadDTO.setOperationRole("1"); - } else { - // 获取操作权限 - params.put("fileCatalogueId", fileCatalogueDTO.getFileCatalogueId()); - if (typeRoleService.hasRole(params)) { + if (null == token) { + if (null == fileUploadDTOList || fileUploadDTOList.size() < 1) { + fileUploadDTOList = new ArrayList<>(); + FileUploadDTO fileUploadDTO = new FileUploadDTO(); + fileUploadDTO.setOperationRole("0"); + FileCatalogueDTO fileCatalogueDTO = fileCatalogueService.get(params.get("fileTypeId").toString()); + // 若文档类型创建者和当前登录用户一致,则授权操作权限 + if (null != fileCatalogueDTO) { + if (creator.equals(fileCatalogueDTO.getCreator())) { fileUploadDTO.setOperationRole("1"); + } else { + // 获取操作权限 + params.put("fileCatalogueId", fileCatalogueDTO.getFileCatalogueId()); + if (typeRoleService.hasRole(params)) { + fileUploadDTO.setOperationRole("1"); + } } } + fileUploadDTOList.add(fileUploadDTO); } - fileUploadDTOList.add(fileUploadDTO); } }