第一步:单点登入
一、创建SSO配置,请参考组织管理里中的SSO管理
二、通过下面代码获取token接
接口:http://127.0.0.1:20020/x_organization_assemble_authentication/jaxrs/sso
String token = "";
//单点登入
String path = "
http://127.0.0.1:20020/x_organization_assemble_authentication/jaxrs/sso
";
long time = new Date().getTime();
String login_uid = "test";
String sso_key = "12345678";
String xtoken = null;
try { xtoken = Crypto.encrypt( login_uid + "#" + time, sso_key );
System.out.println(xtoken); }
catch (Exception e1) {
e1.printStackTrace();
}
String string = "{\"token\": "+xtoken+", \"client\": \"unicom\"}";
String str = HttpClientUtils.getInstance().sendPost(path,string);
try {
JSONObject jsonObj = (JSONObject)(new JSONParser().parse(str));
// System.out.println(jsonObj.toJSONString() + "\n" + jsonObj.getClass());
JSONObject data = (JSONObject) jsonObj.get("data");
System.out.println(data.get("token"));
token = (String) data.get("token");
} catch (ParseException e) {
e.printStackTrace();
}
第二步:获取待办列表
//获取待办数
http://127.0.0.1:20020/x_processplatform_assemble_surface/jaxrs/work/count/%E6%88%91@9938@P;
%E6%88%91@9938@P 为参数名
//获取待办列表
http://127.0.0.1:20020/x_processplatform_assemble_surface/jaxrs/task/list/(0)/next/"+count
(0) 为开始参数名
count为几条参数名
Map headMap = new HashMap();
headMap.put("x-token", token);
headMap.put("accept", "/");
headMap.put("connection", "Keep-Alive");
headMap.put("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
//获取待办数
String count = "0";
String url = "http://127.0.0.1:20020/x_processplatform_assemble_surface/jaxrs/work/count/%E6%88%91@9938@P";
HttpClientUtils2 httpClientUtils = new HttpClientUtils2();
str = httpClientUtils.httpGet(url,headMap);
try {
JSONObject jsonObj = (JSONObject)(new JSONParser().parse(str));
JSONObject data = (JSONObject) jsonObj.get("data");
count = data.get("task").toString();
System.out.println("count=" + count);
} catch (ParseException e) {
e.printStackTrace();
}
//获取待办列表
url = "http://127.0.0.1:20020/x_processplatform_assemble_surface/jaxrs/task/list/(0)/next/"+count;
str = httpClientUtils.httpGet(url,headMap);
try {
JSONObject jsonObj = (JSONObject)(new JSONParser().parse(str));
JSONArray datas = (JSONArray) jsonObj.get("data");
for(int i =0;i"work"