领取优惠券操作
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbSplitAccounts;
|
||||
|
||||
public interface TbSplitAccountsMapper {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(TbSplitAccounts record);
|
||||
|
||||
int insertSelective(TbSplitAccounts record);
|
||||
|
||||
TbSplitAccounts selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByPrimaryKeySelective(TbSplitAccounts record);
|
||||
|
||||
int updateByPrimaryKey(TbSplitAccounts record);
|
||||
}
|
||||
@@ -96,6 +96,7 @@ public class TbOrderInfo implements Serializable {
|
||||
private String tableName;
|
||||
private String masterId;
|
||||
private String isBuyCoupon;
|
||||
private String isUseCoupon;
|
||||
private Integer totalNumber;
|
||||
private List<TbOrderDetail> detailList;
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class TbSplitAccounts implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
private Integer merchantId;
|
||||
|
||||
private Integer shopId;
|
||||
|
||||
private BigDecimal couponsPrice;
|
||||
|
||||
private BigDecimal conponsAmount;
|
||||
private BigDecimal originAmount;
|
||||
|
||||
private String isSplit;
|
||||
|
||||
private BigDecimal orderAmount;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date splitTime;
|
||||
|
||||
private String tradeDay;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@@ -213,7 +213,7 @@ public class CartService {
|
||||
BigDecimal packAMount = BigDecimal.ZERO;
|
||||
BigDecimal originAmount = BigDecimal.ZERO;
|
||||
BigDecimal saleAmount = BigDecimal.ZERO;
|
||||
String couponId = jsonObject.getString("couponsId");
|
||||
String couponId = "";
|
||||
BigDecimal couponAmount = BigDecimal.ZERO;
|
||||
Map<Integer, TbProductSku> skuMap = new HashMap<>();
|
||||
List<TbOrderDetail> orderDetails = new ArrayList<>();
|
||||
@@ -270,7 +270,9 @@ public class CartService {
|
||||
//生成订单
|
||||
TbOrderInfo orderInfo = orderInfoMapper.selectByPrimaryKey(orderId);
|
||||
String isBuyYhq = "false";
|
||||
String isuseYhq = "false";
|
||||
if (jsonObject.containsKey("isYhq") && jsonObject.getString("isYhq").equals("1")) {
|
||||
couponId =jsonObject.getString("couponsId");
|
||||
//1:购买优惠券,0:自己持有优惠券
|
||||
Integer couponsId = jsonObject.getInteger("couponsId");
|
||||
if (jsonObject.getString("isBuyYhq").equals("1")) {
|
||||
@@ -342,7 +344,7 @@ public class CartService {
|
||||
userCouponsMapper.updateByPrimaryKeySelective(userCoupons);
|
||||
couponAmount = userCoupons.getCouponsAmount();
|
||||
}
|
||||
|
||||
isuseYhq = "true";
|
||||
|
||||
}
|
||||
if (Objects.nonNull(orderInfo)) {
|
||||
@@ -370,6 +372,7 @@ public class CartService {
|
||||
orderInfo.setFreightAmount(BigDecimal.ZERO);
|
||||
orderInfo.setProductAmount(saleAmount);
|
||||
orderInfo.setIsBuyCoupon(isBuyYhq);
|
||||
orderInfo.setIsUseCoupon(isuseYhq);
|
||||
orderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
||||
} else {
|
||||
orderInfo = getOrder(totalAmount, packAMount, shopTable, tbMerchantAccount.getId().toString(), jsonObject, originAmount);
|
||||
@@ -377,6 +380,7 @@ public class CartService {
|
||||
orderInfo.setUserCouponId(couponId);
|
||||
orderInfo.setOriginAmount(originAmount);
|
||||
orderInfo.setIsBuyCoupon(isBuyYhq);
|
||||
orderInfo.setIsUseCoupon(isuseYhq);
|
||||
orderInfo.setUserCouponAmount(couponAmount);
|
||||
orderInfoMapper.insert(orderInfo);
|
||||
orderId = orderInfo.getId();
|
||||
|
||||
Reference in New Issue
Block a user