diff --git a/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/DTOJsonHelper.java b/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/DTOJsonHelper.java index 075c4037..9e489cab 100644 --- a/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/DTOJsonHelper.java +++ b/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/DTOJsonHelper.java @@ -32,7 +32,7 @@ public class DTOJsonHelper { try { CommonResponse commonResponse = JSONUtil.readParams(responseBody, CommonResponse.class); String data = (String) commonResponse.getData(); - if (authSecretToken != null) { + if (authSecretToken != null && !data.isEmpty()) { data = Aes128Cbc.decryptString(data, authSecretToken.getDataSecret(), authSecretToken.getDataSecretIV()); } if (!data.isEmpty()) { diff --git a/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/StartChargeRequest.java b/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/StartChargeRequest.java index d0234ea2..04ca8bde 100644 --- a/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/StartChargeRequest.java +++ b/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/StartChargeRequest.java @@ -2,15 +2,11 @@ package com.xhpc.evcs.dto; import com.fasterxml.jackson.annotation.*; -import lombok.Getter; -import lombok.Setter; +import java.util.HashMap; import java.util.Map; -@Getter -@Setter -@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE, - setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE) +@JsonInclude(JsonInclude.Include.NON_EMPTY) public class StartChargeRequest { @JsonProperty("StartChargeSeq") @@ -38,7 +34,7 @@ public class StartChargeRequest { String userId3rdpty; @JsonIgnore - private Map additionalProperties; + private Map additionalProperties = new HashMap(); @JsonAnyGetter public Map getAdditionalProperties() { @@ -52,4 +48,100 @@ public class StartChargeRequest { this.additionalProperties.put(name, value); } + @JsonProperty("StartChargeSeq") + public String getStartChargeSeq() { + + return startChargeSeq; + } + + @JsonProperty("StartChargeSeq") + public void setStartChargeSeq(String startChargeSeq) { + + this.startChargeSeq = startChargeSeq; + } + + @JsonProperty("ConnectorID") + public String getConnectorId() { + + return connectorId; + } + + @JsonProperty("ConnectorID") + public void setConnectorId(String connectorId) { + + this.connectorId = connectorId; + } + + @JsonProperty("QRCode") + public String getqRCode() { + + return qRCode; + } + + @JsonProperty("QRCode") + public void setqRCode(String qRCode) { + + this.qRCode = qRCode; + } + + @JsonProperty("PlateNum") + public String getPlateNum() { + + return plateNum; + } + + @JsonProperty("PlateNum") + public void setPlateNum(String plateNum) { + + this.plateNum = plateNum; + } + + @JsonProperty("CarPlateNo") + public String getPlateNum2() { + + return plateNum2; + } + + @JsonProperty("CarPlateNo") + public void setPlateNum2(String plateNum2) { + + this.plateNum2 = plateNum2; + } + + @JsonProperty("ChargingAmt") + public Integer getChargingAmt() { + + return chargingAmt; + } + + @JsonProperty("ChargingAmt") + public void setChargingAmt(Integer chargingAmt) { + + this.chargingAmt = chargingAmt; + } + + @JsonProperty("driverId") + public String getDriverId() { + + return driverId; + } + + @JsonProperty("driverId") + public void setDriverId(String driverId) { + + this.driverId = driverId; + } + + @JsonProperty("UserId") + public String getUserId3rdpty() { + + return userId3rdpty; + } + + @JsonProperty("UserId") + public void setUserId3rdpty(String userId3rdpty) { + + this.userId3rdpty = userId3rdpty; + } + } diff --git a/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/encryption/Aes128Cbc.java b/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/encryption/Aes128Cbc.java index 92143222..546d4306 100644 --- a/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/encryption/Aes128Cbc.java +++ b/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/encryption/Aes128Cbc.java @@ -61,8 +61,9 @@ public class Aes128Cbc { NoSuchAlgorithmException, IllegalBlockSizeException, UnsupportedEncodingException, NoSuchPaddingException, InvalidKeyException { - System.out.println(decryptString("L+FOSPaN073SDRBNMqKBAQ==", - "ojs67l46z3f7rhok", "tet9swfkyojkhaos" + System.out.println(decryptString("gbmqQAsXVr/c1cvxNkxog7GXLZMMLEp9vGV3O/aW60ZkWNzFsLkwMd0tqb7nU6SKR0QrNL9n" + + "+ayJRaL0LTjPRA==", + "8LpncubmWiPCzY3V", "av6A8QdnRaVRMXu6" )); //ujNoGsWRo5MyPKYOxeofKwgPEng3xF+yhM8DDjwtwHo= System.out.println(encrypt("{\"StationIDs\":[\"1\"]}", "8LpncubmWiPCzY3V", "av6A8QdnRaVRMXu6")); diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStationStatusTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStationStatusTask.java index 17f89db7..87794498 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStationStatusTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStationStatusTask.java @@ -110,7 +110,7 @@ public class NotificationStationStatusTask extends CoreDispatcher { connectorStatusInfo.getOperatorID()); EvcsStatus status = DTOJsonHelper.parseResponseData(responseBody, EvcsStatus.class, authSecretTokenOut); if (status == null || status.getStatus() != 0) { - log.error(String.format("push CD notification connector[%s] failed: %s", + log.error(String.format("push station status connector[%s] failed: %s", connectorStatusInfo.getConnectorID(), responseBody)); } return status; diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RegisterLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RegisterLogic.java index 71125cbc..6f899ad0 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RegisterLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RegisterLogic.java @@ -11,6 +11,7 @@ import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; +import java.util.Collection; import java.util.Map; import java.util.Set; @@ -62,12 +63,12 @@ public class RegisterLogic implements ServiceLogic { REDIS.setCacheMap(gunkey, cacheGun); String svcSrvKeyNew = "svcSrvGuns:".concat(getLocalIPAndPort()); cachePileGunSvcSrv(gunkey, svcSrvKeyNew); -// final Collection cacheSvcSrvKeys = REDIS.keys("svcSrvGuns:*"); -// for (String svcSrvKey : cacheSvcSrvKeys) { -// if (!svcSrvKey.equals(svcSrvKeyNew)) { -// REDIS.deleteSetVal(svcSrvKey, gunkey); -// } -// } todo ucat + final Collection cacheSvcSrvKeys = REDIS.keys("svcSrvGuns:*"); + for (String svcSrvKey : cacheSvcSrvKeys) { + if (!svcSrvKey.equals(svcSrvKeyNew)) { + REDIS.deleteSetVal(svcSrvKey, gunkey); + } + } } log.info("pile (re)registered ({}) ", pileNo); }