public void updateSocialUserAccountByThird(
     SocialUserAccount socialUserAccount, JSONObject userInfo) {
   String name = userInfo.getString("name");
   String nick = userInfo.getString("nick");
   String uid = userInfo.getString("openid");
   String url = userInfo.getString("homepage");
   socialUserAccount.setWeiboUid(uid);
   socialUserAccount.setName(name);
   socialUserAccount.setUrl(url);
   socialUserAccount.setUserScreenName(nick);
   socialUserAccount.setType(getSocialTypeInt());
   socialUserAccountService.updateSocialUserAccount(socialUserAccount);
 }
  public SocialUserAccount addSocialUserAccountByThird(
      org.activiti.engine.identity.User user, JSONObject userInfo) {
    String name = userInfo.getString("name");
    String nick = userInfo.getString("nick");
    String uid = userInfo.getString("openid");
    String url = userInfo.getString("homepage");

    SocialUserAccount socialUserAccount = new SocialUserAccount();
    socialUserAccount.setWeiboUid(uid);
    socialUserAccount.setName(name);
    socialUserAccount.setUrl(url);
    socialUserAccount.setUserScreenName(nick);
    socialUserAccount.setType(getSocialTypeInt());
    socialUserAccount.setOwnUser(user.getId());
    socialUserAccountService.createSocialUserAccount(socialUserAccount);
    return socialUserAccount;
  }
 @Override
 public org.activiti.engine.identity.User handlerUserAuthorize(Map map) {
   OAuthV2 oAuth = (OAuthV2) map.get("oAuth");
   JSONObject userInfo = (JSONObject) map.get("user");
   org.activiti.engine.identity.User retUser = null;
   try {
     SocialUserAccountQuery query = getQuery(userInfo);
     List<SocialUserAccount> list =
         socialUserAccountService.findSocialUserAccountByQueryCriteria(query, null);
     if (list != null && list.size() > 0) {
       SocialUserAccount c = list.get(0);
       retUser = updateSocialInfo(c, userInfo, oAuth);
     } else {
       // retUser = addSocialInfo(userInfo, oAuth);
     }
   } catch (Exception e) {
     throw new ApplicationException(e.getMessage());
   }
   return retUser;
 }