|
@@ -1,5 +1,6 @@
|
|
|
package com.ym.mec.auth.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.dayaedu.cbs.openfeign.wrapper.qrcode.CbsQrCodeScanWrapper;
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
@@ -7,12 +8,12 @@ import com.ym.mec.auth.core.service.CustomTokenServices;
|
|
|
import com.ym.mec.auth.service.SysUserService;
|
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
-import org.json.JSONObject;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@Service
|
|
|
public class CbsQrCodeScanServiceImpl{
|
|
@@ -40,13 +41,14 @@ public class CbsQrCodeScanServiceImpl{
|
|
|
throw new BizException(HttpStatus.UNAUTHORIZED.value(), "用户不存在");
|
|
|
}
|
|
|
//调用登陆接口
|
|
|
- HttpResponseResult<JSONObject> result = sysUserFeignService.smsLogin(phone, "QR_TEACHER", "QR_TEACHER");
|
|
|
+ HttpResponseResult<Map<String,Object>> result = sysUserFeignService.smsLogin(phone, "QR_TEACHER", "QR_TEACHER");
|
|
|
if (result != null){
|
|
|
if(result.getCode() != 200){
|
|
|
throw new BizException("扫码登陆失败", result.getMsg());
|
|
|
}
|
|
|
CbsQrCodeScanWrapper.QrCodeScanToken qrCodeScanToken = new CbsQrCodeScanWrapper.QrCodeScanToken();
|
|
|
- qrCodeScanToken.setTokenData(result.getData().getString("access_token"));
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(result.getData().get("authentication")));
|
|
|
+ qrCodeScanToken.setTokenData(jsonObject.getString("access_token"));
|
|
|
return qrCodeScanToken;
|
|
|
}
|
|
|
throw new BizException("扫码登陆失败", "调用登陆接口失败");
|