|
@@ -113,9 +113,11 @@ public class KnowledgeCategoryServiceImpl extends SuperServiceImpl<KnowledgeCate
|
|
|
e.setIsPermission(permission(e.getCreateBy(),e.getMaintainer(),userId));
|
|
|
e.setOperatorName(userService.queryUser(e.getUpdateBy()).getFullName());
|
|
|
e.setCreateByName(userService.queryUser(e.getCreateBy()).getFullName());
|
|
|
- JPaasUser jPaasUser = userService.queryUser(e.getMaintainer());
|
|
|
- if (jPaasUser != null){
|
|
|
- e.setMaintainerName(jPaasUser.getFullName());
|
|
|
+ if (StringUtils.isNotEmpty(e.getMaintainer())){
|
|
|
+ String maintainerName = Arrays.stream(e.getMaintainer().split(",")).
|
|
|
+ map(maintainer -> userService.queryOsUserDto(maintainer).getFullName()).
|
|
|
+ collect(Collectors.joining(","));
|
|
|
+ e.setMaintainerName(maintainerName);
|
|
|
}
|
|
|
List<KnowledgeCategoryAdminVo> childrens = findChildrens(e,userId);
|
|
|
if (childrens.size() == 0) {
|
|
@@ -141,9 +143,11 @@ public class KnowledgeCategoryServiceImpl extends SuperServiceImpl<KnowledgeCate
|
|
|
e.setIsPermission(permission(e.getCreateBy(),e.getMaintainer(),userId));
|
|
|
e.setOperatorName(userService.queryUser(e.getUpdateBy()).getFullName());
|
|
|
e.setCreateByName(userService.queryUser(e.getCreateBy()).getFullName());
|
|
|
- JPaasUser jPaasUser = userService.queryUser(e.getMaintainer());
|
|
|
- if (jPaasUser != null){
|
|
|
- e.setMaintainerName(jPaasUser.getFullName());
|
|
|
+ if (StringUtils.isNotEmpty(e.getMaintainer())){
|
|
|
+ String maintainerName = Arrays.stream(e.getMaintainer().split(",")).
|
|
|
+ map(maintainer -> userService.queryOsUserDto(maintainer).getFullName()).
|
|
|
+ collect(Collectors.joining(","));
|
|
|
+ e.setMaintainerName(maintainerName);
|
|
|
}
|
|
|
List<KnowledgeCategoryAdminVo> childrens = findChildrens(e,userId);
|
|
|
if (childrens.size() == 0) {
|
|
@@ -222,9 +226,14 @@ public class KnowledgeCategoryServiceImpl extends SuperServiceImpl<KnowledgeCate
|
|
|
KnowledgeCategory knowledgeCategory = this.get(entity.getPkId());
|
|
|
//判断是否能进行修改(创建人或维护人满足一个即可修改)
|
|
|
String userId = userService.queryLoginUser();
|
|
|
- if (!userId.equals(knowledgeCategory.getCreateBy()) && !userId.equals(knowledgeCategory.getMaintainer())){
|
|
|
+ if (!userId.equals(knowledgeCategory.getCreateBy())){
|
|
|
throw new RuntimeException("您没有权限进行此操作");
|
|
|
}
|
|
|
+ if (StringUtils.isNotEmpty(knowledgeCategory.getMaintainer())){
|
|
|
+ if (!Arrays.asList(knowledgeCategory.getMaintainer().split(",")).contains(userId)){
|
|
|
+ throw new RuntimeException("您没有权限进行此操作");
|
|
|
+ }
|
|
|
+ }
|
|
|
if (knowledgeCategory.getIsSys() == 1) {
|
|
|
throw new RuntimeException("系统内置节点,无法修改");
|
|
|
}
|
|
@@ -282,9 +291,14 @@ public class KnowledgeCategoryServiceImpl extends SuperServiceImpl<KnowledgeCate
|
|
|
KnowledgeCategory knowledgeCategory = this.baseMapper.selectById(knowledgeCategoryId);
|
|
|
//判断是否能进行修改(创建人或维护人满足一个即可修改)
|
|
|
String userId = userService.queryLoginUser();
|
|
|
- if (!userId.equals(knowledgeCategory.getCreateBy()) && !userId.equals(knowledgeCategory.getMaintainer())){
|
|
|
+ if (!userId.equals(knowledgeCategory.getCreateBy())){
|
|
|
throw new RuntimeException("您没有权限进行此操作");
|
|
|
}
|
|
|
+ if (StringUtils.isNotEmpty(knowledgeCategory.getMaintainer())){
|
|
|
+ if (!Arrays.asList(knowledgeCategory.getMaintainer().split(",")).contains(userId)){
|
|
|
+ throw new RuntimeException("您没有权限进行此操作");
|
|
|
+ }
|
|
|
+ }
|
|
|
// 查询该分类下是否还有知识
|
|
|
Boolean hasKnowledge = hasKnowledge(knowledgeCategoryId);
|
|
|
if (hasKnowledge) {
|
|
@@ -323,9 +337,11 @@ public class KnowledgeCategoryServiceImpl extends SuperServiceImpl<KnowledgeCate
|
|
|
e.setIsPermission(permission(e.getCreateBy(),e.getMaintainer(),userId));
|
|
|
e.setOperatorName(userService.queryUser(e.getUpdateBy()).getFullName());
|
|
|
e.setCreateByName(userService.queryUser(e.getCreateBy()).getFullName());
|
|
|
- JPaasUser jPaasUser = userService.queryUser(e.getMaintainer());
|
|
|
- if (jPaasUser != null){
|
|
|
- e.setMaintainerName(jPaasUser.getFullName());
|
|
|
+ if (StringUtils.isNotEmpty(e.getMaintainer())){
|
|
|
+ String maintainerName = Arrays.stream(e.getMaintainer().split(",")).
|
|
|
+ map(maintainer -> userService.queryOsUserDto(maintainer).getFullName()).
|
|
|
+ collect(Collectors.joining(","));
|
|
|
+ e.setMaintainerName(maintainerName);
|
|
|
}
|
|
|
return e;
|
|
|
}).
|
|
@@ -451,7 +467,7 @@ public class KnowledgeCategoryServiceImpl extends SuperServiceImpl<KnowledgeCate
|
|
|
*/
|
|
|
private int permission(String createBy,String maintainer,String userId){
|
|
|
if (StringUtils.isNotEmpty(userId)){
|
|
|
- if (userId.equals(createBy) || userId.equals(maintainer)){
|
|
|
+ if (userId.equals(createBy) || (StringUtils.isNotEmpty(maintainer) && Arrays.asList(maintainer.split(",")).contains(userId))){
|
|
|
return 0;
|
|
|
} else {
|
|
|
return 1;
|