|
@@ -122,7 +122,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|
this.removeByIds(idList);
|
|
this.removeByIds(idList);
|
|
}
|
|
}
|
|
|
|
|
|
- //删除组织机构
|
|
|
|
|
|
+ // 删除组织机构
|
|
sysDeptRelationService.deleteDeptById(id);
|
|
sysDeptRelationService.deleteDeptById(id);
|
|
|
|
|
|
// 删除部门级联关系
|
|
// 删除部门级联关系
|
|
@@ -445,14 +445,14 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|
@Override
|
|
@Override
|
|
public List<SysDept> getAllParentDept(SysDept sysDept) {
|
|
public List<SysDept> getAllParentDept(SysDept sysDept) {
|
|
List<SysDept> deptList = deptMapper.getAllParentDept(sysDept);
|
|
List<SysDept> deptList = deptMapper.getAllParentDept(sysDept);
|
|
- //一个机构同时是一级cso和二级cso时,可以自己给自己发包
|
|
|
|
|
|
+ // 一个机构同时是一级cso和二级cso时,可以自己给自己发包
|
|
Map<Integer, SysDept> partsMap = deptList.stream().collect(
|
|
Map<Integer, SysDept> partsMap = deptList.stream().collect(
|
|
Collectors.toMap(SysDept::getLevel, Function.identity(), (dto1, dto2) -> dto1));
|
|
Collectors.toMap(SysDept::getLevel, Function.identity(), (dto1, dto2) -> dto1));
|
|
- //没有药企,有一级cso和二级cso时,这个时候不返回二级cso
|
|
|
|
|
|
+ // 没有药企,有一级cso和二级cso时,这个时候不返回二级cso
|
|
if ((!partsMap.containsKey(2)) && partsMap.containsKey(3) && partsMap.containsKey(4)) {
|
|
if ((!partsMap.containsKey(2)) && partsMap.containsKey(3) && partsMap.containsKey(4)) {
|
|
deptList.remove(partsMap.get(4));
|
|
deptList.remove(partsMap.get(4));
|
|
}
|
|
}
|
|
- //二级CSO只展示上级一级CSO
|
|
|
|
|
|
+ // 二级CSO只展示上级一级CSO
|
|
if (partsMap.containsKey(2) && partsMap.containsKey(3) && partsMap.containsKey(4)) {
|
|
if (partsMap.containsKey(2) && partsMap.containsKey(3) && partsMap.containsKey(4)) {
|
|
SysDept sysDept1 = this.getById(SecurityUtils.getUser().getDeptId());
|
|
SysDept sysDept1 = this.getById(SecurityUtils.getUser().getDeptId());
|
|
if (sysDept1.getLevel() == 4) {
|
|
if (sysDept1.getLevel() == 4) {
|
|
@@ -561,16 +561,17 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public Map<Integer, SysDept> mapConsignee(Set<Integer> consigneeIds, boolean ignoreDel) {
|
|
|
|
-
|
|
|
|
- LambdaQueryWrapper<SysDept> wrapper = Wrappers.<SysDept>lambdaQuery().in(SysDept::getDeptId, consigneeIds);
|
|
|
|
|
|
+ public Map<Integer, SysDept> mapConsignee(Set<Integer> consigneeIds, boolean ignoreDel) {
|
|
|
|
|
|
|
|
+ List<SysDept> list;
|
|
if (ignoreDel) {
|
|
if (ignoreDel) {
|
|
- wrapper.and(i -> i.eq(SysDept::getDelFlag, DelEnum.NOT_DEL.getVal()).or().eq(SysDept::getDelFlag, DelEnum.DELETED.getVal()));
|
|
|
|
|
|
+ list = consigneeIds.stream().map(id -> this.getBaseMapper().selectRealById(id)).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ list = this.list(Wrappers.<SysDept>lambdaQuery().in(SysDept::getDeptId, consigneeIds));
|
|
}
|
|
}
|
|
|
|
|
|
- List<SysDept> list = this.list(wrapper);
|
|
|
|
|
|
|
|
- return list.stream().collect(Collectors.toMap(SysDept::getDeptId, Function.identity()));
|
|
|
|
|
|
+ return CollUtil.isNotEmpty(list) ? list.stream().collect(Collectors.toMap(SysDept::getDeptId, Function.identity())) : Collections.emptyMap();
|
|
}
|
|
}
|
|
}
|
|
}
|