From 6617d1fa3807eb8eb083b163b47f02a83909f8e6 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Tue, 21 Jul 2020 13:54:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0-=E6=8E=88=E6=9D=83=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/controller/AuthRedirectController.java | 3 ++- .../epmet/service/ComponentVerifyTicketService.java | 3 ++- .../service/impl/ComponentVerifyTicketServiceImpl.java | 5 ++++- .../com/epmet/wxapi/constant/WxMaCodeConstant.java | 10 ++++------ 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java index d0a413522e..cb4f5ecfe7 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java @@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** * @Author zxc @@ -28,7 +29,7 @@ public class AuthRedirectController { * @author zxc */ @GetMapping("redirect/{customerId}/{clientType}") - public Result redirectUri(HttpServletRequest request, HttpServletResponse response, @PathVariable("customerId")String customerId, @PathVariable("clientType")String clientType){ + public Result redirectUri(HttpServletRequest request, HttpServletResponse response, @PathVariable("customerId")String customerId, @PathVariable("clientType")String clientType) throws IOException { componentVerifyTicketService.redirectUri(request,response,customerId,clientType); return new Result(); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java index 7637f6242e..ff1b32584a 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java @@ -2,6 +2,7 @@ package com.epmet.service; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** * @Author zxc @@ -41,6 +42,6 @@ public interface ComponentVerifyTicketService { * @param * @author zxc */ - void redirectUri(HttpServletRequest request, HttpServletResponse response,String customerId, String clientType); + void redirectUri(HttpServletRequest request, HttpServletResponse response,String customerId, String clientType) throws IOException; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index d667724fe3..f512809faf 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -30,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.lang.reflect.Field; @@ -366,7 +367,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe */ @Transactional(rollbackFor = Exception.class) @Override - public void redirectUri(HttpServletRequest request, HttpServletResponse response,String customerId, String client) { + public void redirectUri(HttpServletRequest request, HttpServletResponse response,String customerId, String client) throws IOException{ log.info("开始执行回调URL"); try { request.setCharacterEncoding(ModuleConstant.UTF8); @@ -391,11 +392,13 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe //授权方AppId // formDTO.setAuthAppId(authorizationInfo.getAuthorizer_appid()); formDTO.setCustomerId(customerId); + log.info(formDTO.toString()); // this.updateCustomerMpAppIdAndCreateOpenPlatform(customerId,authorizationInfo.getAuthorizer_appid(),client); authCodeDao.insertRedirectAuthCode(formDTO); //authCode存缓存 redisThird.setAuthCode(formDTO); log.info("回调结束"); + response.sendRedirect(WxMaCodeConstant.WEB_URL); } /** diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java index e408fe7fa1..d075440356 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java @@ -26,16 +26,14 @@ public interface WxMaCodeConstant { String API_AUTHORIZER_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/component/api_authorizer_token?component_access_token="; /** - * 授权回调url + * 反参授权回调url */ - String API_REDIRECT_URL = "https://epmet-dev.elinkservice.cn/api/third/redirectauthcode"; + String API_RETURN_REDIRECT_URL = "https://epmet-cloud.elinkservice.cn/api/third/redirectauthcode/%s/%s"; /** - * 反参授权回调url + * 前端地址 【授权之后的跳转的地址】 */ -// String API_RETURN_REDIRECT_URL = "https://epmet-dev.elinkservice.cn/api/third/redirectauthcode?client=%s&customerId=%s"; - String API_RETURN_REDIRECT_URL = "https://epmet-cloud.elinkservice.cn/api/third/redirectauthcode/%s/%s"; -// String API_RETURN_REDIRECT_URL = "https://10.10.10.194:8080/api/third/redirectauthcode?client=%s&customerId=%s"; + String WEB_URL = "https://epmet-cloud.elinkservice.cn/third/mpweb/page/info"; /** * 授权注册页面扫码授权