|
@@ -200,23 +200,26 @@ public class WbsSynchronousServiceImpl {
|
|
|
: Collections.emptySet();
|
|
|
|
|
|
//获取项目信息
|
|
|
- ProjectInfo projectInfo = projectInfoMapper.selectOne(Wrappers.<ProjectInfo>lambdaQuery().eq(ProjectInfo::getId, wbsTreeSynchronousRecord.getProjectId()));
|
|
|
+ ProjectInfo projectInfo = projectInfoMapper.selectOne(Wrappers.<ProjectInfo>lambdaQuery()
|
|
|
+ .eq(ProjectInfo::getId, wbsTreeSynchronousRecord.getProjectId()));
|
|
|
//模板项目信息
|
|
|
- ProjectInfo tempProject = projectInfoMapper.selectOne(Wrappers.<ProjectInfo>lambdaQuery().eq(ProjectInfo::getId, wbsTreeSynchronousRecord.getTemplateId()));
|
|
|
+ ProjectInfo tempProject = projectInfoMapper.selectOne(Wrappers.<ProjectInfo>lambdaQuery()
|
|
|
+ .eq(ProjectInfo::getId, wbsTreeSynchronousRecord.getTemplateId()));
|
|
|
|
|
|
List<WbsTreePrivate> editData = new ArrayList<>();
|
|
|
|
|
|
for (String primaryKeyId : nodeIds) {
|
|
|
if (StringUtils.isNotEmpty(primaryKeyId)) {
|
|
|
//获取当前节点对应节点信息
|
|
|
- WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.selectOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, primaryKeyId));
|
|
|
+ WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.selectOne(Wrappers.<WbsTreePrivate>lambdaQuery()
|
|
|
+ .eq(WbsTreePrivate::getPKeyId, primaryKeyId));
|
|
|
if (wbsTreePrivate == null) {
|
|
|
throw new ServiceException("当前节点不存在");
|
|
|
}
|
|
|
//当前项目绑定的是公有模板还是私有项目
|
|
|
Boolean isPublic = false;
|
|
|
|
|
|
- if(tempProject == null){
|
|
|
+ if (tempProject == null) {
|
|
|
isPublic = true;
|
|
|
}
|
|
|
|
|
@@ -226,16 +229,11 @@ public class WbsSynchronousServiceImpl {
|
|
|
//当前节点引用的模板为公有模板
|
|
|
|
|
|
if (isPublic) {
|
|
|
- //当前节点对应的模板节点信息
|
|
|
- WbsTree wbsTreeTemplate = wbsTreeMapper.selectOne(Wrappers.<WbsTree>lambdaQuery()
|
|
|
- .eq(WbsTree::getId, wbsTreePrivate.getTreePId()));
|
|
|
//获取模板中当前节点的子节点的数据------------------------------------------------------------------------------------------------------------------------
|
|
|
LambdaQueryWrapper<WbsTree> wrapperTree = Wrappers.lambdaQuery();
|
|
|
- wrapperTree.eq(WbsTree::getWbsId, wbsTreePrivate.getWbsId())
|
|
|
- .eq(WbsTree::getIsDeleted, 0);
|
|
|
- if (wbsTreeTemplate.getParentId() != 0) {
|
|
|
- wrapperTree.apply("FIND_IN_SET({0},ancestors)", wbsTreeTemplate.getId());
|
|
|
- }
|
|
|
+ wrapperTree
|
|
|
+ .eq(WbsTree::getIsDeleted, 0)
|
|
|
+ .apply("FIND_IN_SET({0},ancestors)", wbsTreePrivate.getTreePId());
|
|
|
//模板节点的所有子节点信息
|
|
|
List<WbsTree> wbsTrees = wbsTreeMapper.selectList(wrapperTree);
|
|
|
//3、获取需要新增的节点或者表单节点信息 以及他们对应的父级节点信息--------------------------------------------------------------------------------------------
|
|
@@ -253,7 +251,8 @@ public class WbsSynchronousServiceImpl {
|
|
|
|
|
|
//获取模板中当前节点的子节点的数据------------------------------------------------------------------------------------------------------------------------
|
|
|
LambdaQueryWrapper<WbsTreePrivate> wrapperPrivate = Wrappers.lambdaQuery();
|
|
|
- wrapperPrivate.eq(WbsTreePrivate::getProjectId, wbsTreePrivateRoot.getProjectId())
|
|
|
+ wrapperPrivate
|
|
|
+ .eq(WbsTreePrivate::getProjectId, wbsTreePrivateRoot.getProjectId())
|
|
|
.eq(WbsTreePrivate::getIsDeleted, 0);
|
|
|
//判断如果为顶级顶级节点
|
|
|
if (wbsTreePrivate.getTreePId() != 0) {
|
|
@@ -269,7 +268,9 @@ public class WbsSynchronousServiceImpl {
|
|
|
|
|
|
//2、获取当前节点的子节点的数据------------------------------------------------------------------------------------------------------------------------
|
|
|
LambdaQueryWrapper<WbsTreePrivate> wrapperPrivate = Wrappers.lambdaQuery();
|
|
|
- wrapperPrivate.eq(WbsTreePrivate::getWbsId, wbsTreePrivate.getWbsId()).eq(WbsTreePrivate::getIsDeleted, 0);
|
|
|
+ wrapperPrivate
|
|
|
+ .eq(WbsTreePrivate::getWbsId, wbsTreePrivate.getWbsId())
|
|
|
+ .eq(WbsTreePrivate::getIsDeleted, 0);
|
|
|
//判断如果为顶级顶级节点
|
|
|
if (wbsTreePrivate.getTreePId() != 0) {
|
|
|
wrapperPrivate.apply("FIND_IN_SET({0},ancestors_p_id)", wbsTreePrivate.getPKeyId());
|
|
@@ -307,7 +308,7 @@ public class WbsSynchronousServiceImpl {
|
|
|
ExcelTab excelTab = excelTabMapper.selectOne(Wrappers.<ExcelTab>lambdaQuery()
|
|
|
.select(ExcelTab::getTabId)
|
|
|
.eq(ExcelTab::getTabId, templateNode.getExcelId()));
|
|
|
- if(excelTab != null){
|
|
|
+ if (excelTab != null) {
|
|
|
throw new ServerException(templateNode.getNodeName() + " excel未知");
|
|
|
}
|
|
|
if (StringUtil.isBlank(templateNode.getInitTableName())) {
|
|
@@ -331,7 +332,7 @@ public class WbsSynchronousServiceImpl {
|
|
|
TableInfo tableInfo = tableInfoMapper.selectOne(Wrappers.<TableInfo>lambdaQuery()
|
|
|
.select(TableInfo::getId)
|
|
|
.eq(TableInfo::getTabEnName, templateNode.getInitTableName()));
|
|
|
- if(tableInfo != null){
|
|
|
+ if (tableInfo != null) {
|
|
|
throw new ServerException(templateNode.getNodeName() + " 实体表未知");
|
|
|
}
|
|
|
if (templateNode.getExcelId() == null) {
|
|
@@ -478,7 +479,19 @@ public class WbsSynchronousServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
//更新数据的同时统计最小节点数量
|
|
|
- wbsSynchronousEViSaService.updatePrivate(wbsTreeSynchronousRecord,editData);
|
|
|
+ Map<Long, List<WbsTreePrivate>> collect1 = editData.stream().collect(Collectors.groupingBy(WbsTreePrivate::getPId));
|
|
|
+ Set<Long> pIds = collect1.keySet();
|
|
|
+ Integer nodeNumEnd = 0;
|
|
|
+ for (Long pId : pIds) {
|
|
|
+ nodeNumEnd++;
|
|
|
+ //更新最新节点
|
|
|
+ wbsSynchronousEViSaService.updatePrivate(wbsTreeSynchronousRecord.getCreateUserId(), collect1.get(pId));
|
|
|
+
|
|
|
+ synchronousRecordMapper.update(null, Wrappers.<WbsTreeSynchronousRecord>lambdaUpdate()
|
|
|
+ .set(WbsTreeSynchronousRecord::getNodeNumEnd, nodeNumEnd)
|
|
|
+ .set(WbsTreeSynchronousRecord::getUpdateTime, DateTime.now())
|
|
|
+ .eq(WbsTreeSynchronousRecord::getId, wbsTreeSynchronousRecord.getId()));
|
|
|
+ }
|
|
|
synchronousRecordMapper.update(null, Wrappers.<WbsTreeSynchronousRecord>lambdaUpdate()
|
|
|
.set(WbsTreeSynchronousRecord::getStatus, 2)
|
|
|
.set(WbsTreeSynchronousRecord::getErrorMsg, null)
|
|
@@ -743,7 +756,18 @@ public class WbsSynchronousServiceImpl {
|
|
|
|
|
|
|
|
|
//合同段同步同时记录数量
|
|
|
- wbsSynchronousEViSaService.updateContract(wbsTreeSynchronousRecord,editData);
|
|
|
+ Map<Long, List<WbsTreeContract>> collect1 = editData.stream().collect(Collectors.groupingBy(WbsTreeContract::getPId));
|
|
|
+ Set<Long> pIds = collect1.keySet();
|
|
|
+ Integer nodeNumEnd = 0;
|
|
|
+
|
|
|
+ for (Long pId : pIds) {
|
|
|
+ nodeNumEnd++;
|
|
|
+ wbsSynchronousEViSaService.updateContract(wbsTreeSynchronousRecord.getCreateUserId(), collect1.get(pId));
|
|
|
+ synchronousRecordMapper.update(null, Wrappers.<WbsTreeSynchronousRecord>lambdaUpdate()
|
|
|
+ .set(WbsTreeSynchronousRecord::getNodeNumEnd, nodeNumEnd)
|
|
|
+ .set(WbsTreeSynchronousRecord::getUpdateTime, DateTime.now())
|
|
|
+ .eq(WbsTreeSynchronousRecord::getId, wbsTreeSynchronousRecord.getId()));
|
|
|
+ }
|
|
|
|
|
|
synchronousRecordMapper.update(null, Wrappers.<WbsTreeSynchronousRecord>lambdaUpdate()
|
|
|
.set(WbsTreeSynchronousRecord::getStatus, 2)
|
|
@@ -899,7 +923,7 @@ public class WbsSynchronousServiceImpl {
|
|
|
}
|
|
|
|
|
|
//查询出当前模板节点的父节点 去获取对应项目节点 如果父节点为0就跳过
|
|
|
- List<WbsTreeContract> addContractParentNodes = wbsTreeContracts.stream().filter(f -> f.getTreePId().equals(addContractNode.getParentId())).collect(Collectors.toList());
|
|
|
+ List<WbsTreeContract> addContractParentNodes = wbsTreeContracts.stream().filter(f -> Objects.equals(f.getTreePId(), addContractNode.getParentId())).collect(Collectors.toList());
|
|
|
|
|
|
//如果没有数据 就表示这条数据的父节点也时新增节点 就需要从新增节点集合中找父级节点
|
|
|
if (addContractParentNodes.isEmpty()) {
|