实时推送:避免soc超过100;Base64编码:避免绑定jdk

This commit is contained in:
ZZ 2022-07-18 15:04:20 +08:00
parent 0763d92cf8
commit 5a2dab3704
3 changed files with 10 additions and 5 deletions

View File

@ -74,7 +74,7 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher {
equipChargeStatus.setCurrentA(REDIS.getCacheMapValue(gunkey, "current")); equipChargeStatus.setCurrentA(REDIS.getCacheMapValue(gunkey, "current"));
equipChargeStatus.setVoltageA(REDIS.getCacheMapValue(gunkey, "voltage")); equipChargeStatus.setVoltageA(REDIS.getCacheMapValue(gunkey, "voltage"));
Integer soc = REDIS.getCacheMapValue(orderkey, "endSoc"); 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")); CacheRealtimeData lord = REDIS.getCacheObject(orderkey.concat(".lord"));
String lordTime; String lordTime;
if (lord != null) { if (lord != null) {

View File

@ -114,6 +114,12 @@
<version>7.5</version> <version>7.5</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.5</version>
<scope>compile</scope>
</dependency>
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>org.apache.poi</groupId>--> <!-- <groupId>org.apache.poi</groupId>-->

View File

@ -10,7 +10,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson; import com.google.gson.Gson;
import org.testng.annotations.Test; 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 javax.crypto.SecretKey;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
@ -190,12 +190,11 @@ public class IntellaTest {
String signStr = respObject.getString("Sign").replaceAll("\\u003d", "="); String signStr = respObject.getString("Sign").replaceAll("\\u003d", "=");
Object object1 = respObject.remove("Sign"); Object object1 = respObject.remove("Sign");
// String decodeStr = Base64.decodeStr(signStr);
System.out.println(respObject); 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); InputStream is = new FileInputStream(der);
PublicKey rsaPubKey = KeyReader.loadPublicKeyFromDER(is); 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); System.out.println(flag);
} }