Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
张松
2024-12-13 11:21:20 +08:00
3 changed files with 31 additions and 17 deletions

View File

@@ -250,7 +250,7 @@ public class TbPointsExchangeRecordServiceImpl extends ServiceImpl<TbPointsExcha
.set(TbPointsExchangeRecord::getCancelOrRefundTime, new Date())
.set(TbPointsExchangeRecord::getCancelOrRefundReason, "超时未支付,系统自动取消订单")
.eq(TbPointsExchangeRecord::getStatus, "unpaid")
.last("and TIMESTAMPDIFF(MINUTE, NOW(), create_time) >= 5"));
.last("and TIMESTAMPDIFF(MINUTE, create_time, NOW()) >= 5"));
}
}

View File

@@ -286,7 +286,7 @@ public class TbShopTableBookingServiceImpl extends ServiceImpl<TbShopTableBookin
.set(TbShopTableBooking::getStatus, 999)
.set(TbShopTableBooking::getUpdateTime, new Date())
.eq(TbShopTableBooking::getStatus, 20)
.last("and TIMESTAMPDIFF(MINUTE, NOW(), booking_time) >= timeout_minute"));
.last("and TIMESTAMPDIFF(MINUTE, booking_time, NOW()) >= timeout_minute"));
}
@Override
@@ -296,7 +296,7 @@ public class TbShopTableBookingServiceImpl extends ServiceImpl<TbShopTableBookin
.set(TbShopTableBooking::getStatus, -1)
.set(TbShopTableBooking::getUpdateTime, new Date())
.eq(TbShopTableBooking::getStatus, 999)
.last("and TIMESTAMPDIFF(MINUTE, NOW(), booking_time) >= timeout_minute+15"));
.last("and TIMESTAMPDIFF(MINUTE, booking_time, NOW()) >= timeout_minute+15"));
}
}

View File

@@ -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<TbShopTable>()
.eq(TbShopTable::getQrcode, date.getQrcode())
.eq(TbShopTable::getQrcode, data.getQrcode())
.set(TbShopTable::getStatus, TableStateEnum.IDLE.getState()));
}
Map<String, Object> 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<String, Object> 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<TbShopTableBooking> 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<TbShopTableBooking> list = tbShopTableBookingService.list(wrapper);
if (list == null) {
list = new ArrayList<>();
}
itemMap.put("bookingList", list);
infoList.add(itemMap);
}
HashMap<String, Object> map = new HashMap<>();