|
@@ -51,13 +51,20 @@ public class WbsSynchronousEViSaServiceImpl {
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void updateSyncPrivateForm(WbsTreePrivate wbsTreePrivate, List<Long> collect, Long id,String errorMsg) {
|
|
|
+ public void updateSyncPrivateForm(WbsTreePrivate wbsTreePrivate, List<WbsTreePrivate> collect, Long id,String errorMsg) {
|
|
|
+ List<Long> ids = collect.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
|
|
|
+ List<Long> parentIds = collect.stream().map(WbsTreePrivate::getParentId).collect(Collectors.toList());
|
|
|
+ //节点公式同步
|
|
|
+ for (Long parentId : parentIds) {
|
|
|
+ saveFormula(Long.valueOf(wbsTreePrivate.getProjectId()), wbsTreePrivate.getParentId(), parentId);
|
|
|
+ }
|
|
|
+
|
|
|
wbsTreePrivateMapper.update(null, Wrappers.<WbsTreePrivate>lambdaUpdate()
|
|
|
.set(WbsTreePrivate::getHtmlUrl, wbsTreePrivate.getHtmlUrl())
|
|
|
.set(wbsTreePrivate.getExcelId()!=null,WbsTreePrivate::getIsLinkTable, 2)
|
|
|
.set(WbsTreePrivate::getExcelId, wbsTreePrivate.getExcelId())
|
|
|
.set(WbsTreePrivate::getInitTableId, wbsTreePrivate.getInitTableId())
|
|
|
- .in(WbsTreePrivate::getPKeyId, collect)
|
|
|
+ .in(WbsTreePrivate::getPKeyId, ids)
|
|
|
);
|
|
|
synchronousRecordMapper.update(null, Wrappers.<WbsTreeSynchronousRecord>lambdaUpdate()
|
|
|
.set(WbsTreeSynchronousRecord::getStatus, 2)
|
|
@@ -216,4 +223,36 @@ public class WbsSynchronousEViSaServiceImpl {
|
|
|
elementFormulaMappingService.saveBatch(elementFormulaMappings);
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 同项目下不同节点 不同的节点公式
|
|
|
+ * @param projectId 项目id
|
|
|
+ * @param tempParentId 源节点父级id
|
|
|
+ * @param parentId 节点父级id
|
|
|
+ */
|
|
|
+ public void saveFormula(Long projectId, Long tempParentId, Long parentId) {
|
|
|
+
|
|
|
+ List<ElementFormulaMapping> tempElementFormulaMappings = elementFormulaMappingService.list(Wrappers.<ElementFormulaMapping>lambdaQuery()
|
|
|
+ .eq(ElementFormulaMapping::getProjectId, projectId)
|
|
|
+ .in(ElementFormulaMapping::getNodeId, tempParentId));
|
|
|
+ List<ElementFormulaMapping> elementFormulaMappings = elementFormulaMappingService.list(Wrappers.<ElementFormulaMapping>lambdaQuery()
|
|
|
+ .eq(ElementFormulaMapping::getProjectId, projectId)
|
|
|
+ .in(ElementFormulaMapping::getNodeId, parentId));
|
|
|
+ List<Long> collect = elementFormulaMappings.stream().map(ElementFormulaMapping::getElementId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //当前节点不存在的元素公式
|
|
|
+ List<ElementFormulaMapping> collect1 = tempElementFormulaMappings.stream().filter(f -> !collect.contains(f.getElementId())).collect(Collectors.toList());
|
|
|
+
|
|
|
+
|
|
|
+ collect1.forEach(f -> {
|
|
|
+ f.setId(SnowFlakeUtil.getId());
|
|
|
+ f.setProjectId(projectId);
|
|
|
+ f.setNodeId(parentId);
|
|
|
+ f.setCreateTime(DateTime.now());
|
|
|
+ });
|
|
|
+
|
|
|
+ //复制新增模板节点的公式
|
|
|
+ elementFormulaMappingService.saveBatch(collect1);
|
|
|
+
|
|
|
+ }
|
|
|
}
|