添加就餐模式接口

This commit is contained in:
2024-09-25 14:26:40 +08:00
parent 980aad9714
commit a0bd5dccb9

View File

@@ -216,9 +216,6 @@ public class CartService {
return Result.fail("参数缺失");
}
// 校验就餐模式
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(tableId, shopId);
String key = tableId + "-" + shopId;
TbProduct tbProduct = productMapper.selectById(Integer.valueOf(productId));
if (tbProduct == null) {
@@ -270,7 +267,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,isVip, note);
jsonArray.add(cashierCart);
cashierCart.setPlaceNum(cashierCart.getPlaceNum() == null ? 0 : cashierCart.getPlaceNum());
cashierCartArrayList.add(cashierCart);
@@ -315,7 +312,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,isVip, note);
jsonArray.add(cashierCart);
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
}
@@ -323,7 +320,7 @@ 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,isVip, note);
jsonArray.add(cashierCart);
cashierCart.setPlaceNum(cashierCart.getPlaceNum() == null ? 0 : cashierCart.getPlaceNum());
cashierCartArrayList.add(cashierCart);
@@ -487,7 +484,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,Integer isVip, String note) throws Exception{
try {
TbProduct product = productMapper.selectById(Integer.valueOf(productId));
String key = tableId + "-" + shopId;
@@ -553,7 +550,6 @@ public class CartService {
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(productSku.getSalePrice().add(cashierCart.getPackFee())));
}
cashierCart.setPlatformType(PlatformTypeEnum.MINI_APP.getValue());
cashierCart.setUseType(shopEatTypeInfoDTO.getUseType());
mpCashierCartMapper.insert(cashierCart);
//修改耗材数据
@@ -923,10 +919,7 @@ public class CartService {
jsonObject1.put("type", jsonObject.getString("type"));
jsonObject1.put("data", orderInfo);
// 购物车缓存, 后付款订单不删除
if (!OrderUseTypeEnum.DINE_IN_AFTER.getValue().equals(shopEatTypeInfoDTO.getUseType())) {
redisUtil.deleteByKey(RedisCst.TABLE_CART.concat(jsonObject.getString("tableId")).concat("-").concat(shopId));
}
redisUtil.deleteByKey(RedisCst.TABLE_CART.concat(jsonObject.getString("tableId")).concat("-").concat(shopId));
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), key, jsonObject.getString("userId"), true);
JSONObject jsonObject12 = new JSONObject();
jsonObject12.put("status", "success");