public OAuthV2 queryAccountToken(String accountId) {
    // 取数据库中的accesToken和openId
    SocialUserAccountInfo tok =
        socialUserAccountInfoService.findAccountOfInfoByKey(DictDef.dict("accessToken"), accountId);
    String assessToken = tok.getValue();
    SocialUserAccountInfo openIdInfo =
        socialUserAccountInfoService.findAccountOfInfoByKey(DictDef.dict("openId"), accountId);
    String openId = openIdInfo.getValue();

    OAuthV2 oAuth = TencentSociaTool.getQQAuthV2();
    oAuth.setAccessToken(assessToken);
    oAuth.setOpenid(openId);
    return oAuth;
  }
  @Override
  public Map queryUserInfoByCode(String code, String openid, String openkey) {
    HashMap map = new HashMap();
    OAuthV2 oAuth = TencentSociaTool.getQQAuthV2();
    oAuth.setAuthorizeCode(code);
    oAuth.setOpenid(openid);
    oAuth.setOpenkey(openkey);

    String accessToken = null, userOpenID = null;
    long tokenExpireIn = 0L;

    // 换取access token
    oAuth.setGrantType("authorize_code");
    try {
      OAuthV2Client.accessToken(oAuth);
    } catch (Exception e1) {
      e1.printStackTrace();
    }

    // 检查是否正确取得access token
    if (oAuth.getStatus() == 3) {
      System.out.println("Get Access Token failed!");
      return null;
    }

    UserAPI userAPI = new UserAPI(oAuth.getOauthVersion());
    String userInfoJson = "";
    try {
      userInfoJson = userAPI.info(oAuth, "json");
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    Object userInfoObject = TencentSociaTool.getJsonDataObject(userInfoJson);
    if (judgeNull(userInfoObject)) {
      return null;
    }

    JSONObject userInfo = ((JSONObject) userInfoObject);
    map.put("user", userInfo);
    map.put("token", accessToken);
    map.put("oAuth", oAuth);
    map.put("code", code);
    return map;
  }