|
@@ -168,21 +168,6 @@ public class AuthRedirectController {
|
|
|
return modelAndView;
|
|
|
}
|
|
|
|
|
|
- @RequestMapping("/testGetProviderToken")
|
|
|
- public HttpRespMsg testGetProviderToken() {
|
|
|
- try {
|
|
|
- String providerAccessToken = wxCorpInfoService.getNewProviderAccessToken();
|
|
|
- System.out.println("providerAccessToken=="+providerAccessToken);
|
|
|
- HttpRespMsg msg = new HttpRespMsg();
|
|
|
- msg.setData(providerAccessToken);
|
|
|
- return msg;
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- return new HttpRespMsg();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
@RequestMapping("/corpWXScanningAuth")
|
|
|
public ModelAndView corpWXScanningAuth(String code, String state)throws Exception {
|
|
|
Map<String,Object> reqParam = new HashMap<String,Object>(16);
|
|
@@ -193,14 +178,14 @@ public class AuthRedirectController {
|
|
|
String url = null;
|
|
|
String redirecUrl = null;
|
|
|
try {
|
|
|
- String suiteAccessToken = getNewSuiteAccessToken();
|
|
|
- System.out.println("suiteAccessToken=="+suiteAccessToken);
|
|
|
+ String suiteAccessToken = getLoginSuiteAccessToken();
|
|
|
+ System.out.println("loginSuiteAccessToken=="+suiteAccessToken);
|
|
|
url = GET_CORP_USERINFO_URL.replace("SUITE_ACCESS_TOKEN", suiteAccessToken).replace("CODE", code);
|
|
|
String forObject = this.restTemplate.getForObject(url, String.class);
|
|
|
JSONObject obj = JSONObject.parseObject(forObject);
|
|
|
System.out.println("获取授权的用户身份信息:"+obj.toString());
|
|
|
String openId = obj.getString("open_userid");
|
|
|
- String corpId = obj.getString("corpid");
|
|
|
+ String corpId = obj.getString("CorpId");
|
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectById(corpId);
|
|
|
if (wxCorpInfo != null) {
|
|
|
User curUser = null;
|
|
@@ -237,7 +222,8 @@ public class AuthRedirectController {
|
|
|
}
|
|
|
redirecUrl = "https://crm.ttkuaiban.com/#/" + router;
|
|
|
} else {
|
|
|
- reqParam.put("errorMsg", MessageUtils.message("access.grant"));
|
|
|
+ reqParam.put("errorMsg", "该企业尚未授权开通应用,请联系管理员。");
|
|
|
+ redirecUrl = "https://crm.ttkuaiban.com/#/login";
|
|
|
}
|
|
|
} catch (Exception exception) {
|
|
|
exception.printStackTrace();
|
|
@@ -429,13 +415,13 @@ public class AuthRedirectController {
|
|
|
return WeiXinCorpController.SUITE_ACCESS_TOKEN;
|
|
|
}
|
|
|
|
|
|
- private String getNewSuiteAccessToken() {
|
|
|
+ private String getLoginSuiteAccessToken() {
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
JSONObject reqParam = new JSONObject();
|
|
|
reqParam.put("suite_id", "ww19f9868980b9bb43");
|
|
|
reqParam.put("suite_secret", "OeOqoMPGJH2X3k5j_wltO54q9mnXqKoJx6GkCLmOXdQ");
|
|
|
- SysConfig param = sysConfigMapper.selectOne(new QueryWrapper<SysConfig>().eq("param_key", "wx_suite_ticket"));
|
|
|
+ SysConfig param = sysConfigMapper.selectOne(new QueryWrapper<SysConfig>().eq("param_key", "login_wx_suite_ticket"));
|
|
|
if (param != null) {
|
|
|
reqParam.put("suite_ticket",param.getParamValue());
|
|
|
}
|