From 510ea39b50b73808c233b53114404497079939b5 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Thu, 1 Feb 2024 14:46:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E5=90=8C=E7=A8=8B?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/chint/interfaces/rest/ly/LYPostRequest.java | 9 +++++---- .../java/com/chint/interfaces/rest/ly/LYUserRequest.java | 2 +- .../com/chint/interfaces/rest/ly/dto/LYBaseRequest.java | 1 + .../interfaces/rest/ly/dto/user/EmployeeEntity.java | 2 +- .../interfaces/rest/ly/dto/user/EmployeeRequest.java | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/chint/interfaces/rest/ly/LYPostRequest.java b/src/main/java/com/chint/interfaces/rest/ly/LYPostRequest.java index 19150e05..e1982592 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/LYPostRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ly/LYPostRequest.java @@ -22,15 +22,16 @@ public class LYPostRequest { private String mySecret = L_Y_SECRET; - public T post(String url, LYBaseRequest jsonRequest, Class responseType) { + public T post(String url, LYBaseRequest jsonRequest, Class responseType) { String token = lyTokenRequest.loadToken(); jsonRequest.setRandom(UUID.randomUUID().toString()); jsonRequest.setTimestamp(String.valueOf(System.currentTimeMillis())); jsonRequest.setAccessToken(token); - String postDataMd5 = md5(postRequest.gson().toJson(jsonRequest)); + jsonRequest.setEncrypt(false); + String json = postRequest.gson().toJson(jsonRequest); + String postDataMd5 = md5(json); String finallySign = md5(postDataMd5 + mySecret); - jsonRequest.setSign(finallySign); - return postRequest.post(url, jsonRequest, responseType); + return postRequest.post(url + "?sign=" + finallySign, jsonRequest, responseType); } public static String md5(String input) { diff --git a/src/main/java/com/chint/interfaces/rest/ly/LYUserRequest.java b/src/main/java/com/chint/interfaces/rest/ly/LYUserRequest.java index 741913ea..575b60aa 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/LYUserRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ly/LYUserRequest.java @@ -34,7 +34,7 @@ public class LYUserRequest { EmployeeEntity employeeEntity = user2LYEmployee(currentUser); EmployeeRequest employeeData = new EmployeeRequest(); employeeData.setParam(employeeEntity); - UserResponse post = postRequest.post(userUrl, employeeData, UserResponse.class); + UserResponse post = postRequest.post(userUrl , employeeData, UserResponse.class); return post.isSuccess(); } diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/LYBaseRequest.java b/src/main/java/com/chint/interfaces/rest/ly/dto/LYBaseRequest.java index d0b0d3c2..42ccd876 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/LYBaseRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/LYBaseRequest.java @@ -8,4 +8,5 @@ public class LYBaseRequest { private String random; private String timestamp; private String sign; + private boolean isEncrypt; } diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/user/EmployeeEntity.java b/src/main/java/com/chint/interfaces/rest/ly/dto/user/EmployeeEntity.java index 7399dce9..495ec283 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/user/EmployeeEntity.java +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/user/EmployeeEntity.java @@ -24,7 +24,7 @@ public class EmployeeEntity { private int workingState; private String birthday; private String credentialExpireDate; - private int credentialType; +// private int credentialType; private int addTravellerAllowed; private String employeeCode; private String costCenter; diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/user/EmployeeRequest.java b/src/main/java/com/chint/interfaces/rest/ly/dto/user/EmployeeRequest.java index a793f4c3..9977976c 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/user/EmployeeRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/user/EmployeeRequest.java @@ -7,7 +7,7 @@ import java.util.List; @Data public class EmployeeRequest extends LYBaseRequest { - private boolean isEncrypt; + private EmployeeEntity param; private List costCenterList;