fix: 删除isVip相关代码
This commit is contained in:
@@ -294,7 +294,6 @@ public class CartService {
|
||||
String skuId = jsonObject.getString("skuId");
|
||||
Integer type = jsonObject.getInteger("type");
|
||||
Integer buyNum = jsonObject.getInteger("num");
|
||||
Integer isVip = jsonObject.getInteger("isVip");
|
||||
Integer userId = jsonObject.getInteger("userId");
|
||||
// 商品备注
|
||||
String note = jsonObject.getString("note");
|
||||
@@ -356,7 +355,7 @@ public class CartService {
|
||||
if (Objects.isNull(array) || array.isEmpty()) {
|
||||
if (type == 1) {
|
||||
TbCashierCart cashierCart = addCart(productId, skuId,
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId, isVip, note, shopEatTypeInfoDTO);
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId, note, shopEatTypeInfoDTO);
|
||||
jsonArray.add(cashierCart);
|
||||
cashierCart.setPlaceNum(cashierCart.getPlaceNum() == null ? 0 : cashierCart.getPlaceNum());
|
||||
cashierCartArrayList.add(cashierCart);
|
||||
@@ -375,11 +374,11 @@ public class CartService {
|
||||
TbCashierCart cashierCart = JSONUtil.parseJSONStr2T(object.toJSONString(), TbCashierCart.class);
|
||||
cashierCart.setPlaceNum(cashierCart.getPlaceNum() == null ? 0 : cashierCart.getPlaceNum());
|
||||
|
||||
if (cashierCart.getSkuId().equals(skuId) && (isVip == null || cashierCart.getIsVip().intValue() == isVip)) {
|
||||
if (cashierCart.getSkuId().equals(skuId)) {
|
||||
cashierCart.setTotalNumber(buyNum);
|
||||
cashierCart.setNumber(buyNum);
|
||||
cashierCart.setNote(note);
|
||||
if (tbProductSkuWithBLOBs != null && type == 0 && isVip != null && isVip == 0 && tbProductSkuWithBLOBs.getSuit() != null
|
||||
if (tbProductSkuWithBLOBs != null && type == 0 && tbProductSkuWithBLOBs.getSuit() != null
|
||||
&& tbProductSkuWithBLOBs.getSuit() > 1 && cashierCart.getNumber() < tbProductSkuWithBLOBs.getSuit()) {
|
||||
cashierCartMapper.deleteByPrimaryKey(cashierCart.getId());
|
||||
continue;
|
||||
@@ -403,11 +402,11 @@ public class CartService {
|
||||
product.getPackFee().multiply(BigDecimal.valueOf(buyNum)) : BigDecimal.ZERO);
|
||||
|
||||
}
|
||||
if (isVip != null && isVip == 1) {
|
||||
cashierCart.setTotalAmount(BigDecimal.ZERO);
|
||||
} else {
|
||||
// if (isVip != null && isVip == 1) {
|
||||
// cashierCart.setTotalAmount(BigDecimal.ZERO);
|
||||
// } else {
|
||||
cashierCart.resetTotalAmount();
|
||||
}
|
||||
// }
|
||||
cashierCart.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
mpCashierCartMapper.updateById(cashierCart);
|
||||
} else {
|
||||
@@ -430,7 +429,7 @@ public class CartService {
|
||||
|
||||
if (flag && type == 1) {
|
||||
TbCashierCart cashierCart = addCart(productId, skuId,
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId, isVip, note, shopEatTypeInfoDTO);
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId, note, shopEatTypeInfoDTO);
|
||||
jsonArray.add(cashierCart);
|
||||
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
BigDecimal mPrice = cashierCart.getIsMember() != null && cashierCart.getIsMember() == 1 &&
|
||||
@@ -443,13 +442,12 @@ public class CartService {
|
||||
} else {
|
||||
if (type == 1) {
|
||||
TbCashierCart cashierCart = addCart(productId, skuId,
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId, isVip, note, shopEatTypeInfoDTO);
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId, note, shopEatTypeInfoDTO);
|
||||
if (!TableConstant.CART_SEAT_ID.equals(productId)) {
|
||||
jsonArray.add(cashierCart);
|
||||
}
|
||||
cashierCart.setPlaceNum(cashierCart.getPlaceNum() == null ? 0 : cashierCart.getPlaceNum());
|
||||
cashierCartArrayList.add(cashierCart);
|
||||
if (isVip != 1) {
|
||||
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
BigDecimal mPrice = cashierCart.getIsMember() != null && cashierCart.getIsMember() == 1 &&
|
||||
cashierCart.getMemberPrice() != null && cashierCart.getMemberPrice().compareTo(BigDecimal.ZERO) > 0 ? cashierCart.getMemberPrice() : cashierCart.getSalePrice();
|
||||
@@ -457,7 +455,6 @@ public class CartService {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (MsgException e) {
|
||||
if (e.getMessage().equals("商品起售库存不足")) {
|
||||
return Result.fail("商品起售库存不足");
|
||||
@@ -580,7 +577,7 @@ public class CartService {
|
||||
}
|
||||
|
||||
private TbCashierCart addCart(String productId, String skuId, Integer userId, Integer num,
|
||||
String tableId, String shopId, Integer isVip, String note, ShopEatTypeInfoDTO shopEatTypeInfoDTO) throws Exception {
|
||||
String tableId, String shopId, String note, ShopEatTypeInfoDTO shopEatTypeInfoDTO) throws Exception {
|
||||
try {
|
||||
// 查询用户信息
|
||||
TbShopUser shopUser = shopUserMapper.selectByUserIdAndShopId(String.valueOf(userId), shopId);
|
||||
@@ -592,7 +589,7 @@ public class CartService {
|
||||
String key = tableId + "-" + shopId;
|
||||
TbProductSkuWithBLOBs productSku = productSkuMapper.selectByPrimaryKey(Integer.valueOf(skuId));
|
||||
TbCashierCart cashierCart = new TbCashierCart();
|
||||
if (productSku.getSuit() != null && productSku.getSuit() > 1 && isVip != 1) {
|
||||
if (productSku.getSuit() != null && productSku.getSuit() > 1) {
|
||||
if (product.getIsStock() == 1) {
|
||||
boolean isSale = false;
|
||||
if (num > productSku.getSuit()) {
|
||||
@@ -643,14 +640,8 @@ public class CartService {
|
||||
if (shopEatTypeInfoDTO.isTakeout() && product.getPackFee() != null) {
|
||||
cashierCart.setPackFee(product.getPackFee().multiply(BigDecimal.valueOf(num)));
|
||||
}
|
||||
if (isVip == 1) {
|
||||
cashierCart.setIsVip(Byte.parseByte("1"));
|
||||
cashierCart.setTotalAmount(BigDecimal.ZERO);
|
||||
cashierCart.setSalePrice(BigDecimal.ZERO);
|
||||
} else {
|
||||
cashierCart.setIsVip((byte) 0);
|
||||
cashierCart.resetTotalAmount();
|
||||
}
|
||||
cashierCart.setPlatformType(PlatformTypeEnum.MINI_APP.getValue());
|
||||
mpCashierCartMapper.insert(cashierCart);
|
||||
|
||||
@@ -984,6 +975,7 @@ public class CartService {
|
||||
return tbActivateOutRecord;
|
||||
|
||||
}
|
||||
|
||||
public synchronized void addGlobalCode(String day, String clientType, String shopId) {
|
||||
String code = stringRedisTemplate.opsForValue().get("SHOP:CODE:" + clientType + ":" + shopId + ":" + day);
|
||||
if (StrUtil.isBlank(code)) {
|
||||
|
||||
Reference in New Issue
Block a user