|
@ -110,9 +110,11 @@ public class WaterRequestUtil { |
|
|
private void setHead(HttpRequest httpRequest,String serviceId,String appsecret){ |
|
|
private void setHead(HttpRequest httpRequest,String serviceId,String appsecret){ |
|
|
String timestamp = String.valueOf(new Date().getTime()); |
|
|
String timestamp = String.valueOf(new Date().getTime()); |
|
|
String tifTimestamp = String.valueOf(new Date().getTime() / 1000); |
|
|
String tifTimestamp = String.valueOf(new Date().getTime() / 1000); |
|
|
String nonce = IdUtil.fastSimpleUUID(); |
|
|
String tspTimestamp = String.valueOf(new Date().getTime() / 1000); |
|
|
String tifSignature = tifTimestamp + tifToken + nonce + tifTimestamp; |
|
|
String nonceTif = IdUtil.fastSimpleUUID(); |
|
|
String tspSignature = tifTimestamp + tspToken + nonce + tifTimestamp; |
|
|
String nonceTsp = IdUtil.fastSimpleUUID(); |
|
|
|
|
|
String tifSignature = tifTimestamp + tifToken + nonceTif + tifTimestamp; |
|
|
|
|
|
String tspSignature = tspTimestamp + tspToken + nonceTsp + tspTimestamp; |
|
|
// System.out.println(signature);
|
|
|
// System.out.println(signature);
|
|
|
try { |
|
|
try { |
|
|
tifSignature = SHACoder.encodeSHA256Hex(tifSignature).toUpperCase(); |
|
|
tifSignature = SHACoder.encodeSHA256Hex(tifSignature).toUpperCase(); |
|
@ -124,14 +126,14 @@ public class WaterRequestUtil { |
|
|
httpRequest |
|
|
httpRequest |
|
|
.header("x-tsp-paasid",tspPaasId) |
|
|
.header("x-tsp-paasid",tspPaasId) |
|
|
.header("x-tsp-signature",tspSignature) |
|
|
.header("x-tsp-signature",tspSignature) |
|
|
.header("x-tsp-timestamp",tifTimestamp) |
|
|
.header("x-tsp-timestamp",tspTimestamp) |
|
|
.header("x-tsp-nonce", nonce) |
|
|
.header("x-tsp-nonce", nonceTsp) |
|
|
.header("x-tif-paasid",tifPaasId) |
|
|
.header("x-tif-paasid",tifPaasId) |
|
|
.header("x-tif-signature",tifSignature) |
|
|
.header("x-tif-signature",tifSignature) |
|
|
.header("x-tif-timestamp",tifTimestamp) |
|
|
.header("x-tif-timestamp",tifTimestamp) |
|
|
.header("x-tif-nonce",nonce) |
|
|
.header("x-tif-nonce",nonceTif); |
|
|
.header("x-tsp-serviceid",serviceId) |
|
|
// .header("x-tsp-serviceid",serviceId)
|
|
|
.header("x-tsp-appsecret",appsecret); |
|
|
// .header("x-tsp-appsecret",appsecret);
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -162,6 +164,7 @@ public class WaterRequestUtil { |
|
|
HttpResponse response = post.body(JSONObject.toJSONString(query)) |
|
|
HttpResponse response = post.body(JSONObject.toJSONString(query)) |
|
|
.execute(); |
|
|
.execute(); |
|
|
String body = response.body(); |
|
|
String body = response.body(); |
|
|
|
|
|
System.out.println(body); |
|
|
WaterResult waterResult = JSONObject.parseObject(body, WaterResult.class); |
|
|
WaterResult waterResult = JSONObject.parseObject(body, WaterResult.class); |
|
|
isSuccess(waterResult); |
|
|
isSuccess(waterResult); |
|
|
//{
|
|
|
//{
|
|
@ -203,6 +206,7 @@ public class WaterRequestUtil { |
|
|
.header("x-tsp-uid", userId) |
|
|
.header("x-tsp-uid", userId) |
|
|
.execute(); |
|
|
.execute(); |
|
|
String body = response.body(); |
|
|
String body = response.body(); |
|
|
|
|
|
System.out.println(body); |
|
|
return JSONObject.parseObject(body,WaterResult.class); |
|
|
return JSONObject.parseObject(body,WaterResult.class); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -218,6 +222,7 @@ public class WaterRequestUtil { |
|
|
HttpResponse response = get.header("Authorization", authorization) |
|
|
HttpResponse response = get.header("Authorization", authorization) |
|
|
.execute(); |
|
|
.execute(); |
|
|
String body = response.body(); |
|
|
String body = response.body(); |
|
|
|
|
|
System.out.println(body); |
|
|
WaterResult waterResult = JSONObject.parseObject(body, WaterResult.class); |
|
|
WaterResult waterResult = JSONObject.parseObject(body, WaterResult.class); |
|
|
isSuccess(waterResult); |
|
|
isSuccess(waterResult); |
|
|
return waterResult; |
|
|
return waterResult; |
|
@ -234,6 +239,7 @@ public class WaterRequestUtil { |
|
|
HttpResponse response = get.body(JSONObject.toJSONString(hashMap)) |
|
|
HttpResponse response = get.body(JSONObject.toJSONString(hashMap)) |
|
|
.execute(); |
|
|
.execute(); |
|
|
String body = response.body(); |
|
|
String body = response.body(); |
|
|
|
|
|
System.out.println(tifToken+body); |
|
|
WaterResult waterResult = JSONObject.parseObject(body, WaterResult.class); |
|
|
WaterResult waterResult = JSONObject.parseObject(body, WaterResult.class); |
|
|
isSuccess(waterResult); |
|
|
isSuccess(waterResult); |
|
|
//{
|
|
|
//{
|
|
@ -278,6 +284,7 @@ public class WaterRequestUtil { |
|
|
HttpResponse response = get.body(JSONObject.toJSONString(hashMap)) |
|
|
HttpResponse response = get.body(JSONObject.toJSONString(hashMap)) |
|
|
.execute(); |
|
|
.execute(); |
|
|
String body = response.body(); |
|
|
String body = response.body(); |
|
|
|
|
|
System.out.println(tifToken+body); |
|
|
WaterResult waterResult = JSONObject.parseObject(body, WaterResult.class); |
|
|
WaterResult waterResult = JSONObject.parseObject(body, WaterResult.class); |
|
|
isSuccess(waterResult); |
|
|
isSuccess(waterResult); |
|
|
//{\"total\":1,\"size\":100,\"records\":[{\"area\":\"440000\",\"systemList\":[{\"area\":\"440000\",\"code\":\"sgc-jg\",\"name\":\"水工程应用-水利工程建设管理模块\",\"id\":\"1732648267643097090\"}],\"code\":\"YW00013\",\"level\":\"1d\",\"dataConfig\":\"none\",\"type\":\"BUSINESS\",\"posts\":[],\"users\":[{\"id\":\"20231225000006\"},{\"id\":\"20240119000002\"}],\"name\":\"水利工程应用-水利工程建设管理模块角色\",\"id\":\"20231213000001\",\"category\":\"BUSINESS\",\"businesses\":[{\"parent\":\"1762458920822599682\",\"businessCode\":\"YWSLGCJSGL0008\",\"parentName\":\"水利工程建设管理\",\"businessName\":\"水利工程建设管理\",\"description\":\"\",\"id\":\"1705128209926942721\",\"delFlag\":0}],\"status\":\"1\"}],\"page\":1}
|
|
|
//{\"total\":1,\"size\":100,\"records\":[{\"area\":\"440000\",\"systemList\":[{\"area\":\"440000\",\"code\":\"sgc-jg\",\"name\":\"水工程应用-水利工程建设管理模块\",\"id\":\"1732648267643097090\"}],\"code\":\"YW00013\",\"level\":\"1d\",\"dataConfig\":\"none\",\"type\":\"BUSINESS\",\"posts\":[],\"users\":[{\"id\":\"20231225000006\"},{\"id\":\"20240119000002\"}],\"name\":\"水利工程应用-水利工程建设管理模块角色\",\"id\":\"20231213000001\",\"category\":\"BUSINESS\",\"businesses\":[{\"parent\":\"1762458920822599682\",\"businessCode\":\"YWSLGCJSGL0008\",\"parentName\":\"水利工程建设管理\",\"businessName\":\"水利工程建设管理\",\"description\":\"\",\"id\":\"1705128209926942721\",\"delFlag\":0}],\"status\":\"1\"}],\"page\":1}
|
|
|