|
|
@@ -13,13 +13,11 @@ import com.ydtech.exception.SystemException;
|
|
|
import com.ydtech.modules.admin.dao.*;
|
|
|
import com.ydtech.modules.admin.model.SysArea;
|
|
|
import com.ydtech.modules.admin.model.SysDept;
|
|
|
-import com.ydtech.modules.admin.model.dto.QxFrontlineAgentDto;
|
|
|
+import com.ydtech.modules.admin.model.SysUser;
|
|
|
import com.ydtech.modules.admin.model.po.InsDeptDistributionProportion;
|
|
|
import com.ydtech.modules.admin.model.po.SysUserDeptRelationship;
|
|
|
-import com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesMonthVo;
|
|
|
-import com.ydtech.modules.admin.model.vo.*;
|
|
|
-import com.ydtech.modules.admin.model.SysUser;
|
|
|
import com.ydtech.modules.admin.model.po.SysUserTreeShowLevel;
|
|
|
+import com.ydtech.modules.admin.model.vo.*;
|
|
|
import com.ydtech.modules.admin.service.SysAreaService;
|
|
|
import com.ydtech.modules.admin.service.SysDeptService;
|
|
|
import com.ydtech.modules.admin.service.SysUserTreeShowLevelService;
|
|
|
@@ -29,7 +27,6 @@ import com.ydtech.modules.esm.service.EsmRetailService;
|
|
|
import com.ydtech.modules.protocol.utils.AssertionUtils;
|
|
|
import com.ydtech.utils.StringUtils;
|
|
|
import com.ydtech.utils.idgen.IdGenerate;
|
|
|
-import io.lettuce.core.ScriptOutputType;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -39,7 +36,6 @@ import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
-import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@@ -132,8 +128,10 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
lqw.eq(SysDept::getManagementSource, managementSource);
|
|
|
//条件
|
|
|
List<SysDept> conditionList = list(lqw);
|
|
|
- Map<String, List<SysDept>> conditionMap = conditionList.stream().collect(Collectors.groupingBy(SysDept::getParentId));
|
|
|
- Map<String, List<SysDept>> map = conditionList.stream().collect(Collectors.groupingBy(SysDept::getParentId));
|
|
|
+ Map<String, List<SysDept>> conditionMap = conditionList.stream()
|
|
|
+ .collect(Collectors.groupingBy(SysDept::getParentId));
|
|
|
+ Map<String, List<SysDept>> map = conditionList.stream()
|
|
|
+ .collect(Collectors.groupingBy(SysDept::getParentId));
|
|
|
//先查第6层
|
|
|
conditionList.forEach(i ->
|
|
|
i.setChildren(map.getOrDefault(i.getId(), new ArrayList<>()))
|
|
|
@@ -147,7 +145,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
break;
|
|
|
} else {
|
|
|
int finalLevel = level;
|
|
|
- resultTmp = resultTmp.stream().filter(x -> x.getComlevel().equals(String.valueOf(finalLevel))).collect(Collectors.toList());
|
|
|
+ resultTmp = resultTmp.stream()
|
|
|
+ .filter(x -> x.getComlevel().equals(String.valueOf(finalLevel)))
|
|
|
+ .collect(Collectors.toList());
|
|
|
result.clear();
|
|
|
result.addAll(resultTmp);
|
|
|
}
|
|
|
@@ -309,23 +309,23 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
boolean b = save(sysDept);
|
|
|
|
|
|
//如果是团队并且个代 初始化分销比例
|
|
|
- if("D".equals(sysDeptVo.getDeptType()) && "2".equals(sysDept.getManagementSource())){
|
|
|
+ if ("D".equals(sysDeptVo.getDeptType()) && "2".equals(sysDept.getManagementSource())) {
|
|
|
List<InsDeptDistributionProportion> insDeptDistributionProportions = insDeptDistributionProportionMapper.selectList(new LambdaQueryWrapper<>());
|
|
|
BigDecimal oneProportion = new BigDecimal(0);
|
|
|
BigDecimal twoProportion = new BigDecimal(0);
|
|
|
BigDecimal threeProportion = new BigDecimal(0);
|
|
|
|
|
|
- for(int i=1;i<=insDeptDistributionProportions.size();i++){
|
|
|
- InsDeptDistributionProportion insDeptDistributionProportion = insDeptDistributionProportions.get(i-1);
|
|
|
- if(i==1){
|
|
|
+ for (int i = 1; i <= insDeptDistributionProportions.size(); i++) {
|
|
|
+ InsDeptDistributionProportion insDeptDistributionProportion = insDeptDistributionProportions.get(i - 1);
|
|
|
+ if (i == 1) {
|
|
|
oneProportion = insDeptDistributionProportion.getProportion();
|
|
|
- }else if(i==2){
|
|
|
+ } else if (i == 2) {
|
|
|
twoProportion = insDeptDistributionProportion.getProportion();
|
|
|
- }else if(i==3){
|
|
|
+ } else if (i == 3) {
|
|
|
threeProportion = insDeptDistributionProportion.getProportion();
|
|
|
}
|
|
|
}
|
|
|
- EsmRetail esmRetail = new EsmRetail(sysDept.getId(),sysDept.getName(),String.valueOf(insDeptDistributionProportions.size()),oneProportion.doubleValue(),twoProportion.doubleValue(),threeProportion.doubleValue());
|
|
|
+ EsmRetail esmRetail = new EsmRetail(sysDept.getId(), sysDept.getName(), String.valueOf(insDeptDistributionProportions.size()), oneProportion.doubleValue(), twoProportion.doubleValue(), threeProportion.doubleValue());
|
|
|
esmRetail.setId(IdGenerate.nextId());
|
|
|
esmRetailService.insert(esmRetail);
|
|
|
}
|
|
|
@@ -428,7 +428,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
|
|
|
|
|
|
public String findMaxDeptId(String deptId) {
|
|
|
- if (deptId == null) return "";
|
|
|
+ if (deptId == null) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
String result = "00";
|
|
|
QueryWrapper<SysDept> qw = new QueryWrapper<>();
|
|
|
qw.likeRight(StringUtils.isNotEmpty(deptId), "id", deptId + "D%");
|
|
|
@@ -580,7 +582,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
List<SysDept> sysDeptsHX = sysDeptMapper.queryHXDeptTree();
|
|
|
//查询后线中顶级的数据
|
|
|
List<SysDept> resultList = new ArrayList<SysDept>();
|
|
|
- List<SysDept> sysDeptTop = sysDeptsHX.stream().filter(item -> "99".equals(item.getId())).collect(Collectors.toList());
|
|
|
+ List<SysDept> sysDeptTop = sysDeptsHX.stream()
|
|
|
+ .filter(item -> "99".equals(item.getId()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
for (SysDept dept : sysDeptTop) {
|
|
|
resultList.add(buildDeptTree(dept, sysDeptsHX));
|
|
|
}
|
|
|
@@ -614,7 +618,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
List<SysDept> sysDeptAll = sysDeptMapper.queryListByQXDept();
|
|
|
//查询后线中顶级的数据
|
|
|
List<SysDept> resultList = new ArrayList<SysDept>();
|
|
|
- List<SysDept> sysDeptTop = sysDeptAll.stream().filter(item -> "3".equals(item.getComlevel())).collect(Collectors.toList());
|
|
|
+ List<SysDept> sysDeptTop = sysDeptAll.stream()
|
|
|
+ .filter(item -> "3".equals(item.getComlevel()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
for (SysDept dept : sysDeptTop) {
|
|
|
resultList.add(buildDeptTree(dept, sysDeptAll));
|
|
|
}
|
|
|
@@ -633,7 +639,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
SysDeptTreeVo sysDeptTreeVo = BeanUtil.copyProperties(sysDept, SysDeptTreeVo.class);
|
|
|
List<SysDeptTreeVo> sysDeptTreeVos = BeanUtil.copyToList(sysDeptList, SysDeptTreeVo.class);
|
|
|
sysDeptTreeVos.add(sysDeptTreeVo);
|
|
|
- Map<String, List<SysDeptTreeVo>> map = sysDeptTreeVos.stream().sorted(Comparator.comparing(SysDeptTreeVo::getId)).collect(Collectors.groupingBy(SysDeptTreeVo::getParentId));
|
|
|
+ Map<String, List<SysDeptTreeVo>> map = sysDeptTreeVos.stream()
|
|
|
+ .sorted(Comparator.comparing(SysDeptTreeVo::getId))
|
|
|
+ .collect(Collectors.groupingBy(SysDeptTreeVo::getParentId));
|
|
|
sysDeptTreeVos.forEach(i -> {
|
|
|
i.setChildren(map.getOrDefault(i.getId(), new ArrayList<>()));
|
|
|
i.setDeptCount(i.getChildren().size());
|
|
|
@@ -655,7 +663,8 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
|
|
|
List<SysDeptTreeVo> sysDeptTreeVos = BeanUtil.copyToList(sysDeptList, SysDeptTreeVo.class);
|
|
|
|
|
|
- Map<String, List<SysDeptTreeVo>> map = sysDeptTreeVos.stream().sorted(Comparator.comparing(SysDeptTreeVo::getId))
|
|
|
+ Map<String, List<SysDeptTreeVo>> map = sysDeptTreeVos.stream()
|
|
|
+ .sorted(Comparator.comparing(SysDeptTreeVo::getId))
|
|
|
.collect(Collectors.groupingBy(SysDeptTreeVo::getParentId));
|
|
|
sysDeptTreeVos.forEach(i -> {
|
|
|
i.setChildren(map.getOrDefault(i.getId(), new ArrayList<>()));
|
|
|
@@ -667,23 +676,31 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
List<SysDeptTreeVo> children2 = deptTreeVo.getChildren();
|
|
|
for (SysDeptTreeVo children : children2) {//2
|
|
|
List<SysDeptTreeVo> children3 = children.getChildren();
|
|
|
- if (children3.size()>0) {
|
|
|
- children3=children3.stream().filter(SysDeptTreeVo -> SysDeptTreeVo.getComlevel() != null).collect(Collectors.toList());
|
|
|
+ if (children3.size() > 0) {
|
|
|
+ children3 = children3.stream()
|
|
|
+ .filter(SysDeptTreeVo -> SysDeptTreeVo.getComlevel() != null)
|
|
|
+ .collect(Collectors.toList());
|
|
|
children.setChildren(children3);
|
|
|
for (SysDeptTreeVo child4 : children3) {//3
|
|
|
List<SysDeptTreeVo> children4 = child4.getChildren();
|
|
|
- if (children4.size()>0) {
|
|
|
- children4=children4.stream().filter(SysDeptTreeVo -> SysDeptTreeVo.getComlevel() != null).collect(Collectors.toList());
|
|
|
+ if (children4.size() > 0) {
|
|
|
+ children4 = children4.stream()
|
|
|
+ .filter(SysDeptTreeVo -> SysDeptTreeVo.getComlevel() != null)
|
|
|
+ .collect(Collectors.toList());
|
|
|
child4.setChildren(children4);
|
|
|
for (SysDeptTreeVo child : children4) {//4
|
|
|
List<SysDeptTreeVo> children5 = child.getChildren();
|
|
|
- children5 = children5.stream().filter(SysDeptTreeVo ->SysDeptTreeVo.getComlevel() != null).collect(Collectors.toList());
|
|
|
+ children5 = children5.stream()
|
|
|
+ .filter(SysDeptTreeVo -> SysDeptTreeVo.getComlevel() != null)
|
|
|
+ .collect(Collectors.toList());
|
|
|
child.setChildren(children5);
|
|
|
- if (children5.size()>0) {
|
|
|
+ if (children5.size() > 0) {
|
|
|
for (SysDeptTreeVo treeVo : children5) {
|
|
|
List<SysDeptTreeVo> childrenEnd = treeVo.getChildren();
|
|
|
- if (childrenEnd.size()>0) {
|
|
|
- childrenEnd=childrenEnd.stream().filter(SysDeptTreeVo ->SysDeptTreeVo.getComlevel() == null).collect(Collectors.toList());
|
|
|
+ if (childrenEnd.size() > 0) {
|
|
|
+ childrenEnd = childrenEnd.stream()
|
|
|
+ .filter(SysDeptTreeVo -> SysDeptTreeVo.getComlevel() == null)
|
|
|
+ .collect(Collectors.toList());
|
|
|
treeVo.setChildren(childrenEnd);
|
|
|
}
|
|
|
|
|
|
@@ -707,15 +724,17 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
String managementSourceDept = sysDeptMapper.getByOrderNoQueryManagementSource(orderNo);
|
|
|
return managementSource.equals(managementSourceDept);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 数据权限机构数
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
public List<SysDept> getDataDeptTree(List<String> deptIds) {
|
|
|
String name = BaseController.getUser().getName();
|
|
|
List<SysDept> result = new ArrayList<>();
|
|
|
- if(!deptIds.isEmpty()){
|
|
|
+ if (!deptIds.isEmpty()) {
|
|
|
List<SysDept> deptList = sysDeptMapper.getListByIdsByKzt(deptIds);
|
|
|
// 使用一个Map来快速查找部门节点
|
|
|
Map<String, SysDept> deptMap = new HashMap<>();
|
|
|
@@ -732,14 +751,14 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
}
|
|
|
|
|
|
} else if ("admin".equals(name)) {
|
|
|
- String deptId ="9";
|
|
|
- if(deptId==null || "".equals(deptId)){
|
|
|
- deptId="9";
|
|
|
- }else{
|
|
|
+ String deptId = "9";
|
|
|
+ if (deptId == null || "".equals(deptId)) {
|
|
|
+ deptId = "9";
|
|
|
+ } else {
|
|
|
//如果是平台下判断包含D的查询上级id
|
|
|
- if(deptId.contains("D")){
|
|
|
+ if (deptId.contains("D")) {
|
|
|
SysDept dept = baseMapper.selectById(deptId);
|
|
|
- deptId =dept==null?"":dept.getParentId();
|
|
|
+ deptId = dept == null ? "" : dept.getParentId();
|
|
|
}
|
|
|
}
|
|
|
LambdaQueryWrapper<SysDept> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
@@ -790,7 +809,8 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
List<SysDept> sysDeptList = baseMapper.getFiveLevelDept(sysDeptVo);
|
|
|
sysDeptList.add(sysDept);//添加总部 总部没有等级机构
|
|
|
List<SysDeptTreeVo> sysDeptTreeVos = BeanUtil.copyToList(sysDeptList, SysDeptTreeVo.class);
|
|
|
- Map<String, List<SysDeptTreeVo>> map = sysDeptTreeVos.stream().sorted(Comparator.comparing(SysDeptTreeVo::getId))
|
|
|
+ Map<String, List<SysDeptTreeVo>> map = sysDeptTreeVos.stream()
|
|
|
+ .sorted(Comparator.comparing(SysDeptTreeVo::getId))
|
|
|
.collect(Collectors.groupingBy(SysDeptTreeVo::getParentId));
|
|
|
sysDeptTreeVos.forEach(i -> {
|
|
|
i.setChildren(map.getOrDefault(i.getId(), new ArrayList<>()));
|
|
|
@@ -814,12 +834,13 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 前线只要机构 后线人员(按照领导人) 机构
|
|
|
+ * 前线只要机构 后线人员(按照领导人) 机构
|
|
|
+ *
|
|
|
* @param sysDeptVo
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public KztUserDeptTreeDto getUserDeptTree(SysDeptVo sysDeptVo) {
|
|
|
+ public KztUserDeptTreeDto getUserDeptTree(SysDeptVo sysDeptVo) {
|
|
|
String managementSource = sysDeptVo.getManagementSource();
|
|
|
KztUserDeptTreeDto kztUserDeptTreeDto = new KztUserDeptTreeDto();
|
|
|
String userId = BaseController.getUserId();
|
|
|
@@ -831,24 +852,24 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
} else {
|
|
|
kztUserDeptTreeDto.setType("2"); //代理
|
|
|
}
|
|
|
- SysUser byUserId = sysUserMapper.getByUserId(userId);
|
|
|
- List<SysDeptTreeVo> resultDeptList = this.getFiveLevelDeptKzt(byUserId,managementSource);
|
|
|
- kztUserDeptTreeDto.setDeptList(resultDeptList);
|
|
|
- if (!userId.contains("M")) {
|
|
|
- List<SysUser> resultList =this.getUserTreeHx(byUserId,managementSource);
|
|
|
- kztUserDeptTreeDto.setUserList(resultList);
|
|
|
- }
|
|
|
+ SysUser byUserId = sysUserMapper.getByUserId(userId);
|
|
|
+ List<SysDeptTreeVo> resultDeptList = this.getFiveLevelDeptKzt(byUserId, managementSource);
|
|
|
+ kztUserDeptTreeDto.setDeptList(resultDeptList);
|
|
|
+ if (!userId.contains("M")) {
|
|
|
+ List<SysUser> resultList = this.getUserTreeHx(byUserId, managementSource);
|
|
|
+ kztUserDeptTreeDto.setUserList(resultList);
|
|
|
+ }
|
|
|
|
|
|
return kztUserDeptTreeDto;
|
|
|
}
|
|
|
|
|
|
- private List<SysUser> getUserTreeHx(SysUser sysUser,String managementSource) {
|
|
|
+ private List<SysUser> getUserTreeHx(SysUser sysUser, String managementSource) {
|
|
|
//获取领导字段不为空的人的ID
|
|
|
QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.isNotNull("leader_id");
|
|
|
|
|
|
HashMap<String, Object> params = new HashMap<>();
|
|
|
- params.put("managementSource",managementSource);
|
|
|
+ params.put("managementSource", managementSource);
|
|
|
List<SysUser> users = sysUserMapper.selectByParams(params);
|
|
|
|
|
|
for (SysUser user : users) {
|
|
|
@@ -860,7 +881,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
|
|
|
List<SysUser> allList = new ArrayList<>();
|
|
|
for (SysUser user : users) {
|
|
|
- this.addLeadUserList(user,allList);
|
|
|
+ this.addLeadUserList(user, allList);
|
|
|
}
|
|
|
List<SysUser> collect = allList.stream()
|
|
|
.collect(Collectors.collectingAndThen(
|
|
|
@@ -872,14 +893,14 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
|
|
|
List<SysUser> topUsers = new ArrayList<>(); //存放1级用户,即没有直接上级的用户
|
|
|
// 根据组织结构展示级别,筛选顶层节点并构建组织结构树
|
|
|
- if("admin".equals(sysUser.getName())){
|
|
|
+ if ("admin".equals(sysUser.getName())) {
|
|
|
topUsers.add(sysUserMapper.selectById("99D1501"));
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
this.appendName(sysUser);
|
|
|
topUsers.add(sysUser);
|
|
|
}
|
|
|
// 递归构建用户树结构
|
|
|
- buildUserTree(topUsers, collect,managementSource);
|
|
|
+ buildUserTree(topUsers, collect, managementSource);
|
|
|
return topUsers;
|
|
|
}
|
|
|
|
|
|
@@ -906,6 +927,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
|
|
|
/**
|
|
|
* 拼接机构来源
|
|
|
+ *
|
|
|
* @param users
|
|
|
*/
|
|
|
private void appendName(SysUser user) {
|
|
|
@@ -933,27 +955,27 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
stringBuilder.append("(").append(dept1.getName()).append(dept2.getName()).append(")");
|
|
|
}
|
|
|
}
|
|
|
- user.setName(user.getName()+stringBuilder.toString());
|
|
|
+ user.setName(user.getName() + stringBuilder.toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private List<SysDeptTreeVo> getFiveLevelDeptKzt(SysUser byUserId,String managementSource) {
|
|
|
+ private List<SysDeptTreeVo> getFiveLevelDeptKzt(SysUser byUserId, String managementSource) {
|
|
|
SysDept sysDept = getById("9");
|
|
|
SysDeptVo sysDeptVo = new SysDeptVo();
|
|
|
String id = byUserId.getId();
|
|
|
List<String> deptIds = new ArrayList<>();
|
|
|
- if("admin".equals(byUserId.getId())){
|
|
|
+ if ("admin".equals(byUserId.getId())) {
|
|
|
List<SysDept> sysDeptList = baseMapper.getFiveLevelDept(sysDeptVo);
|
|
|
deptIds.addAll(sysDeptList.stream().map(SysDept::getId).collect(Collectors.toList()));
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
List<SysUserDeptRelationship> relationships = sysUserDeptRelationshipMapper.selectList(new QueryWrapper<SysUserDeptRelationship>().eq("user_id", id));
|
|
|
deptIds.addAll(relationships.stream().map(SysUserDeptRelationship::getDeptId).collect(Collectors.toList()));
|
|
|
}
|
|
|
- if(!deptIds.isEmpty()){
|
|
|
+ if (!deptIds.isEmpty()) {
|
|
|
sysDeptVo.setDeptIds(deptIds);
|
|
|
List<SysDept> sysDeptList = baseMapper.getFiveLevelDept(sysDeptVo);
|
|
|
- if("admin".equals(byUserId.getId())){
|
|
|
+ if ("admin".equals(byUserId.getId())) {
|
|
|
sysDept.setComlevel("1");
|
|
|
sysDeptList.add(sysDept);
|
|
|
List<SysDeptTreeVo> sysDeptTreeVos = BeanUtil.copyToList(sysDeptList, SysDeptTreeVo.class);
|
|
|
@@ -962,16 +984,17 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
.filter(dept -> !(dept.getComlevel().equals("5") &&
|
|
|
!Objects.equals(dept.getManagementSource(), managementSource)))
|
|
|
.collect(Collectors.toList());
|
|
|
- Map<String, List<SysDeptTreeVo>> map = filteredSysDeptTreeVos.stream().sorted(Comparator.comparing(SysDeptTreeVo::getId))
|
|
|
+ Map<String, List<SysDeptTreeVo>> map = filteredSysDeptTreeVos.stream()
|
|
|
+ .sorted(Comparator.comparing(SysDeptTreeVo::getId))
|
|
|
.collect(Collectors.groupingBy(SysDeptTreeVo::getParentId));
|
|
|
filteredSysDeptTreeVos.forEach(i -> {
|
|
|
- if(Integer.parseInt(i.getComlevel())<=5){
|
|
|
+ if (Integer.parseInt(i.getComlevel()) <= 5) {
|
|
|
i.setChildren(map.getOrDefault(i.getId(), new ArrayList<>()));
|
|
|
i.setDeptCount(i.getChildren().size());
|
|
|
}
|
|
|
});
|
|
|
return map.get(sysDept.getParentId());
|
|
|
- } else {
|
|
|
+ } else {
|
|
|
List<SysDept> result = new ArrayList<>();
|
|
|
List<SysDept> deptList = sysDeptMapper.getListByIds(deptIds);
|
|
|
List<SysDept> filteredDeptList = deptList.stream()
|
|
|
@@ -1000,8 +1023,8 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
List<SysDeptTreeVo> sysDeptTreeVos = BeanUtil.copyToList(result, SysDeptTreeVo.class);
|
|
|
return sysDeptTreeVos;
|
|
|
}
|
|
|
- }else {
|
|
|
- return new ArrayList<SysDeptTreeVo>();
|
|
|
+ } else {
|
|
|
+ return new ArrayList<>();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1012,7 +1035,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
// 查找并添加子部门
|
|
|
for (SysDept potentialChild : deptMap.values()) {
|
|
|
if (potentialChild.getParentId() != null && potentialChild.getParentId().equals(dept.getId())) {
|
|
|
- if(StringUtils.isNotEmpty(potentialChild.getComlevel()) && Integer.parseInt(potentialChild.getComlevel())<=5 ){
|
|
|
+ if (StringUtils.isNotEmpty(potentialChild.getComlevel()) && Integer.parseInt(potentialChild.getComlevel()) <= 5) {
|
|
|
children.add(potentialChild);
|
|
|
buildDeptTreeKzt(potentialChild, deptMap); // 递归构建子部门的子树
|
|
|
}
|
|
|
@@ -1027,7 +1050,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
if (user.getId().equals(childUser.getLeaderId())) {
|
|
|
children.add(childUser);
|
|
|
// 递归查找下一级
|
|
|
- buildUserTree(children, users,managementSource);
|
|
|
+ buildUserTree(children, users, managementSource);
|
|
|
}
|
|
|
}
|
|
|
user.setChildren(children);
|
|
|
@@ -1038,20 +1061,21 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
public List<SysUser> getLeadListDeptId(String deptId) {
|
|
|
return sysUserMapper.getLeadListDeptId(deptId);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
- * @version
|
|
|
- * @author: hxl
|
|
|
- * @Date: 2024/9/26 18:31
|
|
|
- * @Description: 设置领导人
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/9/26 18:31
|
|
|
+ * @Description: 设置领导人
|
|
|
*/
|
|
|
@Override
|
|
|
public void saveLeadId(DeptLeadVo deptLeadVo) {
|
|
|
SysDept dept = baseMapper.selectById(deptLeadVo.getDeptId());
|
|
|
- if(StringUtils.isBlank(deptLeadVo.getLeadId())){
|
|
|
+ if (StringUtils.isBlank(deptLeadVo.getLeadId())) {
|
|
|
dept.setLeaderId("");
|
|
|
dept.setLeadername("");
|
|
|
baseMapper.updateById(dept);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
SysUser sysUser = sysUserMapper.selectById(deptLeadVo.getLeadId());
|
|
|
dept.setLeaderId(deptLeadVo.getLeadId());
|
|
|
dept.setLeadername(sysUser.getName());
|