|
|
|
|
@@ -2,6 +2,7 @@ package com.njcn.user.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.njcn.common.pojo.exception.BusinessException;
|
|
|
|
|
@@ -25,7 +26,10 @@ import lombok.AllArgsConstructor;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -89,17 +93,18 @@ public class ComponentServiceImpl extends ServiceImpl<ComponentMapper, Component
|
|
|
|
|
List<ComponentVO> list = new ArrayList<>();
|
|
|
|
|
List<ComponentVO> result = new ArrayList<>();
|
|
|
|
|
List<ComponentDTO> componentList = componentMapper.getAllComponent();
|
|
|
|
|
if (!CollectionUtils.isEmpty(componentList)){
|
|
|
|
|
if (!CollectionUtils.isEmpty(componentList)) {
|
|
|
|
|
componentList.forEach(item -> {
|
|
|
|
|
ComponentVO componentVO = new ComponentVO();
|
|
|
|
|
BeanUtil.copyProperties(item, componentVO);
|
|
|
|
|
componentVO.setTimeKeys(StrUtil.split(item.getTimeKey(), ","));
|
|
|
|
|
// componentVO.setFunctionGroup(Arrays.stream(item.getFunctionGroup().split(",")).map(s -> Integer.valueOf(s.trim())).collect(Collectors.toList()));
|
|
|
|
|
list.add(componentVO);
|
|
|
|
|
});
|
|
|
|
|
Map<String,List<ComponentVO>> map = list.stream().filter(m->!Objects.isNull(m.getSystemType())).collect(Collectors.groupingBy(ComponentVO::getSystemType));
|
|
|
|
|
map.forEach((k,v)->{
|
|
|
|
|
Map<String, List<ComponentVO>> map = list.stream().filter(m -> !Objects.isNull(m.getSystemType())).collect(Collectors.groupingBy(ComponentVO::getSystemType));
|
|
|
|
|
map.forEach((k, v) -> {
|
|
|
|
|
DictData dictData = dicDataFeignClient.getDicDataById(k).getData();
|
|
|
|
|
if (Objects.isNull(dictData)){
|
|
|
|
|
if (Objects.isNull(dictData)) {
|
|
|
|
|
throw new BusinessException(SystemResponseEnum.SYSTEM_TYPE_EMPTY);
|
|
|
|
|
}
|
|
|
|
|
ComponentVO componentVO = new ComponentVO();
|
|
|
|
|
@@ -107,9 +112,9 @@ public class ComponentServiceImpl extends ServiceImpl<ComponentMapper, Component
|
|
|
|
|
componentVO.setName(dictData.getName());
|
|
|
|
|
componentVO.setChildren(
|
|
|
|
|
v.stream()
|
|
|
|
|
.filter(fun -> Objects.equals(ComponentState.FATHER_PID, fun.getPid()))
|
|
|
|
|
.peek(funS -> funS.setChildren(getChildCategoryList(funS, v)))
|
|
|
|
|
.collect(Collectors.toList()));
|
|
|
|
|
.filter(fun -> Objects.equals(ComponentState.FATHER_PID, fun.getPid()))
|
|
|
|
|
.peek(funS -> funS.setChildren(getChildCategoryList(funS, v)))
|
|
|
|
|
.collect(Collectors.toList()));
|
|
|
|
|
result.add(componentVO);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@@ -132,19 +137,20 @@ public class ComponentServiceImpl extends ServiceImpl<ComponentMapper, Component
|
|
|
|
|
}
|
|
|
|
|
list = componentMapper.getComponentByList(componentList);
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isEmpty(list)){
|
|
|
|
|
if (CollectionUtil.isEmpty(list)) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
list.forEach(item -> {
|
|
|
|
|
ComponentVO componentVO = new ComponentVO();
|
|
|
|
|
BeanUtil.copyProperties(item, componentVO);
|
|
|
|
|
componentVO.setTimeKeys(StrUtil.split(item.getTimeKey(), ","));
|
|
|
|
|
// componentVO.setFunctionGroup(Arrays.stream(item.getFunctionGroup().split(",")).map(s -> Integer.valueOf(s.trim())).collect(Collectors.toList()));
|
|
|
|
|
componentVOList.add(componentVO);
|
|
|
|
|
});
|
|
|
|
|
Map<String,List<ComponentVO>> map = componentVOList.stream().collect(Collectors.groupingBy(ComponentVO::getSystemType));
|
|
|
|
|
map.forEach((k, v)->{
|
|
|
|
|
Map<String, List<ComponentVO>> map = componentVOList.stream().collect(Collectors.groupingBy(ComponentVO::getSystemType));
|
|
|
|
|
map.forEach((k, v) -> {
|
|
|
|
|
DictData dictData = dicDataFeignClient.getDicDataById(k).getData();
|
|
|
|
|
if (Objects.isNull(dictData)){
|
|
|
|
|
if (Objects.isNull(dictData)) {
|
|
|
|
|
throw new BusinessException(SystemResponseEnum.SYSTEM_TYPE_EMPTY);
|
|
|
|
|
}
|
|
|
|
|
ComponentVO componentVO = new ComponentVO();
|
|
|
|
|
@@ -167,7 +173,7 @@ public class ComponentServiceImpl extends ServiceImpl<ComponentMapper, Component
|
|
|
|
|
component.setId("0");
|
|
|
|
|
component.setName("无");
|
|
|
|
|
list.add(component);
|
|
|
|
|
list.addAll(this.lambdaQuery().eq(Component::getSystemType, systemType).eq(Component::getPid,ComponentState.FATHER_PID).eq(Component::getState, ComponentState.ENABLE).list());
|
|
|
|
|
list.addAll(this.lambdaQuery().eq(Component::getSystemType, systemType).eq(Component::getPid, ComponentState.FATHER_PID).eq(Component::getState, ComponentState.ENABLE).list());
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|