1.代客下单 新增后付款下单

This commit is contained in:
2024-08-20 17:05:36 +08:00
parent 830271a838
commit 376af15266
7 changed files with 95 additions and 10 deletions

View File

@@ -2,11 +2,15 @@ package cn.ysk.cashier.controller.product;
import cn.ysk.cashier.annotation.AnonymousAccess;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.cons.rabbit.RabbitConstants;
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 com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiOperation;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.Validator;
@@ -14,6 +18,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.UUID;
@RestController
@RequestMapping("/api/place")
@@ -38,10 +43,11 @@ public class TbPlaceController {
return new ResponseEntity<>(tbProductService.activateProduct(page, size, categoryId, shopId, productId),HttpStatus.OK);
}
public TbPlaceController(TbShopTableService tbShopTableService, TbProductService tbProductService, Validator validator) {
public TbPlaceController(TbShopTableService tbShopTableService, TbProductService tbProductService, Validator validator, RabbitTemplate rabbitTemplate) {
this.tbShopTableService = tbShopTableService;
this.tbProductService = tbProductService;
this.validator = validator;
this.rabbitTemplate = rabbitTemplate;
}
@AnonymousAccess
@@ -179,6 +185,7 @@ public class TbPlaceController {
) {
return ResponseEntity.ok(tbShopTableService.pay(payDTO));
}
@AnonymousAccess
@PutMapping("/updateVip")
@Log("代客下单 查询购物车")
@@ -189,4 +196,17 @@ public class TbPlaceController {
return ResponseEntity.ok(tbShopTableService.updateVip(updateVipDTO));
}
private final RabbitTemplate rabbitTemplate;
@AnonymousAccess
@GetMapping("/test")
public void test() {
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()));
}
}