直接添加端下一级菜单bugfix

This commit is contained in:
yangsong 2023-10-08 17:12:39 +08:00
parent e2a100fdd9
commit 35d0184fef

View File

@ -4,7 +4,6 @@ import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import cn.hutool.core.util.RandomUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
@ -30,6 +29,7 @@ import cn.axzo.tyr.server.repository.entity.SaasFeatureApplyDetail;
import cn.axzo.tyr.server.service.PermissionPointService;
import cn.axzo.tyr.server.service.SaasFeatureApplyDetailService;
import cn.axzo.tyr.server.service.SaasFeatureApplyService;
import cn.hutool.core.util.RandomUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -287,16 +287,19 @@ public class SaasFeatureApplyServiceImpl implements SaasFeatureApplyService {
&& (!Objects.equals(p.getDataType(), 1) && !Objects.equals(p.getDataType(), 2)))
.map(SubmitPermissionPointApplyVO.SubmitPermissionPointInfoVO::getPermissionPointId).distinct().sorted()
.collect(Collectors.toList());
if (CollectionUtils.isEmpty(featureIds)) {
throw new ServiceException("数据错误, 父节点为空");
}
List<PermissionPointTreeNode> featureNodes = permissionPointService.listNodesByIds(featureIds);
if (featureNodes.size() != featureIds.size()) {
List<Long> existIds =
featureNodes.stream().map(PermissionPointTreeNode::getPermissionPointId).collect(Collectors.toList());
throw new ServiceException(
String.format("数据错误, 权限点【%s】不存在", JSON.toJSONString(CollectionUtils.subtract(featureIds, existIds))));
List<PermissionPointTreeNode> featureNodes;
if (CollectionUtils.isNotEmpty(featureIds)) {
featureNodes = permissionPointService.listNodesByIds(featureIds);
if (featureNodes.size() != featureIds.size()) {
List<Long> existIds =
featureNodes.stream().map(PermissionPointTreeNode::getPermissionPointId).collect(Collectors.toList());
throw new ServiceException(
String.format("数据错误, 权限点【%s】不存在", JSON.toJSONString(CollectionUtils.subtract(featureIds, existIds))));
}
} else {
featureNodes = new ArrayList<>();
}
Map<Long, PermissionPointTreeNode> featureMap = featureNodes.stream().collect(
Collectors.toMap(PermissionPointTreeNode::getPermissionPointId, Function.identity(), (e1, e2) -> e2));
Map<String, List<SubmitPermissionPointApplyVO.SubmitPermissionPointInfoVO>> pointMap = flatPoints.stream()