Compare commits
4 Commits
061e003ca7
...
6079b7f4ec
| Author | SHA1 | Date | |
|---|---|---|---|
| 6079b7f4ec | |||
| 82e40dc82a | |||
| e8731e1d4d | |||
| ab697be8ef |
@@ -37,7 +37,7 @@ public class StatisticTask {
|
||||
|
||||
|
||||
//每天 00点15分 执行 开始统计数据
|
||||
@Scheduled(cron = "0 15 0 * * ? ")
|
||||
@Scheduled(cron = "0 0 5 * * ? ")
|
||||
public void run() {
|
||||
log.info("统计数据,定时任务执行");
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
@@ -33,6 +33,11 @@ public interface ShopTableService extends IService<ShopTable> {
|
||||
|
||||
Boolean updateInfo(long shopId, ShopTableDTO shopTableDTO);
|
||||
|
||||
/**
|
||||
* 更新台桌状态
|
||||
*/
|
||||
Boolean updateStatus(long shopId, Long tableId, String tableCode, String status);
|
||||
|
||||
Boolean clear(long shopId, ShopTableClearDTO shopTableClearDTO);
|
||||
Boolean expiredTable(long tableId);
|
||||
|
||||
|
||||
@@ -29,4 +29,9 @@ public class MergeOrderDTO implements Serializable {
|
||||
* 转台详情Id
|
||||
*/
|
||||
private List<Long> detailIds;
|
||||
|
||||
/**
|
||||
* 是否全部商品转台 0:否 1:是
|
||||
*/
|
||||
private Integer allMerge;
|
||||
}
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
|
||||
@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
|
||||
public Boolean clear(long shopId, ShopTableClearDTO shopTableClearDTO) {
|
||||
ShopTable shopTable = getOne(new QueryWrapper().eq(ShopTable::getShopId, shopId).eq(ShopTable::getId, shopTableClearDTO.getId()));
|
||||
|
||||
@@ -553,6 +553,9 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
if (param.getTargetOrderId() == null && StrUtil.isBlank(param.getTargetTableCode())) {
|
||||
throw new CzgException("转台失败,请选择目标台桌后转台");
|
||||
}
|
||||
if(param.getAllMerge()==null){
|
||||
param.setAllMerge(0);
|
||||
}
|
||||
OrderInfo sourceOrder = orderInfoService.getById(param.getSourceOrderId());
|
||||
if (sourceOrder == null || !sourceOrder.getStatus().equals(OrderStatusEnums.UNPAID.getCode())) {
|
||||
throw new CzgException("转台失败,无可转订单");
|
||||
@@ -561,6 +564,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
.eq(OrderInfo::getTableCode, param.getTargetTableCode())
|
||||
.eq(OrderInfo::getStatus, OrderStatusEnums.UNPAID.getCode()));
|
||||
if (targetOrder == null) {
|
||||
ShopTable shopTable = shopTableService.getOneByTableCode(sourceOrder.getShopId(), param.getTargetTableCode());
|
||||
OrderInfoAddDTO addDTO = new OrderInfoAddDTO();
|
||||
addDTO.setShopId(sourceOrder.getShopId());
|
||||
addDTO.setStaffId(sourceOrder.getStaffId());
|
||||
@@ -573,7 +577,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
addDTO.setWaitCall(false);
|
||||
addDTO.setVipPrice(false);
|
||||
ShopInfo shopInfo = shopInfoService.getById(sourceOrder.getShopId());
|
||||
targetOrder = initOrderInfo(addDTO, shopInfo, null);
|
||||
targetOrder = initOrderInfo(addDTO, shopInfo, shopTable);
|
||||
} else {
|
||||
targetOrder.setPlaceNum(targetOrder.getPlaceNum() + 1);
|
||||
//下单次数+1
|
||||
@@ -582,24 +586,23 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
updateTargetOrder.setPlaceNum(targetOrder.getPlaceNum() + 1);
|
||||
orderInfoService.updateById(updateTargetOrder);
|
||||
}
|
||||
OrderDetail orderDetailUp = new OrderDetail();
|
||||
orderDetailUp.setOrderId(targetOrder.getId());
|
||||
orderDetailUp.setPlaceNum(targetOrder.getPlaceNum());
|
||||
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) {
|
||||
throw new CzgException("转台失败,该订单无可转商品");
|
||||
}
|
||||
orderDetailService.updateChain()
|
||||
.eq(OrderDetail::getOrderId, sourceOrder.getId())
|
||||
.set(OrderDetail::getPlaceNum, targetOrder.getPlaceNum())
|
||||
.set(OrderDetail::getOrderId, targetOrder.getId())
|
||||
.update();
|
||||
orderDetailService.update(orderDetailUp,new QueryWrapper().eq(OrderDetail::getOrderId, sourceOrder.getId()));
|
||||
} else {
|
||||
orderDetailService.updateChain()
|
||||
.eq(OrderDetail::getOrderId, sourceOrder.getId())
|
||||
.in(OrderDetail::getId, param.getDetailIds())
|
||||
.set(OrderDetail::getPlaceNum, targetOrder.getPlaceNum())
|
||||
.set(OrderDetail::getOrderId, targetOrder.getId())
|
||||
.update();
|
||||
orderDetailService.update(orderDetailUp,
|
||||
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());
|
||||
}
|
||||
shopTableService.updateStatus(sourceOrder.getShopId(), null, targetOrder.getTableCode(), ShopTableStatusEnum.UNSETTLED.getValue());
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -1382,10 +1385,6 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
} else {
|
||||
orderInfo.setOrderNo(param.getPlatformType() + CzgRandomUtils.snowflake());
|
||||
orderInfo.setShopId(param.getShopId());
|
||||
if (table != null) {
|
||||
orderInfo.setTableCode(table.getTableCode());
|
||||
orderInfo.setTableName(table.getName());
|
||||
}
|
||||
orderInfo.setRefundAmount(BigDecimal.ZERO);
|
||||
orderInfo.setPayAmount(BigDecimal.ZERO);
|
||||
|
||||
@@ -1407,6 +1406,10 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
//取餐码 多端一致
|
||||
orderInfo.setTakeCode(getCode(shopInfo.getId()));
|
||||
}
|
||||
if (table != null) {
|
||||
orderInfo.setTableCode(table.getTableCode());
|
||||
orderInfo.setTableName(table.getName());
|
||||
}
|
||||
// 餐位费
|
||||
if (shopInfo.getIsTableFee().equals(0)) {
|
||||
orderInfo.setSeatAmount(shopInfo.getTableFee().multiply(new BigDecimal(param.getSeatNum())));
|
||||
|
||||
Reference in New Issue
Block a user