Commit 06bf1140 by zhangkb

修改加载标签兼容一个用户多个机构情况

parent ac28d254
package com.keymobile.tagmanager.api; package com.keymobile.tagmanager.api;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -15,7 +15,6 @@ import com.keymobile.tagmanager.model.SysTag; ...@@ -15,7 +15,6 @@ import com.keymobile.tagmanager.model.SysTag;
import com.keymobile.tagmanager.model.Tag; import com.keymobile.tagmanager.model.Tag;
import com.keymobile.tagmanager.service.TagService; import com.keymobile.tagmanager.service.TagService;
import com.keymobile.tagmanager.util.JsonTreeHelper.JsonNode; import com.keymobile.tagmanager.util.JsonTreeHelper.JsonNode;
import com.keymobile.tagmanager.util.Constants;
import com.keymobile.tagmanager.util.UserInfoUtils; import com.keymobile.tagmanager.util.UserInfoUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -74,7 +73,10 @@ public class TagCtrl { ...@@ -74,7 +73,10 @@ public class TagCtrl {
@RequestParam(required = false) String deptIdPath) throws TagNotExistException { @RequestParam(required = false) String deptIdPath) throws TagNotExistException {
//获取当前登录用户机构 //获取当前登录用户机构
deptIdPath = UserInfoUtils.getDataRoleOrg(); deptIdPath = UserInfoUtils.getDataRoleOrg();
return tagService.queryDimensionTagAsTree(deptIdPath, parentId); //考虑一个用户对应多个机构的情况
List<String> orgIds = new ArrayList<>();
orgIds.add(deptIdPath);
return tagService.queryDimensionTagAsTree(orgIds, parentId);
} }
@ApiOperation(value = "获取个人标签树", notes = "获取个人标签树") @ApiOperation(value = "获取个人标签树", notes = "获取个人标签树")
...@@ -84,9 +86,12 @@ public class TagCtrl { ...@@ -84,9 +86,12 @@ public class TagCtrl {
@RequestParam(required = false) String deptIdPath) throws TagNotExistException { @RequestParam(required = false) String deptIdPath) throws TagNotExistException {
//获取当前登录用户机构id //获取当前登录用户机构id
deptIdPath = UserInfoUtils.getDataRoleOrg(); deptIdPath = UserInfoUtils.getDataRoleOrg();
//考虑一个用户对应多个机构的情况
List<String> orgIds = new ArrayList<>();
orgIds.add(deptIdPath);
//获取当前登录用户id //获取当前登录用户id
String userId = UserInfoUtils.getUserId(); String userId = UserInfoUtils.getUserId();
return tagService.queryPersonalTagAsTree(parentId, userId, deptIdPath); return tagService.queryPersonalTagAsTree(parentId, userId, orgIds);
} }
@ApiOperation(value = "搜索维度标签里面的个人标签", notes = "搜索维度标签里面的个人标签") @ApiOperation(value = "搜索维度标签里面的个人标签", notes = "搜索维度标签里面的个人标签")
...@@ -100,7 +105,10 @@ public class TagCtrl { ...@@ -100,7 +105,10 @@ public class TagCtrl {
@RequestParam("pageSize") Integer pageSize) throws TagNotExistException{ @RequestParam("pageSize") Integer pageSize) throws TagNotExistException{
String userName = UserInfoUtils.getUserId(); String userName = UserInfoUtils.getUserId();
deptIdPath = UserInfoUtils.getDataRoleOrg(); deptIdPath = UserInfoUtils.getDataRoleOrg();
return tagService.searchPersonalDimensionTagByPage(userName, deptIdPath, keyword, //考虑一个用户对应多个机构的情况
List<String> orgIds = new ArrayList<>();
orgIds.add(deptIdPath);
return tagService.searchPersonalDimensionTagByPage(userName, orgIds, keyword,
path, domain, new Page(pageSize, pageNo)); path, domain, new Page(pageSize, pageNo));
} }
...@@ -114,7 +122,10 @@ public class TagCtrl { ...@@ -114,7 +122,10 @@ public class TagCtrl {
@RequestParam("pageSize") Integer pageSize) throws TagNotExistException{ @RequestParam("pageSize") Integer pageSize) throws TagNotExistException{
String userName = UserInfoUtils.getUserId(); String userName = UserInfoUtils.getUserId();
deptIdPath = UserInfoUtils.getDataRoleOrg(); deptIdPath = UserInfoUtils.getDataRoleOrg();
return tagService.searchPersonalTagByPage(userName, deptIdPath, keyword, path, domain, new Page(pageSize, pageNo)); //考虑一个用户对应多个机构的情况
List<String> orgIds = new ArrayList<>();
orgIds.add(deptIdPath);
return tagService.searchPersonalTagByPage(userName, orgIds, keyword, path, domain, new Page(pageSize, pageNo));
} }
// @PreAuthorize("principal.authorities.?[authority.startsWith('ROLE_tagmanager_admin')].size() > 0") // @PreAuthorize("principal.authorities.?[authority.startsWith('ROLE_tagmanager_admin')].size() > 0")
...@@ -142,7 +153,10 @@ public class TagCtrl { ...@@ -142,7 +153,10 @@ public class TagCtrl {
@RequestParam(required = false) String deptIdPath) throws TagNotExistException { @RequestParam(required = false) String deptIdPath) throws TagNotExistException {
String userName = UserInfoUtils.getUserId(); String userName = UserInfoUtils.getUserId();
deptIdPath = UserInfoUtils.getDataRoleOrg(); deptIdPath = UserInfoUtils.getDataRoleOrg();
return tagService.queryPersonalTagExcludeOpenTypeAsTree(parentId, userName, deptIdPath); //考虑一个用户对应多个机构的情况
List<String> orgIds = new ArrayList<>();
orgIds.add(deptIdPath);
return tagService.queryPersonalTagExcludeOpenTypeAsTree(parentId, userName, orgIds);
} }
@ApiOperation(value = "分享/取消分享标签(0:取消分享 1:分享)", notes = "分享/取消分享标签(0:取消分享 1:分享)") @ApiOperation(value = "分享/取消分享标签(0:取消分享 1:分享)", notes = "分享/取消分享标签(0:取消分享 1:分享)")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment