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 {
|
||||
cashierCart.resetTotalAmount();
|
||||
}
|
||||
// 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,19 +442,17 @@ 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();
|
||||
memberAmount = memberAmount.add(mPrice.multiply(BigDecimal.valueOf(cashierCart.getTotalNumber())).add(cashierCart.getPackFee()));
|
||||
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();
|
||||
memberAmount = memberAmount.add(mPrice.multiply(BigDecimal.valueOf(cashierCart.getTotalNumber())).add(cashierCart.getPackFee()));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (MsgException e) {
|
||||
@@ -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.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)) {
|
||||
@@ -1019,7 +1011,7 @@ public class CartService {
|
||||
if (eatTypeInfoDTO.isIncrMaterId()) {
|
||||
String key = RedisCst.getMasterIdKey(String.valueOf(createOrderDTO.getShopId()), DateUtils.getDay(), orderInfo.getTableId());
|
||||
stringRedisTemplate.delete(key);
|
||||
}else {
|
||||
} else {
|
||||
addGlobalCode(DateUtils.getDay(), "pc", String.valueOf(createOrderDTO.getShopId()));
|
||||
}
|
||||
}
|
||||
@@ -1075,7 +1067,7 @@ public class CartService {
|
||||
|
||||
for (TbCashierCart cashierCart : fullCashierCarts) {
|
||||
// if (StrUtil.isNotBlank(cashierCart.getMasterId())) {
|
||||
cashierCart.setMasterId(masterId);
|
||||
cashierCart.setMasterId(masterId);
|
||||
// }
|
||||
// 设置打包费
|
||||
if (shopEatTypeInfoDTO.isTakeout() && !TableConstant.CashierCart.ID.equals(cashierCart.getProductId())) {
|
||||
@@ -1172,7 +1164,7 @@ public class CartService {
|
||||
couponVo.setCurrentUseNum(couponVo.getCurrentUseNum() - cashierCart.getNumber());
|
||||
currentUseNum = BigDecimal.valueOf(cashierCart.getNumber());
|
||||
// 优惠券数量小于购物车数量,分割购物车数据
|
||||
}else if (cashierCart.getNumber() > couponVo.getCurrentUseNum()) {
|
||||
} else if (cashierCart.getNumber() > couponVo.getCurrentUseNum()) {
|
||||
currentUseNum = BigDecimal.valueOf(couponVo.getCurrentUseNum());
|
||||
BigDecimal cartNum = BigDecimal.valueOf(cashierCart.getNumber());
|
||||
int balanceNum = cashierCart.getTotalNumber() - couponVo.getCurrentUseNum();
|
||||
@@ -1246,7 +1238,7 @@ public class CartService {
|
||||
tbUserCouponVos = new ArrayList<>();
|
||||
tbUserCouponVos.add(item);
|
||||
couponMap.put(item.getProId().toString(), tbUserCouponVos);
|
||||
}else {
|
||||
} else {
|
||||
tbUserCouponVos.add(item);
|
||||
}
|
||||
});
|
||||
@@ -1303,7 +1295,7 @@ public class CartService {
|
||||
// 设置会员信息及价格
|
||||
if (shopUser.getIsVip() == 0) {
|
||||
tbCashierCart.setIsMember(0);
|
||||
}else {
|
||||
} else {
|
||||
if (!TableConstant.CashierCart.ID.equals(tbCashierCart.getProductId())) {
|
||||
TbProductSkuWithBLOBs sku = productSkuMapper.selectByPrimaryKey(Integer.valueOf(tbCashierCart.getSkuId()));
|
||||
tbCashierCart.setIsMember(sku.getMemberPrice() != null && sku.getMemberPrice().compareTo(BigDecimal.ZERO) > 0 ? 1 : 0);
|
||||
@@ -1366,7 +1358,7 @@ public class CartService {
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getMasterId(String shopId, String tableId ) {
|
||||
private String getMasterId(String shopId, String tableId) {
|
||||
String day = DateUtils.getDay();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
// 当前台桌码
|
||||
@@ -1434,7 +1426,7 @@ public class CartService {
|
||||
List<TbCashierCart> cashierCartList;
|
||||
if (orderDTO.isOnlyChangeCoupon()) {
|
||||
cashierCartList = cashierCartService.selectByOrderId(orderDTO.getShopId(), orderDTO.getOrderId());
|
||||
}else {
|
||||
} else {
|
||||
cashierCartList = cashierCartService.selectByShopEatTypeInfo(shopEatTypeInfoDTO, orderDTO.getUserId());
|
||||
}
|
||||
if (cashierCartList.isEmpty()) {
|
||||
@@ -1486,7 +1478,7 @@ public class CartService {
|
||||
|
||||
// 计算订单满减优惠
|
||||
TbActivateOutRecord outRecord = calcOrderInfoDiscount(orderDTO, orderInfo, couponInfo, Integer.valueOf(tbShopUser.getId()));
|
||||
if (couponInfo != null) {
|
||||
if (couponInfo != null) {
|
||||
if (outRecord != null) {
|
||||
couponInfo.getOutRecordList().add(outRecord);
|
||||
}
|
||||
@@ -1652,7 +1644,7 @@ public class CartService {
|
||||
// .eq(TbCashierCart::getTableId, choseEatModelDTO.getTableId())
|
||||
.and(q -> q.eq(TbCashierCart::getUseType, shopEatTypeInfoDTO.getUseType()).or().isNull(TbCashierCart::getUseType).or().eq(TbCashierCart::getUseType, ""))
|
||||
.eq(TbCashierCart::getStatus, "create");
|
||||
}else {
|
||||
} else {
|
||||
queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, choseEatModelDTO.getShopId())
|
||||
.gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime())
|
||||
|
||||
Reference in New Issue
Block a user