1.代客下单 创建订单删除小程序购物车缓存

This commit is contained in:
SongZhang 2024-09-03 10:41:57 +08:00
parent 5480d0eb5f
commit 1b9b088e43
2 changed files with 10 additions and 11 deletions

View File

@ -333,7 +333,7 @@ public class TbPayServiceImpl implements TbPayService {
private final TbShopUserFlowMapper shopUserFlowMapper;
@Override
public TbOrderInfo vipPay(@NotNull Integer shopId, @NotNull Integer orderId) {
public TbOrderInfo vipPay(@NotNull Integer shopId, @NotNull Integer orderId, Double discount, Integer vipUserId) {
TbOrderInfo orderInfo = orderInfoMapper.selectById(orderId);
@ -365,7 +365,7 @@ public class TbPayServiceImpl implements TbPayService {
userFlow.setBalance(shopUser.getAmount());
userFlow.setShopUserId(shopUser.getId());
userFlow.setBizCode("vipCardCash");
userFlow.setBizName("代客下单会员余额支付");
userFlow.setBizName("余额支付");
userFlow.setCreateTime(new Timestamp(System.currentTimeMillis()));
userFlow.setType("-");
shopUserFlowMapper.insert(userFlow);

View File

@ -368,10 +368,6 @@ public class TbShopTableServiceImpl implements TbShopTableService {
// 增加redis购物车数据
String tableCartKey = RedisConstant.getTableCartKey(addCartDTO.getTableId(), addCartDTO.getShopId().toString());
String tableCart = redisTemplate.opsForValue().get(tableCartKey);
List<TbCashierCart> cartArrayList = new ArrayList<>();
if (tableCart != null) {
cartArrayList = JSONObject.parseArray(tableCart, TbCashierCart.class);
}
// 首次加入
if (tbCashierCart == null) {
tbCashierCart = new TbCashierCart();
@ -895,7 +891,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
})
.or((query4 -> {
query4.isNull(TbCashierCart::getTradeDay)
.eq(TbCashierCart::getMasterId, "");
.isNull(TbCashierCart::getMasterId);
}));
});
// if (createOrderDTO.getVipUserId() != null) {
@ -1063,10 +1059,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
// 推送耗材信息
pushConsMsg(orderInfo, cashierCarts);
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getShopId, createOrderDTO.getShopId())
.eq(TbShopTable::getQrcode, createOrderDTO.getTableId())
.set(TbShopTable::getStatus, TableStateEnum.USING.getState()));
if (createOrderDTO.isPostPay() && isPrint) {
Long count = orderInfoMapper.selectCount(new LambdaQueryWrapper<TbOrderInfo>()
@ -1077,7 +1070,13 @@ public class TbShopTableServiceImpl implements TbShopTableService {
}
}
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getShopId, createOrderDTO.getShopId())
.eq(TbShopTable::getQrcode, createOrderDTO.getTableId())
.set(TbShopTable::getStatus, TableStateEnum.USING.getState()));
String tableCartKey = RedisConstant.getTableCartKey(createOrderDTO.getTableId(), createOrderDTO.getShopId().toString());
redisTemplate.delete(tableCartKey);
return orderInfo;
}, stringRedisTemplate, RedisConstant.getLockKey(RedisConstant.CREATE_ORDER,createOrderDTO.getShopId(),
createOrderDTO.getTableId(), createOrderDTO.getMasterId(), createOrderDTO.isPostPay()));