发送订阅消息增加token

This commit is contained in:
谭凯凯 2024-10-21 13:56:57 +08:00 committed by Tankaikai
parent af1d4faa03
commit c5da6f1ca1
1 changed files with 10 additions and 0 deletions

View File

@ -8,7 +8,11 @@ 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 cn.ysk.cashier.utils.RedisUtils;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
@ -18,6 +22,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
@Slf4j
@RestController
@RequestMapping("/api/place")
public class TbPlaceController {
@ -26,6 +31,9 @@ public class TbPlaceController {
private final RabbitMsgUtils rabbitMsgUtils;
@Resource
private TokenProvider tokenProvider;
@Lazy
@Autowired
private RedisUtils redisUtils;
@GetMapping("/activate")
@ApiOperation("查询/product")
@ -146,6 +154,8 @@ public class TbPlaceController {
public ResponseEntity<Object> pay(HttpServletRequest request, @Validated @RequestBody PayDTO payDTO) {
String token = tokenProvider.getToken(request);
payDTO.setToken(token);
String subject = tokenProvider.getClaims(token).getSubject();
log.error(">>>>>>>>>>>>>>>>>>>>>>>>>>>>subject:{}", subject);
return ResponseEntity.ok(tbShopTableService.pay(payDTO));
}