Merge remote-tracking branch 'origin/master'

This commit is contained in:
张松
2025-02-28 10:51:51 +08:00
10 changed files with 33 additions and 44 deletions

View File

@@ -91,12 +91,12 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
@Override
public Page<ShopActivateCouponRecord> find(Long userId, Long shopId, Integer status) {
Page<Object> page = PageUtil.buildPage();
PageHelper.startPage(Math.toIntExact(page.getPageNumber()),Math.toIntExact(page.getPageSize()));
List<Long> shopUserIds = shopUserService.queryChain()
.eq(ShopUser::getUserId, userId)
.eq(ShopUser::getShopId, shopId)
.select(ShopUser::getId).listAs(Long.class);
if (CollectionUtil.isNotEmpty(shopUserIds)) {
PageHelper.startPage(Math.toIntExact(page.getPageNumber()),Math.toIntExact(page.getPageSize()));
return PageUtil.convert(new PageInfo<>(couponRecordService.findByUser(shopUserIds, status)));
}
return new Page<>();

View File

@@ -282,7 +282,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
if (prodCouponAmount.getPrice().compareTo(param.getProductCouponDiscountAmount()) != 0) {
throw new ValidateException("生成支付订单失败,商品优惠券优惠金额不正确");
}
BigDecimal newTotalAmount = BigDecimal.ZERO;
BigDecimal newTotalAmount;
//折扣金额 如 9折 计算 为 订单金额*0.9 向上取整
if (param.getDiscountRatio().compareTo(BigDecimal.ONE) != 0) {
newTotalAmount = totalAmount.getPrice().multiply(param.getDiscountRatio()).setScale(2, RoundingMode.UP);
@@ -648,7 +648,6 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
*/
private void upOrderPayInfo(OrderInfo orderInfo, CheckOrderPay param) {
orderInfo.setPointsNum(param.getPointsNum());
orderInfo.setOriginAmount(param.getOriginAmount());
orderInfo.setRoundAmount(param.getRoundAmount());
orderInfo.setOrderAmount(param.getOrderAmount());
orderInfo.setPointsDiscountAmount(param.getPointsDiscountAmount());
@@ -660,7 +659,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
//折扣信息
orderInfo.setDiscountInfo(buildDiscountInfo(orderInfo));
//最终折扣
orderInfo.setDiscountRatio(param.getOriginAmount().divide(param.getOrderAmount(), 2, RoundingMode.UP));
orderInfo.setDiscountRatio(orderInfo.getOriginAmount().divide(param.getOrderAmount(), 2, RoundingMode.UP));
saveOrUpdate(orderInfo);
}

View File

@@ -42,17 +42,7 @@
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<exclusions>
<exclusion>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>sqlparser4.5</artifactId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.czg</groupId>