票据打印简化
This commit is contained in:
@@ -580,11 +580,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
if (cashierCart.getTableId() != null && removeCartDTO.getTableId() != null) {
|
||||
// 清空购物车 出票
|
||||
long carCount = countCar(Long.valueOf(cashierCart.getTableId()), cashierCart.getShopId(), cashierCart.getMasterId());
|
||||
|
||||
log.info("购物车数量: {}", carCount);
|
||||
if (cashierCart.getOrderId() != null && carCount < 1) {
|
||||
rabbitMsgUtils.printTicket(String.valueOf(cashierCart.getOrderId()));
|
||||
}
|
||||
setRedisTableCartInfo(removeCartDTO.getTableId(), removeCartDTO.getShopId().toString(), Collections.singletonList(cashierCart), false);
|
||||
}
|
||||
|
||||
@@ -1075,12 +1071,14 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
|
||||
List<TbOrderDetail> oldOrderDetailList = orderDetailMapper.selectList(query);
|
||||
ArrayList<Integer> removeOrderDetailIds = new ArrayList<>();
|
||||
ArrayList<TbOrderDetail> removeOrderDetailList = new ArrayList<>();
|
||||
HashMap<String, TbOrderDetail> oldOrderDetailMap = new HashMap<>();
|
||||
oldOrderDetailList.forEach(item -> {
|
||||
if (cartIdList.contains(item.getCartId())) {
|
||||
oldOrderDetailMap.put(item.getOrderId().toString() + item.getCartId(), item);
|
||||
} else {
|
||||
removeOrderDetailIds.add(item.getId());
|
||||
removeOrderDetailList.add(item);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1149,7 +1147,6 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
throw new BadRequestException("请选择用餐人数");
|
||||
}
|
||||
|
||||
|
||||
// 查询订单
|
||||
TbOrderInfo orderInfo = null;
|
||||
if (orderId != null) {
|
||||
@@ -1221,7 +1218,6 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
orderInfoMapper.insert(orderInfo);
|
||||
}
|
||||
|
||||
|
||||
// 添加订单详细数据
|
||||
orderId = orderInfo.getId();
|
||||
for (TbOrderDetail orderDetail : orderDetails) {
|
||||
@@ -1233,12 +1229,18 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
// 删除已经移除购物车的订单 修改并保存数据
|
||||
if (!orderDetails.isEmpty()) {
|
||||
mpOrderDetailService.saveOrUpdateBatch(orderDetails);
|
||||
if (shopEatTypeInfoDTO.isDineInAfter()) {
|
||||
rabbitMsgUtils.printDishesTicket(orderInfo.getId(), false, orderDetails.toArray(new TbOrderDetail[0]));
|
||||
}
|
||||
}
|
||||
if (!removeOrderDetailIds.isEmpty()) {
|
||||
// 退单票
|
||||
orderDetailMapper.deleteBatchIds(removeOrderDetailIds);
|
||||
if (shopEatTypeInfoDTO.isDineInAfter()) {
|
||||
rabbitMsgUtils.printDishesTicket(orderInfo.getId(), true, removeOrderDetailList.toArray(new TbOrderDetail[0]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 更新购物车记录的orderId
|
||||
for (TbCashierCart cashierCart : cashierCarts) {
|
||||
if (!"-999".equals(cashierCart.getProductId())) {
|
||||
@@ -1275,15 +1277,6 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
// 推送耗材信息
|
||||
pushConsMsg(orderInfo, cashierCarts);
|
||||
|
||||
if (createOrderDTO.isPostPay() && isPrint) {
|
||||
Long count = orderInfoMapper.selectCount(new LambdaQueryWrapper<TbOrderInfo>()
|
||||
.eq(TbOrderInfo::getStatus, "unpaid")
|
||||
.eq(TbOrderInfo::getId, orderId));
|
||||
if (count != 0) {
|
||||
rabbitMsgUtils.printTicket(String.valueOf(orderId));
|
||||
}
|
||||
}
|
||||
|
||||
if (!shopEatTypeInfoDTO.isTakeout()) {
|
||||
LambdaUpdateWrapper<TbShopTable> wrapper = new LambdaUpdateWrapper<TbShopTable>()
|
||||
.eq(TbShopTable::getShopId, createOrderDTO.getShopId())
|
||||
@@ -1530,8 +1523,14 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
jsonObject.put("orderId", orderInfo.getId());
|
||||
|
||||
// 打印消息
|
||||
if (!shopEatTypeInfoDTO.isDineInAfter()) {
|
||||
List<TbOrderDetail> detailList = orderDetailMapper.selectList(new LambdaQueryWrapper<TbOrderDetail>()
|
||||
.eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
||||
.eq(TbOrderDetail::getStatus, "closed"));
|
||||
rabbitMsgUtils.printDishesTicket(orderInfo.getId(), false, detailList.toArray(new TbOrderDetail[0]));
|
||||
}
|
||||
rabbitMsgUtils.sendOrderCollectMsg(jsonObject);
|
||||
rabbitMsgUtils.printTicket(String.valueOf(orderInfo.getId()));
|
||||
rabbitMsgUtils.printPlaceTicket(orderInfo.getId(), false);
|
||||
|
||||
// 发送库存记录mq消息
|
||||
JSONObject mqData = new JSONObject();
|
||||
@@ -1814,11 +1813,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
throw new BadRequestException("当前台桌还未下单任何菜品, 请先下单");
|
||||
}
|
||||
|
||||
Integer[] detailIds = new Integer[detailList.size()];
|
||||
for (int i = 0; i < detailList.size(); i++) {
|
||||
detailIds[i] = detailList.get(i).getId();
|
||||
}
|
||||
rabbitMsgUtils.printDishesTicket(currentOrder.getId(), false, detailIds);
|
||||
rabbitMsgUtils.printDishesTicket(currentOrder.getId(), false, detailList.toArray(new TbOrderDetail[0]));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user