|
|
@ -10,6 +10,7 @@ import com.dingtalk.api.response.OapiGettokenResponse; |
|
|
|
import com.dingtalk.api.response.OapiSnsGetuserinfoBycodeResponse; |
|
|
|
import com.dingtalk.api.response.OapiUserGetbyunionidResponse; |
|
|
|
import com.dingtalk.api.response.OapiV2UserGetResponse; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.taobao.api.ApiException; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestMethod; |
|
|
@ -30,8 +31,8 @@ public class DingdingLoginController { |
|
|
|
* @return |
|
|
|
* @throws Exception ServiceResult<Map<String,Object>> 2020-11-4 |
|
|
|
*/ |
|
|
|
@RequestMapping(value = "/getUserInfo", method = RequestMethod.GET) |
|
|
|
public String getDdScan(@RequestParam("code") String code) throws Exception { |
|
|
|
@RequestMapping(value = "/auth", method = RequestMethod.GET) |
|
|
|
public Result<String> getDdScan(@RequestParam("code") String code) throws Exception { |
|
|
|
// 获取access_token,注意正式代码要有异常流处理
|
|
|
|
String access_token = this.getToken(); |
|
|
|
|
|
|
@ -58,7 +59,7 @@ public class DingdingLoginController { |
|
|
|
//reqGetRequest.setLang("zh_CN");
|
|
|
|
OapiV2UserGetResponse rspGetResponse = clientDingTalkClient2.execute(reqGetRequest, access_token); |
|
|
|
System.out.println(rspGetResponse.getBody()); |
|
|
|
return rspGetResponse.getBody(); |
|
|
|
return new Result<String>().ok(rspGetResponse.getBody()); |
|
|
|
} |
|
|
|
private String getToken() throws RuntimeException { |
|
|
|
try { |
|
|
|