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

This commit is contained in:
2024-10-25 10:37:44 +08:00
9 changed files with 113 additions and 10 deletions

View File

@@ -20,6 +20,7 @@ import com.chaozhanggui.system.cashierservice.entity.dto.ChoseEatModelDTO;
import com.chaozhanggui.system.cashierservice.entity.dto.ShopEatTypeInfoDTO;
import com.chaozhanggui.system.cashierservice.exception.MsgException;
import com.chaozhanggui.system.cashierservice.mapper.*;
import com.chaozhanggui.system.cashierservice.mpservice.MpShopTableService;
import com.chaozhanggui.system.cashierservice.netty.PushToAppChannelHandlerAdapter;
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
@@ -120,10 +121,12 @@ public class CartService {
private MpOrderDetailMapper mpOrderDetailMapper;
@Autowired
private MpShopTableMapper mpShopTableMapper;
private final MpShopTableService mpShopTableService;
@Autowired
private MQUtils mQUtils;
public CartService(TbUserShopMsgMapper tbUserShopMsgMapper, WechatUtil wechatUtil, WxAccountUtil wxAccountUtil, TbShopOpenIdMapper shopOpenIdMapper, ProductService productService, TbProductMapper tbProductMapper, RedisTemplate<String, Object> redisTemplate, StringRedisTemplate stringRedisTemplate, ShopUtils shopUtils) {
public CartService(TbUserShopMsgMapper tbUserShopMsgMapper, WechatUtil wechatUtil, WxAccountUtil wxAccountUtil, TbShopOpenIdMapper shopOpenIdMapper, ProductService productService, TbProductMapper tbProductMapper, RedisTemplate<String, Object> redisTemplate, StringRedisTemplate stringRedisTemplate, ShopUtils shopUtils, MpShopTableService mpShopTableService) {
this.tbUserShopMsgMapper = tbUserShopMsgMapper;
this.wechatUtil = wechatUtil;
this.wxAccountUtil = wxAccountUtil;
@@ -133,6 +136,7 @@ public class CartService {
this.redisTemplate = redisTemplate;
this.stringRedisTemplate = stringRedisTemplate;
this.shopUtils = shopUtils;
this.mpShopTableService = mpShopTableService;
}
@@ -1053,6 +1057,11 @@ public class CartService {
}
}
// 修改台桌状态
if (!shopEatTypeInfoDTO.isTakeout() && StrUtil.isNotBlank(tableId)) {
mpShopTableService.updateStateByQrcode(tableId, TableConstant.ShopTable.State.USING);
}
// 发送mq消息
JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("orderId", orderInfo.getId());

View File

@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.chaozhanggui.system.cashierservice.constant.TableConstant;
import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.Enum.OrderUseTypeEnum;
import com.chaozhanggui.system.cashierservice.entity.*;
@@ -20,6 +21,7 @@ import com.chaozhanggui.system.cashierservice.mapper.MpOrderDetailMapper;
import com.chaozhanggui.system.cashierservice.mapper.MpOrderInfoMapper;
import com.chaozhanggui.system.cashierservice.model.PayReq;
import com.chaozhanggui.system.cashierservice.model.TradeQueryReq;
import com.chaozhanggui.system.cashierservice.mpservice.MpShopTableService;
import com.chaozhanggui.system.cashierservice.netty.PushToClientChannelHandlerAdapter;
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
@@ -181,8 +183,11 @@ public class PayService {
@Autowired
private MpCashierCartMapper mpCashierCartMapper;
public PayService(@Qualifier("tbShopSongOrderServiceImpl") TbShopSongOrderService shopSongOrderService) {
private final MpShopTableService mpShopTableService;
public PayService(@Qualifier("tbShopSongOrderServiceImpl") TbShopSongOrderService shopSongOrderService, MpShopTableService mpShopTableService) {
this.shopSongOrderService = shopSongOrderService;
this.mpShopTableService = mpShopTableService;
}
@Transactional(rollbackFor = Exception.class)
@@ -522,6 +527,15 @@ public class PayService {
stringRedisTemplate.delete(currentOrderKey);
}
// 重置台桌状态
if (StrUtil.isNotBlank(orderInfo.getTableId())) {
TbShopTable shopTable = mpShopTableService.selectByQrcode(orderInfo.getTableId());
if (shopTable.getAutoClear() != null && shopTable.getAutoClear() == 1) {
mpShopTableService.updateStateByQrcode(orderInfo.getTableId(), TableConstant.ShopTable.State.IDLE);
}else {
mpShopTableService.updateStateByQrcode(orderInfo.getTableId(), TableConstant.ShopTable.State.CLEANING);
}
}
return Result.success(CodeEnum.SUCCESS, "1");
}
@@ -1137,6 +1151,16 @@ public class PayService {
data.put("orderId", orderInfo.getId());
data.put("plat", "miniApp");
mQUtils.sendStockSaleMsg(data);
// 重置台桌状态
if (StrUtil.isNotBlank(orderInfo.getTableId())) {
TbShopTable shopTable = mpShopTableService.selectByQrcode(orderInfo.getTableId());
if (shopTable.getAutoClear() != null && shopTable.getAutoClear() == 1) {
mpShopTableService.updateStateByQrcode(orderInfo.getTableId(), TableConstant.ShopTable.State.IDLE);
}else {
mpShopTableService.updateStateByQrcode(orderInfo.getTableId(), TableConstant.ShopTable.State.CLEANING);
}
}
return "SUCCESS";
}

View File

@@ -150,7 +150,7 @@ public class TbCallServiceImpl implements TbCallService {
return callQueueService.lambdaUpdate()
.eq(TbCallQueue::getShopId, cancelCallQueueDTO.getShopId())
.eq(TbCallQueue::getId, cancelCallQueueDTO.getQueueId())
.set(TbCallQueue::getCreateDay, DateUtil.date())
.set(TbCallQueue::getCallTime, DateUtil.date())
.set(TbCallQueue::getState, -1).update();
}