//package com.landtool.lanbase.modules.api.utils;
|
//
|
//import com.alibaba.fastjson.JSON;
|
//import com.alibaba.fastjson.JSONArray;
|
//import com.alibaba.fastjson.JSONObject;
|
//
|
//import com.landtool.lanbase.common.utils.HttpContextUtils;
|
//import com.landtool.lanbase.common.utils.HttpOperateUtils;
|
//import com.landtool.lanbase.config.SysTemPropertyConfig;
|
//import com.landtool.lanbase.modules.org.entity.OrgUnitJoinRegion;
|
//import com.landtool.lanbase.modules.org.entity.OrgUserJoinUnit;
|
//import com.landtool.lanbase.modules.sys.entity.SysFieldvalue;
|
//
|
//import javax.servlet.http.HttpServletRequest;
|
//import java.io.IOException;
|
//
|
//
|
///**
|
// * 获取登录用户信息
|
// * @return Json 字符串
|
// */
|
//
|
//public class GetUserInfo {
|
//
|
// //查询用户信息
|
// public static OrgUserJoinUnit getUser(SysTemPropertyConfig sysConfig, String username) {
|
// String url = sysConfig.getApiServer() + "/api/org/user/getInfoByName/" + username;
|
// return getOrgUserJoinUnit(url);
|
// }
|
//
|
// //后台查询用户信息
|
// private static OrgUserJoinUnit getOrgUserJoinUnit(String url) {
|
// OrgUserJoinUnit user = null;
|
// try {
|
// user = HttpOperateUtils.getJsonObject(url, OrgUserJoinUnit.class);
|
// } catch (IOException e) {
|
// e.printStackTrace();
|
// }
|
// return user;
|
// }
|
//
|
// //根据用户id来查询
|
// public static OrgUserJoinUnit getUserId(SysTemPropertyConfig sysConfig, String id) {
|
// String url = sysConfig.getApiServer() + "/api/org/user/getInfoById/" + id;
|
// return getOrgUserJoinUnit(url);
|
// }
|
//
|
// //后台查询用户信息
|
// private static OrgUnitJoinRegion getOrgUnitJoinRegion(String url) {
|
// OrgUnitJoinRegion unit = null;
|
// try {
|
// unit = HttpOperateUtils.getJsonObject(url, OrgUnitJoinRegion.class);
|
// } catch (IOException e) {
|
// e.printStackTrace();
|
// }
|
// return unit;
|
// }
|
//
|
// //查询单位id对应的单位
|
// public static OrgUnitJoinRegion getUnitname(SysTemPropertyConfig sysConfig, int unitid) {
|
// String url = sysConfig.getApiServer() + "/api/org/unit/getInfoById/" + unitid;
|
// return getOrgUnitJoinRegion(url);
|
// }
|
//
|
//
|
// //获取当前登录人id name 还有对应的单位id name
|
//
|
// public static String getUserAndUnid(SysTemPropertyConfig sysConfig) {
|
// OrgUserJoinUnit user = getUser(sysConfig);
|
// String unid = user.getOrguserunits().get(0).getUnitid().toString(); //((JSONObject) jsarr.get(0)).get("unitid").toString();
|
// String unitname = user.getOrguserunits().get(0).getUnitname(); //obj1.getString("unitname");
|
// return "{'userid': '" + user.getUserid() + "','loginname': '" + user.getChinesename() + "','unid': '" + unid + "','unitname': '" + unitname + "'}";
|
//
|
// }
|
//
|
// public static String findUserByWord(String RootUrl, String keyWord) {
|
//
|
//
|
// FieldUtils fieldUtils = new FieldUtils();
|
// String url = RootUrl + "api/org/user/findUserByWord/" + keyWord;
|
// String username = null;
|
// try {
|
// username = HttpOperateUtils.httpGet(url);
|
// } catch (IOException e) {
|
// e.printStackTrace();
|
// }
|
// StringBuilder Json = new StringBuilder();
|
// Json.append(username);
|
// System.out.print("test:==============" + Json.toString());
|
//
|
// return Json.toString();
|
// }
|
//}
|