|
|
|
@ -504,14 +504,17 @@ public class IotThingSourceServiceImpl extends BaseServiceImpl<IotThingSourceMap |
|
|
|
AtomicLong aLong = new AtomicLong(0); |
|
|
|
List<IotThingSourceEntity> resList = Lists.newArrayList(); |
|
|
|
if(toSourceEntity.getSort()<=sort){ |
|
|
|
sourceOtherEntities.stream().filter(s -> s.getSort() < sort) |
|
|
|
.sorted(Comparator.comparing(IotThingSourceEntity::getSort)) |
|
|
|
List<IotThingSourceEntity> list = sourceOtherEntities.stream().filter(s -> s.getSort() < sort).toList(); |
|
|
|
list.stream().sorted(Comparator.comparing(IotThingSourceEntity::getSort)) |
|
|
|
.forEach(s -> s.setSort(aLong.incrementAndGet())); |
|
|
|
resList.addAll(list); |
|
|
|
sourceEntity.setSort(aLong.incrementAndGet()); |
|
|
|
mapper.update(sourceEntity); |
|
|
|
sourceOtherEntities.stream() |
|
|
|
resList.add(sourceEntity); |
|
|
|
List<IotThingSourceEntity> list1 = sourceOtherEntities.stream().filter(s -> s.getSort() >= sort).toList(); |
|
|
|
list1.stream() |
|
|
|
.sorted(Comparator.comparing(IotThingSourceEntity::getSort)) |
|
|
|
.filter(s -> s.getSort() >= sort).forEach(s -> s.setSort(aLong.incrementAndGet())); |
|
|
|
.forEach(s -> s.setSort(aLong.incrementAndGet())); |
|
|
|
resList.addAll(list1); |
|
|
|
}else{ |
|
|
|
List<IotThingSourceEntity> list = sourceOtherEntities.stream().filter(s -> s.getSort() <= sort).toList(); |
|
|
|
list.stream().sorted(Comparator.comparing(IotThingSourceEntity::getSort)) |
|
|
|
|