|
@@ -52,7 +52,7 @@ public class WeChatServiceImpl implements WeChatService{
|
|
|
private static final Integer ACCESS_TOKEN_EXPIRES_IN = 3600;
|
|
private static final Integer ACCESS_TOKEN_EXPIRES_IN = 3600;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public ModelMap getWxUserInfo(String code, String state) {
|
|
|
|
|
|
|
+ public ModelMap getWxUserInfo(String code, String state, String openId) {
|
|
|
ModelMap result = new ModelMap();
|
|
ModelMap result = new ModelMap();
|
|
|
if (!StringUtils.isEmpty(code)) {
|
|
if (!StringUtils.isEmpty(code)) {
|
|
|
AuthUserInfo userInfo = null;
|
|
AuthUserInfo userInfo = null;
|
|
@@ -65,21 +65,22 @@ public class WeChatServiceImpl implements WeChatService{
|
|
|
}
|
|
}
|
|
|
result.put("nickname", userInfo.getNickname());
|
|
result.put("nickname", userInfo.getNickname());
|
|
|
result.put("headimgurl", userInfo.getHeadimgurl());
|
|
result.put("headimgurl", userInfo.getHeadimgurl());
|
|
|
- String openid = userInfo.getOpenid();
|
|
|
|
|
-
|
|
|
|
|
- result.put("openid", openid);
|
|
|
|
|
- User user = userDao.findUsersByOpenId(openid);
|
|
|
|
|
- if (StringUtils.isEmpty(user)) {
|
|
|
|
|
- result.put("status", 0);
|
|
|
|
|
- } else {
|
|
|
|
|
- result.put("status", 1);
|
|
|
|
|
- // 转成userAccount
|
|
|
|
|
- UserAccount userAccount = convertUserAccount(user);
|
|
|
|
|
- // 企业信息单独提出
|
|
|
|
|
- Set<Enterprise> enterprises = user.getEnterprises();
|
|
|
|
|
- result.put("userAccount", userAccount);
|
|
|
|
|
- result.put("enterprises", enterprises);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ openId = userInfo.getOpenid();
|
|
|
|
|
+ result.put("openid", openId);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 用户信息查询
|
|
|
|
|
+ List<User> users = userDao.findUsersByOpenId(openId);
|
|
|
|
|
+ if (CollectionUtils.isEmpty(users)) {
|
|
|
|
|
+ result.put("status", 0);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ result.put("status", 1);
|
|
|
|
|
+ // 转成userAccount
|
|
|
|
|
+ UserAccount userAccount = convertUserAccount(users.get(0));
|
|
|
|
|
+ // 企业信息单独提出
|
|
|
|
|
+ Set<Enterprise> enterprises = users.get(0).getEnterprises();
|
|
|
|
|
+ result.put("userAccount", userAccount);
|
|
|
|
|
+ result.put("enterprises", enterprises);
|
|
|
}
|
|
}
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
@@ -151,8 +152,8 @@ public class WeChatServiceImpl implements WeChatService{
|
|
|
if (CollectionUtils.isEmpty(oldUsers)) {
|
|
if (CollectionUtils.isEmpty(oldUsers)) {
|
|
|
throw new IllegalOperatorException("未找到用户信息");
|
|
throw new IllegalOperatorException("未找到用户信息");
|
|
|
}
|
|
}
|
|
|
- User judgeUser = userDao.findUsersByOpenId(user.getOpenId());
|
|
|
|
|
- if (!StringUtils.isEmpty(judgeUser)) {
|
|
|
|
|
|
|
+ List<User> judgeUser = userDao.findUsersByOpenId(user.getOpenId());
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(judgeUser)) {
|
|
|
throw new IllegalOperatorException("该微信号已被绑定");
|
|
throw new IllegalOperatorException("该微信号已被绑定");
|
|
|
}
|
|
}
|
|
|
UserView userView = new UserView();
|
|
UserView userView = new UserView();
|