| | |
| | | import com.java110.core.factory.WechatFactory; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import com.java110.dto.owner.OwnerAppUserDto; |
| | | import com.java110.dto.ownerCarOpenUser.OwnerCarOpenUserDto; |
| | | import com.java110.dto.smallWeChat.SmallWeChatDto; |
| | | import com.java110.dto.owner.OwnerCarOpenUserDto; |
| | | import com.java110.dto.wechat.SmallWeChatDto; |
| | | import com.java110.dto.user.UserDto; |
| | | import com.java110.intf.user.IOwnerCarOpenUserV1InnerServiceSMO; |
| | | import com.java110.utils.cache.CommonCache; |
| | |
| | | private final static int expireTime = 7200; |
| | | |
| | | private final static int LOGIN_PAGE = 1; |
| | | private final static int COMMON_PAGE = 2; |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | |
| | | logger.debug("调用微信换去openId " + paramOut); |
| | | if (paramOut.getStatusCode() != HttpStatus.OK) { |
| | | return ResultVo.redirectPage(errorUrl); |
| | | |
| | | } |
| | | |
| | | JSONObject paramObj = JSONObject.parseObject(paramOut.getBody()); |
| | | |
| | | //获取 openId |
| | | String openId = paramObj.getString("openid"); |
| | | |
| | | String userinfo_url = WechatConstant.APP_GET_USER_INFO_URL |
| | | .replace("ACCESS_TOKEN", paramObj.getString("access_token")) |
| | | .replace("OPENID", openId); |
| | |
| | | logger.debug("登录跳转url:{}", errorUrl); |
| | | |
| | | return ResultVo.redirectPage(errorUrl); |
| | | } |
| | | |
| | | if (loginFlag == COMMON_PAGE) { |
| | | //将openId放到redis 缓存,给前段下发临时票据 |
| | | if (errorUrl.indexOf("?") > 0) { |
| | | redirectUrl += ("&openId=" + openId); |
| | | } else { |
| | | redirectUrl += ("?openId=" + openId); |
| | | } |
| | | logger.debug("跳转url:{}", redirectUrl); |
| | | return ResultVo.redirectPage(redirectUrl); |
| | | } |
| | | |
| | | //判断当前openId 是否绑定了业主 |
| | |
| | | |
| | | openUrl = WechatConstant.OPEN_AUTH |
| | | .replace("APPID", smallWeChatDto.getAppId()) |
| | | .replace("SCOPE", "snsapi_userinfo") |
| | | .replace("SCOPE", "snsapi_base") |
| | | .replace( |
| | | "REDIRECT_URL", |
| | | URLEncoder |