|
|
|
@ -8,6 +8,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
|
|
import cn.jlw.aliPay.utils.StringUtils;
|
|
|
|
|
import com.ibeetl.admin.core.service.CoreBaseService;
|
|
|
|
|
import com.ibeetl.admin.core.util.PlatformException;
|
|
|
|
|
import com.ibeetl.jlw.dao.CourseInfoDao;
|
|
|
|
|
import com.ibeetl.jlw.dao.ResourcesInfoDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.CourseInfo;
|
|
|
|
@ -331,13 +332,15 @@ public class ResourcesInfoService extends CoreBaseService<ResourcesInfo>{
|
|
|
|
|
.limit(1, 1)
|
|
|
|
|
.select(ResourcesInfo::getOrderIndex);
|
|
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(result)) {
|
|
|
|
|
if (CollectionUtil.isEmpty(result)) {
|
|
|
|
|
throw new PlatformException("已处于置顶状态!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ResourcesInfo minOrderClientLink = result.get(0);
|
|
|
|
|
// 最小的排序值
|
|
|
|
|
BigDecimal minLinkOrder = minOrderClientLink.getOrderIndex();
|
|
|
|
|
// 置顶就现有的最小值减1。但是需要确保结果小于0
|
|
|
|
|
calcedOrder = NumberUtil.sub(min(minLinkOrder.floatValue(), 0), 1);
|
|
|
|
|
}
|
|
|
|
|
} break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -349,7 +352,10 @@ public class ResourcesInfoService extends CoreBaseService<ResourcesInfo>{
|
|
|
|
|
.limit(1, 2)
|
|
|
|
|
.select(ResourcesInfo::getOrderIndex);
|
|
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(result)) {
|
|
|
|
|
if (CollectionUtil.isEmpty(result)) {
|
|
|
|
|
throw new PlatformException("已处于置顶状态!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 找到应该安插的位置
|
|
|
|
|
BigDecimal LinkOrder0 = result.get(0).getOrderIndex();
|
|
|
|
|
BigDecimal LinkOrder1 = LinkOrder0.subtract(BigDecimal.ONE);
|
|
|
|
@ -362,7 +368,6 @@ public class ResourcesInfoService extends CoreBaseService<ResourcesInfo>{
|
|
|
|
|
|
|
|
|
|
// 左移位后的值
|
|
|
|
|
calcedOrder = RandomUtil.randomDouble(min.doubleValue(), max.doubleValue(), 6, RoundingMode.HALF_UP);
|
|
|
|
|
}
|
|
|
|
|
} break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -374,7 +379,10 @@ public class ResourcesInfoService extends CoreBaseService<ResourcesInfo>{
|
|
|
|
|
.limit(1, 2)
|
|
|
|
|
.select(ResourcesInfo::getOrderIndex);
|
|
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(result)) {
|
|
|
|
|
if (CollectionUtil.isEmpty(result)) {
|
|
|
|
|
throw new PlatformException("已处于置底状态!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 找到应该安插的位置
|
|
|
|
|
BigDecimal LinkOrder0 = result.get(0).getOrderIndex();
|
|
|
|
|
BigDecimal LinkOrder1 = LinkOrder0.add(BigDecimal.ONE);
|
|
|
|
@ -387,7 +395,6 @@ public class ResourcesInfoService extends CoreBaseService<ResourcesInfo>{
|
|
|
|
|
|
|
|
|
|
// 右移位后的值
|
|
|
|
|
calcedOrder = RandomUtil.randomDouble(min.doubleValue(), max.doubleValue(), 6, RoundingMode.HALF_UP);
|
|
|
|
|
}
|
|
|
|
|
} break;
|
|
|
|
|
default:
|
|
|
|
|
log.error("不支持的移动类型!");
|
|
|
|
|