|
|
|
@ -12,6 +12,7 @@ import com.daqing.framework.domain.hrms.UserEntity; |
|
|
|
|
import com.daqing.framework.domain.hrms.request.LoginRequest; |
|
|
|
|
import com.daqing.framework.domain.hrms.response.LoginResponse; |
|
|
|
|
import com.daqing.framework.model.response.ResponseResult; |
|
|
|
|
import com.daqing.framework.util.Md5Util; |
|
|
|
|
import com.daqing.framework.util.RedisUtil; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
@ -58,16 +59,18 @@ public class UserServiceImpl extends ServiceImpl<UserLoginDao, UserEntity> imple |
|
|
|
|
String accessToken = (String)baseMap.get("access_token"); |
|
|
|
|
String openId = (String) baseMap.get("openid"); |
|
|
|
|
|
|
|
|
|
//对code(回调过来的openid)加密
|
|
|
|
|
String md5OpenId = Md5Util.md5(openId); |
|
|
|
|
log.info("accessToken========> "+accessToken+"openId========> "+openId+"code=======> "+code); |
|
|
|
|
|
|
|
|
|
UserEntity dbUser = userMapper.findByOpenid(openId); |
|
|
|
|
UserEntity dbUser = userMapper.findByOpenid(md5OpenId); |
|
|
|
|
|
|
|
|
|
if(dbUser!=null && dbUser.getPhoneAccount()!=null) { //dbUser不为空,存在直接让它登录
|
|
|
|
|
log.info("来了微信扫码登录~~~~~~~~~~~~~~~~~~~~~~~~~~~"); |
|
|
|
|
LoginRequest loginRequest = new LoginRequest(); |
|
|
|
|
loginRequest.setTenDayEffective(1); |
|
|
|
|
loginRequest.setType(2); |
|
|
|
|
loginRequest.setWechatId(openId); |
|
|
|
|
loginRequest.setWechatId(md5OpenId); |
|
|
|
|
ResponseResult login = userLoginService.login(loginRequest); |
|
|
|
|
LoginResponse data = (LoginResponse) login.getData(); |
|
|
|
|
|
|
|
|
@ -81,7 +84,7 @@ public class UserServiceImpl extends ServiceImpl<UserLoginDao, UserEntity> imple |
|
|
|
|
if(dbUser == null){//openId不存在,返回绑定手机号页面,须另写绑定手机号接口
|
|
|
|
|
log.info("dbUser为空,openId不存在,请先绑定手机号哦~~~"); |
|
|
|
|
try { |
|
|
|
|
response.sendRedirect("http://www.huorantech.cn/dq/index.html#/bind-phone?matched="+openId);//跳转绑定手机号页面
|
|
|
|
|
response.sendRedirect("http://www.huorantech.cn/dq/index.html#/bind-phone?matched="+md5OpenId);//跳转绑定手机号页面
|
|
|
|
|
} catch (IOException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|