|
@@ -8,6 +8,7 @@ import com.doc.common.annotation.Log;
|
|
|
import com.doc.common.constant.Constants;
|
|
|
import com.doc.common.core.controller.BaseController;
|
|
|
import com.doc.common.core.domain.AjaxResult;
|
|
|
+import com.doc.common.core.domain.entity.SysRole;
|
|
|
import com.doc.common.enums.BusinessType;
|
|
|
import com.doc.common.enums.EventLevel;
|
|
|
import com.doc.common.utils.SecurityUtils;
|
|
@@ -17,8 +18,8 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 文档目录管理Controller
|
|
@@ -50,7 +51,11 @@ public class DocDirController extends BaseController {
|
|
|
@GetMapping(value = "/top-dir/{type}")
|
|
|
public DocDir topDir(@ApiParam(value = "目录类型(1.公共 2.部门 3.个人)", required = true) @PathVariable("type") String type) {
|
|
|
DocSpace space = spaceService.selectDocSpaceListByType(type);
|
|
|
-
|
|
|
+ String dept = "2";
|
|
|
+ if (space.getSpaceId() == null && dept.equals(type)) {
|
|
|
+ spaceService.initDeptSpace(SecurityUtils.getLoginUser().getUser().getDept());
|
|
|
+ space = spaceService.selectDocSpaceListByType(type);
|
|
|
+ }
|
|
|
DocDir dir = new DocDir();
|
|
|
dir.setSpaceId(space.getSpaceId());
|
|
|
dir.setParentId(0L);
|
|
@@ -188,6 +193,33 @@ public class DocDirController extends BaseController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 查询文档目录管理列表
|
|
|
+ */
|
|
|
+ @ApiOperation("按空间类型查询目录列表")
|
|
|
+ @GetMapping("/list/{type}")
|
|
|
+ public AjaxResult listByType(@ApiParam(value = "目录类型(1.公共 2.部门 3.个人)", required = true) @PathVariable("type") String type, DocDir docDir) {
|
|
|
+ String pub_t = "1";
|
|
|
+ String dept_t = "2";
|
|
|
+ String pub_k = "system";
|
|
|
+ String dept_k = "dept";
|
|
|
+ //如果不是个人空间,则需要按权限
|
|
|
+ List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
|
|
|
+ Set<String> roleKeys = roles.stream().map(SysRole::getRoleKey).collect(Collectors.toSet());
|
|
|
+
|
|
|
+ if ((pub_t.equals(type) && !roleKeys.contains(pub_k)) || (dept_t.equals(type) && !roleKeys.contains(dept_k))) {
|
|
|
+ //如果是公共空间,且不为系统管理员
|
|
|
+ //如果是部门空间,且不为部门管理员
|
|
|
+ //则需要判断组织目录是否有权限访问
|
|
|
+ Map<String, Object> params = new HashMap<>(4);
|
|
|
+ params.put("flag", 1);
|
|
|
+ params.put("uid", SecurityUtils.getUserId());
|
|
|
+ docDir.setParams(params);
|
|
|
+ }
|
|
|
+
|
|
|
+ return list(docDir);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 导出文档目录管理列表
|
|
|
*/
|
|
|
// @ApiOperation("导出文档目录管理列表")
|