Compare commits

7 Commits

Author SHA1 Message Date
b48a6fbe0c 新单子的 超时时间 2026-03-27 15:58:21 +08:00
3fcd6fc3fd 订单为空 2026-03-27 15:31:39 +08:00
d6e27e81be 订单列表 2026-03-27 14:13:18 +08:00
c886f82812 转桌问题3 2026-03-27 10:34:46 +08:00
1534c537d5 转桌问题 2026-03-27 10:22:50 +08:00
4a4b2a88cc 转桌问题 2026-03-27 10:19:06 +08:00
56eed8f3d4 空单 2026-03-27 09:48:15 +08:00
2 changed files with 57 additions and 28 deletions

View File

@@ -68,6 +68,10 @@ public class OrderInfoVo implements Serializable {
* 台桌名称
*/
private String tableName;
/**
* 台桌编号
*/
private String tableCode;
/**
* 取餐码
*/

View File

@@ -549,6 +549,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
}
@Override
@Transactional
public CzgResult<Object> mergeOrder(MergeOrderDTO param) {
if (param.getTargetOrderId() == null && StrUtil.isBlank(param.getTargetTableCode())) {
throw new CzgException("转台失败,请选择目标台桌后转台");
@@ -560,11 +561,21 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
if (sourceOrder == null || !sourceOrder.getStatus().equals(OrderStatusEnums.UNPAID.getCode())) {
throw new CzgException("转台失败,无可转订单");
}
String sourceTableCode = sourceOrder.getTableCode();
OrderInfo targetOrder = orderInfoService.getOne(QueryWrapper.create().eq(OrderInfo::getId, param.getTargetOrderId())
.eq(OrderInfo::getTableCode, param.getTargetTableCode())
.eq(OrderInfo::getStatus, OrderStatusEnums.UNPAID.getCode()));
if (targetOrder == null) {
ShopTable shopTable = shopTableService.getOneByTableCode(sourceOrder.getShopId(), param.getTargetTableCode());
sourceOrder.setTableCode(shopTable.getTableCode());
sourceOrder.setTableName(shopTable.getName());
if(param.getAllMerge()==1){
OrderInfo upOrder = new OrderInfo();
upOrder.setTableCode(shopTable.getTableCode());
upOrder.setTableName(shopTable.getName());
orderInfoService.update(upOrder, new QueryWrapper().eq(OrderInfo::getId, sourceOrder.getId()));
targetOrder=sourceOrder;
}else {
OrderInfoAddDTO addDTO = new OrderInfoAddDTO();
addDTO.setShopId(sourceOrder.getShopId());
addDTO.setStaffId(sourceOrder.getStaffId());
@@ -578,14 +589,20 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
addDTO.setVipPrice(false);
ShopInfo shopInfo = shopInfoService.getById(sourceOrder.getShopId());
targetOrder = initOrderInfo(addDTO, shopInfo, shopTable);
OrderDetail orderDetailUp = new OrderDetail();
orderDetailUp.setOrderId(targetOrder.getId());
orderDetailUp.setPlaceNum(1);
orderDetailService.update(orderDetailUp,
new QueryWrapper().eq(OrderDetail::getOrderId, sourceOrder.getId()).in(OrderDetail::getId, param.getDetailIds()));
redisService.set(RedisCst.classKeyExpired.EXPIRED_ORDER + targetOrder.getId(), "", 60 * 15);
}
} else {
targetOrder.setPlaceNum(targetOrder.getPlaceNum() + 1);
//下单次数+1
OrderInfo updateTargetOrder = new OrderInfo();
updateTargetOrder.setId(targetOrder.getId());
updateTargetOrder.setPlaceNum(targetOrder.getPlaceNum() + 1);
orderInfoService.updateById(updateTargetOrder);
}
orderInfoService.update(updateTargetOrder, new QueryWrapper().eq(OrderInfo::getId, targetOrder.getId()));
OrderDetail orderDetailUp = new OrderDetail();
orderDetailUp.setOrderId(targetOrder.getId());
orderDetailUp.setPlaceNum(targetOrder.getPlaceNum());
@@ -600,7 +617,11 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
new QueryWrapper().eq(OrderDetail::getOrderId, sourceOrder.getId()).in(OrderDetail::getId, param.getDetailIds()));
}
if(param.getAllMerge()==1){
shopTableService.updateStatus(sourceOrder.getShopId(), null, sourceOrder.getTableCode(), ShopTableStatusEnum.IDLE.getValue());
orderInfoService.remove(new QueryWrapper().eq(OrderInfo::getId, sourceOrder.getId()));
}
}
if(param.getAllMerge()==1){
shopTableService.updateStatus(sourceOrder.getShopId(), null, sourceTableCode, ShopTableStatusEnum.IDLE.getValue());
}
shopTableService.updateStatus(sourceOrder.getShopId(), null, targetOrder.getTableCode(), ShopTableStatusEnum.UNSETTLED.getValue());
return CzgResult.success();
@@ -1330,6 +1351,10 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
@Transactional
public void expired(Long orderId) {
OrderInfo orderInfo = orderInfoService.getById(orderId);
if(orderInfo == null){
log.info("订单取消失败,订单Id:{} 为空", orderId);
return;
}
if (orderInfo.getStatus().equals(OrderStatusEnums.UNPAID.getCode())) {
orderInfoService.updateById(new OrderInfo().setId(orderId).setStatus(OrderStatusEnums.CANCELLED.getCode()));
if (StrUtil.isNotBlank(orderInfo.getTableCode())) {