|
@@ -80,7 +80,7 @@ public class WbsTreeSynchronousRecordServiceImpl extends ServiceImpl<WbsTreeSync
|
|
|
|
|
|
|
|
|
//记录选中节点下的表单数
|
|
|
- String[] newNodeIds = mWbsTreeSynchronousRecord.getNodeId().split(",");
|
|
|
+ List<String> newNodeIds = Arrays.asList(mWbsTreeSynchronousRecord.getNodeId().split(","));
|
|
|
for (String newNodeId : newNodeIds) {
|
|
|
Long nodeIdLong = Long.valueOf(newNodeId);
|
|
|
if (privateIds.contains(nodeIdLong)) {
|
|
@@ -88,6 +88,28 @@ public class WbsTreeSynchronousRecordServiceImpl extends ServiceImpl<WbsTreeSync
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ List<String> parentIds = new ArrayList<>();
|
|
|
+ //处理父节点包含子节点数据
|
|
|
+ for (String newNodeId : newNodeIds) {
|
|
|
+ WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.selectOne(Wrappers.<WbsTreePrivate>lambdaQuery()
|
|
|
+ .eq(WbsTreePrivate::getPKeyId, newNodeId));
|
|
|
+ //如果是最顶层节点
|
|
|
+ if(wbsTreePrivate.getPId() == 0){
|
|
|
+ //清空所有记录,只保留最顶层节点id
|
|
|
+ parentIds.clear();
|
|
|
+ parentIds.add(newNodeId);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ //如果当前节点的父节点也在列表中,去掉当前节点
|
|
|
+ if(newNodeIds.contains(wbsTreePrivate.getPId().toString())){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ parentIds.add(newNodeId);
|
|
|
+ }
|
|
|
+ if(!privateIds.isEmpty()){
|
|
|
+ mWbsTreeSynchronousRecord.setNodeId(String.join(",", parentIds));
|
|
|
+ }
|
|
|
+
|
|
|
//模板项目信息
|
|
|
ProjectInfo tempProject = projectInfoMapper.selectOne(Wrappers.<ProjectInfo>lambdaQuery()
|
|
|
.eq(ProjectInfo::getId, mWbsTreeSynchronousRecord.getTemplateId()));
|
|
@@ -234,13 +256,14 @@ public class WbsTreeSynchronousRecordServiceImpl extends ServiceImpl<WbsTreeSync
|
|
|
* 同步节点表单
|
|
|
* 定时检查同步任务,状态为1的数据如果最后更新时间与当前时间超过10分钟,则修改状态为1
|
|
|
*/
|
|
|
- @Scheduled(fixedDelay = 10000)
|
|
|
+ @Scheduled(fixedDelay = 100000000)
|
|
|
public void syncInit() {
|
|
|
// 本地环境跳过执行(可添加日志输出)
|
|
|
- if (!schedulerEnabled) return;
|
|
|
+// if (!schedulerEnabled) return;
|
|
|
|
|
|
List<WbsTreeSynchronousRecord> wbsTreeSynchronousRecords = baseMapper.selectList(new QueryWrapper<WbsTreeSynchronousRecord>().lambda()
|
|
|
- .in(WbsTreeSynchronousRecord::getStatus, 0, 1)
|
|
|
+ .eq(WbsTreeSynchronousRecord::getId, 1962703967901188096L)
|
|
|
+ .in(WbsTreeSynchronousRecord::getStatus, 2)
|
|
|
.eq(WbsTreeSynchronousRecord::getIsDeleted, 0)
|
|
|
.orderByAsc(WbsTreeSynchronousRecord::getCreateTime)
|
|
|
.last("limit 10")
|