feat: 增加会员价
This commit is contained in:
parent
b583d01312
commit
de3b435637
|
|
@ -165,8 +165,21 @@ public class TbCashierCart implements Serializable {
|
|||
private String platformType;
|
||||
// 优惠券id
|
||||
private Integer userCouponId;
|
||||
private BigDecimal memberPrice;
|
||||
private Integer isMember;
|
||||
|
||||
public void copy(TbCashierCart source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据是否会员充值价格
|
||||
*/
|
||||
public void resetTotalAmount() {
|
||||
if (isMember != null && isMember == 1) {
|
||||
totalAmount = BigDecimal.valueOf(totalNumber).multiply(memberPrice).add(packFee);
|
||||
}else {
|
||||
totalAmount = BigDecimal.valueOf(totalNumber).multiply(salePrice).add(packFee);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -550,6 +550,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
tbCashierCart.setCategoryId(product.getCategoryId());
|
||||
tbCashierCart.setNote(addCartDTO.getNote());
|
||||
tbCashierCart.setPlatformType(OrderPlatformTypeEnum.PC.getValue());
|
||||
tbCashierCart.setMemberPrice(productSku.getMemberPrice());
|
||||
cashierCartRepository.save(tbCashierCart);
|
||||
|
||||
} else {
|
||||
|
|
@ -1127,7 +1128,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
// 就餐模式信息
|
||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(createOrderDTO.getShopId(), createOrderDTO.getTableId(), createOrderDTO.getUseType());
|
||||
|
||||
OrderCartInfoDTO cartInfoDTO = getCartForCreateOrder(shopEatTypeInfoDTO, createOrderDTO.getMasterId());
|
||||
OrderCartInfoDTO cartInfoDTO = getCartForCreateOrder(shopEatTypeInfoDTO, createOrderDTO.getMasterId(), shopUser);
|
||||
if (cartInfoDTO.getOrderId() == null) {
|
||||
createOrderDTO.setOrderId(shopEatTypeInfoDTO.isDineInAfter() ?
|
||||
getCurrentOrderId(shopEatTypeInfoDTO) : null);
|
||||
|
|
@ -1306,7 +1307,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
return infoDTO;
|
||||
}
|
||||
|
||||
private OrderCartInfoDTO getCartForCreateOrder(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId) {
|
||||
private OrderCartInfoDTO getCartForCreateOrder(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId, TbShopUser shopUser) {
|
||||
OrderCartInfoDTO cartInfoDTO = new OrderCartInfoDTO();
|
||||
|
||||
List<TbCashierCart> allCashierCarts = mpCashierCartService.selectByShopEatType(shopEatTypeInfoDTO, masterId);
|
||||
|
|
@ -1343,7 +1344,14 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
if (TableConstant.CashierCart.Status.CREATE.equalsVals(tbCashierCart.getStatus())) {
|
||||
cartInfoDTO.setNewAddTotalAmount(cartInfoDTO.getNewAddTotalAmount().add(tbCashierCart.getTotalAmount()));
|
||||
}
|
||||
|
||||
tbCashierCart.resetTotalAmount();
|
||||
if (shopUser != null) {
|
||||
if (shopUser.getIsVip() == 0) {
|
||||
tbCashierCart.setIsMember(0);
|
||||
}else {
|
||||
tbCashierCart.setIsMember(tbCashierCart.getMemberPrice() == null ? 0 : 1);
|
||||
}
|
||||
}
|
||||
cartInfoDTO.setTotalAmount(cartInfoDTO.getTotalAmount().add(tbCashierCart.getTotalAmount()));
|
||||
}
|
||||
cartInfoDTO.setCashierCartIds(cartIdList);
|
||||
|
|
|
|||
Loading…
Reference in New Issue