2
13693261870
2022-09-16 653761a31dfeb50dd3d007e892d69c90bf0cdafc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//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();
//    }
//}