diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsExchangeRecordServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsExchangeRecordServiceImpl.java index ccb65cda..00071ce7 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsExchangeRecordServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsExchangeRecordServiceImpl.java @@ -250,7 +250,7 @@ public class TbPointsExchangeRecordServiceImpl extends ServiceImpl= 5")); + .last("and TIMESTAMPDIFF(MINUTE, create_time, NOW()) >= 5")); } } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopTableBookingServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopTableBookingServiceImpl.java index f0344229..6bb4dee1 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopTableBookingServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopTableBookingServiceImpl.java @@ -286,7 +286,7 @@ public class TbShopTableBookingServiceImpl extends ServiceImpl= timeout_minute")); + .last("and TIMESTAMPDIFF(MINUTE, booking_time, NOW()) >= timeout_minute")); } @Override @@ -296,7 +296,7 @@ public class TbShopTableBookingServiceImpl extends ServiceImpl= timeout_minute+15")); + .last("and TIMESTAMPDIFF(MINUTE, booking_time, NOW()) >= timeout_minute+15")); } } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 2fbfec76..65a18f89 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -29,6 +29,7 @@ import cn.ysk.cashier.exception.BadRequestException; import cn.ysk.cashier.mapper.shop.TbShopTableMapper; import cn.ysk.cashier.mybatis.entity.TbActivateOutRecord; import cn.ysk.cashier.mybatis.entity.TbShopCoupon; +import cn.ysk.cashier.mybatis.entity.TbShopTableBooking; import cn.ysk.cashier.mybatis.entity.TbThirdPartyCouponRecord; import cn.ysk.cashier.mybatis.mapper.*; import cn.ysk.cashier.mybatis.service.*; @@ -55,6 +56,7 @@ import cn.ysk.cashier.vo.*; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.dianguang.cloud.ossservice.model.DateUtils; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -111,6 +113,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { private final MpProductStockDetailMapper mpProductStockDetailMapper; private final TbMemberPointsService memberPointsService; private final TbShopCouponService shopCouponService; + private final TbShopTableBookingService tbShopTableBookingService; /** @@ -296,30 +299,30 @@ public class TbShopTableServiceImpl implements TbShopTableService { .orderByDesc(TbOrderInfo::getId)).getRecords(); orderInfoList.forEach(item -> currentOrderInfoMap.computeIfAbsent(item.getTableId(), k -> item)); - for (TbShopTable date : tbShopTableList) { - if (StrUtil.isBlank(date.getQrcode())) { - date.setStatus("unbind"); - } else if ((countMap.get(date.getQrcode()) == null || countMap.get(date.getQrcode()) < 1) && !TableStateEnum.CLEANING.getState().equals(date.getStatus())) { - date.setStatus("idle"); + for (TbShopTable data : tbShopTableList) { + if (StrUtil.isBlank(data.getQrcode())) { + data.setStatus("unbind"); + } else if ((countMap.get(data.getQrcode()) == null || countMap.get(data.getQrcode()) < 1) && !TableStateEnum.CLEANING.getState().equals(data.getStatus())) { + data.setStatus("idle"); mpShopTableMapper.update(null, new LambdaUpdateWrapper() - .eq(TbShopTable::getQrcode, date.getQrcode()) + .eq(TbShopTable::getQrcode, data.getQrcode()) .set(TbShopTable::getStatus, TableStateEnum.IDLE.getState())); } - Map itemMap = BeanUtil.beanToMap(date, false, false); - if ((date.getStatus().equals("using") || date.getStatus().equals("cleaning")) && date.getUseTime() != null) { - itemMap.put("durationTime", DateUtil.current() - date.getUseTime().getTime()); + Map itemMap = BeanUtil.beanToMap(data, false, false); + if ((data.getStatus().equals("using") || data.getStatus().equals("cleaning")) && data.getUseTime() != null) { + itemMap.put("durationTime", DateUtil.current() - data.getUseTime().getTime()); } else { itemMap.put("durationTime", 0); } - if (!"".equals(date.getQrcode())) { - itemMap.put("qrcode", QRCODE + date.getQrcode().trim()); - itemMap.put("tableId", date.getQrcode()); + if (!"".equals(data.getQrcode())) { + itemMap.put("qrcode", QRCODE + data.getQrcode().trim()); + itemMap.put("tableId", data.getQrcode()); } TbOrderInfo orderInfo = null; - if (StrUtil.isNotBlank(date.getQrcode())) { + if (StrUtil.isNotBlank(data.getQrcode())) { try { - orderInfo = currentOrderInfoMap.get(date.getQrcode()); + orderInfo = currentOrderInfoMap.get(data.getQrcode()); } catch (Exception e) { log.info(e.getMessage()); } @@ -328,6 +331,17 @@ public class TbShopTableServiceImpl implements TbShopTableService { itemMap.put("orderId", orderInfo == null ? null : orderInfo.getId()); itemMap.put("useType", orderInfo == null ? null : orderInfo.getUseType()); itemMap.put("masterId", orderInfo == null ? null : orderInfo.getMasterId()); + Date bookingDate = DateUtil.date().toJdkDate(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); + wrapper.eq(TbShopTableBooking::getBookingDate, bookingDate); + wrapper.eq(TbShopTableBooking::getShopTableId, data.getId()); + wrapper.ne(TbShopTableBooking::getStatus, -1); + wrapper.eq(TbShopTableBooking::getDelFlag, 0); + List list = tbShopTableBookingService.list(wrapper); + if (list == null) { + list = new ArrayList<>(); + } + itemMap.put("bookingList", list); infoList.add(itemMap); } HashMap map = new HashMap<>();