就餐模式获取修改
This commit is contained in:
@@ -3,10 +3,12 @@ package com.chaozhanggui.system.cashierservice.rabbit;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.dto.ShopEatTypeInfoDTO;
|
||||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||||
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
||||||
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.service.CartService;
|
import com.chaozhanggui.system.cashierservice.service.CartService;
|
||||||
|
import com.chaozhanggui.system.cashierservice.util.ShopUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||||
@@ -26,6 +28,9 @@ public class CartConsumer {
|
|||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CartService cartService;
|
private CartService cartService;
|
||||||
|
@Autowired
|
||||||
|
private ShopUtils shopUtils;
|
||||||
|
|
||||||
@RabbitHandler
|
@RabbitHandler
|
||||||
@RabbitListener(queues = {"${queue}"})
|
@RabbitListener(queues = {"${queue}"})
|
||||||
public void listener(String message) {
|
public void listener(String message) {
|
||||||
@@ -47,7 +52,8 @@ public class CartConsumer {
|
|||||||
else if (jsonObject.getString("type").equals("queryCart") ) {
|
else if (jsonObject.getString("type").equals("queryCart") ) {
|
||||||
cartService.queryCart(jsonObject);
|
cartService.queryCart(jsonObject);
|
||||||
} else if(jsonObject.getString("type").equals("createOrder")){
|
} else if(jsonObject.getString("type").equals("createOrder")){
|
||||||
String tableCartKey = RedisCst.getTableCartKey(shopId, tableId, userId);
|
ShopEatTypeInfoDTO eatModel = shopUtils.getEatModel(tableId, shopId);
|
||||||
|
String tableCartKey = RedisCst.getTableCartKey(shopId, eatModel.isOpenDineIn() ? tableId : null, userId);
|
||||||
String cartDetail = redisUtil.getMessage(tableCartKey);
|
String cartDetail = redisUtil.getMessage(tableCartKey);
|
||||||
if (StringUtils.isEmpty(cartDetail)){
|
if (StringUtils.isEmpty(cartDetail)){
|
||||||
log.info("createOrder购物车为空");
|
log.info("createOrder购物车为空");
|
||||||
|
|||||||
Reference in New Issue
Block a user