diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/CartService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/CartService.java index a966548..51b3997 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/CartService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/CartService.java @@ -641,8 +641,7 @@ public class CartService { .gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime()) .eq(TbCashierCart::getStatus, "create"); - Integer seatNum = 0; - BigDecimal seatCost = BigDecimal.ZERO; + TbShopTable shopTable = null; // 外带模式 @@ -690,6 +689,8 @@ public class CartService { boolean hasNewInfo = false; + Integer seatNum = 0; + BigDecimal seatCost = BigDecimal.ZERO; //校验 库存 耗材 for (TbCashierCart cart : cashierCartList) { // 设置用餐类型 @@ -769,6 +770,8 @@ public class CartService { }else { tbProduct = null; saleAmount = saleAmount.add(shopEatTypeInfoDTO.getShopInfo().getTableFee()); + seatNum = cart.getNumber(); + seatCost = cart.getTotalAmount(); } totalAmount = totalAmount.add(cart.getTotalAmount()); @@ -886,35 +889,21 @@ public class CartService { // 设置餐位费 TbShopInfo shopInfo = mpShopInfoMapper.selectById(shopId); - TbCashierCart seatCart = null; if (!shopEatTypeInfoDTO.isTakeout() && shopInfo.getIsTableFee() != null && shopInfo.getIsTableFee() == 0 - && (orderInfo != null && orderInfo.getSeatCount() == null)) { - seatNum = jsonObject.getInteger("dinersNum"); - if (seatNum == null) { - MsgException.throwException("dinersNum不能为空"); - } + && seatNum < 1) { + log.info("消息推送"); + JSONObject jsonObject1 = new JSONObject(); + jsonObject1.put("msg", "请选择就餐人数"); if (shopTable.getMaxCapacity() < seatNum) { - throw new MsgException("当前台桌最大人数为: " + shopTable.getMaxCapacity()); + jsonObject1.put("msg", "当前台桌最大人数为: " + shopTable.getMaxCapacity()); } - seatCost = shopInfo.getTableFee().multiply(BigDecimal.valueOf(seatNum)); - - ChoseCountDTO choseCountDTO = new ChoseCountDTO(); - choseCountDTO.setTableId(tableId); - choseCountDTO.setShopId(Integer.valueOf(shopId)); - choseCountDTO.setNum(seatNum); - choseCountDTO.setUserId(userId); - seatCart = productService.choseCount(choseCountDTO); - TbOrderDetail orderDetail = new TbOrderDetail(); - orderDetail.setCartId(seatCart.getId()); - orderDetail.setPrice(seatCart.getTotalAmount()); - orderDetail.setProductId(Integer.valueOf(seatCart.getProductId())); - orderDetail.setProductSkuId(Integer.valueOf(seatCart.getProductId())); - orderDetail.setUseType(seatCart.getUseType()); - orderDetail.setPrice(shopInfo.getTableFee()); - orderDetails.add(orderDetail); + jsonObject1.put("status", "fail"); + jsonObject1.put("type", jsonObject.getString("type")); + jsonObject1.put("data", ""); + PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), tableCartKey, jsonObject.getString("userId"), true); + return; } - totalAmount = totalAmount.add(seatCost); if (orderInfo != null) { log.info("订单状态:" + orderInfo.getStatus()); if (!"unpaid".equals(orderInfo.getStatus())) {