就餐模式获取修改

This commit is contained in:
2024-09-29 13:57:11 +08:00
parent 688f73b4b3
commit caccb33016
2 changed files with 24 additions and 16 deletions

View File

@@ -3,11 +3,13 @@ package com.chaozhanggui.system.cashierservice.netty;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.entity.dto.ShopEatTypeInfoDTO;
import com.chaozhanggui.system.cashierservice.netty.config.NettyChannelHandlerAdapter;
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
import com.chaozhanggui.system.cashierservice.util.ShopUtils;
import com.chaozhanggui.system.cashierservice.util.SpringUtils;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler.Sharable;
@@ -17,6 +19,7 @@ import io.netty.handler.timeout.IdleState;
import io.netty.handler.timeout.IdleStateEvent;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
@@ -51,6 +54,9 @@ public class PushToAppChannelHandlerAdapter extends NettyChannelHandlerAdapter {
private RabbitProducer a;
//注入为空
public static RabbitProducer rabbitProducer;
@Autowired
private ShopUtils shopUtils;
@PostConstruct
public void b() {
rabbitProducer = this.a;
@@ -135,6 +141,8 @@ public class PushToAppChannelHandlerAdapter extends NettyChannelHandlerAdapter {
return;
}
ShopEatTypeInfoDTO eatModel = shopUtils.getEatModel(tableId, shopId);
tableId = !eatModel.isOpenTakeout() ? null : tableId;
String tableCartKey = RedisCst.getTableCartKey(shopId, tableId, Integer.valueOf(userId));
log.info("netty连接 接收到数据 建立连接参数 param:{}",jsonObject);
this.tableId=tableId;