|
@@ -26,6 +26,8 @@ import org.springframework.web.servlet.view.RedirectView;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.net.URLDecoder;
|
|
|
+import java.net.URLEncoder;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneOffset;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
@@ -45,6 +47,8 @@ public class AuthRedirectController {
|
|
|
private String pcUrl;
|
|
|
@Value("${privateDeployURL.mobUrl}")
|
|
|
private String mobUrl;
|
|
|
+ @Value("${privateDeployURL.authUrl}")
|
|
|
+ private String authUrl;
|
|
|
@Value("${corpId}")
|
|
|
private String corpId;
|
|
|
|
|
@@ -274,7 +278,7 @@ public class AuthRedirectController {
|
|
|
boolean isMobile = "MOBILE".equals(deviceType);
|
|
|
WxCorpInfo corpInfo = wxCorpInfoMapper.selectById(corpId);
|
|
|
System.out.println("========================ACCESS_TOKEN====================="+wxCorpInfoService.getCorpAgentAccessToken(corpInfo));
|
|
|
- System.out.println("========================CODE====================="+code);
|
|
|
+ System.out.println("========================CODE====================="+code+"state="+state);
|
|
|
String url = WeiXinCorpController.GET_CORP_INSIDE_USERINFO_URL.replace("ACCESS_TOKEN", wxCorpInfoService.getCorpAgentAccessToken(corpInfo)).replace("CODE", code);
|
|
|
String forObject = this.restTemplate.getForObject(url, String.class);
|
|
|
JSONObject obj = JSONObject.parseObject(forObject);
|
|
@@ -318,11 +322,13 @@ public class AuthRedirectController {
|
|
|
}
|
|
|
reqParam.put("hasTriedAutoLogin", 1);
|
|
|
if (!StringUtils.isEmpty(state) && state.length() > 1) {
|
|
|
+ System.out.println("Decode前state=="+state);
|
|
|
+ state = URLDecoder.decode(state, "UTF-8");
|
|
|
reqParam.put("path", state);
|
|
|
+ System.out.println("Decode后state=="+state);
|
|
|
}
|
|
|
|
|
|
- String redirecUrl = null;
|
|
|
- String router = "index";
|
|
|
+ String router = "login";//从登录页面进入系统
|
|
|
if (companyId > 0) {
|
|
|
HashMap compExpireInfo = getCompExpireInfo(companyId);
|
|
|
if (compExpireInfo != null) {
|
|
@@ -332,11 +338,7 @@ public class AuthRedirectController {
|
|
|
reqParam.put("version", compExpireInfo.get("version"));
|
|
|
}
|
|
|
}
|
|
|
- if (isMobile) {
|
|
|
- redirecUrl = mobUrl +"/#/"+ router;
|
|
|
- } else {
|
|
|
- redirecUrl = pcUrl +"/#/"+ router;
|
|
|
- }
|
|
|
+ String redirecUrl = (isMobile? mobUrl : pcUrl) +"/#/"+ router;
|
|
|
ModelAndView modelAndView = new ModelAndView(
|
|
|
new RedirectView(redirecUrl), reqParam);
|
|
|
reqParam.put("isPrivateCorpWX", 1);
|