|
@@ -944,16 +944,32 @@ public class WbsSynchronousServiceImpl {
|
|
|
}
|
|
|
|
|
|
boolean b = saveData.addAll(list);
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
- //单个批次一个事务,只会回滚当前批次数据
|
|
|
- Integer i = wbsTreePrivateMapper.insertBatchSomeColumn(saveData);
|
|
|
- //如果失败 -- - - - - 继续执行 或者把当前节点的p_key_id 记录到某个地方 方便后续处理
|
|
|
- if (i == 0) {
|
|
|
- List<Long> collect1 = addData.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
|
|
|
- //这里可以保存到数据库指定错误日志表
|
|
|
- throw new ServiceException("添加失败:" + StringUtil.join(collect1, ","));
|
|
|
+ //单个批次一个事务,只会回滚当前批次数据
|
|
|
+ Integer i = wbsTreePrivateMapper.insertBatchSomeColumn(saveData);
|
|
|
+ //如果失败 -- - - - - 继续执行 或者把当前节点的p_key_id 记录到某个地方 方便后续处理
|
|
|
+ if (i == 0) {
|
|
|
+ List<Long> collect1 = addData.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
|
|
|
+ //这里可以保存到数据库指定错误日志表
|
|
|
+ throw new ServiceException("添加失败:" + StringUtil.join(collect1, ","));
|
|
|
+ }else{
|
|
|
+ //排序调整-连续排序
|
|
|
+ if (wbsTreeSynchronousRecord.getType().contains("7")) {
|
|
|
+ //获取节点下的当前表单
|
|
|
+ List<WbsTreePrivate> resourceData = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery()
|
|
|
+ .select(WbsTreePrivate::getPKeyId, WbsTreePrivate::getSort)
|
|
|
+ .eq(WbsTreePrivate::getPId, pId)
|
|
|
+ .eq(WbsTreePrivate::getIsDeleted, 0)
|
|
|
+ .orderByAsc(WbsTreePrivate::getSort));
|
|
|
+ if (CollectionUtil.isNotEmpty(resourceData)) {
|
|
|
+ for (int j = 0; j < resourceData.size(); j++) {
|
|
|
+ resourceData.get(j).setSort(j + 1);
|
|
|
+ }
|
|
|
+ //修改排序为连续排序
|
|
|
+ wbsTreePrivateMapper.updateSortBatchByPKeyId(resourceData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1072,16 +1088,35 @@ public class WbsSynchronousServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
boolean b = saveData.addAll(list);
|
|
|
- }
|
|
|
|
|
|
- //单个批次一个事务,只会回滚当前批次数据
|
|
|
- Integer i = wbsTreeContractMapper.insertBatchSomeColumn(saveData);
|
|
|
- //如果失败 -- - - - - 继续执行 或者把当前节点的p_key_id 记录到某个地方 方便后续处理
|
|
|
- if (i == 0) {
|
|
|
- List<Long> collect1 = addData.stream().map(WbsTreeContract::getPKeyId).collect(Collectors.toList());
|
|
|
- //这里可以保存到数据库指定错误日志表
|
|
|
- //这里可以保存到数据库指定错误日志表
|
|
|
- throw new ServiceException("添加失败:" + StringUtil.join(collect1, ","));
|
|
|
+
|
|
|
+ //单个批次一个事务,只会回滚当前批次数据
|
|
|
+ Integer i = wbsTreeContractMapper.insertBatchSomeColumn(saveData);
|
|
|
+ //如果失败 -- - - - - 继续执行 或者把当前节点的p_key_id 记录到某个地方 方便后续处理
|
|
|
+ if (i == 0) {
|
|
|
+ List<Long> collect1 = addData.stream().map(WbsTreeContract::getPKeyId).collect(Collectors.toList());
|
|
|
+ //这里可以保存到数据库指定错误日志表
|
|
|
+ //这里可以保存到数据库指定错误日志表
|
|
|
+ throw new ServiceException("添加失败:" + StringUtil.join(collect1, ","));
|
|
|
+ }else{
|
|
|
+ //排序调整
|
|
|
+ if (wbsTreeSynchronousRecord.getType().contains("7")) {
|
|
|
+ //获取节点下的当前表单
|
|
|
+ List<WbsTreeContract> resourceData = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery()
|
|
|
+ .select(WbsTreeContract::getPKeyId, WbsTreeContract::getSort)
|
|
|
+ .eq(WbsTreeContract::getPId, pId)
|
|
|
+ .eq(WbsTreeContract::getIsDeleted, 0)
|
|
|
+ .orderByAsc(WbsTreeContract::getSort));
|
|
|
+ if (CollectionUtil.isNotEmpty(resourceData)) {
|
|
|
+ for (int j = 0; i < resourceData.size(); j++) {
|
|
|
+ resourceData.get(j).setSort(j + 1);
|
|
|
+ }
|
|
|
+ //修改排序为连续排序
|
|
|
+ wbsTreeContractMapper.updateSortBatchByPKeyId(resourceData);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|