满减活动金额字段
This commit is contained in:
parent
0c34fd0959
commit
6ca8e1c9b8
|
|
@ -1,265 +0,0 @@
|
|||
|
||||
package com.czg.account.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import java.io.Serial;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 订单表 实体类。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-02-24
|
||||
*/
|
||||
@Data
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderInfoDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private BigInteger id;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
pc 收银机客户端 PC+雪花ID
|
||||
wechat 微信小程序 WX+雪花ID
|
||||
alipay 支付宝小程序 ALI+雪花ID
|
||||
admin-pc PC管理端 WEB+雪花ID
|
||||
admin-app APP管理端 APP+雪花ID
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 店铺Id
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 用户Id user_info表的id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 退单金额
|
||||
*/
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
/**
|
||||
* 订单原金额 不含折扣价格
|
||||
*/
|
||||
private BigDecimal originAmount;
|
||||
|
||||
/**
|
||||
* 抹零金额
|
||||
*/
|
||||
private BigDecimal roundAmount;
|
||||
|
||||
/**
|
||||
* 订单金额 (扣除各类折扣)
|
||||
*/
|
||||
private BigDecimal orderAmount;
|
||||
|
||||
/**
|
||||
* 实际支付金额
|
||||
*/
|
||||
private BigDecimal payAmount;
|
||||
|
||||
/**
|
||||
* 积分抵扣金额
|
||||
*/
|
||||
private BigDecimal pointsDiscountAmount;
|
||||
|
||||
/**
|
||||
* 使用的积分数量
|
||||
*/
|
||||
private Integer pointsNum;
|
||||
|
||||
/**
|
||||
* 商品优惠券抵扣金额
|
||||
*/
|
||||
private BigDecimal productCouponDiscountAmount;
|
||||
|
||||
/**
|
||||
* 用户使用的卡券 券id集合
|
||||
*/
|
||||
private String couponInfoList;
|
||||
|
||||
/**
|
||||
* 满减优惠券抵扣金额
|
||||
*/
|
||||
private BigDecimal fullCouponDiscountAmount;
|
||||
/**
|
||||
* 其它优惠券抵扣金额
|
||||
*/
|
||||
private BigDecimal otherCouponDiscountAmount;
|
||||
|
||||
/**
|
||||
* 手动优惠金额
|
||||
*/
|
||||
private BigDecimal discountAmount;
|
||||
|
||||
/**
|
||||
* 折扣比例 多次下单的用,分割
|
||||
*/
|
||||
private String discountRatio;
|
||||
|
||||
/**
|
||||
* 打包费
|
||||
*/
|
||||
private BigDecimal packFee;
|
||||
|
||||
/**
|
||||
* 台桌编号
|
||||
*/
|
||||
private String tableCode;
|
||||
|
||||
/**
|
||||
* 台桌名称
|
||||
*/
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 订单类型-
|
||||
cash收银(除小程序以外 都属于收银)
|
||||
miniapp小程序
|
||||
*/
|
||||
private String orderType;
|
||||
|
||||
/**
|
||||
* 平台类型
|
||||
微信小程序 WX
|
||||
支付宝小程序 ALI
|
||||
收银机客户端 PC
|
||||
PC管理端 APC
|
||||
APP管理端 APP
|
||||
*/
|
||||
private String platformType;
|
||||
|
||||
/**
|
||||
* 用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
|
||||
*/
|
||||
private String dineMode;
|
||||
|
||||
/**
|
||||
* 支付模式:
|
||||
后付费 after-pay
|
||||
先付费 before-pay
|
||||
无桌码 no-table
|
||||
*/
|
||||
private String payMode;
|
||||
|
||||
/**
|
||||
* 支付类型
|
||||
主扫 main-scan
|
||||
被扫 back-scan
|
||||
微信小程序 wechat-mini
|
||||
支付宝小程序 alipay-mini
|
||||
会员支付 vip-pay
|
||||
现金支付 cash-pay
|
||||
*/
|
||||
private String payType;
|
||||
|
||||
/**
|
||||
* 状态: unpaid-待支付;in-production 制作中;wait-out 待取餐;;done-订单完成;refunding-申请退单;refund-退单;part-refund 部分退单;cancelled-取消订单
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 折扣信息 json
|
||||
*/
|
||||
private String discountInfo;
|
||||
|
||||
/**
|
||||
* 是否支持退款,1支持退单, 0不支持退单
|
||||
*/
|
||||
private Integer refundAble;
|
||||
|
||||
/**
|
||||
* 支付时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime paidTime;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 支付订单号
|
||||
tb_order_payment.id tb_shop_user_flow.id
|
||||
|
||||
*/
|
||||
private Long payOrderId;
|
||||
|
||||
/**
|
||||
* 交易日期
|
||||
*/
|
||||
private String tradeDay;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 取餐码
|
||||
*/
|
||||
private String takeCode;
|
||||
|
||||
/**
|
||||
* 员工id
|
||||
*/
|
||||
private Long staffId;
|
||||
|
||||
/**
|
||||
* 当前订单下单次数
|
||||
*/
|
||||
private Integer placeNum;
|
||||
|
||||
/**
|
||||
* 用餐人数
|
||||
*/
|
||||
private Integer seatNum;
|
||||
|
||||
/**
|
||||
* 餐位费
|
||||
*/
|
||||
private BigDecimal seatAmount;
|
||||
|
||||
/**
|
||||
* 退款备注
|
||||
*/
|
||||
private String refundRemark;
|
||||
|
||||
/**
|
||||
* 是否使用了霸王餐
|
||||
*/
|
||||
private Integer isFreeDine;
|
||||
|
||||
/**
|
||||
* 是否等叫 0 否 1 等叫
|
||||
*/
|
||||
private Integer isWaitCall;
|
||||
|
||||
/**
|
||||
* 挂账人id
|
||||
*/
|
||||
private Long creditBuyerId;
|
||||
|
||||
/**
|
||||
* 是否回收站 0-否,1回收站
|
||||
*/
|
||||
private Integer isDel;
|
||||
|
||||
}
|
||||
|
|
@ -15,6 +15,8 @@ import com.czg.market.entity.MkDiscountActivity;
|
|||
public interface MkDiscountActivityService extends IService<MkDiscountActivity> {
|
||||
Page<MkDiscountActivityDTO> getActivityPage(TimeQueryParam param, Long shopId);
|
||||
|
||||
MkDiscountActivityDTO checkDiscountAct(Long shopId, boolean couponShare, boolean vipShare, boolean pointsShare);
|
||||
|
||||
MkDiscountActivityDTO getActivityByShopId(Long shopId);
|
||||
|
||||
void addActivity(MkDiscountActivityDTO param);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -48,10 +47,6 @@ public class CheckOrderPay implements Serializable {
|
|||
*/
|
||||
private BigDecimal originAmount;
|
||||
|
||||
/**
|
||||
* 折扣比例(计算时 向上取整保留 两位小数)
|
||||
*/
|
||||
// private BigDecimal discountRatio;
|
||||
/**
|
||||
* 手动优惠金额
|
||||
*/
|
||||
|
|
@ -66,6 +61,10 @@ public class CheckOrderPay implements Serializable {
|
|||
* 商品优惠券抵扣金额
|
||||
*/
|
||||
private BigDecimal productCouponDiscountAmount;
|
||||
/**
|
||||
* 满减活动抵扣金额
|
||||
*/
|
||||
private BigDecimal discountActAmount;
|
||||
/**
|
||||
* 其它优惠券抵扣金额
|
||||
*/
|
||||
|
|
@ -113,12 +112,6 @@ public class CheckOrderPay implements Serializable {
|
|||
return pointsNum == null ? 0 : pointsNum;
|
||||
}
|
||||
|
||||
// public BigDecimal getDiscountRatio() {
|
||||
// if (discountRatio == null) {
|
||||
// return BigDecimal.ZERO;
|
||||
// }
|
||||
// return discountRatio.setScale(2, RoundingMode.UP);
|
||||
// }
|
||||
/**
|
||||
* 新客立减金额
|
||||
*/
|
||||
|
|
@ -126,6 +119,13 @@ public class CheckOrderPay implements Serializable {
|
|||
return newCustomerDiscountAmount == null ? BigDecimal.ZERO : newCustomerDiscountAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 满减活动抵扣金额
|
||||
*/
|
||||
public BigDecimal getDiscountActAmount() {
|
||||
return discountActAmount == null ? BigDecimal.ZERO : discountActAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getOtherCouponDiscountAmount() {
|
||||
return otherCouponDiscountAmount == null ? BigDecimal.ZERO : otherCouponDiscountAmount;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,9 +95,9 @@ public class OrderInfoDTO implements Serializable {
|
|||
private String couponInfoList;
|
||||
|
||||
/**
|
||||
* 满减优惠券抵扣金额
|
||||
* 满减活动抵扣金额
|
||||
*/
|
||||
private BigDecimal fullCouponDiscountAmount;
|
||||
private BigDecimal discountActAmount;
|
||||
|
||||
/**
|
||||
* 折扣金额
|
||||
|
|
|
|||
|
|
@ -104,9 +104,9 @@ public class OrderInfo implements Serializable {
|
|||
private String couponInfoList;
|
||||
|
||||
/**
|
||||
* 满减优惠券抵扣金额
|
||||
* 满减活动抵扣金额
|
||||
*/
|
||||
private BigDecimal fullCouponDiscountAmount;
|
||||
private BigDecimal discountActAmount;
|
||||
/**
|
||||
* 其它优惠券抵扣金额
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -48,12 +48,27 @@ public class MkDiscountActivityServiceImpl extends ServiceImpl<MkDiscountActivit
|
|||
Page<MkDiscountActivityDTO> page = pageAs(PageUtil.buildPage(), queryWrapper, MkDiscountActivityDTO.class);
|
||||
page.getRecords().forEach(
|
||||
item -> item.setThresholds(thresholdMapper.selectListByQuery(
|
||||
new QueryWrapper().eq(MkDiscountThreshold::getActivityId, item.getId())
|
||||
new QueryWrapper()
|
||||
.eq(MkDiscountThreshold::getActivityId, item.getId())
|
||||
.orderBy(MkDiscountThreshold::getFullAmount, true)
|
||||
))
|
||||
);
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MkDiscountActivityDTO checkDiscountAct(Long shopId, boolean couponShare, boolean vipShare, boolean pointsShare) {
|
||||
MkDiscountActivityDTO activityDTO = getActivityByShopId(shopId);
|
||||
AssertUtil.isNull(activityDTO, "店铺未配置满减活动");
|
||||
//检查是否开启了优惠券抵扣
|
||||
AssertUtil.isNotEqual(activityDTO.getCouponShare() == 1, couponShare, "满减活动与优惠券不可共用");
|
||||
//检查是否开启了会员抵扣
|
||||
AssertUtil.isNotEqual(activityDTO.getVipPriceShare() == 1, vipShare, "满减活动与会员价不可共用");
|
||||
//检查是否开启了积分抵扣
|
||||
AssertUtil.isNotEqual(activityDTO.getPointsShare() == 1, pointsShare, "满减活动与积分抵扣不可共用");
|
||||
return activityDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MkDiscountActivityDTO getActivityByShopId(Long shopId) {
|
||||
ShopInfo shopInfo = shopInfoService.getById(shopId);
|
||||
|
|
@ -67,7 +82,9 @@ public class MkDiscountActivityServiceImpl extends ServiceImpl<MkDiscountActivit
|
|||
}
|
||||
MkDiscountActivityDTO activityDTO = BeanUtil.toBean(activity, MkDiscountActivityDTO.class);
|
||||
activityDTO.setThresholds(thresholdMapper.selectListByQuery(
|
||||
new QueryWrapper().eq(MkDiscountThreshold::getActivityId, activity.getId())
|
||||
new QueryWrapper()
|
||||
.eq(MkDiscountThreshold::getActivityId, activity.getId())
|
||||
.orderBy(MkDiscountThreshold::getFullAmount, false)
|
||||
));
|
||||
return activityDTO;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.czg.service.order.dto;
|
||||
|
||||
import com.czg.order.dto.CheckOrderPay;
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -19,6 +18,7 @@ public class OrderPayParamDTO {
|
|||
// @NotNull(message = "店铺不能为空")
|
||||
private Long shopId;
|
||||
private Long shopUserId;
|
||||
//挂账人
|
||||
private Long creditBuyerId;
|
||||
private String buyerRemark;
|
||||
private String returnUrl;
|
||||
|
|
@ -26,9 +26,12 @@ public class OrderPayParamDTO {
|
|||
private String openId;
|
||||
private String authCode;
|
||||
private String pwd;
|
||||
|
||||
//充值id
|
||||
private Long rechargeId;
|
||||
//充值配置详情id
|
||||
private Long rechargeDetailId;
|
||||
//满减活动id
|
||||
private Long discountActId;
|
||||
private BigDecimal amount;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,14 +22,21 @@ import com.czg.enums.ShopUserFlowBizEnum;
|
|||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.exception.OrderCancelException;
|
||||
import com.czg.market.entity.MemberOrder;
|
||||
import com.czg.market.dto.MkDiscountActivityDTO;
|
||||
import com.czg.market.entity.MkDiscountThreshold;
|
||||
import com.czg.market.entity.MkShopCouponRecord;
|
||||
import com.czg.market.entity.ShopCoupon;
|
||||
import com.czg.market.service.*;
|
||||
import com.czg.order.dto.*;
|
||||
import com.czg.order.entity.*;
|
||||
import com.czg.order.entity.CashierCart;
|
||||
import com.czg.order.entity.OrderDetail;
|
||||
import com.czg.order.entity.OrderInfo;
|
||||
import com.czg.order.entity.OrderPayment;
|
||||
import com.czg.order.enums.PayEnums;
|
||||
import com.czg.order.service.*;
|
||||
import com.czg.order.service.CashierCartService;
|
||||
import com.czg.order.service.OrderDetailService;
|
||||
import com.czg.order.service.OrderInfoService;
|
||||
import com.czg.order.service.OrderPaymentService;
|
||||
import com.czg.order.vo.*;
|
||||
import com.czg.product.entity.Product;
|
||||
import com.czg.product.service.ProductRpcService;
|
||||
|
|
@ -123,6 +130,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
@Resource
|
||||
private MemberOrderService memberOrderService;
|
||||
@Resource
|
||||
private MkDiscountActivityService discountActService;
|
||||
@Resource
|
||||
private MkShopRechargeService shopRechargeService;
|
||||
// 延迟 5 秒
|
||||
private static final long DELAY = 5;
|
||||
|
|
@ -325,6 +334,9 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
log.info("订单信息:{},优惠信息:{}", JSONObject.toJSONString(orderInfo), JSONObject.toJSONString(param));
|
||||
Long shopId = orderInfo.getShopId();
|
||||
AssertUtil.isNull(shopId, "生成支付订单失败,订单信息异常");
|
||||
//检查满减活动是否开启
|
||||
MkDiscountActivityDTO discountAct = discountActService.checkDiscountAct(orderInfo.getShopId(),
|
||||
CollUtil.isNotEmpty(param.getCouponList()), param.isVipPrice(), param.getPointsDiscountAmount().compareTo(BigDecimal.ZERO) > 0);
|
||||
orderInfo.setSeatNum(param.getSeatNum());
|
||||
if (shopInfo.getIsTableFee() != 1 && shopInfo.getTableFee().compareTo(BigDecimal.ZERO) != 0) {
|
||||
orderInfo.setSeatAmount(new BigDecimal(param.getSeatNum()).multiply(shopInfo.getTableFee()));
|
||||
|
|
@ -482,16 +494,20 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
}
|
||||
//优惠券金额结束 (商品金额+打包费+餐位费)
|
||||
newTotalAmount = newTotalAmount.add(packAmount.getPrice()).add(orderInfo.getSeatAmount());
|
||||
|
||||
//新客立减
|
||||
if (shopUser != null) {
|
||||
newTotalAmount = newTotalAmount.subtract(param.getNewCustomerDiscountAmount());
|
||||
} else {
|
||||
param.setNewCustomerDiscountAmount(BigDecimal.ZERO);
|
||||
}
|
||||
//折扣金额
|
||||
if (param.getDiscountAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
newTotalAmount = newTotalAmount.subtract(param.getDiscountAmount());
|
||||
//满减活动
|
||||
BigDecimal discountActAmount = calculateDiscountActAmount(discountAct, newTotalAmount);
|
||||
if (discountActAmount.compareTo(param.getDiscountActAmount()) != 0) {
|
||||
log.info("满减活动金额不正确:传递为:{},计算为:{}", param.getDiscountActAmount(), discountActAmount);
|
||||
throw new ValidateException("生成支付订单失败,满减活动金额不正确");
|
||||
}
|
||||
newTotalAmount = newTotalAmount.subtract(discountActAmount);
|
||||
//积分抵扣 金额范围校验 抵扣金额校验
|
||||
if (param.getPointsNum() > 0) {
|
||||
if (pointSetting.getMinPaymentAmount().compareTo(newTotalAmount) > 0) {
|
||||
|
|
@ -506,6 +522,10 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
}
|
||||
}
|
||||
newTotalAmount = newTotalAmount.subtract(param.getPointsDiscountAmount());
|
||||
//商家最终改价
|
||||
if (param.getDiscountAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
newTotalAmount = newTotalAmount.subtract(param.getDiscountAmount());
|
||||
}
|
||||
//抹零
|
||||
newTotalAmount = newTotalAmount.subtract(param.getRoundAmount());
|
||||
if (newTotalAmount.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
|
|
@ -614,7 +634,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
}
|
||||
|
||||
/**
|
||||
* 使用时段校验
|
||||
* 使用优惠券时段校验
|
||||
*/
|
||||
private void isUseTime(ShopCoupon coupon) {
|
||||
if (!coupon.getUseDays().contains(CzgStrUtils.getStrWeek())) {
|
||||
|
|
@ -747,6 +767,21 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 满减活动 校验门槛获取减免金额
|
||||
*/
|
||||
private BigDecimal calculateDiscountActAmount(MkDiscountActivityDTO discountAct, BigDecimal originalPrice) {
|
||||
if (discountAct == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
for (MkDiscountThreshold threshold : discountAct.getThresholds()) {
|
||||
if (originalPrice.compareTo(threshold.getFullAmount()) >= 0) {
|
||||
return threshold.getDiscountAmount();
|
||||
}
|
||||
}
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getOrderAmount(List<OrderDetail> orderDetails, BigDecimalDTO totalAmount, BigDecimalDTO packAmount,
|
||||
BigDecimalDTO tempAmount, boolean isAllPack, Integer userAllPack, boolean isVipPrice) {
|
||||
|
|
@ -875,7 +910,6 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
bizEnum = ShopUserFlowBizEnum.CASH_IN;
|
||||
}
|
||||
if (isFree) {
|
||||
bizEnum = ShopUserFlowBizEnum.CASH_IN;
|
||||
updateChain().eq(OrderInfo::getId, payment.getRelatedId())
|
||||
.set(OrderInfo::getStatus, OrderStatusEnums.DONE.getCode())
|
||||
.set(OrderInfo::getIsFreeDine, 1)
|
||||
|
|
@ -883,7 +917,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
.update();
|
||||
} else {
|
||||
shopRechargeService.recharge(payment.getShopId(), payment.getSourceId(), payment.getRelatedId(),
|
||||
BigDecimal.valueOf(czgCallBackDto.getAmount()).divide(BigDecimal.valueOf(100)), payment.getId(), payment.getPayType(), bizEnum);
|
||||
BigDecimal.valueOf(czgCallBackDto.getAmount()).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN), payment.getId(), payment.getPayType(), bizEnum);
|
||||
//充值并支付 ↓
|
||||
OrderInfo orderInfo = getOne(new QueryWrapper()
|
||||
.eq(OrderInfo::getPayOrderId, payment.getId())
|
||||
|
|
@ -904,7 +938,9 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
|
||||
// 发放成长值
|
||||
// 会员消费赠送成长值
|
||||
memberConfigService.deliver(orderInfo.getShopId(), orderInfo.getUserId(), TableValueConstant.MemberExpFlow.Type.RECHARGE, BigDecimal.valueOf(czgCallBackDto.getAmount()).divide(BigDecimal.valueOf(100)), null, orderInfo.getId());
|
||||
memberConfigService.deliver(orderInfo.getShopId(), orderInfo.getUserId(),
|
||||
TableValueConstant.MemberExpFlow.Type.RECHARGE,
|
||||
BigDecimal.valueOf(czgCallBackDto.getAmount()).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN), null, orderInfo.getId());
|
||||
if (TransactionSynchronizationManager.isSynchronizationActive()) {
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||
@Override
|
||||
|
|
@ -1209,12 +1245,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
orderInfo.setCouponInfoList(CollUtil.isEmpty(param.getCouponList()) ? "" : JSONObject.toJSONString(param.getCouponList()));
|
||||
//折扣信息
|
||||
orderInfo.setDiscountInfo(buildDiscountInfo(orderInfo));
|
||||
//最终折扣
|
||||
if (param.getOrderAmount().compareTo(BigDecimal.ZERO) != 0) {
|
||||
orderInfo.setDiscountRatio(orderInfo.getOrderAmount().divide(orderInfo.getOriginAmount(), 2, RoundingMode.UP));
|
||||
} else {
|
||||
orderInfo.setDiscountRatio(BigDecimal.ZERO);
|
||||
}
|
||||
//满减活动抵扣金额
|
||||
orderInfo.setDiscountActAmount(param.getDiscountActAmount());
|
||||
//0元按照现金支付处理
|
||||
if (orderInfo.getOrderAmount().compareTo(BigDecimal.ZERO) == 0) {
|
||||
orderInfo.setStatus(OrderStatusEnums.DONE.getCode());
|
||||
|
|
@ -1268,8 +1300,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
if (orderInfo.getDiscountAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
jsonObject.put("打折优惠", orderInfo.getDiscountAmount());
|
||||
}
|
||||
if (orderInfo.getFullCouponDiscountAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
jsonObject.put("满减券抵扣", orderInfo.getFullCouponDiscountAmount());
|
||||
if (orderInfo.getDiscountActAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
jsonObject.put("满减活动抵扣", orderInfo.getDiscountActAmount());
|
||||
}
|
||||
if (orderInfo.getOtherCouponDiscountAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
jsonObject.put("其它优惠券折扣", orderInfo.getOtherCouponDiscountAmount());
|
||||
|
|
|
|||
Loading…
Reference in New Issue