用户权限调整 组织功能完成

yun-zuoyi
wei.peng 6 years ago
parent f787d270ba
commit c5c650d7ce

@ -79,9 +79,15 @@ public interface ICoreMemTreeService {
@ApiOperation(value = "分装组织树",notes = "根据制定ID分装组织树")
SysOrganize packTreeSysOrganizeById(List<SysOrganize> list, Long id);
@ApiOperation(value = "找到相应字节点",notes = "从一棵树中找到相应的子节点")
SysOrganize getTreeSysOrganizeById(List<SysOrganize> list, Long id);
@ApiOperation(value = "查询组织子节点",notes = "查询字节点组织ID")
List<Long> findChildSysOrganize(SysOrganize organize);
@ApiOperation(value = "查询组织子节点",notes = "查询字节点组织ID")
List<Long> findSysOrganizeChildIdList(Long id);
/********************************************* End SysOrganize Tree *********************************************/
/********************************************* Start CommonTreeModel Tree *********************************************/

@ -166,15 +166,31 @@ public class SysOrganizeController extends CoreBaseController{
@ApiOperation(value="查询组织",notes="组合查询组织外加分页")
public ResultBean queryPosition(SysOrganize organize, Pager pager){
try{
List<Long> idList = new ArrayList<>();
if(AuthUtil.getUserType().equals(CommonEnumUtil.USER_TYPE.ADMIN)){
if(organize.getParentId() != null){
idList = coreMemTreeService.findSysOrganizeChildIdList(organize.getParentId());
}
}else{
List<SysRefUserDepartment> refList = personnelService.findSysRefUserDepartmentByUserId(getSessionUser().getUser().getId());
if(organize.getParentId() == null || organize.getParentId() <= 0){
if(refList != null && refList.size() > 0){
List<Long> idList = new ArrayList<>(refList.size());
refList.forEach(ref ->idList.add(ref.getOrganizeId()));
return ResultBean.success("操作成功").setListPager(organizeService.querySysOrganize(organize, idList, pager))
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
for (SysRefUserDepartment ref : refList) {
idList.add(ref.getOrganizeId());
}
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
}
}else{
List<SysOrganize> rootTreeList = personnelService.findSysOrganizeList();
rootTreeList = coreMemTreeService.packTreeSysOrganize(rootTreeList,CommonEnumUtil.PARENT.DEFAULT.getValue());
rootTreeList = coreMemTreeService.packTreeSysOrganizeBySysRefUserOrganize(rootTreeList,refList);
SysOrganize sysOrganizeTree = coreMemTreeService.getTreeSysOrganizeById(rootTreeList, organize.getParentId());
idList = coreMemTreeService.findChildSysOrganize(sysOrganizeTree);
}
}
ListPager<SysOrganize> result = organizeService.querySysOrganize(organize, idList, pager);
return ResultBean.success("操作成功").setListPager(result).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
}catch(ImppBusiException busExcep){
return ResultBean.fail(busExcep);
}catch(Exception e){

@ -202,18 +202,55 @@ public class CoreMemTreeService implements ICoreMemTreeService {
}
@Override
public SysOrganize getTreeSysOrganizeById(List<SysOrganize> list, Long id) {
SysOrganize result = null;
if(list != null && list.size() > 0){
for (SysOrganize organize : list) {
if(organize.getId().equals(id)){
result = organize;
} else if(organize.getChildList() != null && organize.getChildList().size() > 0){
result = getTreeSysOrganizeById(organize.getChildList(), id);
}
if(result != null){
return result;
}
}
}
return result;
}
@Override
public List<Long> findChildSysOrganize(SysOrganize organize) {
List<Long> result = new ArrayList<>();
if(organize != null && organize.getChildList() != null && organize.getChildList().size() > 0){
if(organize != null){
if(organize.getChildList() != null && organize.getChildList().size() > 0){
for (SysOrganize so : organize.getChildList()) {
result.add(so.getId());
result.addAll(findChildSysOrganize(so));
}
}
result.add(organize.getId());
}
return result;
}
@Override
public List<Long> findSysOrganizeChildIdList(Long id) {
SysOrganize organize = personnelService.getSysOrganizeById(id);
if(organize != null){
List<SysOrganize> list = personnelService.findSysOrganizeList();
if(list != null && list.size() > 0){
SysOrganize treeSPosition = packTreeSysOrganizeById(list, organize.getId());
List<Long> idList = findChildSysOrganize(treeSPosition);
idList.add(organize.getId());
return idList;
}
}
return null;
}
/********************************************* End SysOrganize Tree *********************************************/

@ -448,7 +448,7 @@
// @Test
// public void testUserInfo() throws Exception {
// List<SysRole> roleList = roleService.findSysRoleAll();
// List<SysPosition> positionList = positionService.listSysPosition();
// List<SysPosition> positionList = positionService.findSysPositionAll();
// List<SysDepartment> departmentList = departmentService.listSysDepartment();
//
// for (int y = 0; y < 10; y++) {
@ -655,7 +655,7 @@
//
// public void testUserDetailModel(){
// List<SysRole> roleList = roleService.findSysRoleAll();
// List<SysPosition> positionList = positionService.listSysPosition();
// List<SysPosition> positionList = positionService.findSysPositionAll();
// List<SysDepartment> departmentList = departmentService.listSysDepartment();
//
// UserDetailModel model = new UserDetailModel();

Loading…
Cancel
Save