From f9757165e416d13a3b011cc429c1f12c8a758330 Mon Sep 17 00:00:00 2001 From: zth <1205836521@qq.com> Date: Thu, 2 Jan 2025 18:55:06 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E5=9B=9E=E5=BD=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/kms/config/WaterRequestUtil.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/jwtech-admin/src/main/java/com/kms/config/WaterRequestUtil.java b/jwtech-admin/src/main/java/com/kms/config/WaterRequestUtil.java index aa1c9058..ac766e4a 100644 --- a/jwtech-admin/src/main/java/com/kms/config/WaterRequestUtil.java +++ b/jwtech-admin/src/main/java/com/kms/config/WaterRequestUtil.java @@ -110,9 +110,11 @@ public class WaterRequestUtil { private void setHead(HttpRequest httpRequest,String serviceId,String appsecret){ String timestamp = String.valueOf(new Date().getTime()); String tifTimestamp = String.valueOf(new Date().getTime() / 1000); - String nonce = IdUtil.fastSimpleUUID(); - String tifSignature = tifTimestamp + tifToken + nonce + tifTimestamp; - String tspSignature = tifTimestamp + tspToken + nonce + tifTimestamp; + String tspTimestamp = String.valueOf(new Date().getTime() / 1000); + String nonceTif = IdUtil.fastSimpleUUID(); + String nonceTsp = IdUtil.fastSimpleUUID(); + String tifSignature = tifTimestamp + tifToken + nonceTif + tifTimestamp; + String tspSignature = tspTimestamp + tspToken + nonceTsp + tspTimestamp; // System.out.println(signature); try { tifSignature = SHACoder.encodeSHA256Hex(tifSignature).toUpperCase(); @@ -124,14 +126,14 @@ public class WaterRequestUtil { httpRequest .header("x-tsp-paasid",tspPaasId) .header("x-tsp-signature",tspSignature) - .header("x-tsp-timestamp",tifTimestamp) - .header("x-tsp-nonce", nonce) + .header("x-tsp-timestamp",tspTimestamp) + .header("x-tsp-nonce", nonceTsp) .header("x-tif-paasid",tifPaasId) .header("x-tif-signature",tifSignature) .header("x-tif-timestamp",tifTimestamp) - .header("x-tif-nonce",nonce) - .header("x-tsp-serviceid",serviceId) - .header("x-tsp-appsecret",appsecret); + .header("x-tif-nonce",nonceTif); +// .header("x-tsp-serviceid",serviceId) +// .header("x-tsp-appsecret",appsecret); } @@ -162,6 +164,7 @@ public class WaterRequestUtil { HttpResponse response = post.body(JSONObject.toJSONString(query)) .execute(); String body = response.body(); + System.out.println(body); WaterResult waterResult = JSONObject.parseObject(body, WaterResult.class); isSuccess(waterResult); //{ @@ -203,6 +206,7 @@ public class WaterRequestUtil { .header("x-tsp-uid", userId) .execute(); String body = response.body(); + System.out.println(body); return JSONObject.parseObject(body,WaterResult.class); } @@ -218,6 +222,7 @@ public class WaterRequestUtil { HttpResponse response = get.header("Authorization", authorization) .execute(); String body = response.body(); + System.out.println(body); WaterResult waterResult = JSONObject.parseObject(body, WaterResult.class); isSuccess(waterResult); return waterResult; @@ -234,6 +239,7 @@ public class WaterRequestUtil { HttpResponse response = get.body(JSONObject.toJSONString(hashMap)) .execute(); String body = response.body(); + System.out.println(tifToken+body); WaterResult waterResult = JSONObject.parseObject(body, WaterResult.class); isSuccess(waterResult); //{ @@ -278,6 +284,7 @@ public class WaterRequestUtil { HttpResponse response = get.body(JSONObject.toJSONString(hashMap)) .execute(); String body = response.body(); + System.out.println(tifToken+body); WaterResult waterResult = JSONObject.parseObject(body, WaterResult.class); 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}