|
|
|
@ -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; |
|
|
|
@ -127,7 +128,7 @@ public class UserServiceImpl extends ServiceImpl<UserLoginDao, UserEntity> imple |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public Boolean weChatBinding(String code, HttpServletResponse response,String state) { |
|
|
|
|
|
|
|
|
|
//String md5Code = Md5Util.md5(code);
|
|
|
|
|
String accessTokenUrl = String.format(weChatConfig.getOPEN_ACCESS_TOKEN_URL(),weChatConfig.getOpenAppid(),weChatConfig.getOpenAppsecret(),code); |
|
|
|
|
|
|
|
|
|
//获取access_token
|
|
|
|
@ -136,10 +137,20 @@ public class UserServiceImpl extends ServiceImpl<UserLoginDao, UserEntity> imple |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
String openId = (String) baseMap.get("openid"); |
|
|
|
|
Boolean result = this.getBaseMapper().updateWeChat(Long.parseLong(state), openId); |
|
|
|
|
String md5OpenId = Md5Util.md5(openId); |
|
|
|
|
Integer countWeChatId = this.getBaseMapper().countWeChatId(md5OpenId); |
|
|
|
|
String token = this.getBaseMapper().getTokenByUserId(Long.parseLong(state)); |
|
|
|
|
if (countWeChatId > 0){ |
|
|
|
|
try { |
|
|
|
|
response.sendRedirect("http://www.huorantech.cn/dq/index.html#/workbench-manpower?token="+token+"&message=1"); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
Boolean result = this.getBaseMapper().updateWeChat(Long.parseLong(state), md5OpenId); |
|
|
|
|
log.info("绑定成功---------------------------------------"); |
|
|
|
|
if (result){ |
|
|
|
|
String token = this.getBaseMapper().getTokenByUserId(Long.parseLong(state)); |
|
|
|
|
|
|
|
|
|
if (token != null){ |
|
|
|
|
try { |
|
|
|
|
log.info("转发成功---------------------------------------"); |
|
|
|
|