1.代客下单 台桌状态同步更新

This commit is contained in:
2024-08-21 10:45:59 +08:00
parent 7d1571628f
commit 91751b0f32
3 changed files with 19 additions and 11 deletions

View File

@@ -7,6 +7,7 @@ import cn.ysk.cashier.dto.shoptable.*;
import cn.ysk.cashier.pojo.order.TbCashierCart;
import cn.ysk.cashier.service.product.TbProductService;
import cn.ysk.cashier.service.shop.TbShopTableService;
import cn.ysk.cashier.utils.RabbitMsgUtils;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiOperation;
import org.springframework.amqp.rabbit.connection.CorrelationData;
@@ -28,6 +29,7 @@ public class TbPlaceController {
private final TbProductService tbProductService;
private final Validator validator;
private final RabbitMsgUtils rabbitMsgUtils;
@AnonymousAccess
@@ -43,11 +45,12 @@ public class TbPlaceController {
return new ResponseEntity<>(tbProductService.activateProduct(page, size, categoryId, shopId, productId),HttpStatus.OK);
}
public TbPlaceController(TbShopTableService tbShopTableService, TbProductService tbProductService, Validator validator, RabbitTemplate rabbitTemplate) {
public TbPlaceController(TbShopTableService tbShopTableService, TbProductService tbProductService, Validator validator, RabbitTemplate rabbitTemplate, RabbitMsgUtils rabbitMsgUtils) {
this.tbShopTableService = tbShopTableService;
this.tbProductService = tbProductService;
this.validator = validator;
this.rabbitTemplate = rabbitTemplate;
this.rabbitMsgUtils = rabbitMsgUtils;
}
@AnonymousAccess
@@ -199,13 +202,15 @@ public class TbPlaceController {
private final RabbitTemplate rabbitTemplate;
@AnonymousAccess
@GetMapping("/test")
public void test() {
public void test(
@RequestParam Integer id
) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("type", "create");
jsonObject.put("orderId", "2980");
rabbitTemplate.convertAndSend(RabbitConstants.CART_ORDER_COLLECT_PUT, RabbitConstants.CART_ORDER_COLLECT_ROUTINGKEY_PUT, jsonObject.toJSONString(), new CorrelationData(UUID.randomUUID().toString()));
rabbitTemplate.convertAndSend(RabbitConstants.PRINT_MECHINE_COLLECT_PUT, RabbitConstants.PRINT_MECHINE_COLLECT_ROUTINGKEY_PUT, "2980", new CorrelationData(UUID.randomUUID().toString()));
jsonObject.put("orderId", id);
// rabbitTemplate.convertAndSend(RabbitConstants.CART_ORDER_COLLECT_PUT, RabbitConstants.CART_ORDER_COLLECT_ROUTINGKEY_PUT, jsonObject.toJSONString(), new CorrelationData(UUID.randomUUID().toString()));
rabbitMsgUtils.printTicket(String.valueOf(id));
// rabbitTemplate.convertAndSend(RabbitConstants.PRINT_MECHINE_COLLECT_PUT, RabbitConstants.PRINT_MECHINE_COLLECT_ROUTINGKEY_PUT, id, new CorrelationData(UUID.randomUUID().toString()));
}