参加消费赠券
新客立减 50%
This commit is contained in:
@@ -23,10 +23,7 @@ import com.czg.exception.CzgException;
|
||||
import com.czg.exception.OrderCancelException;
|
||||
import com.czg.market.entity.MkShopCouponRecord;
|
||||
import com.czg.market.entity.ShopCoupon;
|
||||
import com.czg.market.service.MemberOrderService;
|
||||
import com.czg.market.service.MkShopCouponRecordService;
|
||||
import com.czg.market.service.ShopCouponService;
|
||||
import com.czg.market.service.TbMemberConfigService;
|
||||
import com.czg.market.service.*;
|
||||
import com.czg.order.dto.*;
|
||||
import com.czg.order.entity.*;
|
||||
import com.czg.order.enums.PayEnums;
|
||||
@@ -107,11 +104,11 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
private ShopUserFlowService flowService;
|
||||
@DubboReference
|
||||
private ShopTableService shopTableService;
|
||||
// @DubboReference
|
||||
// private ShopActivateService activateService;
|
||||
@DubboReference
|
||||
private PointsBasicSettingService pointsBasicService;
|
||||
@DubboReference
|
||||
private MkShopConsumerCouponService consumerCouponService;
|
||||
@DubboReference
|
||||
private ShopCouponService couponService;
|
||||
@DubboReference
|
||||
private MkShopCouponRecordService couponRecordService;
|
||||
@@ -464,6 +461,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
throw new ValidateException("生成支付订单失败,商品优惠券优惠金额不正确");
|
||||
}
|
||||
//TODO 新客立减
|
||||
//新客立减
|
||||
newTotalAmount = newTotalAmount.subtract(param.getNewCustomerDiscountAmount());
|
||||
//折扣金额
|
||||
if (param.getDiscountAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
newTotalAmount = totalAmount.getPrice().subtract(param.getDiscountAmount());
|
||||
@@ -721,7 +720,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
|
||||
@Override
|
||||
public void getOrderAmount(List<OrderDetail> orderDetails, BigDecimalDTO totalAmount, BigDecimalDTO packAmount,
|
||||
BigDecimalDTO tempAmount, boolean isAllPack, Integer userAllPack, boolean isVipPrice) {
|
||||
BigDecimalDTO tempAmount, boolean isAllPack, Integer userAllPack, boolean isVipPrice) {
|
||||
for (OrderDetail orderDetail : orderDetails) {
|
||||
if (orderDetail.getDiscountSaleAmount() != null && orderDetail.getDiscountSaleAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
orderDetail.setUnitPrice(orderDetail.getDiscountSaleAmount());
|
||||
@@ -965,6 +964,10 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
couponService.use(coupons, shopUser.getId(), orderInfo.getId());
|
||||
}
|
||||
}
|
||||
if (!orderInfo.getPayType().equals(PayEnums.CREDIT_PAY.getValue())) {
|
||||
//消费赠券 挂账支付不赠送
|
||||
consumerCouponService.receiveConsumerCoupon(shopUser.getShopId(), orderInfo.getId(), orderInfo.getPayAmount(), shopUser.getUserId(), shopUser.getId());
|
||||
}
|
||||
String[] payTypes = {PayEnums.VIP_PAY.getValue(), PayEnums.CREDIT_PAY.getValue()};
|
||||
if ((orderInfo.getPayType() != null && !ArrayUtil.contains(payTypes, orderInfo.getPayType()))
|
||||
|| (payType != null && !ArrayUtil.contains(payTypes, payType))) {
|
||||
@@ -1115,6 +1118,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
orderInfo.setOrderAmount(param.getOrderAmount());
|
||||
orderInfo.setPointsDiscountAmount(param.getPointsDiscountAmount());
|
||||
orderInfo.setProductCouponDiscountAmount(param.getProductCouponDiscountAmount());
|
||||
//新客立减
|
||||
orderInfo.setNewCustomerDiscountAmount(param.getNewCustomerDiscountAmount());
|
||||
// orderInfo.setFullCouponDiscountAmount(param.getFullCouponDiscountAmount());
|
||||
orderInfo.setOtherCouponDiscountAmount(param.getOtherCouponDiscountAmount());
|
||||
orderInfo.setDiscountAmount(param.getDiscountAmount());
|
||||
@@ -1164,6 +1169,9 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
*/
|
||||
private String buildDiscountInfo(OrderInfo orderInfo) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
if (orderInfo.getNewCustomerDiscountAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
jsonObject.put("新客立减", orderInfo.getNewCustomerDiscountAmount());
|
||||
}
|
||||
if (orderInfo.getProductCouponDiscountAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
jsonObject.put("商品券抵扣", orderInfo.getProductCouponDiscountAmount());
|
||||
}
|
||||
@@ -1173,7 +1181,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
if (orderInfo.getFullCouponDiscountAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
jsonObject.put("满减券抵扣", orderInfo.getFullCouponDiscountAmount());
|
||||
}
|
||||
if(orderInfo.getOtherCouponDiscountAmount().compareTo(BigDecimal.ZERO) > 0){
|
||||
if (orderInfo.getOtherCouponDiscountAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
jsonObject.put("其它优惠券折扣", orderInfo.getOtherCouponDiscountAmount());
|
||||
}
|
||||
if (orderInfo.getPointsDiscountAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
|
||||
Reference in New Issue
Block a user