|
@@ -75,7 +75,9 @@ public class WbsSynchronousServiceImpl {
|
|
|
//同步信息
|
|
|
@Autowired
|
|
|
private WbsTreeSynchronousRecordMapper synchronousRecordMapper;
|
|
|
-
|
|
|
+ //公式
|
|
|
+ @Autowired
|
|
|
+ private ElementFormulaMappingServiceImpl elementFormulaMappingService;
|
|
|
|
|
|
@Async("taskExecutor1")
|
|
|
public void syncExecute(WbsTreeSynchronousRecord wbsTreeSynchronousRecord) {
|
|
@@ -480,6 +482,8 @@ public class WbsSynchronousServiceImpl {
|
|
|
case 3:
|
|
|
//公式配置
|
|
|
case 5:
|
|
|
+ editData.addAll(addPrivateNodes);
|
|
|
+ saveFormula(wbsTreeSynchronousRecord,editData);
|
|
|
//排序
|
|
|
case 7:
|
|
|
//元素配置
|
|
@@ -1290,4 +1294,24 @@ public class WbsSynchronousServiceImpl {
|
|
|
}
|
|
|
return collect;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ private void saveFormula(WbsTreeSynchronousRecord wbsTreeSynchronousRecord, List<WbsTreePrivate> list){
|
|
|
+ Map<Long, List<WbsTreePrivate>> collect = list.stream().collect(Collectors.groupingBy(WbsTreePrivate::getParentId));
|
|
|
+ Set<Long> ids = collect.keySet();
|
|
|
+ List<ElementFormulaMapping> elementFormulaMappings = elementFormulaMappingService.list(Wrappers.<ElementFormulaMapping>lambdaQuery()
|
|
|
+ .eq(ElementFormulaMapping::getProjectId, wbsTreeSynchronousRecord.getTemplateId())
|
|
|
+ .in(ElementFormulaMapping::getNodeId, ids));
|
|
|
+ elementFormulaMappings.forEach(f -> f.setProjectId(wbsTreeSynchronousRecord.getProjectId()));
|
|
|
+
|
|
|
+
|
|
|
+ //删除当前节点的公式
|
|
|
+ elementFormulaMappingService.remove(Wrappers.<ElementFormulaMapping>lambdaQuery()
|
|
|
+ .eq(ElementFormulaMapping::getProjectId, wbsTreeSynchronousRecord.getProjectId())
|
|
|
+ .in(ElementFormulaMapping::getNodeId, ids));
|
|
|
+ //复制新增模板节点的公式
|
|
|
+ elementFormulaMappingService.saveBatch(elementFormulaMappings);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|