| | |
| | | //解析code |
| | | PersonnelQr personnelQr = PersonnelTool.qrLoginInfo(sysParameter.getParamValue(),employeeQrLogin.getCode()); |
| | | |
| | | logger.info("扫码登录:"+personnelQr.toString()); |
| | | logger.info("企业员工-扫码登录:"+personnelQr.toString()); |
| | | |
| | | if(personnelQr == null){ |
| | | throw new PlatTipsException(PlatformCode.ERROR_TIPS,"人员信息不存在"); |
| | |
| | | |
| | | //获取userId |
| | | net.sf.json.JSONObject oauthObj = com.hx.mp.util.CorpMpUtil.code2Session(sysParameter.getParamValue(),employeeQrLogin.getCode()); |
| | | logger.info("网页登录获取userId,返回数据:"+oauthObj); |
| | | //String errcode = oauthObj.optString("errcode", "");// 有错误的时候才有 |
| | | // String corpId = oauthObj.optString("corpid", "");// 有错误的时候才有 |
| | | // String corpId = oauthObj.optString("corpid", "");// 有错误的时候才有 |
| | | String userId = oauthObj.optString("userid", ""); |
| | | // String sessionKey = oauthObj.optString("session_key"); |
| | | |
| | | logger.info("网页登录获取userId:"+oauthObj); |
| | | // String sessionKey = oauthObj.optString("session_key"); |
| | | |
| | | if (StringUtils.isEmpty(userId)) { |
| | | throw new PlatTipsException(PlatformCode.ERROR_TIPS,"人员没有权限登录"); |
| | |
| | | |
| | | // 查询企业微信员工是否离职 |
| | | WeiXinInfo weiXinInfo = CorpMpUtil.userInfo(userId, sysParameter.getParamValue()); |
| | | logger.info("网页登录,查询企业微信员工是否离职:"+ JSON.toJSONString(weiXinInfo)); |
| | | if (weiXinInfo == null){ |
| | | throw new PlatTipsException(PlatformCode.ERROR_TIPS,"该员工不存在企业微信"); |
| | | } |
| | |
| | | |
| | | //获取openId |
| | | net.sf.json.JSONObject oauthObj = MPWeixinBaseUtil.getJscode2session(applyParameter.getMpAppId(),AesUtil.aesDecryp(applyParameter.getMpSecretKey()),employeeQrLogin.getCode()); |
| | | logger.info("企业员工-网页登录(普通小程序):"+oauthObj); |
| | | String errcode = oauthObj.optString("errcode", "");// 有错误的时候才有 |
| | | String openId = oauthObj.optString("openid", ""); |
| | | //String session_key = oauthObj.optString("session_key"); |
| | | String unionid = oauthObj.optString("unionid", ""); |
| | | |
| | | logger.info("企业员工-网页登录(普通小程序):"+oauthObj); |
| | | if(StringUtils.noNull(errcode)){ |
| | | throw new PlatTipsException(PlatformCode.ERROR_TIPS,"解析code获取用户信息失败"); |
| | | } |
| | |
| | | |
| | | //openId转userId |
| | | OpenIdAUserId openIdAUserId = CorpMpUtil.openIdToUserId(openId,sysParameter.getParamValue()); |
| | | logger.info("企业员工-网页登录openId转userId:"+openIdAUserId); |
| | | logger.info("企业员工-网页登录(普通小程序)openId转userId:"+openIdAUserId); |
| | | if(openIdAUserId.getErrcode() != 0){ |
| | | throw new PlatTipsException(PlatformCode.ERROR_TIPS,openIdAUserId.getErrmsg()); |
| | | } |
| | |
| | | |
| | | // 查询企业微信员工是否离职 |
| | | WeiXinInfo weiXinInfo = CorpMpUtil.userInfo(openIdAUserId.getUserid(), sysParameter.getParamValue()); |
| | | logger.info("企业员工-网页登录查询企业微信员工是否离职:"+JSON.toJSONString(weiXinInfo)); |
| | | if (weiXinInfo == null){ |
| | | throw new PlatTipsException(PlatformCode.ERROR_TIPS,"该员工不存在企业微信"); |
| | | } |