Commit df85fd91 authored by hezhen's avatar hezhen

123

parent a2bfe95b
......@@ -253,7 +253,7 @@ public class AppPermissionService {
Map<String,Object> map=registerIm(username,appUserLogin.getPassword(),nickname);
if(map!=null){
Integer imUserId=Integer.parseInt(map.get("userId").toString());
String access_token=map.get("access_token").toString();
//String access_token=map.get("access_token").toString();
String imPassword=map.get("password").toString();
if(imUserId!=null&&imUserId>0&&StringUtils.isNotBlank(imPassword)){
AppUserLogin userLogin = new AppUserLogin();
......@@ -264,7 +264,7 @@ public class AppPermissionService {
appUserLoginBiz.updateSelectiveById(userLogin);
log.info(username+"----userLogin updateSelectiveById---username====="+username+"----imPassword===="+imPassword);
}
data.put("imToken",access_token);
//data.put("imToken",access_token);
data.put("imUserId",imUserId);
}
if (data != null) {
......@@ -283,12 +283,10 @@ public class AppPermissionService {
*/
public JSONObject autoLogin(Integer userid, String username, String headimgurl, String nickname) {
JSONObject data = new JSONObject();
AppUserLogin userLoign = appUserLoginBiz.selectById(userid);
if (userLoign != null) {
data.put("nickname", nickname);
data.put("headerurl", headimgurl);
AppUserVo userVo = appUserDetailBiz.getUserInfoById(userid);
if (userVo != null) {
data.put("nickname", nickname);
data.put("headerurl", headimgurl);
if (StringUtils.isNotBlank(userVo.getNickname())) {
data.put("nickname", userVo.getNickname());
}
......@@ -296,7 +294,6 @@ public class AppPermissionService {
data.put("headerurl", userVo.getHeadimgurl());
}
data.put("certificationStatus", userVo.getCertificationStatus());
}
// 缓存操作
String token = "";
String imtoken_ = "";
......@@ -304,13 +301,16 @@ public class AppPermissionService {
//userRedisTemplate.opsForValue().set("imtoken_" + userid,imtoken_,SystemConfig.REDISTOKENTIME, TimeUnit.SECONDS);
// 返回结果
// data.put("token", token);
data.put("username", StringUtils.isNotEmpty(username)?username:userLoign.getUsername());
data.put("username", StringUtils.isNotEmpty(username)?username:userVo.getUsername());
data.put("userId", userid);
data.put("imUserId", userVo.getImUserid());
//更新登录时间 和 ip
EntityUtils.setCreatAndUpdatInfo(userLoign);
AppUserLogin userLoign= new AppUserLogin();
EntityUtils.setCreateInfo(userLoign);
appUserLoginBiz.updateLoginInfo(userid,userLoign.getCrtHost());
}
return data;
}
......@@ -387,14 +387,14 @@ public class AppPermissionService {
}*/
// 登录结果要做做统一处理
JSONObject data = autoLogin(userid, username, headimgurl, nickname);
// 到im注册,获取返回结果
Integer imUserId=userLogin.getImUserid();
// 到im登录,获取返回结果
/*Integer imUserId=userLogin.getImUserid();
String imPassword=userLogin.getImPassword();
if(StringUtils.isNotBlank(imPassword)&&imUserId!=null&&imUserId>0){
String access_token=loginIm(username,imPassword,imUserId);
data.put("imToken",access_token);
data.put("imUserId",imUserId);
}
}*/
if (data != null) {
return JsonResultUtil.createSuccessResultWithObj(data);
}
......@@ -474,14 +474,14 @@ public class AppPermissionService {
nickname = userVo.getNickname();
}
JSONObject data = autoLogin(userid, userLogin.getUsername(), headimgurl, nickname);
// 到im注册,获取返回结果
/* // 到im注册,获取返回结果
Integer imUserId=userLogin.getImUserid();
String imPassword=userLogin.getImPassword();
if(StringUtils.isNotBlank(imPassword)&&imUserId!=null&&imUserId>0){
String access_token=loginIm(userLogin.getUsername(),imPassword,imUserId);
data.put("imToken",access_token);
data.put("imUserId",imUserId);
}
}*/
if (data != null) {
return JsonResultUtil.createSuccessResultWithObj(data);
}
......@@ -516,14 +516,14 @@ public class AppPermissionService {
Integer userid = user.getId();
String nickname = SystemConfig.USER_NIKENAME_DEFAULT + (int) ((Math.random() * 9 + 1) * 100000);
JSONObject data = autoLogin(userid, user.getUsername(), SystemConfig.USER_HEADER_URL_DEFAULT, nickname);
// 到im注册,获取返回结果
/*// 到im注册,获取返回结果
Integer imUserId=user.getImUserid();
String imPassword=user.getImPassword();
if(StringUtils.isNotBlank(imPassword)&&imUserId!=null&&imUserId>0){
String access_token=loginIm(username,imPassword,imUserId);
data.put("imToken",access_token);
data.put("imUserId",imUserId);
}
}*/
if (data != null) {
return JsonResultUtil.createSuccessResultWithObj(data);
}
......@@ -557,14 +557,14 @@ public class AppPermissionService {
Integer userid = user.getId();
String nickname = SystemConfig.USER_NIKENAME_DEFAULT + (int) ((Math.random() * 9 + 1) * 100000);
JSONObject data = autoLogin(userid, user.getUsername(), SystemConfig.USER_HEADER_URL_DEFAULT, nickname);
// 到im注册,获取返回结果
/* // 到im登录,获取返回结果
Integer imUserId=user.getImUserid();
String imPassword=user.getImPassword();
if(StringUtils.isNotBlank(imPassword)&&imUserId!=null&&imUserId>0){
String access_token=loginIm(username,imPassword,imUserId);
data.put("imToken",access_token);
data.put("imUserId",imUserId);
}
}*/
if (data != null) {
return JsonResultUtil.createSuccessResultWithObj(data);
}
......@@ -638,10 +638,10 @@ public class AppPermissionService {
log.error("------im注册----data======"+data);
if (data != null) {
map.put("userId", data.getString("userId"));
map.put("access_token", data.getString("access_token"));
// map.put("access_token", data.getString("access_token"));
} else {
map.put("userId", "");
map.put("access_token", "");
// map.put("access_token", "");
}
}
}
......@@ -658,7 +658,7 @@ public class AppPermissionService {
map.put("password", password);
map.put("userId", userId);
BaseResponse response = imFeign.login(map);
log.error("registerIm->response:{}", response);
log.error("loginIm->response:{}", response);
String access_token = "";
if (response.getStatus() == ResultCode.SUCCESS_CODE) {
String result = response.getMessage();
......@@ -721,7 +721,6 @@ public class AppPermissionService {
//主要是ip地址
EntityUtils.setCreatAndUpdatInfo(appUserLogin);
setCreateIPInfo(appUserLogin);
appUserLogin.setUsername(username);
appUserLogin.setPassword(password);
appUserLogin.setIsdel(0);
......@@ -745,17 +744,15 @@ public class AppPermissionService {
log.error("注册:新增用户详情: " + userid);
//上线绑定
relationBiz.bindByUserId(userid,small_id);
//自动登录获取优惠卷
authCoupn(userid);
//发送短信通知用户
thirdFeign.sendCode(username,password,SystemConfig.TEMPLATECODE);
// 登录结果要做做统一处理
JSONObject data = autoLogin(userid, username, headimgurl, nickname);
// 到im注册,获取返回结果
/*Map<String,Object> map=registerIm(username,appUserLogin.getPassword(),nickname);
Map<String,Object> map=registerIm(username,appUserLogin.getPassword(),nickname);
if(map!=null){
Integer imUserId=Integer.parseInt(map.get("userId").toString());
String access_token=map.get("access_token").toString();
//String access_token=map.get("access_token").toString();
String imPassword=map.get("password").toString();
if(imUserId!=null&&imUserId>0&&StringUtils.isNotBlank(imPassword)){
AppUserLogin userLogin = new AppUserLogin();
......@@ -766,11 +763,10 @@ public class AppPermissionService {
appUserLoginBiz.updateSelectiveById(userLogin);
log.info(username+"----userLogin updateSelectiveById---username====="+username+"----imPassword===="+imPassword);
}
data.put("imToken",access_token);
//data.put("imToken",access_token);
data.put("imUserId",imUserId);
}*/
}
if (data != null) {
return JsonResultUtil.createSuccessResultWithObj(data);
} else {
return JsonResultUtil.createDefaultFail();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment