|
|
@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
@ -35,10 +36,10 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<SysPosition> packTreeSysPosition(List<SysPosition> list, Long parentId) {
|
|
|
|
public List<SysPosition> packTreeSysPosition(List<SysPosition> list, Long parentId) {
|
|
|
|
List<SysPosition> result = new ArrayList<>();
|
|
|
|
List<SysPosition> result = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
List<SysPosition> copyList = new ArrayList<>(list);
|
|
|
|
List<SysPosition> copyList = new ArrayList<>(list);
|
|
|
|
list.forEach(position -> {
|
|
|
|
list.forEach(position -> {
|
|
|
|
if(position.getParentId() != null && position.getParentId().equals(parentId)){
|
|
|
|
if (position.getParentId() != null && position.getParentId().equals(parentId)) {
|
|
|
|
result.add(position);
|
|
|
|
result.add(position);
|
|
|
|
copyList.remove(position);
|
|
|
|
copyList.remove(position);
|
|
|
|
position.setChildList(packTreeSysPosition(copyList, position.getId()));
|
|
|
|
position.setChildList(packTreeSysPosition(copyList, position.getId()));
|
|
|
@ -51,11 +52,11 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<SysPosition> packTreeSysPositionBySysRefUserPosition(List<SysPosition> list, List<SysRefUserPosition> refList) {
|
|
|
|
public List<SysPosition> packTreeSysPositionBySysRefUserPosition(List<SysPosition> list, List<SysRefUserPosition> refList) {
|
|
|
|
List<Long> ids = new ArrayList<>(refList.size());
|
|
|
|
if (refList == null || refList.isEmpty()) {
|
|
|
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
if(refList != null && refList.size() > 0){
|
|
|
|
|
|
|
|
refList.forEach(ref -> ids.add(ref.getPositionId()));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Long> ids = new ArrayList<>(refList.size());
|
|
|
|
|
|
|
|
refList.forEach(ref -> ids.add(ref.getPositionId()));
|
|
|
|
|
|
|
|
|
|
|
|
return packTreeSysPositionByIds(list, ids);
|
|
|
|
return packTreeSysPositionByIds(list, ids);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -64,15 +65,15 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<SysPosition> packTreeSysPositionByIds(List<SysPosition> list, List<Long> ids) {
|
|
|
|
public List<SysPosition> packTreeSysPositionByIds(List<SysPosition> list, List<Long> ids) {
|
|
|
|
List<SysPosition> result = new ArrayList<>();
|
|
|
|
List<SysPosition> result = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
list.forEach(position -> {
|
|
|
|
list.forEach(position -> {
|
|
|
|
if(position.getChildList() == null || position.getChildList().size() <= 0){
|
|
|
|
if (position.getChildList() == null || position.getChildList().size() <= 0) {
|
|
|
|
if(ids.contains(position.getId())){
|
|
|
|
if (ids.contains(position.getId())) {
|
|
|
|
result.add(position);
|
|
|
|
result.add(position);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
List<SysPosition> childList = packTreeSysPositionByIds(position.getChildList(), ids);
|
|
|
|
List<SysPosition> childList = packTreeSysPositionByIds(position.getChildList(), ids);
|
|
|
|
if(ids.contains(position.getId()) || childList != null && childList.size() > 0){
|
|
|
|
if (ids.contains(position.getId()) || childList != null && childList.size() > 0) {
|
|
|
|
position.setChildList(childList);
|
|
|
|
position.setChildList(childList);
|
|
|
|
result.add(position);
|
|
|
|
result.add(position);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -85,9 +86,9 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public SysPosition packTreeSysPositionById(List<SysPosition> list, Long id) {
|
|
|
|
public SysPosition packTreeSysPositionById(List<SysPosition> list, Long id) {
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
for (SysPosition position : list) {
|
|
|
|
for (SysPosition position : list) {
|
|
|
|
if(position.getId().equals(id)){
|
|
|
|
if (position.getId().equals(id)) {
|
|
|
|
position.setChildList(packTreeSysPosition(list, position.getId()));
|
|
|
|
position.setChildList(packTreeSysPosition(list, position.getId()));
|
|
|
|
return position;
|
|
|
|
return position;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -100,7 +101,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<Long> findChildSysPosition(SysPosition position) {
|
|
|
|
public List<Long> findChildSysPosition(SysPosition position) {
|
|
|
|
List<Long> result = new ArrayList<>();
|
|
|
|
List<Long> result = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
if(position != null && position.getChildList() != null && position.getChildList().size() > 0){
|
|
|
|
if (position != null && position.getChildList() != null && position.getChildList().size() > 0) {
|
|
|
|
for (SysPosition sp : position.getChildList()) {
|
|
|
|
for (SysPosition sp : position.getChildList()) {
|
|
|
|
result.add(sp.getId());
|
|
|
|
result.add(sp.getId());
|
|
|
|
List<Long> list = findChildSysPosition(sp);
|
|
|
|
List<Long> list = findChildSysPosition(sp);
|
|
|
@ -114,16 +115,16 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<Long> findSysPositionChildIdList(Long id) {
|
|
|
|
public List<Long> findSysPositionChildIdList(Long id) {
|
|
|
|
SysPosition position = personnelService.getSysPositionById(id);
|
|
|
|
SysPosition position = personnelService.getSysPositionById(id);
|
|
|
|
if(position != null){
|
|
|
|
if (position != null) {
|
|
|
|
List<SysPosition> list = personnelService.findSysPositionList();
|
|
|
|
List<SysPosition> list = personnelService.findSysPositionList();
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
SysPosition treeSPosition = packTreeSysPositionById(list, position.getId());
|
|
|
|
SysPosition treeSPosition = packTreeSysPositionById(list, position.getId());
|
|
|
|
List<Long> idList = findChildSysPosition(treeSPosition);
|
|
|
|
List<Long> idList = findChildSysPosition(treeSPosition);
|
|
|
|
idList.add(position.getId());
|
|
|
|
idList.add(position.getId());
|
|
|
|
return idList;
|
|
|
|
return idList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
return Collections.emptyList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/********************************************* Start SysOrganize Tree *********************************************/
|
|
|
|
/********************************************* Start SysOrganize Tree *********************************************/
|
|
|
@ -131,10 +132,10 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<SysOrganize> packTreeSysOrganize(List<SysOrganize> list, Long parentId) {
|
|
|
|
public List<SysOrganize> packTreeSysOrganize(List<SysOrganize> list, Long parentId) {
|
|
|
|
List<SysOrganize> result = new ArrayList<>();
|
|
|
|
List<SysOrganize> result = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
List<SysOrganize> copyList = new ArrayList<>(list);
|
|
|
|
List<SysOrganize> copyList = new ArrayList<>(list);
|
|
|
|
list.forEach(organize -> {
|
|
|
|
list.forEach(organize -> {
|
|
|
|
if(organize.getParentId() != null && organize.getParentId().equals(parentId)){
|
|
|
|
if (organize.getParentId() != null && organize.getParentId().equals(parentId)) {
|
|
|
|
result.add(organize);
|
|
|
|
result.add(organize);
|
|
|
|
copyList.remove(organize);
|
|
|
|
copyList.remove(organize);
|
|
|
|
organize.setChildList(packTreeSysOrganize(copyList, organize.getId()));
|
|
|
|
organize.setChildList(packTreeSysOrganize(copyList, organize.getId()));
|
|
|
@ -149,7 +150,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<SysOrganize> packTreeSysOrganizeBySysRefUserOrganize(List<SysOrganize> list, List<SysRefUserDepartment> refList) {
|
|
|
|
public List<SysOrganize> packTreeSysOrganizeBySysRefUserOrganize(List<SysOrganize> list, List<SysRefUserDepartment> refList) {
|
|
|
|
List<Long> ids = new ArrayList<>(refList.size());
|
|
|
|
List<Long> ids = new ArrayList<>(refList.size());
|
|
|
|
|
|
|
|
|
|
|
|
if(refList != null && refList.size() > 0){
|
|
|
|
if (refList != null && refList.size() > 0) {
|
|
|
|
refList.forEach(ref -> ids.add(ref.getOrganizeId()));
|
|
|
|
refList.forEach(ref -> ids.add(ref.getOrganizeId()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -160,8 +161,8 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<SysOrganize> packTreeSysOrganizeBySysRefUserInfoOrganize(List<SysOrganize> list, List<SysRefUserInfoDepartment> refList) {
|
|
|
|
public List<SysOrganize> packTreeSysOrganizeBySysRefUserInfoOrganize(List<SysOrganize> list, List<SysRefUserInfoDepartment> refList) {
|
|
|
|
List<Long> ids = new ArrayList<>(refList.size());
|
|
|
|
List<Long> ids = new ArrayList<>(refList.size());
|
|
|
|
|
|
|
|
|
|
|
|
if(refList != null && refList.size() > 0){
|
|
|
|
if (refList != null && refList.size() > 0) {
|
|
|
|
refList.forEach(ref ->{
|
|
|
|
refList.forEach(ref -> {
|
|
|
|
ids.add(ref.getOrganizeId());
|
|
|
|
ids.add(ref.getOrganizeId());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -173,15 +174,15 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<SysOrganize> packTreeSysOrganizeByIds(List<SysOrganize> list, List<Long> ids) {
|
|
|
|
public List<SysOrganize> packTreeSysOrganizeByIds(List<SysOrganize> list, List<Long> ids) {
|
|
|
|
List<SysOrganize> result = new ArrayList<>();
|
|
|
|
List<SysOrganize> result = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
list.forEach(organize -> {
|
|
|
|
list.forEach(organize -> {
|
|
|
|
if(organize.getChildList() == null || organize.getChildList().size() <= 0){
|
|
|
|
if (organize.getChildList() == null || organize.getChildList().size() <= 0) {
|
|
|
|
if(ids.contains(organize.getId())){
|
|
|
|
if (ids.contains(organize.getId())) {
|
|
|
|
result.add(organize);
|
|
|
|
result.add(organize);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
List<SysOrganize> childList = packTreeSysOrganizeByIds(organize.getChildList(), ids);
|
|
|
|
List<SysOrganize> childList = packTreeSysOrganizeByIds(organize.getChildList(), ids);
|
|
|
|
if(ids.contains(organize.getId()) || childList != null && childList.size() > 0){
|
|
|
|
if (ids.contains(organize.getId()) || childList != null && childList.size() > 0) {
|
|
|
|
organize.setChildList(childList);
|
|
|
|
organize.setChildList(childList);
|
|
|
|
result.add(organize);
|
|
|
|
result.add(organize);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -194,9 +195,9 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public SysOrganize packTreeSysOrganizeById(List<SysOrganize> list, Long id) {
|
|
|
|
public SysOrganize packTreeSysOrganizeById(List<SysOrganize> list, Long id) {
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
for (SysOrganize organize : list) {
|
|
|
|
for (SysOrganize organize : list) {
|
|
|
|
if(organize.getId().equals(id)){
|
|
|
|
if (organize.getId().equals(id)) {
|
|
|
|
organize.setChildList(packTreeSysOrganize(list, organize.getId()));
|
|
|
|
organize.setChildList(packTreeSysOrganize(list, organize.getId()));
|
|
|
|
return organize;
|
|
|
|
return organize;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -208,14 +209,14 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public SysOrganize getTreeSysOrganizeById(List<SysOrganize> list, Long id) {
|
|
|
|
public SysOrganize getTreeSysOrganizeById(List<SysOrganize> list, Long id) {
|
|
|
|
SysOrganize result = null;
|
|
|
|
SysOrganize result = null;
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
for (SysOrganize organize : list) {
|
|
|
|
for (SysOrganize organize : list) {
|
|
|
|
if(organize.getId().equals(id)){
|
|
|
|
if (organize.getId().equals(id)) {
|
|
|
|
result = organize;
|
|
|
|
result = organize;
|
|
|
|
} else if(organize.getChildList() != null && organize.getChildList().size() > 0){
|
|
|
|
} else if (organize.getChildList() != null && organize.getChildList().size() > 0) {
|
|
|
|
result = getTreeSysOrganizeById(organize.getChildList(), id);
|
|
|
|
result = getTreeSysOrganizeById(organize.getChildList(), id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(result != null){
|
|
|
|
if (result != null) {
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -227,8 +228,8 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<Long> findChildSysOrganize(SysOrganize organize) {
|
|
|
|
public List<Long> findChildSysOrganize(SysOrganize organize) {
|
|
|
|
List<Long> result = new ArrayList<>();
|
|
|
|
List<Long> result = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
if(organize != null){
|
|
|
|
if (organize != null) {
|
|
|
|
if(organize.getChildList() != null && organize.getChildList().size() > 0){
|
|
|
|
if (organize.getChildList() != null && organize.getChildList().size() > 0) {
|
|
|
|
for (SysOrganize so : organize.getChildList()) {
|
|
|
|
for (SysOrganize so : organize.getChildList()) {
|
|
|
|
result.add(so.getId());
|
|
|
|
result.add(so.getId());
|
|
|
|
result.addAll(findChildSysOrganize(so));
|
|
|
|
result.addAll(findChildSysOrganize(so));
|
|
|
@ -243,16 +244,16 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<Long> findSysOrganizeChildIdList(Long id) {
|
|
|
|
public List<Long> findSysOrganizeChildIdList(Long id) {
|
|
|
|
SysOrganize organize = personnelService.getSysOrganizeById(id);
|
|
|
|
SysOrganize organize = personnelService.getSysOrganizeById(id);
|
|
|
|
if(organize != null){
|
|
|
|
if (organize != null) {
|
|
|
|
List<SysOrganize> list = personnelService.findSysOrganizeList();
|
|
|
|
List<SysOrganize> list = personnelService.findSysOrganizeList();
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
SysOrganize treeSPosition = packTreeSysOrganizeById(list, organize.getId());
|
|
|
|
SysOrganize treeSPosition = packTreeSysOrganizeById(list, organize.getId());
|
|
|
|
List<Long> idList = findChildSysOrganize(treeSPosition);
|
|
|
|
List<Long> idList = findChildSysOrganize(treeSPosition);
|
|
|
|
idList.add(organize.getId());
|
|
|
|
idList.add(organize.getId());
|
|
|
|
return idList;
|
|
|
|
return idList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
return Collections.emptyList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/********************************************* End SysOrganize Tree *********************************************/
|
|
|
|
/********************************************* End SysOrganize Tree *********************************************/
|
|
|
@ -262,15 +263,15 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<CommonTreeModel> packTreeTreeModelByRefUserDepartment(List<SysOrganize> organizeList, List<SysDepartment> departmentList, List<SysRefUserDepartment> refList) {
|
|
|
|
public List<CommonTreeModel> packTreeTreeModelByRefUserDepartment(List<SysOrganize> organizeList, List<SysDepartment> departmentList, List<SysRefUserDepartment> refList) {
|
|
|
|
if(refList != null && organizeList != null && departmentList != null){
|
|
|
|
if (refList != null && organizeList != null && departmentList != null) {
|
|
|
|
List<Long> organizeIdList = new ArrayList<>();
|
|
|
|
List<Long> organizeIdList = new ArrayList<>();
|
|
|
|
List<Long> departmentIdList = new ArrayList<>();
|
|
|
|
List<Long> departmentIdList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
refList.forEach(ref -> {
|
|
|
|
refList.forEach(ref -> {
|
|
|
|
if(!organizeIdList.contains(ref.getOrganizeId())){
|
|
|
|
if (!organizeIdList.contains(ref.getOrganizeId())) {
|
|
|
|
organizeIdList.add(ref.getOrganizeId());
|
|
|
|
organizeIdList.add(ref.getOrganizeId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!departmentIdList.contains(ref.getDepartmentId())){
|
|
|
|
if (!departmentIdList.contains(ref.getDepartmentId())) {
|
|
|
|
departmentIdList.add(ref.getDepartmentId());
|
|
|
|
departmentIdList.add(ref.getDepartmentId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -286,7 +287,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
return Collections.emptyList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -324,7 +325,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<CommonTreeModel> packTreeTreeModelSysOrganize(List<SysOrganize> list) {
|
|
|
|
public List<CommonTreeModel> packTreeTreeModelSysOrganize(List<SysOrganize> list) {
|
|
|
|
List<CommonTreeModel> result = new ArrayList<>();
|
|
|
|
List<CommonTreeModel> result = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
for (SysOrganize organize : list) {
|
|
|
|
for (SysOrganize organize : list) {
|
|
|
|
CommonTreeModel model = new CommonTreeModel();
|
|
|
|
CommonTreeModel model = new CommonTreeModel();
|
|
|
|
model.setBeanType(ModelEnumUtil.COMMON_TREE_TYPE.TYPE_ORGANIZE.getValue());
|
|
|
|
model.setBeanType(ModelEnumUtil.COMMON_TREE_TYPE.TYPE_ORGANIZE.getValue());
|
|
|
@ -342,7 +343,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<CommonTreeModel> packTreeTreeModelSysDepartment(List<SysDepartment> list) {
|
|
|
|
public List<CommonTreeModel> packTreeTreeModelSysDepartment(List<SysDepartment> list) {
|
|
|
|
List<CommonTreeModel> result = new ArrayList<>();
|
|
|
|
List<CommonTreeModel> result = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
for (SysDepartment department : list) {
|
|
|
|
for (SysDepartment department : list) {
|
|
|
|
CommonTreeModel model = new CommonTreeModel();
|
|
|
|
CommonTreeModel model = new CommonTreeModel();
|
|
|
|
model.setBeanType(ModelEnumUtil.COMMON_TREE_TYPE.TYPE_DEPARTMENT.getValue());
|
|
|
|
model.setBeanType(ModelEnumUtil.COMMON_TREE_TYPE.TYPE_DEPARTMENT.getValue());
|
|
|
@ -358,12 +359,12 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<CommonTreeModel> packTreeTreeModel(List<CommonTreeModel> list, List<SysDepartment> departmentList) {
|
|
|
|
public List<CommonTreeModel> packTreeTreeModel(List<CommonTreeModel> list, List<SysDepartment> departmentList) {
|
|
|
|
if(list != null && list.size() > 0 && departmentList != null && departmentList.size() > 0){
|
|
|
|
if (list != null && list.size() > 0 && departmentList != null && departmentList.size() > 0) {
|
|
|
|
list.forEach(model -> {
|
|
|
|
list.forEach(model -> {
|
|
|
|
SysOrganize organize = (SysOrganize) model.getBean();
|
|
|
|
SysOrganize organize = (SysOrganize) model.getBean();
|
|
|
|
List<SysDepartment> departments = new ArrayList<>();
|
|
|
|
List<SysDepartment> departments = new ArrayList<>();
|
|
|
|
departmentList.forEach(department -> {
|
|
|
|
departmentList.forEach(department -> {
|
|
|
|
if(department.getParentId().equals(CommonEnumUtil.PARENT.DEFAULT.getValue()) && department.getOrganizeId().equals(organize.getId())){
|
|
|
|
if (department.getParentId().equals(CommonEnumUtil.PARENT.DEFAULT.getValue()) && department.getOrganizeId().equals(organize.getId())) {
|
|
|
|
departments.add(department);
|
|
|
|
departments.add(department);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -387,9 +388,9 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
refList.forEach(ref -> refFilterIds.add(ref.getDepartmentId()));
|
|
|
|
refList.forEach(ref -> refFilterIds.add(ref.getDepartmentId()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(refIdList.size() <= 0){
|
|
|
|
if (refIdList.size() <= 0) {
|
|
|
|
refIdList = refFilterIds;
|
|
|
|
refIdList = refFilterIds;
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
// List 取交集
|
|
|
|
// List 取交集
|
|
|
|
refIdList = (ArrayList<Long>) CollectionUtils.intersection(refIdList, refFilterIds);
|
|
|
|
refIdList = (ArrayList<Long>) CollectionUtils.intersection(refIdList, refFilterIds);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -429,10 +430,10 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<SysDepartment> packTreeSysDepartment(List<SysDepartment> list, Long parentId) {
|
|
|
|
public List<SysDepartment> packTreeSysDepartment(List<SysDepartment> list, Long parentId) {
|
|
|
|
List<SysDepartment> result = new ArrayList<>();
|
|
|
|
List<SysDepartment> result = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
List<SysDepartment> copyList = new ArrayList<>(list);
|
|
|
|
List<SysDepartment> copyList = new ArrayList<>(list);
|
|
|
|
list.forEach(department -> {
|
|
|
|
list.forEach(department -> {
|
|
|
|
if(department.getParentId() != null && department.getParentId().equals(parentId)){
|
|
|
|
if (department.getParentId() != null && department.getParentId().equals(parentId)) {
|
|
|
|
result.add(department);
|
|
|
|
result.add(department);
|
|
|
|
copyList.remove(department);
|
|
|
|
copyList.remove(department);
|
|
|
|
department.setChildList(packTreeSysDepartment(copyList, department.getId()));
|
|
|
|
department.setChildList(packTreeSysDepartment(copyList, department.getId()));
|
|
|
@ -447,7 +448,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<SysDepartment> packTreeSysDepartmentBySysRefUserOrganize(List<SysDepartment> list, List<SysRefUserDepartment> refList) {
|
|
|
|
public List<SysDepartment> packTreeSysDepartmentBySysRefUserOrganize(List<SysDepartment> list, List<SysRefUserDepartment> refList) {
|
|
|
|
List<Long> ids = new ArrayList<>(refList.size());
|
|
|
|
List<Long> ids = new ArrayList<>(refList.size());
|
|
|
|
|
|
|
|
|
|
|
|
if(refList != null && refList.size() > 0){
|
|
|
|
if (refList != null && refList.size() > 0) {
|
|
|
|
refList.forEach(ref -> ids.add(ref.getDepartmentId()));
|
|
|
|
refList.forEach(ref -> ids.add(ref.getDepartmentId()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -458,7 +459,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<SysDepartment> packTreeSysDepartmentBySysRefUserInfoOrganize(List<SysDepartment> list, List<SysRefUserInfoDepartment> refList) {
|
|
|
|
public List<SysDepartment> packTreeSysDepartmentBySysRefUserInfoOrganize(List<SysDepartment> list, List<SysRefUserInfoDepartment> refList) {
|
|
|
|
List<Long> ids = new ArrayList<>(refList.size());
|
|
|
|
List<Long> ids = new ArrayList<>(refList.size());
|
|
|
|
|
|
|
|
|
|
|
|
if(refList != null && refList.size() > 0){
|
|
|
|
if (refList != null && refList.size() > 0) {
|
|
|
|
refList.forEach(ref -> ids.add(ref.getDepartmentId()));
|
|
|
|
refList.forEach(ref -> ids.add(ref.getDepartmentId()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -469,15 +470,15 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<SysDepartment> packTreeSysDepartmentByIds(List<SysDepartment> list, List<Long> ids) {
|
|
|
|
public List<SysDepartment> packTreeSysDepartmentByIds(List<SysDepartment> list, List<Long> ids) {
|
|
|
|
List<SysDepartment> result = new ArrayList<>();
|
|
|
|
List<SysDepartment> result = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
list.forEach(department -> {
|
|
|
|
list.forEach(department -> {
|
|
|
|
if(department.getChildList() == null || department.getChildList().size() <= 0){
|
|
|
|
if (department.getChildList() == null || department.getChildList().size() <= 0) {
|
|
|
|
if(ids.contains(department.getId())){
|
|
|
|
if (ids.contains(department.getId())) {
|
|
|
|
result.add(department);
|
|
|
|
result.add(department);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
List<SysDepartment> childList = packTreeSysDepartmentByIds(department.getChildList(), ids);
|
|
|
|
List<SysDepartment> childList = packTreeSysDepartmentByIds(department.getChildList(), ids);
|
|
|
|
if(ids.contains(department.getId()) || childList != null && childList.size() > 0){
|
|
|
|
if (ids.contains(department.getId()) || childList != null && childList.size() > 0) {
|
|
|
|
department.setChildList(childList);
|
|
|
|
department.setChildList(childList);
|
|
|
|
result.add(department);
|
|
|
|
result.add(department);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -490,9 +491,9 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public SysDepartment packTreeSysDepartmentById(List<SysDepartment> list, Long id) {
|
|
|
|
public SysDepartment packTreeSysDepartmentById(List<SysDepartment> list, Long id) {
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
for (SysDepartment department : list) {
|
|
|
|
for (SysDepartment department : list) {
|
|
|
|
if(department.getId().equals(id)){
|
|
|
|
if (department.getId().equals(id)) {
|
|
|
|
department.setChildList(packTreeSysDepartment(list, department.getId()));
|
|
|
|
department.setChildList(packTreeSysDepartment(list, department.getId()));
|
|
|
|
return department;
|
|
|
|
return department;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -505,7 +506,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<Long> findChildSysDepartment(SysDepartment department) {
|
|
|
|
public List<Long> findChildSysDepartment(SysDepartment department) {
|
|
|
|
List<Long> result = new ArrayList<>();
|
|
|
|
List<Long> result = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
if(department != null && department.getChildList() != null && department.getChildList().size() > 0){
|
|
|
|
if (department != null && department.getChildList() != null && department.getChildList().size() > 0) {
|
|
|
|
for (SysDepartment dep : department.getChildList()) {
|
|
|
|
for (SysDepartment dep : department.getChildList()) {
|
|
|
|
result.add(dep.getId());
|
|
|
|
result.add(dep.getId());
|
|
|
|
result.addAll(findChildSysDepartment(dep));
|
|
|
|
result.addAll(findChildSysDepartment(dep));
|
|
|
@ -518,16 +519,16 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<Long> findSysDepartmentChildIdList(Long id) {
|
|
|
|
public List<Long> findSysDepartmentChildIdList(Long id) {
|
|
|
|
SysDepartment department = personnelService.getSysDepartmentById(id);
|
|
|
|
SysDepartment department = personnelService.getSysDepartmentById(id);
|
|
|
|
if(department != null){
|
|
|
|
if (department != null) {
|
|
|
|
List<SysDepartment> list = personnelService.findSysDepartmentList();
|
|
|
|
List<SysDepartment> list = personnelService.findSysDepartmentList();
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
SysDepartment treeDep = packTreeSysDepartmentById(list, department.getId());
|
|
|
|
SysDepartment treeDep = packTreeSysDepartmentById(list, department.getId());
|
|
|
|
List<Long> idList = findChildSysDepartment(treeDep);
|
|
|
|
List<Long> idList = findChildSysDepartment(treeDep);
|
|
|
|
idList.add(department.getId());
|
|
|
|
idList.add(department.getId());
|
|
|
|
return idList;
|
|
|
|
return idList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
return Collections.emptyList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/********************************************* End SysDepartment Tree *********************************************/
|
|
|
|
/********************************************* End SysDepartment Tree *********************************************/
|
|
|
@ -537,10 +538,10 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<SysMenu> packTreeSysMenu(List<SysMenu> list, Long parentId) {
|
|
|
|
public List<SysMenu> packTreeSysMenu(List<SysMenu> list, Long parentId) {
|
|
|
|
List<SysMenu> result = new ArrayList<>();
|
|
|
|
List<SysMenu> result = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
List<SysMenu> copyList = new ArrayList<>(list);
|
|
|
|
List<SysMenu> copyList = new ArrayList<>(list);
|
|
|
|
list.forEach(menu -> {
|
|
|
|
list.forEach(menu -> {
|
|
|
|
if(menu.getParentId() != null && menu.getParentId().equals(parentId)){
|
|
|
|
if (menu.getParentId() != null && menu.getParentId().equals(parentId)) {
|
|
|
|
result.add(menu);
|
|
|
|
result.add(menu);
|
|
|
|
copyList.remove(menu);
|
|
|
|
copyList.remove(menu);
|
|
|
|
menu.setChildList(packTreeSysMenu(copyList, menu.getId()));
|
|
|
|
menu.setChildList(packTreeSysMenu(copyList, menu.getId()));
|
|
|
@ -555,7 +556,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<SysMenu> packTreeSysMenuBySysRefRoleMenu(List<SysMenu> list, List<SysRefRoleMenu> refList) {
|
|
|
|
public List<SysMenu> packTreeSysMenuBySysRefRoleMenu(List<SysMenu> list, List<SysRefRoleMenu> refList) {
|
|
|
|
List<Long> ids = new ArrayList<>(refList.size());
|
|
|
|
List<Long> ids = new ArrayList<>(refList.size());
|
|
|
|
|
|
|
|
|
|
|
|
if(refList != null && refList.size() > 0){
|
|
|
|
if (refList != null && refList.size() > 0) {
|
|
|
|
refList.forEach(ref -> ids.add(ref.getMenuId()));
|
|
|
|
refList.forEach(ref -> ids.add(ref.getMenuId()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -566,15 +567,15 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<SysMenu> packTreeSysMenuByIds(List<SysMenu> list, List<Long> ids) {
|
|
|
|
public List<SysMenu> packTreeSysMenuByIds(List<SysMenu> list, List<Long> ids) {
|
|
|
|
List<SysMenu> result = new ArrayList<>();
|
|
|
|
List<SysMenu> result = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
list.forEach(menu -> {
|
|
|
|
list.forEach(menu -> {
|
|
|
|
if(menu.getChildList() == null || menu.getChildList().size() <= 0){
|
|
|
|
if (menu.getChildList() == null || menu.getChildList().size() <= 0) {
|
|
|
|
if(ids.contains(menu.getId())){
|
|
|
|
if (ids.contains(menu.getId())) {
|
|
|
|
result.add(menu);
|
|
|
|
result.add(menu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
List<SysMenu> childList = packTreeSysMenuByIds(menu.getChildList(), ids);
|
|
|
|
List<SysMenu> childList = packTreeSysMenuByIds(menu.getChildList(), ids);
|
|
|
|
if(ids.contains(menu.getId()) || childList != null && childList.size() > 0){
|
|
|
|
if (ids.contains(menu.getId()) || childList != null && childList.size() > 0) {
|
|
|
|
menu.setChildList(childList);
|
|
|
|
menu.setChildList(childList);
|
|
|
|
result.add(menu);
|
|
|
|
result.add(menu);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -587,9 +588,9 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public SysMenu packTreeSysMenuById(List<SysMenu> list, Long id) {
|
|
|
|
public SysMenu packTreeSysMenuById(List<SysMenu> list, Long id) {
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
for (SysMenu menu : list) {
|
|
|
|
for (SysMenu menu : list) {
|
|
|
|
if(menu.getId().equals(id)){
|
|
|
|
if (menu.getId().equals(id)) {
|
|
|
|
menu.setChildList(packTreeSysMenu(list, menu.getId()));
|
|
|
|
menu.setChildList(packTreeSysMenu(list, menu.getId()));
|
|
|
|
return menu;
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -602,7 +603,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<Long> findChildSysMenu(SysMenu menu) {
|
|
|
|
public List<Long> findChildSysMenu(SysMenu menu) {
|
|
|
|
List<Long> result = new ArrayList<>();
|
|
|
|
List<Long> result = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
if(menu != null && menu.getChildList() != null && menu.getChildList().size() > 0){
|
|
|
|
if (menu != null && menu.getChildList() != null && menu.getChildList().size() > 0) {
|
|
|
|
for (SysMenu sp : menu.getChildList()) {
|
|
|
|
for (SysMenu sp : menu.getChildList()) {
|
|
|
|
result.add(sp.getId());
|
|
|
|
result.add(sp.getId());
|
|
|
|
result.addAll(findChildSysMenu(sp));
|
|
|
|
result.addAll(findChildSysMenu(sp));
|
|
|
@ -621,28 +622,28 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
public List<SysMenu> packTreeSysMenuByUserIdAndParentId(Long userId, Long parentId) {
|
|
|
|
public List<SysMenu> packTreeSysMenuByUserIdAndParentId(Long userId, Long parentId) {
|
|
|
|
List<SysRefUserRole> roleList = personnelService.findSysRefUserRole(userId);
|
|
|
|
List<SysRefUserRole> roleList = personnelService.findSysRefUserRole(userId);
|
|
|
|
|
|
|
|
|
|
|
|
if(roleList != null && roleList.size() > 0){
|
|
|
|
if (roleList != null && roleList.size() > 0) {
|
|
|
|
List<SysRefRoleMenu> refRoleMenuList = personnelService.findSysRefRoleMenuByRefUserRole(roleList);
|
|
|
|
List<SysRefRoleMenu> refRoleMenuList = personnelService.findSysRefRoleMenuByRefUserRole(roleList);
|
|
|
|
if(refRoleMenuList != null && refRoleMenuList.size() > 0){
|
|
|
|
if (refRoleMenuList != null && refRoleMenuList.size() > 0) {
|
|
|
|
List<SysMenu> menuList = menuService.findLanguageMenuByMenuAndInId(null,null);
|
|
|
|
List<SysMenu> menuList = menuService.findLanguageMenuByMenuAndInId(null, null);
|
|
|
|
|
|
|
|
|
|
|
|
List<SysMenu> menuRootTree = packTreeSysMenu(menuList, parentId);
|
|
|
|
List<SysMenu> menuRootTree = packTreeSysMenu(menuList, parentId);
|
|
|
|
return packTreeSysMenuBySysRefRoleMenu(menuRootTree, refRoleMenuList);
|
|
|
|
return packTreeSysMenuBySysRefRoleMenu(menuRootTree, refRoleMenuList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
return Collections.emptyList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<SysMenu> packTreeSysMenuByParentIdAndMenuType(List<SysMenu> list,Long parentId, Integer menuType) {
|
|
|
|
public List<SysMenu> packTreeSysMenuByParentIdAndMenuType(List<SysMenu> list, Long parentId, Integer menuType) {
|
|
|
|
List<SysMenu> result = new ArrayList<>();
|
|
|
|
List<SysMenu> result = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
for (SysMenu menu : list) {
|
|
|
|
for (SysMenu menu : list) {
|
|
|
|
if(menu.getChildList() != null && menu.getChildList().size() > 0){
|
|
|
|
if (menu.getChildList() != null && menu.getChildList().size() > 0) {
|
|
|
|
result.addAll(packTreeSysMenuByParentIdAndMenuType(menu.getChildList(), parentId, menuType));
|
|
|
|
result.addAll(packTreeSysMenuByParentIdAndMenuType(menu.getChildList(), parentId, menuType));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(menu.getParentId().equals(parentId) && menu.getMenuType().equals(menuType)){
|
|
|
|
if (menu.getParentId().equals(parentId) && menu.getMenuType().equals(menuType)) {
|
|
|
|
result.add(menu);
|
|
|
|
result.add(menu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -653,7 +654,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<SysMenu> packTreeSysMenu() {
|
|
|
|
public List<SysMenu> packTreeSysMenu() {
|
|
|
|
List<SysMenu> menuList = menuService.findLanguageMenuByMenuAndInId(null,null);
|
|
|
|
List<SysMenu> menuList = menuService.findLanguageMenuByMenuAndInId(null, null);
|
|
|
|
return packTreeSysMenu(menuList, CommonEnumUtil.PARENT.DEFAULT.getValue());
|
|
|
|
return packTreeSysMenu(menuList, CommonEnumUtil.PARENT.DEFAULT.getValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|