新增同步用户数据并带参数
This commit is contained in:
@@ -69,6 +69,51 @@ public class SyncUserService {
|
||||
return json;
|
||||
}
|
||||
|
||||
public List<String> syncFotonUser2(Long chuo)throws Exception{
|
||||
String appuser = "app_slrs";
|
||||
String appkey = "Fxi5LHbI5yGbQQDpVp86GcCdXeC5Bjfe";
|
||||
AuthUtils util = new AuthUtils(appuser, appkey, null);
|
||||
|
||||
List<String> json=new ArrayList<>();
|
||||
byte[] cookie = null;
|
||||
do {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("cookie", Base64.encodeBase64String(cookie));
|
||||
params.put("timestamp", chuo);
|
||||
|
||||
// 用户参数
|
||||
params.put("filter", "(userid=*)");
|
||||
params.put("basedn", "ou=People,o=foton.com.cn,o=isp");
|
||||
System.out.println("RequestBody:" + params.toString());
|
||||
// 用户测试
|
||||
String rs = util.getResponseFromServer("http://idmsync.foton.com.cn/rest/users/getUserList", params);
|
||||
log.debug(rs);
|
||||
JSONObject responseStr = JSON.parseObject(rs);
|
||||
if(responseStr.containsKey("status") && responseStr.getBoolean("status")){
|
||||
json.add(rs);
|
||||
}
|
||||
if (responseStr.containsKey("cookie")) {
|
||||
try {
|
||||
JSONArray entries = responseStr.getJSONArray("cookie");
|
||||
if(entries==null){
|
||||
break;
|
||||
}
|
||||
cookie = new byte[entries.size()];
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
cookie[i] = (byte) entries.getByte(i);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
if (e.getMessage().contains("is not a JSONArray")) {
|
||||
cookie = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} while (cookie != null);
|
||||
return json;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<String> syncFotonOrg()throws Exception{
|
||||
|
||||
Reference in New Issue
Block a user