netty
This commit is contained in:
@@ -6,7 +6,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
||||
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||
import com.chaozhanggui.system.cashierservice.service.CartService;
|
||||
import com.chaozhanggui.system.cashierservice.service.CartService1;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
@@ -25,7 +25,7 @@ public class CartConsumer {
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@Autowired
|
||||
private CartService cartService;
|
||||
private CartService1 cartService;
|
||||
@RabbitHandler
|
||||
@RabbitListener(queues = {"${queue}"})
|
||||
public void listener(String message) {
|
||||
@@ -34,8 +34,9 @@ public class CartConsumer {
|
||||
JSONObject jsonObject = JSON.parseObject(message);
|
||||
String tableId = jsonObject.getString("tableId");
|
||||
String shopId = jsonObject.getString("shopId");
|
||||
log.info("推送信息"+jsonObject.toJSONString());
|
||||
if (jsonObject.getString("type").equals("addcart") ) {
|
||||
if (jsonObject.getString("type").equals("initCart") ) {
|
||||
cartService.initCart(jsonObject);
|
||||
}else if (jsonObject.getString("type").equals("addcart") ) {
|
||||
if (!jsonObject.containsKey("num")) {
|
||||
throw new MsgException("商品数量错误");
|
||||
}
|
||||
@@ -46,12 +47,6 @@ public class CartConsumer {
|
||||
String cartDetail = redisUtil.getMessage(RedisCst.TABLE_CART.concat(tableId).concat("-").concat(shopId));
|
||||
if (StringUtils.isEmpty(cartDetail)){
|
||||
log.info("createOrder购物车为空");
|
||||
// JSONObject jsonObject1 = new JSONObject();
|
||||
// jsonObject1.put("status", "success");
|
||||
// jsonObject1.put("msg", "订单已存在");
|
||||
// jsonObject1.put("type", jsonObject.getString("type"));
|
||||
// jsonObject1.put("data", "{\"id\": \"-1\"}");
|
||||
// AppWebSocketServer.AppSendInfo(jsonObject1,tableId+"-"+shopId, jsonObject.getString("userId"), true);
|
||||
throw new MsgException("购物车为空无法下单");
|
||||
}
|
||||
JSONArray array = JSON.parseArray(cartDetail);
|
||||
|
||||
Reference in New Issue
Block a user