创建订单保存sendType
This commit is contained in:
@@ -592,6 +592,7 @@ public class CartService {
|
|||||||
String shopId = jsonObject.getString("shopId");
|
String shopId = jsonObject.getString("shopId");
|
||||||
String tableId = jsonObject.getString("tableId");
|
String tableId = jsonObject.getString("tableId");
|
||||||
String userId = jsonObject.getString("userId");
|
String userId = jsonObject.getString("userId");
|
||||||
|
String sendType = jsonObject.getString("sendType");
|
||||||
String remark = StringUtils.isBlank(jsonObject.getString("remark"))?"":jsonObject.getString("remark");
|
String remark = StringUtils.isBlank(jsonObject.getString("remark"))?"":jsonObject.getString("remark");
|
||||||
String tableCartKey = RedisCst.getTableCartKey(shopId, tableId, Integer.valueOf(userId));
|
String tableCartKey = RedisCst.getTableCartKey(shopId, tableId, Integer.valueOf(userId));
|
||||||
JSONArray array = JSON.parseArray(redisUtil.getMessage(tableCartKey));
|
JSONArray array = JSON.parseArray(redisUtil.getMessage(tableCartKey));
|
||||||
@@ -613,6 +614,10 @@ public class CartService {
|
|||||||
MsgException.throwException("生成订单失败");
|
MsgException.throwException("生成订单失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StrUtil.isBlank(sendType)) {
|
||||||
|
MsgException.throwException("用餐类型不为空");
|
||||||
|
}
|
||||||
|
|
||||||
// 获取当前下单次数和用餐类型
|
// 获取当前下单次数和用餐类型
|
||||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(tableId, shopId);
|
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(tableId, shopId);
|
||||||
Integer currentPlaceNum = getCurrentPlaceNum(tableId, shopId, shopEatTypeInfoDTO);
|
Integer currentPlaceNum = getCurrentPlaceNum(tableId, shopId, shopEatTypeInfoDTO);
|
||||||
@@ -633,8 +638,7 @@ public class CartService {
|
|||||||
queryWrapper.eq(TbCashierCart::getUserId, userId);
|
queryWrapper.eq(TbCashierCart::getUserId, userId);
|
||||||
// 台桌点单
|
// 台桌点单
|
||||||
} else {
|
} else {
|
||||||
queryWrapper.eq(TbCashierCart::getTableId, tableId)
|
queryWrapper.eq(TbCashierCart::getTableId, tableId);
|
||||||
.and(q -> q.eq(TbCashierCart::getUseType, shopEatTypeInfoDTO.getUseType()).or().isNull(TbCashierCart::getUseType));
|
|
||||||
|
|
||||||
shopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>()
|
shopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>()
|
||||||
.eq(TbShopTable::getQrcode, tableId));
|
.eq(TbShopTable::getQrcode, tableId));
|
||||||
@@ -739,10 +743,8 @@ public class CartService {
|
|||||||
}else {
|
}else {
|
||||||
tbProduct = null;
|
tbProduct = null;
|
||||||
saleAmount = saleAmount.add(shopEatTypeInfoDTO.getShopInfo().getTableFee());
|
saleAmount = saleAmount.add(shopEatTypeInfoDTO.getShopInfo().getTableFee());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
totalAmount = totalAmount.add(cart.getTotalAmount());
|
totalAmount = totalAmount.add(cart.getTotalAmount());
|
||||||
packAMount = packAMount.add(cart.getPackFee());
|
packAMount = packAMount.add(cart.getPackFee());
|
||||||
originAmount = originAmount.add(cart.getTotalAmount());
|
originAmount = originAmount.add(cart.getTotalAmount());
|
||||||
@@ -858,6 +860,7 @@ 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)) {
|
&& (orderInfo != null && orderInfo.getSeatCount() == null)) {
|
||||||
seatNum = jsonObject.getInteger("dinersNum");
|
seatNum = jsonObject.getInteger("dinersNum");
|
||||||
@@ -874,8 +877,18 @@ public class CartService {
|
|||||||
choseCountDTO.setShopId(Integer.valueOf(shopId));
|
choseCountDTO.setShopId(Integer.valueOf(shopId));
|
||||||
choseCountDTO.setNum(seatNum);
|
choseCountDTO.setNum(seatNum);
|
||||||
choseCountDTO.setUserId(userId);
|
choseCountDTO.setUserId(userId);
|
||||||
productService.choseCount(choseCountDTO);
|
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())) {
|
||||||
@@ -908,6 +921,7 @@ public class CartService {
|
|||||||
orderInfo.setUseType(shopEatTypeInfoDTO.getUseType());
|
orderInfo.setUseType(shopEatTypeInfoDTO.getUseType());
|
||||||
orderInfo.setSeatCount(seatNum);
|
orderInfo.setSeatCount(seatNum);
|
||||||
orderInfo.setSeatAmount(seatCost);
|
orderInfo.setSeatAmount(seatCost);
|
||||||
|
orderInfo.setSendType(sendType);
|
||||||
mpOrderInfoMapper.updateById(orderInfo);
|
mpOrderInfoMapper.updateById(orderInfo);
|
||||||
} else {
|
} else {
|
||||||
orderInfo = getOrder(totalAmount, packAMount, shopTable, tbMerchantAccount.getId().toString(), jsonObject, originAmount);
|
orderInfo = getOrder(totalAmount, packAMount, shopTable, tbMerchantAccount.getId().toString(), jsonObject, originAmount);
|
||||||
@@ -941,6 +955,7 @@ public class CartService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
orderInfo.setOutNumber(number + "");
|
orderInfo.setOutNumber(number + "");
|
||||||
|
orderInfo.setSendType(sendType);
|
||||||
redisUtil.saveMessage(RedisCst.OUT_NUMBER.concat(jsonObject.getString("shopId")), object.toString());
|
redisUtil.saveMessage(RedisCst.OUT_NUMBER.concat(jsonObject.getString("shopId")), object.toString());
|
||||||
mpOrderInfoMapper.insert(orderInfo);
|
mpOrderInfoMapper.insert(orderInfo);
|
||||||
orderId = orderInfo.getId();
|
orderId = orderInfo.getId();
|
||||||
|
|||||||
@@ -872,7 +872,7 @@ public class ProductService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object choseCount(ChoseCountDTO choseCountDTO) {
|
public TbCashierCart choseCount(ChoseCountDTO choseCountDTO) {
|
||||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(choseCountDTO.getTableId(), choseCountDTO.getShopId());
|
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(choseCountDTO.getTableId(), choseCountDTO.getShopId());
|
||||||
|
|
||||||
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(choseCountDTO.getShopId());
|
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(choseCountDTO.getShopId());
|
||||||
|
|||||||
Reference in New Issue
Block a user