|
@@ -2,6 +2,7 @@ package org.springblade.manager.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import lombok.AllArgsConstructor;
|
|
@@ -149,7 +150,7 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<WbsTreePrivateVO> tabTypeLazyTree( Long parentId, String projectId) {
|
|
|
+ public List<WbsTreePrivateVO> tabTypeLazyTree(Long parentId, String projectId) {
|
|
|
return ForestNodeMerger.merge(baseMapper.tabTypeLazyTree(parentId, projectId));
|
|
|
}
|
|
|
|
|
@@ -473,26 +474,28 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
|
break;
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(wbsId)) {
|
|
|
+ //获取当前参数表的所有数据
|
|
|
+ List<WbsParam> wbsParamListAll = wbsParamMapper.selectList(Wrappers.<WbsParam>query().lambda());
|
|
|
|
|
|
List<WbsParam> paramListData = new ArrayList<>();
|
|
|
-
|
|
|
//获取公有树
|
|
|
List<WbsTree> treePublicNodeAll = wbsTreeMapper.selectList(Wrappers.<WbsTree>query().lambda()
|
|
|
.eq(WbsTree::getWbsId, wbsId)
|
|
|
.eq(WbsTree::getStatus, 1)
|
|
|
.eq(WbsTree::getType, 1)
|
|
|
);
|
|
|
+
|
|
|
if (treePublicNodeAll.size() > 0) {
|
|
|
//公有引用
|
|
|
for (WbsTreePrivate wbsTreePrivate : wbsTreePrivateAllNow) {
|
|
|
for (WbsTree wbsTree : treePublicNodeAll) {
|
|
|
if (wbsTree.getId().equals(wbsTreePrivate.getId())) {
|
|
|
//获取公有节点参数
|
|
|
- List<WbsParam> paramList = wbsParamServiceImpl.findByNodeId(wbsTree.getId());
|
|
|
- for (WbsParam wbsParam : paramList) {
|
|
|
- wbsParam.setWbsId(wbsTreePrivate.getPKeyId());
|
|
|
- wbsParam.setId(SnowFlakeUtil.getId());
|
|
|
- paramListData.add(wbsParam);
|
|
|
+ List<WbsParam> wbsParamList = wbsParamListAll.stream().filter(f -> f.getWbsId().equals(wbsTree.getId())).collect(Collectors.toList());
|
|
|
+ for (WbsParam param : Objects.requireNonNull(wbsParamList)) {
|
|
|
+ param.setWbsId(wbsTreePrivate.getPKeyId());
|
|
|
+ param.setId(SnowFlakeUtil.getId());
|
|
|
+ paramListData.add(param);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -517,8 +520,8 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
|
for (WbsTreePrivate wbsTreePrivateYS : treePrivateNodeAll) {
|
|
|
if (wbsTreePrivateYS.getId().equals(wbsTreePrivate.getId())) {
|
|
|
//获取公有节点参数
|
|
|
- List<WbsParam> paramList = wbsParamServiceImpl.findByNodeId(wbsTreePrivateYS.getPKeyId());
|
|
|
- for (WbsParam wbsParam : paramList) {
|
|
|
+ List<WbsParam> wbsParamList = wbsParamListAll.stream().filter(f -> f.getWbsId().equals(wbsTreePrivateYS.getPKeyId())).collect(Collectors.toList());
|
|
|
+ for (WbsParam wbsParam : wbsParamList) {
|
|
|
wbsParam.setWbsId(wbsTreePrivate.getPKeyId());
|
|
|
wbsParam.setId(SnowFlakeUtil.getId());
|
|
|
paramListData.add(wbsParam);
|
|
@@ -532,16 +535,17 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
|
Iterator<WbsParam> iterator = paramListData.iterator();
|
|
|
while (iterator.hasNext()) {
|
|
|
WbsParam next = iterator.next();
|
|
|
- WbsParam wbsParam = wbsParamMapper.selectOne(Wrappers.<WbsParam>query().lambda()
|
|
|
- .eq(WbsParam::getK, next.getK())
|
|
|
- .eq(WbsParam::getV, next.getV())
|
|
|
- .eq(WbsParam::getName, next.getName())
|
|
|
- .eq(WbsParam::getWbsId, next.getWbsId())
|
|
|
- );
|
|
|
- if (wbsParam != null) {
|
|
|
+ List<WbsParam> collect = wbsParamListAll.stream().filter(f ->
|
|
|
+ (StringUtils.isNotEmpty(f.getK()) && f.getK().equals(next.getK()))
|
|
|
+ && (StringUtils.isNotEmpty(f.getV()) && f.getV().equals(next.getV()))
|
|
|
+ && (StringUtils.isNotEmpty(f.getName()) && f.getName().equals(next.getName()))
|
|
|
+ && (ObjectUtils.isNotEmpty(f.getWbsId()) && f.getWbsId().equals(next.getWbsId())))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (collect.size() > 0) {
|
|
|
iterator.remove();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
wbsParamServiceImpl.saveBatch(paramListData, 1000);
|
|
|
return true;
|
|
|
}
|
|
@@ -749,7 +753,7 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
|
//将表单同步到复制或新增的节点下
|
|
|
for (WbsTreeContract treeContract : wbsTreeContracts2) {
|
|
|
WbsTreeContract wbsTreeContract2 = BeanUtil.copyProperties(wbsTreeContract, WbsTreeContract.class);
|
|
|
- if (wbsTreeContract2 != null){
|
|
|
+ if (wbsTreeContract2 != null) {
|
|
|
wbsTreeContract2.setPKeyId(SnowFlakeUtil.getId());
|
|
|
wbsTreeContract2.setParentId(treeContract.getId());
|
|
|
|