|
@@ -161,12 +161,13 @@ public class AuthRedirectController {
|
|
String url = WeiXinCorpController.GET_CORP_INSIDE_USERINFO_URL.replace("ACCESS_TOKEN",getCorpConcactAccessToken(corpInfo)).replace("CODE", code);
|
|
String url = WeiXinCorpController.GET_CORP_INSIDE_USERINFO_URL.replace("ACCESS_TOKEN",getCorpConcactAccessToken(corpInfo)).replace("CODE", code);
|
|
String forObject = this.restTemplate.getForObject(url, String.class);
|
|
String forObject = this.restTemplate.getForObject(url, String.class);
|
|
JSONObject obj = JSONObject.parseObject(forObject);
|
|
JSONObject obj = JSONObject.parseObject(forObject);
|
|
- String wxUserId = obj.getString("UserId");
|
|
|
|
- String openUserId = obj.getString("open_userid");
|
|
|
|
- String corpId = obj.getString("CorpId");
|
|
|
|
|
|
+ String wxUserId = obj.getString("userid");
|
|
|
|
+// String openUserId = obj.getString("open_userid");
|
|
|
|
+// String corpId = obj.getString("CorpId");
|
|
|
|
|
|
- System.out.println("wxUserId="+wxUserId+", openUserId="+openUserId);
|
|
|
|
- List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("corpwx_userid", openUserId));
|
|
|
|
|
|
+ System.out.println("wxUserId="+wxUserId);
|
|
|
|
+ System.out.println(obj.toString());
|
|
|
|
+ List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("corpwx_userid", wxUserId).eq("company_id", corpInfo.getCompanyId()));
|
|
Integer companyId = 0;
|
|
Integer companyId = 0;
|
|
if (userList.size() > 0) {
|
|
if (userList.size() > 0) {
|
|
//该用户已存在
|
|
//该用户已存在
|
|
@@ -187,11 +188,7 @@ public class AuthRedirectController {
|
|
} else {
|
|
} else {
|
|
User curUser = userMapper.selectOne(new QueryWrapper<User>().eq("company_id", wxCorpInfo.getCompanyId()).eq("corpwx_userid", wxUserId));
|
|
User curUser = userMapper.selectOne(new QueryWrapper<User>().eq("company_id", wxCorpInfo.getCompanyId()).eq("corpwx_userid", wxUserId));
|
|
if (curUser == null) {
|
|
if (curUser == null) {
|
|
-// reqParam.put("errorMsg", MessageUtils.message("user.accountNoExist"));
|
|
|
|
- //用户不存在,去生成该用户
|
|
|
|
- if (wxCorpInfo.getSaasSyncContact() == 1) {
|
|
|
|
- curUser = wxCorpInfoService.generateUserInfo(wxCorpInfo.getCompanyId(), openUserId);
|
|
|
|
- }
|
|
|
|
|
|
+ reqParam.put("errorMsg", MessageUtils.message("user.accountNoExist"));
|
|
}
|
|
}
|
|
if (curUser != null) {
|
|
if (curUser != null) {
|
|
if (curUser.getIsActive() == 1) {
|
|
if (curUser.getIsActive() == 1) {
|
|
@@ -199,11 +196,9 @@ public class AuthRedirectController {
|
|
reqParam.put("userId", curUser.getId());
|
|
reqParam.put("userId", curUser.getId());
|
|
} else {
|
|
} else {
|
|
//提示账号已停用
|
|
//提示账号已停用
|
|
- //reqParam.put("errorMsg", "您的账号已停用,无法登录");
|
|
|
|
reqParam.put("errorMsg", MessageUtils.message("user.inactive"));
|
|
reqParam.put("errorMsg", MessageUtils.message("user.inactive"));
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- System.err.println("==生成企业微信User失败==");
|
|
|
|
reqParam.put("errorMsg", MessageUtils.message("user.accountNoExist"));
|
|
reqParam.put("errorMsg", MessageUtils.message("user.accountNoExist"));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -232,13 +227,11 @@ public class AuthRedirectController {
|
|
}
|
|
}
|
|
ModelAndView modelAndView = new ModelAndView(
|
|
ModelAndView modelAndView = new ModelAndView(
|
|
new RedirectView(redirecUrl), reqParam);
|
|
new RedirectView(redirecUrl), reqParam);
|
|
-
|
|
|
|
|
|
+ reqParam.put("isPrivateCorpWX", 1);
|
|
|
|
+ System.out.println("跳转=="+redirecUrl);
|
|
return modelAndView;
|
|
return modelAndView;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
private HashMap getCompExpireInfo(Integer companyId) {
|
|
private HashMap getCompExpireInfo(Integer companyId) {
|
|
Company company = companyMapper.selectById(companyId);
|
|
Company company = companyMapper.selectById(companyId);
|
|
int version = 1;
|
|
int version = 1;
|