加入购物车修改

This commit is contained in:
2024-09-28 09:41:17 +08:00
parent 492fa159b9
commit 70291911a6

View File

@@ -1284,6 +1284,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
}
}
if (!shopEatTypeInfoDTO.isTakeout()) {
LambdaUpdateWrapper<TbShopTable> wrapper = new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getShopId, createOrderDTO.getShopId())
.eq(TbShopTable::getQrcode, createOrderDTO.getTableId())
@@ -1297,6 +1298,8 @@ public class TbShopTableServiceImpl implements TbShopTableService {
}
// 设置台桌信息
mpShopTableMapper.update(null, wrapper);
}
String tableCartKey = RedisConstant.getTableCartKey(createOrderDTO.getTableId(), createOrderDTO.getShopId().toString());
redisTemplate.delete(tableCartKey);
@@ -1461,6 +1464,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
throw new BadRequestException("未知支付方式");
}
TbOrderInfo orderInfo = orderInfoMapper.selectById(payDTO.getOrderId());
if (ObjectUtil.isEmpty(orderInfo)) {
@@ -1471,6 +1475,8 @@ public class TbShopTableServiceImpl implements TbShopTableService {
throw new BadRequestException("订单非未支付状态");
}
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(payDTO.getShopId(), orderInfo.getTableId());
if (payDTO.getDiscount() == null) {
payDTO.setDiscount((double) 1);
}
@@ -1534,6 +1540,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
rabbitTemplate.convertAndSend(RabbitConstants.EXCHANGE_STOCK_RECORD, RabbitConstants.ROUTING_STOCK_RECORD_SALE, mqData.toJSONString(), new CorrelationData(UUID.randomUUID().toString()));
// 修改台桌状态
if (!shopEatTypeInfoDTO.isTakeout()) {
TbShopTable tbShopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>()
.eq(TbShopTable::getShopId, payDTO.getShopId())
.eq(TbShopTable::getQrcode, orderInfo.getTableId()));
@@ -1549,8 +1556,10 @@ public class TbShopTableServiceImpl implements TbShopTableService {
.set(TbShopTable::getEndTime, DateUtil.date())
.set(TbShopTable::getStatus, TableStateEnum.CLEANING.getState()));
}
}
if ("postPay".equals(orderInfo.getUseType())) {
if (!shopEatTypeInfoDTO.isTakeout()) {
String day = DateUtils.getDay();
String key = "SHOP:CODE:USER:pc" + ":" + payDTO.getShopId() + ":" + day + ":" + orderInfo.getTableId();
redisTemplate.delete(key);