交班bug修复
This commit is contained in:
parent
920219f978
commit
3b88f464de
|
|
@ -134,13 +134,13 @@ public class TbMemberPointsServiceImpl extends ServiceImpl<TbMemberPointsMapper,
|
||||||
BigDecimal accountYuan = NumberUtil.div(accountPoints, equivalentPoints);
|
BigDecimal accountYuan = NumberUtil.div(accountPoints, equivalentPoints);
|
||||||
// 下单最高抵扣比例
|
// 下单最高抵扣比例
|
||||||
BigDecimal maxDeductionRatio = basic.getMaxDeductionRatio();
|
BigDecimal maxDeductionRatio = basic.getMaxDeductionRatio();
|
||||||
// 计算订单最多可以抵扣多少元
|
// 计算订单最多可以抵扣多少元,向下取整
|
||||||
BigDecimal orderYuan = NumberUtil.roundDown(NumberUtil.mul(orderAmount, NumberUtil.div(maxDeductionRatio, new BigDecimal("100"))), 2);
|
BigDecimal orderYuan = NumberUtil.roundDown(NumberUtil.mul(orderAmount, NumberUtil.div(maxDeductionRatio, new BigDecimal("100"))), 0);
|
||||||
// 积分余额足够
|
// 积分余额足够
|
||||||
if (NumberUtil.isGreaterOrEqual(accountYuan, orderYuan)) {
|
if (NumberUtil.isGreaterOrEqual(accountYuan, orderYuan)) {
|
||||||
dto.setMaxDeductionAmount(orderYuan);
|
dto.setMaxDeductionAmount(orderYuan);
|
||||||
} else {
|
} else {
|
||||||
dto.setMaxDeductionAmount(NumberUtil.roundDown(accountYuan, 2));
|
dto.setMaxDeductionAmount(NumberUtil.roundDown(accountYuan, 0));
|
||||||
}
|
}
|
||||||
if (NumberUtil.isLess(dto.getMaxDeductionAmount(), BigDecimal.ONE)) {
|
if (NumberUtil.isLess(dto.getMaxDeductionAmount(), BigDecimal.ONE)) {
|
||||||
dto.setUnusableReason("积分不足1元,无法进行抵扣");
|
dto.setUnusableReason("积分不足1元,无法进行抵扣");
|
||||||
|
|
@ -185,7 +185,7 @@ public class TbMemberPointsServiceImpl extends ServiceImpl<TbMemberPointsMapper,
|
||||||
throw new BadRequestException(StrUtil.format("使用积分不能超过最大使用限制{}", core.getMaxUsablePoints()));
|
throw new BadRequestException(StrUtil.format("使用积分不能超过最大使用限制{}", core.getMaxUsablePoints()));
|
||||||
}
|
}
|
||||||
BigDecimal money = NumberUtil.mul(points, NumberUtil.div(BigDecimal.ONE, core.getEquivalentPoints()));
|
BigDecimal money = NumberUtil.mul(points, NumberUtil.div(BigDecimal.ONE, core.getEquivalentPoints()));
|
||||||
BigDecimal maxDeductionAmount = NumberUtil.roundDown(money, 2);
|
BigDecimal maxDeductionAmount = NumberUtil.roundDown(money, 0);
|
||||||
if (NumberUtil.isGreater(maxDeductionAmount, core.getMaxDeductionAmount())) {
|
if (NumberUtil.isGreater(maxDeductionAmount, core.getMaxDeductionAmount())) {
|
||||||
return core.getMaxDeductionAmount();
|
return core.getMaxDeductionAmount();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue