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