Compare commits

4 Commits

Author SHA1 Message Date
6079b7f4ec 转桌 台桌名称 2026-03-26 10:53:37 +08:00
82e40dc82a 转桌 全部商品 2026-03-26 10:14:15 +08:00
e8731e1d4d 转桌 台桌状态 2026-03-26 09:53:35 +08:00
ab697be8ef 统计时间 2026-03-26 09:26:57 +08:00
5 changed files with 38 additions and 18 deletions

View File

@@ -37,7 +37,7 @@ public class StatisticTask {
//每天 00点15分 执行 开始统计数据 //每天 00点15分 执行 开始统计数据
@Scheduled(cron = "0 15 0 * * ? ") @Scheduled(cron = "0 0 5 * * ? ")
public void run() { public void run() {
log.info("统计数据,定时任务执行"); log.info("统计数据,定时任务执行");
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();

View File

@@ -33,6 +33,11 @@ public interface ShopTableService extends IService<ShopTable> {
Boolean updateInfo(long shopId, ShopTableDTO shopTableDTO); Boolean updateInfo(long shopId, ShopTableDTO shopTableDTO);
/**
* 更新台桌状态
*/
Boolean updateStatus(long shopId, Long tableId, String tableCode, String status);
Boolean clear(long shopId, ShopTableClearDTO shopTableClearDTO); Boolean clear(long shopId, ShopTableClearDTO shopTableClearDTO);
Boolean expiredTable(long tableId); Boolean expiredTable(long tableId);

View File

@@ -29,4 +29,9 @@ public class MergeOrderDTO implements Serializable {
* 转台详情Id * 转台详情Id
*/ */
private List<Long> detailIds; private List<Long> detailIds;
/**
* 是否全部商品转台 0:否 1:是
*/
private Integer allMerge;
} }

View File

@@ -278,6 +278,13 @@ public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable
return update(shopTable, new QueryWrapper().eq(ShopTable::getShopId, StpKit.USER.getShopId()).eq(ShopTable::getId, shopTableDTO.getId())); return update(shopTable, new QueryWrapper().eq(ShopTable::getShopId, StpKit.USER.getShopId()).eq(ShopTable::getId, shopTableDTO.getId()));
} }
@Override
public Boolean updateStatus(long shopId, Long tableId, String tableCode, String status) {
ShopTable shopTable = new ShopTable();
shopTable.setStatus(status);
return update(shopTable, query().eq(ShopTable::getShopId, shopId).eq(ShopTable::getId, tableId).eq(ShopTable::getTableCode, tableCode));
}
@Override @Override
public Boolean clear(long shopId, ShopTableClearDTO shopTableClearDTO) { public Boolean clear(long shopId, ShopTableClearDTO shopTableClearDTO) {
ShopTable shopTable = getOne(new QueryWrapper().eq(ShopTable::getShopId, shopId).eq(ShopTable::getId, shopTableClearDTO.getId())); ShopTable shopTable = getOne(new QueryWrapper().eq(ShopTable::getShopId, shopId).eq(ShopTable::getId, shopTableClearDTO.getId()));

View File

@@ -553,6 +553,9 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
if (param.getTargetOrderId() == null && StrUtil.isBlank(param.getTargetTableCode())) { if (param.getTargetOrderId() == null && StrUtil.isBlank(param.getTargetTableCode())) {
throw new CzgException("转台失败,请选择目标台桌后转台"); throw new CzgException("转台失败,请选择目标台桌后转台");
} }
if(param.getAllMerge()==null){
param.setAllMerge(0);
}
OrderInfo sourceOrder = orderInfoService.getById(param.getSourceOrderId()); OrderInfo sourceOrder = orderInfoService.getById(param.getSourceOrderId());
if (sourceOrder == null || !sourceOrder.getStatus().equals(OrderStatusEnums.UNPAID.getCode())) { if (sourceOrder == null || !sourceOrder.getStatus().equals(OrderStatusEnums.UNPAID.getCode())) {
throw new CzgException("转台失败,无可转订单"); throw new CzgException("转台失败,无可转订单");
@@ -561,6 +564,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
.eq(OrderInfo::getTableCode, param.getTargetTableCode()) .eq(OrderInfo::getTableCode, param.getTargetTableCode())
.eq(OrderInfo::getStatus, OrderStatusEnums.UNPAID.getCode())); .eq(OrderInfo::getStatus, OrderStatusEnums.UNPAID.getCode()));
if (targetOrder == null) { if (targetOrder == null) {
ShopTable shopTable = shopTableService.getOneByTableCode(sourceOrder.getShopId(), param.getTargetTableCode());
OrderInfoAddDTO addDTO = new OrderInfoAddDTO(); OrderInfoAddDTO addDTO = new OrderInfoAddDTO();
addDTO.setShopId(sourceOrder.getShopId()); addDTO.setShopId(sourceOrder.getShopId());
addDTO.setStaffId(sourceOrder.getStaffId()); addDTO.setStaffId(sourceOrder.getStaffId());
@@ -573,7 +577,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
addDTO.setWaitCall(false); addDTO.setWaitCall(false);
addDTO.setVipPrice(false); addDTO.setVipPrice(false);
ShopInfo shopInfo = shopInfoService.getById(sourceOrder.getShopId()); ShopInfo shopInfo = shopInfoService.getById(sourceOrder.getShopId());
targetOrder = initOrderInfo(addDTO, shopInfo, null); targetOrder = initOrderInfo(addDTO, shopInfo, shopTable);
} else { } else {
targetOrder.setPlaceNum(targetOrder.getPlaceNum() + 1); targetOrder.setPlaceNum(targetOrder.getPlaceNum() + 1);
//下单次数+1 //下单次数+1
@@ -582,24 +586,23 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
updateTargetOrder.setPlaceNum(targetOrder.getPlaceNum() + 1); updateTargetOrder.setPlaceNum(targetOrder.getPlaceNum() + 1);
orderInfoService.updateById(updateTargetOrder); orderInfoService.updateById(updateTargetOrder);
} }
OrderDetail orderDetailUp = new OrderDetail();
orderDetailUp.setOrderId(targetOrder.getId());
orderDetailUp.setPlaceNum(targetOrder.getPlaceNum());
if (CollUtil.isEmpty(param.getDetailIds())) { if (CollUtil.isEmpty(param.getDetailIds())) {
long count = orderDetailService.queryChain().eq(OrderDetail::getOrderId, sourceOrder.getId()).count(); long count = orderDetailService.count(new QueryWrapper().eq(OrderDetail::getOrderId, sourceOrder.getId()));
if (count < 1) { if (count < 1) {
throw new CzgException("转台失败,该订单无可转商品"); throw new CzgException("转台失败,该订单无可转商品");
} }
orderDetailService.updateChain() orderDetailService.update(orderDetailUp,new QueryWrapper().eq(OrderDetail::getOrderId, sourceOrder.getId()));
.eq(OrderDetail::getOrderId, sourceOrder.getId())
.set(OrderDetail::getPlaceNum, targetOrder.getPlaceNum())
.set(OrderDetail::getOrderId, targetOrder.getId())
.update();
} else { } else {
orderDetailService.updateChain() orderDetailService.update(orderDetailUp,
.eq(OrderDetail::getOrderId, sourceOrder.getId()) new QueryWrapper().eq(OrderDetail::getOrderId, sourceOrder.getId()).in(OrderDetail::getId, param.getDetailIds()));
.in(OrderDetail::getId, param.getDetailIds())
.set(OrderDetail::getPlaceNum, targetOrder.getPlaceNum())
.set(OrderDetail::getOrderId, targetOrder.getId())
.update();
} }
if(param.getAllMerge()==1){
shopTableService.updateStatus(sourceOrder.getShopId(), null, sourceOrder.getTableCode(), ShopTableStatusEnum.IDLE.getValue());
}
shopTableService.updateStatus(sourceOrder.getShopId(), null, targetOrder.getTableCode(), ShopTableStatusEnum.UNSETTLED.getValue());
return CzgResult.success(); return CzgResult.success();
} }
@@ -1382,10 +1385,6 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
} else { } else {
orderInfo.setOrderNo(param.getPlatformType() + CzgRandomUtils.snowflake()); orderInfo.setOrderNo(param.getPlatformType() + CzgRandomUtils.snowflake());
orderInfo.setShopId(param.getShopId()); orderInfo.setShopId(param.getShopId());
if (table != null) {
orderInfo.setTableCode(table.getTableCode());
orderInfo.setTableName(table.getName());
}
orderInfo.setRefundAmount(BigDecimal.ZERO); orderInfo.setRefundAmount(BigDecimal.ZERO);
orderInfo.setPayAmount(BigDecimal.ZERO); orderInfo.setPayAmount(BigDecimal.ZERO);
@@ -1407,6 +1406,10 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
//取餐码 多端一致 //取餐码 多端一致
orderInfo.setTakeCode(getCode(shopInfo.getId())); orderInfo.setTakeCode(getCode(shopInfo.getId()));
} }
if (table != null) {
orderInfo.setTableCode(table.getTableCode());
orderInfo.setTableName(table.getName());
}
// 餐位费 // 餐位费
if (shopInfo.getIsTableFee().equals(0)) { if (shopInfo.getIsTableFee().equals(0)) {
orderInfo.setSeatAmount(shopInfo.getTableFee().multiply(new BigDecimal(param.getSeatNum()))); orderInfo.setSeatAmount(shopInfo.getTableFee().multiply(new BigDecimal(param.getSeatNum())));