Browse Source

支付链接重定向到页面

chao 3 years ago
parent
commit
c7aeff82de

+ 4 - 2
src/main/java/com/caimei365/order/controller/PayOrderApi.java

@@ -15,6 +15,8 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.http.HttpHeaders;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 import java.security.NoSuchAlgorithmException;
 import java.security.spec.InvalidKeySpecException;
 import java.util.Map;
@@ -105,8 +107,8 @@ public class PayOrderApi {
     @ApiOperation("支付链接重定向到页面(旧:/PayOrder/jumpPage)")
     @ApiImplicitParam(required = false, name = "linkLogo", value = "链接标识")
     @GetMapping("/link/jump")
-    public String jumpPayPage(String linkLogo) {
-        return payOrderService.jumpPayPage(linkLogo);
+    public void jumpPayPage(String linkLogo, HttpServletResponse response) throws IOException {
+        payOrderService.jumpPayPage(linkLogo, response);
     }
 
     /**

+ 3 - 1
src/main/java/com/caimei365/order/service/PayOrderService.java

@@ -7,6 +7,8 @@ import com.caimei365.order.model.dto.PayLinkDto;
 import com.caimei365.order.model.dto.SecondPayDto;
 import org.springframework.http.HttpHeaders;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 import java.security.NoSuchAlgorithmException;
 import java.security.spec.InvalidKeySpecException;
 import java.util.Map;
@@ -48,7 +50,7 @@ public interface PayOrderService {
      * 支付链接重定向到页面
      * @param linkLogo 链接标识
      */
-    String jumpPayPage(String linkLogo);
+    void jumpPayPage(String linkLogo, HttpServletResponse response) throws IOException;
     /**
      * 重定向页面的支付数据
      * @param linkLogo 链接标识

+ 4 - 2
src/main/java/com/caimei365/order/service/impl/PayOrderServiceImpl.java

@@ -33,6 +33,8 @@ import org.springframework.http.HttpHeaders;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.security.NoSuchAlgorithmException;
 import java.security.spec.InvalidKeySpecException;
@@ -325,8 +327,8 @@ public class PayOrderServiceImpl implements PayOrderService {
      * @param linkLogo 链接标识
      */
     @Override
-    public String jumpPayPage(String linkLogo) {
-        return "redirect:" + linkPage + "?linkLogo=" + linkLogo;
+    public void jumpPayPage(String linkLogo, HttpServletResponse response) throws IOException {
+        response.sendRedirect(linkPage + "?linkLogo=" + linkLogo);
     }
 
     /**