|
@@ -85,17 +85,22 @@ public class WbsSynchronousEViSaServiceImpl {
|
|
|
//排序调整
|
|
|
if (type.contains("7")) {
|
|
|
list.sort(Comparator.comparingInt(WbsTreePrivate::getSort));
|
|
|
+ List<Long> pKeyIds = list.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
|
|
|
//获取节点下的当前表单
|
|
|
List<WbsTreePrivate> resourceData = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery()
|
|
|
.select(WbsTreePrivate::getPKeyId, WbsTreePrivate::getSort)
|
|
|
.eq(WbsTreePrivate::getPId, pId)
|
|
|
.eq(WbsTreePrivate::getIsDeleted, 0)
|
|
|
+ .notIn(WbsTreePrivate::getPKeyId, pKeyIds)
|
|
|
.orderByAsc(WbsTreePrivate::getSort));
|
|
|
- for (int i = 0; i < resourceData.size(); i++) {
|
|
|
- resourceData.get(i).setSort(i + 1);
|
|
|
+ if (CollectionUtil.isNotEmpty(resourceData)) {
|
|
|
+ for (int i = 0; i < resourceData.size(); i++) {
|
|
|
+ resourceData.get(i).setSort(i + 1);
|
|
|
+ }
|
|
|
+ //修改排序为连续排序
|
|
|
+ wbsTreePrivateMapper.updateSortBatchByPKeyId(resourceData);
|
|
|
+
|
|
|
}
|
|
|
- //修改排序为连续排序
|
|
|
- wbsTreePrivateMapper.updateSortBatchByPKeyId(resourceData);
|
|
|
|
|
|
for (WbsTreePrivate wbsTreePrivate : list) {
|
|
|
wbsTreePrivateMapper.updateSortByPId(pId, wbsTreePrivate.getSort());
|
|
@@ -110,21 +115,26 @@ public class WbsSynchronousEViSaServiceImpl {
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void updateContract(String type, Long pId,Long createUserId, List<WbsTreeContract> list) {
|
|
|
+ public void updateContract(String type, Long pId, Long createUserId, List<WbsTreeContract> list) {
|
|
|
//排序调整
|
|
|
if (type.contains("7")) {
|
|
|
list.sort(Comparator.comparingInt(WbsTreeContract::getSort));
|
|
|
+
|
|
|
+ List<Long> pKeyIds = list.stream().map(WbsTreeContract::getPKeyId).collect(Collectors.toList());
|
|
|
//获取节点下的当前表单
|
|
|
List<WbsTreeContract> resourceData = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery()
|
|
|
.select(WbsTreeContract::getPKeyId, WbsTreeContract::getSort)
|
|
|
.eq(WbsTreeContract::getPId, pId)
|
|
|
.eq(WbsTreeContract::getIsDeleted, 0)
|
|
|
+ .notIn(WbsTreeContract::getPKeyId, pKeyIds)
|
|
|
.orderByAsc(WbsTreeContract::getSort));
|
|
|
- for (int i = 0; i < resourceData.size(); i++) {
|
|
|
- resourceData.get(i).setSort(i + 1);
|
|
|
+ if (CollectionUtil.isNotEmpty(resourceData)) {
|
|
|
+ for (int i = 0; i < resourceData.size(); i++) {
|
|
|
+ resourceData.get(i).setSort(i + 1);
|
|
|
+ }
|
|
|
+ //修改排序为连续排序
|
|
|
+ wbsTreeContractMapper.updateSortBatchByPKeyId(resourceData);
|
|
|
}
|
|
|
- //修改排序为连续排序
|
|
|
- wbsTreeContractMapper.updateSortBatchByPKeyId(resourceData);
|
|
|
|
|
|
for (WbsTreeContract wbsTreePrivate : list) {
|
|
|
wbsTreeContractMapper.updateSortByPId(pId, wbsTreePrivate.getSort());
|