xiongzhu 4 年之前
父節點
當前提交
cc6a6c9bb5
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/main/java/com/izouma/nineth/service/SandPayService.java

+ 2 - 1
src/main/java/com/izouma/nineth/service/SandPayService.java

@@ -12,6 +12,7 @@ import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.lang.StringUtils;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 import java.io.IOException;
@@ -142,7 +143,7 @@ public class SandPayService {
         return requestServer(header, body, "https://cashier.sandpay.com.cn/qr/api/order/query");
     }
 
-
+    @Cacheable(value = "sandPay", key = "#orderId")
     public String payOrder(Long orderId) {
         Order order = orderRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));
         if (order.getStatus() != OrderStatus.NOT_PAID) {