|
@@ -101,7 +101,7 @@ public class WbsTreeSynchronousRecordServiceImpl extends ServiceImpl<WbsTreeSync
|
|
|
|
|
|
//获取项目名称
|
|
|
ProjectInfo projectInfo = projectInfoMapper.selectById(mWbsTreeSynchronousRecord.getProjectId());
|
|
|
- if(projectInfo == null){
|
|
|
+ if (projectInfo == null) {
|
|
|
throw new ServiceException("项目不存在");
|
|
|
}
|
|
|
mWbsTreeSynchronousRecord.setId(SnowFlakeUtil.getId());
|
|
@@ -114,7 +114,7 @@ public class WbsTreeSynchronousRecordServiceImpl extends ServiceImpl<WbsTreeSync
|
|
|
}
|
|
|
if (mWbsTreeSynchronousRecord.getRange() == 4) {
|
|
|
mWbsTreeSynchronousRecord.setRangeName("单表强制同步");
|
|
|
- if (StringUtil.isBlank(mWbsTreeSynchronousRecord.getFormIds())){
|
|
|
+ if (StringUtil.isBlank(mWbsTreeSynchronousRecord.getFormIds())) {
|
|
|
throw new ServiceException("请选择表单");
|
|
|
}
|
|
|
}
|
|
@@ -129,6 +129,37 @@ public class WbsTreeSynchronousRecordServiceImpl extends ServiceImpl<WbsTreeSync
|
|
|
return count;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Boolean getNodeStatus(Long id) {
|
|
|
+ WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.selectById(id);
|
|
|
+ if(wbsTreePrivate == null){
|
|
|
+ throw new ServiceException("节点不存在");
|
|
|
+ }
|
|
|
+ //新增之前 判断当前选中节点是否在同步列表中,因为是多节点 所有要查询所有同项目下的同步节点再获取所有子节点 判断当前选中节点是否在这一批次当中
|
|
|
+ List<WbsTreeSynchronousRecord> wbsTreeSynchronousRecords = baseMapper.selectList(new QueryWrapper<WbsTreeSynchronousRecord>().lambda()
|
|
|
+ .select(WbsTreeSynchronousRecord::getNodeId)
|
|
|
+ .eq(WbsTreeSynchronousRecord::getProjectId, wbsTreePrivate.getProjectId())
|
|
|
+ .eq(WbsTreeSynchronousRecord::getIsDeleted, 0)
|
|
|
+ .in(WbsTreeSynchronousRecord::getStatus, 0, 1));
|
|
|
+ List<String> nodeIds = wbsTreeSynchronousRecords.stream().map(WbsTreeSynchronousRecord::getNodeId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //所有子节点集合
|
|
|
+ List<Long> privateIds = new ArrayList<>();
|
|
|
+ //通过 ancestors_p_id 查询所有 非表单子节点
|
|
|
+ for (String nodeId : nodeIds) {
|
|
|
+ String[] split = nodeId.split(",");
|
|
|
+ for (String s : split) {
|
|
|
+ List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateMapper.selectList(new QueryWrapper<WbsTreePrivate>().lambda()
|
|
|
+ .select(WbsTreePrivate::getPKeyId)
|
|
|
+ .eq(WbsTreePrivate::getIsDeleted, 0)
|
|
|
+ .apply("find_in_set({0},ancestors_p_id)", s)
|
|
|
+ );
|
|
|
+ privateIds.add(Long.valueOf(s));
|
|
|
+ privateIds.addAll(wbsTreePrivates.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return privateIds.contains(id);
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public List<WbsTreeSynchronousRecordVo> getProjectTemplate(String nodeIds) {
|
|
@@ -184,7 +215,7 @@ public class WbsTreeSynchronousRecordServiceImpl extends ServiceImpl<WbsTreeSync
|
|
|
* 同步节点表单
|
|
|
* 定时检查同步任务,状态为1的数据如果最后更新时间与当前时间超过10分钟,则修改状态为1
|
|
|
*/
|
|
|
-// @Scheduled(fixedDelay = 10000)
|
|
|
+ @Scheduled(fixedDelay = 10000)
|
|
|
public void syncInit() {
|
|
|
List<WbsTreeSynchronousRecord> wbsTreeSynchronousRecords = baseMapper.selectList(new QueryWrapper<WbsTreeSynchronousRecord>().lambda()
|
|
|
.in(WbsTreeSynchronousRecord::getStatus, 0, 1)
|