fix: 转桌不打票

This commit is contained in:
张松
2024-12-16 16:54:28 +08:00
parent 2231792463
commit 0a89b6d67c
2 changed files with 8 additions and 7 deletions

View File

@@ -140,7 +140,7 @@ public class OrderController {
String userId = jsonObject.getString("accountId"); String userId = jsonObject.getString("accountId");
orderVo.setMerchantId(Integer.valueOf(userId)); orderVo.setMerchantId(Integer.valueOf(userId));
orderVo.setUserId(jsonObject.getString("staffId")); orderVo.setUserId(jsonObject.getString("staffId"));
return orderService.createOrder(orderVo, clientType, token, null); return orderService.createOrder(orderVo, clientType, token, null, true);
} }
/** /**

View File

@@ -884,7 +884,7 @@ public class OrderService {
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Result createOrder(OrderVo orderVo, String clientType, String token, Integer oldOrderId) { public Result createOrder(OrderVo orderVo, String clientType, String token, Integer oldOrderId, boolean isPrint) {
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(orderVo.getShopId()); TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(orderVo.getShopId());
if (shopInfo == null) { if (shopInfo == null) {
throw new MsgException("店铺信息不存在"); throw new MsgException("店铺信息不存在");
@@ -1214,12 +1214,12 @@ public class OrderService {
.set(TbShopTable::getStatus, TableStateEnum.USING.getState())); .set(TbShopTable::getStatus, TableStateEnum.USING.getState()));
// 打印票据 // 打印票据
if (!addOrderDetailList.isEmpty()) { if (!addOrderDetailList.isEmpty() && isPrint) {
log.info("待打印菜品信息: {}", addOrderDetailList); log.info("待打印菜品信息: {}", addOrderDetailList);
rabbitMsgUtils.printDishesTicket(orderInfo.getId(), false, addOrderDetailList.toArray(new TbOrderDetail[0])); rabbitMsgUtils.printDishesTicket(orderInfo.getId(), false, addOrderDetailList.toArray(new TbOrderDetail[0]));
} }
if (!removedOrderDetailList.isEmpty()) { if (!removedOrderDetailList.isEmpty() && isPrint) {
log.info("待打印退菜菜品信息: {}", removedOrderDetailList); log.info("待打印退菜菜品信息: {}", removedOrderDetailList);
// 退单票 // 退单票
rabbitMsgUtils.printDishesTicket(orderInfo.getId(), true, removedOrderDetailList.toArray(new TbOrderDetail[0])); rabbitMsgUtils.printDishesTicket(orderInfo.getId(), true, removedOrderDetailList.toArray(new TbOrderDetail[0]));
@@ -1382,7 +1382,7 @@ public class OrderService {
orderVo.setTableId(tableId); orderVo.setTableId(tableId);
JSONObject jsonObject = TokenUtil.parseParamFromToken(token); JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
orderVo.setMerchantId(Integer.valueOf(jsonObject.getString("accountId"))); orderVo.setMerchantId(Integer.valueOf(jsonObject.getString("accountId")));
Result result = createOrder(orderVo, clientType, token, null); Result result = createOrder(orderVo, clientType, token, null, true);
if (!"0".equals(result.getCode())) { if (!"0".equals(result.getCode())) {
return result; return result;
} }
@@ -2503,7 +2503,7 @@ public class OrderService {
JSONObject jsonObject = TokenUtil.parseParamFromToken(token); JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
String userId = jsonObject.getString("accountId"); String userId = jsonObject.getString("accountId");
createOrderDTO.setMerchantId(Integer.valueOf(userId)); createOrderDTO.setMerchantId(Integer.valueOf(userId));
createOrder(createOrderDTO, "pc", token, switchTableDTO.getOrderId()); createOrder(createOrderDTO, "pc", token, switchTableDTO.getOrderId(), false);
} }
if (targetOrderId != null) { if (targetOrderId != null) {
@@ -2515,9 +2515,10 @@ public class OrderService {
JSONObject jsonObject = TokenUtil.parseParamFromToken(token); JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
String userId = jsonObject.getString("accountId"); String userId = jsonObject.getString("accountId");
createOrderDTO.setMerchantId(Integer.valueOf(userId)); createOrderDTO.setMerchantId(Integer.valueOf(userId));
createOrder(createOrderDTO, "pc", token, targetOrderId); createOrder(createOrderDTO, "pc", token, targetOrderId, false);
} }
return true; return true;
} }