餐位费设置
This commit is contained in:
@@ -641,8 +641,7 @@ public class CartService {
|
|||||||
.gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime())
|
.gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime())
|
||||||
.eq(TbCashierCart::getStatus, "create");
|
.eq(TbCashierCart::getStatus, "create");
|
||||||
|
|
||||||
Integer seatNum = 0;
|
|
||||||
BigDecimal seatCost = BigDecimal.ZERO;
|
|
||||||
|
|
||||||
TbShopTable shopTable = null;
|
TbShopTable shopTable = null;
|
||||||
// 外带模式
|
// 外带模式
|
||||||
@@ -690,6 +689,8 @@ public class CartService {
|
|||||||
|
|
||||||
|
|
||||||
boolean hasNewInfo = false;
|
boolean hasNewInfo = false;
|
||||||
|
Integer seatNum = 0;
|
||||||
|
BigDecimal seatCost = BigDecimal.ZERO;
|
||||||
//校验 库存 耗材
|
//校验 库存 耗材
|
||||||
for (TbCashierCart cart : cashierCartList) {
|
for (TbCashierCart cart : cashierCartList) {
|
||||||
// 设置用餐类型
|
// 设置用餐类型
|
||||||
@@ -769,6 +770,8 @@ public class CartService {
|
|||||||
}else {
|
}else {
|
||||||
tbProduct = null;
|
tbProduct = null;
|
||||||
saleAmount = saleAmount.add(shopEatTypeInfoDTO.getShopInfo().getTableFee());
|
saleAmount = saleAmount.add(shopEatTypeInfoDTO.getShopInfo().getTableFee());
|
||||||
|
seatNum = cart.getNumber();
|
||||||
|
seatCost = cart.getTotalAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
totalAmount = totalAmount.add(cart.getTotalAmount());
|
totalAmount = totalAmount.add(cart.getTotalAmount());
|
||||||
@@ -886,35 +889,21 @@ public class CartService {
|
|||||||
|
|
||||||
// 设置餐位费
|
// 设置餐位费
|
||||||
TbShopInfo shopInfo = mpShopInfoMapper.selectById(shopId);
|
TbShopInfo shopInfo = mpShopInfoMapper.selectById(shopId);
|
||||||
TbCashierCart seatCart = null;
|
|
||||||
if (!shopEatTypeInfoDTO.isTakeout() && shopInfo.getIsTableFee() != null && shopInfo.getIsTableFee() == 0
|
if (!shopEatTypeInfoDTO.isTakeout() && shopInfo.getIsTableFee() != null && shopInfo.getIsTableFee() == 0
|
||||||
&& (orderInfo != null && orderInfo.getSeatCount() == null)) {
|
&& seatNum < 1) {
|
||||||
seatNum = jsonObject.getInteger("dinersNum");
|
log.info("消息推送");
|
||||||
if (seatNum == null) {
|
JSONObject jsonObject1 = new JSONObject();
|
||||||
MsgException.throwException("dinersNum不能为空");
|
jsonObject1.put("msg", "请选择就餐人数");
|
||||||
}
|
|
||||||
if (shopTable.getMaxCapacity() < seatNum) {
|
if (shopTable.getMaxCapacity() < seatNum) {
|
||||||
throw new MsgException("当前台桌最大人数为: " + shopTable.getMaxCapacity());
|
jsonObject1.put("msg", "当前台桌最大人数为: " + shopTable.getMaxCapacity());
|
||||||
}
|
}
|
||||||
seatCost = shopInfo.getTableFee().multiply(BigDecimal.valueOf(seatNum));
|
jsonObject1.put("status", "fail");
|
||||||
|
jsonObject1.put("type", jsonObject.getString("type"));
|
||||||
ChoseCountDTO choseCountDTO = new ChoseCountDTO();
|
jsonObject1.put("data", "");
|
||||||
choseCountDTO.setTableId(tableId);
|
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), tableCartKey, jsonObject.getString("userId"), true);
|
||||||
choseCountDTO.setShopId(Integer.valueOf(shopId));
|
return;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
totalAmount = totalAmount.add(seatCost);
|
|
||||||
if (orderInfo != null) {
|
if (orderInfo != null) {
|
||||||
log.info("订单状态:" + orderInfo.getStatus());
|
log.info("订单状态:" + orderInfo.getStatus());
|
||||||
if (!"unpaid".equals(orderInfo.getStatus())) {
|
if (!"unpaid".equals(orderInfo.getStatus())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user