就餐模式获取修改

This commit is contained in:
2024-09-29 14:50:28 +08:00
parent 6327b6cd3b
commit 70ad132780
2 changed files with 4 additions and 15 deletions

View File

@@ -52,17 +52,7 @@ public class CartConsumer {
else if (jsonObject.getString("type").equals("queryCart") ) {
cartService.queryCart(jsonObject);
} else if(jsonObject.getString("type").equals("createOrder")){
ShopEatTypeInfoDTO eatModel = shopUtils.getEatModel(tableId, shopId);
String tableCartKey = RedisCst.getTableCartKey(shopId, eatModel.isOpenDineIn() ? tableId : null, userId);
String cartDetail = redisUtil.getMessage(tableCartKey);
if (StringUtils.isEmpty(cartDetail)){
log.info("createOrder购物车为空");
throw new MsgException("购物车为空无法下单");
}
JSONArray array = JSON.parseArray(cartDetail);
if (!array.isEmpty()){
cartService.createOrder(jsonObject);
}
cartService.createOrder(jsonObject);
}
// else if(jsonObject.getString("type").equals("clearCart")){
// cartService.clearCart(jsonObject);

View File

@@ -1198,7 +1198,7 @@ public class CartService {
log.info("开始发送mq消息消耗耗材消息内容{}", jsonObject2);
producer.cons(jsonObject2.toString());
redisUtil.saveMessage(tableCartKey, array.toJSONString());
redisUtil.saveMessage(tableCartKey, new JSONArray().toJSONString());
orderInfo.setDetailList(orderDetails);
responseData.put("status", "success");
responseData.put("msg", "成功");
@@ -1216,11 +1216,10 @@ public class CartService {
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(responseData.toString(), tableCartKey, jsonObject.getString("userId"));
redisUtil.saveMessage(RedisCst.ORDER_EXPIRED.concat(orderId.toString()), orderId.toString(), 60 * 16L);
List<TbCashierCart> finalCashierCartList = cashierCartList;
ThreadUtil.execAsync(() -> {
ThreadUtil.sleep(5, TimeUnit.SECONDS);
for (int i = 0; i < array.size(); i++) {
JSONObject object = array.getJSONObject(i);
TbCashierCart cashierCart = JSONUtil.parseJSONStr2T(object.toJSONString(), TbCashierCart.class);
for (TbCashierCart cashierCart : finalCashierCartList) {
// 发送判断耗材是否耗尽消息
JSONObject objectMsg = new JSONObject();
objectMsg.put("skuId", Integer.valueOf(cashierCart.getSkuId()));