扫码点餐部分

This commit is contained in:
2024-08-05 11:40:49 +08:00
parent 5ad0eea854
commit cf62b19179
8 changed files with 389 additions and 337 deletions

View File

@@ -36,12 +36,14 @@ public class CartConsumer {
String shopId = jsonObject.getString("shopId");
if (jsonObject.getString("type").equals("initCart") ) {
cartService.initCart(jsonObject);
}else if (jsonObject.getString("type").equals("addcart") ) {
if (!jsonObject.containsKey("num")) {
throw new MsgException("商品数量错误");
}
cartService.createCart(jsonObject);
}else if (jsonObject.getString("type").equals("queryCart") ) {
}
// else if (jsonObject.getString("type").equals("addcart") ) {
// if (!jsonObject.containsKey("num")) {
// throw new MsgException("商品数量错误");
// }
// cartService.createCart(jsonObject);
// }
else if (jsonObject.getString("type").equals("queryCart") ) {
cartService.queryCart(jsonObject);
} else if(jsonObject.getString("type").equals("createOrder")){
String cartDetail = redisUtil.getMessage(RedisCst.TABLE_CART.concat(tableId).concat("-").concat(shopId));
@@ -54,9 +56,9 @@ public class CartConsumer {
cartService.createOrder(jsonObject);
}
}
else if(jsonObject.getString("type").equals("clearCart")){
cartService.clearCart(jsonObject);
}
// else if(jsonObject.getString("type").equals("clearCart")){
// cartService.clearCart(jsonObject);
// }
} catch (Exception e) {
log.info("数据处理失败:{}",e.getMessage());
e.printStackTrace();