钉钉免登接口登陆
String code=request.getParameter("code");
if(StringUtil.isNotEmpty(code)) {
String url = "https://oapi.dingtalk.com/gettoken?appkey=&appsecret=";
JSONObject resp= JwtHttpUtil.httpRequest(url, "GET", null,null);
String accesstoken=resp.get("access_token").toString();
System.out.println(accesstoken+";;"+code);
JSONObject jb=new JSONObject();
jb.put("code", code);
String url1 = "https://oapi.dingtalk.com/topapi/v2/user/getuserinfo?access_token="+accesstoken;
JSONObject resp1= JwtHttpUtil.httpRequest(url1, "POST", jb.toString(),null);
JSONObject jb1=(JSONObject) resp1.get("result");
String name=jb1.get("name").toString();
String id=jeecgMinidaoDao.getUsername(name);
user=systemService.getEntity(TSUser.class, id);
String sql="select org_id from \n" +
" t_s_user_org where user_id='"+id+"'";
String departid= jdbcTemplate.queryForObject(sql, String.class);
userService.saveLoginUserInfo(request, user, departid);
request.getSession().setAttribute("lang", "zh-cn");
System.out.println(resp1.get("result").toString());
}