From 5a2dab3704b5fa53fd46d8bd7c2037e36773d02e Mon Sep 17 00:00:00 2001 From: ZZ Date: Mon, 18 Jul 2022 15:04:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E6=97=B6=E6=8E=A8=E9=80=81:=E9=81=BF?= =?UTF-8?q?=E5=85=8Dsoc=E8=B6=85=E8=BF=87100;Base64=E7=BC=96=E7=A0=81:?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E7=BB=91=E5=AE=9Ajdk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notification/NotificationEquipChargeStatusTask.java | 2 +- xhpc-modules/xhpc-order/pom.xml | 6 ++++++ .../src/main/java/com/xhpc/order/intella/IntellaTest.java | 7 +++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationEquipChargeStatusTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationEquipChargeStatusTask.java index 1117a0d9..db7b51c0 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationEquipChargeStatusTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationEquipChargeStatusTask.java @@ -74,7 +74,7 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher { equipChargeStatus.setCurrentA(REDIS.getCacheMapValue(gunkey, "current")); equipChargeStatus.setVoltageA(REDIS.getCacheMapValue(gunkey, "voltage")); Integer soc = REDIS.getCacheMapValue(orderkey, "endSoc"); - equipChargeStatus.setSoc(soc == null ? 0.0 : Double.valueOf(soc.toString())); + equipChargeStatus.setSoc(soc == null ? 0.0 : (double) (soc > 100 ? 100 : soc)); CacheRealtimeData lord = REDIS.getCacheObject(orderkey.concat(".lord")); String lordTime; if (lord != null) { diff --git a/xhpc-modules/xhpc-order/pom.xml b/xhpc-modules/xhpc-order/pom.xml index fd727c73..865a126e 100644 --- a/xhpc-modules/xhpc-order/pom.xml +++ b/xhpc-modules/xhpc-order/pom.xml @@ -114,6 +114,12 @@ 7.5 test + + org.testng + testng + 7.5 + compile + diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/intella/IntellaTest.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/intella/IntellaTest.java index f78a8f1d..f525fa6c 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/intella/IntellaTest.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/intella/IntellaTest.java @@ -10,7 +10,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; import org.testng.annotations.Test; -import com.sun.org.apache.xml.internal.security.utils.Base64; +import org.apache.commons.codec.binary.Base64; import javax.crypto.SecretKey; import java.io.File; import java.io.FileInputStream; @@ -190,12 +190,11 @@ public class IntellaTest { String signStr = respObject.getString("Sign").replaceAll("\\u003d", "="); Object object1 = respObject.remove("Sign"); -// String decodeStr = Base64.decodeStr(signStr); System.out.println(respObject); - File der = new File("D:\\intella\\pub.der"); + File der = new File("C:\\intella\\pub.der"); InputStream is = new FileInputStream(der); PublicKey rsaPubKey = KeyReader.loadPublicKeyFromDER(is); - boolean flag= RsaCryptoUtil.verify(Base64.decode(signStr), sss.getBytes(StandardCharsets.UTF_8), rsaPubKey); + boolean flag= RsaCryptoUtil.verify(Base64.decodeBase64(signStr), sss.getBytes(StandardCharsets.UTF_8), rsaPubKey); System.out.println(flag); }