From 465d2be266a6f6fac9fb01d368abd36cae0626ea Mon Sep 17 00:00:00 2001 From: ZZ Date: Mon, 15 Nov 2021 15:40:51 +0800 Subject: [PATCH] =?UTF-8?q?WIP:=E4=B8=89=E6=96=B9=E5=AF=B9=E6=8E=A5,?= =?UTF-8?q?=E5=B0=8F=E6=A1=94AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/XhpcStationInternetBlacklist.java | 12 ++-- .../com/xhpc/evcs/dto/ChargeOrderInfo.java | 5 +- .../com/xhpc/evcs/encryption/Aes128Cbc.java | 3 +- .../evcs/api/QueryEquipAuthController.java | 55 +++++++++++------- .../api/QueryEquipChargeStatusController.java | 3 +- .../evcs/api/QueryStartChargeController.java | 2 +- .../evcs/jpa/XhpcInternetUserRepository.java | 7 +++ ...hpcStationInternetBlacklistRepository.java | 2 +- .../NotificationCancelOrderTask.java | 3 +- .../NotificationChargeOrderInfoTask.java | 14 +++-- .../NotificationStationStatusTask.java | 56 ++++++++++++------- .../NotificationStopChargeResultTask.java | 4 +- .../order/api/XhpcPileOrderController.java | 1 + .../pp/controller/ChargingController.java | 2 +- 14 files changed, 114 insertions(+), 55 deletions(-) diff --git a/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/domain/XhpcStationInternetBlacklist.java b/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/domain/XhpcStationInternetBlacklist.java index f188e484..03e0e501 100644 --- a/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/domain/XhpcStationInternetBlacklist.java +++ b/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/domain/XhpcStationInternetBlacklist.java @@ -13,7 +13,7 @@ public class XhpcStationInternetBlacklist extends BaseEntity { private Long id; @Column(name = "internet_user_id") - private String internetUserId; + private Long internetUserId; @Column(name = "charging_station_id") private Long chargingStationId; @@ -30,27 +30,31 @@ public class XhpcStationInternetBlacklist extends BaseEntity { } public void setStatus(Integer status) { + this.status = status; } + public Long getInternetUserId() { - public String getInternetUserId() { return internetUserId; } - public void setInternetUserId(String internetUserId) { + public void setInternetUserId(Long internetUserId) { + this.internetUserId = internetUserId; } public Long getChargingStationId() { + return chargingStationId; } public Long getId() { + return id; } public void setId(Long id) { this.id = id; } -} \ No newline at end of file +} diff --git a/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/ChargeOrderInfo.java b/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/ChargeOrderInfo.java index ebbb4711..01a7cac4 100644 --- a/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/ChargeOrderInfo.java +++ b/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/ChargeOrderInfo.java @@ -1,6 +1,7 @@ package com.xhpc.evcs.dto; import com.fasterxml.jackson.annotation.*; +import com.xhpc.common.core.utils.DateUtils; import com.xhpc.evcs.domain.XhpcStatisticsTimeInterval; import com.xhpc.evcs.utils.DateUtil; import com.xhpc.order.domain.XhpcHistoryOrder; @@ -13,6 +14,8 @@ import javax.persistence.Id; import javax.persistence.Transient; import java.util.*; +import static com.xhpc.common.core.utils.DateUtils.YYYY_MM_DD_HH_MM_SS; + //@JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "StartChargeSeq", @@ -82,7 +85,7 @@ public class ChargeOrderInfo { this.connectorID = xhpcHistoryOrder.getSerialNumber().substring(0, 16); this.startChargeSeq = xhpcHistoryOrder.getInternetSerialNumber(); - this.endTime = DateUtil.date2StringDt(xhpcHistoryOrder.getEndTime()); + this.endTime = DateUtils.parseDateToStr(YYYY_MM_DD_HH_MM_SS, xhpcHistoryOrder.getEndTime()); this.connectorID = xhpcHistoryOrder.getSerialNumber().substring(0, 16); this.endTime = DateUtil.date2String(xhpcHistoryOrder.getEndTime(), DateUtil.DATE_FORMAT_DATE_TIME); this.startTime = DateUtil.date2String(xhpcHistoryOrder.getStartTime(), DateUtil.DATE_FORMAT_DATE_TIME); 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 8daaf566..92143222 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,7 +61,8 @@ public class Aes128Cbc { NoSuchAlgorithmException, IllegalBlockSizeException, UnsupportedEncodingException, NoSuchPaddingException, InvalidKeyException { - System.out.println(decryptString("Fa09StzEtf3Qfmr/b91gfg==", "8LpncubmWiPCzY3V", "av6A8QdnRaVRMXu6" + System.out.println(decryptString("L+FOSPaN073SDRBNMqKBAQ==", + "ojs67l46z3f7rhok", "tet9swfkyojkhaos" )); //ujNoGsWRo5MyPKYOxeofKwgPEng3xF+yhM8DDjwtwHo= System.out.println(encrypt("{\"StationIDs\":[\"1\"]}", "8LpncubmWiPCzY3V", "av6A8QdnRaVRMXu6")); diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryEquipAuthController.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryEquipAuthController.java index 799ce7ce..dc29939c 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryEquipAuthController.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryEquipAuthController.java @@ -1,10 +1,12 @@ package com.xhpc.evcs.api; +import com.xhpc.evcs.domain.XhpcInternetUser; import com.xhpc.evcs.domain.XhpcStationInternetBlacklist; import com.xhpc.evcs.dto.CommonRequest; import com.xhpc.evcs.dto.CommonResponse; import com.xhpc.evcs.dto.EquipAuthRequest; import com.xhpc.evcs.dto.EquipAuthResponse; +import com.xhpc.evcs.jpa.XhpcInternetUserRepository; import com.xhpc.evcs.jpa.XhpcStationInternetBlacklistRepository; import com.xhpc.evcs.utils.JSONUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -12,6 +14,8 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; +import java.time.Instant; +import java.util.List; import java.util.Map; import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS; @@ -27,6 +31,8 @@ public class QueryEquipAuthController { @Autowired private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo; + @Autowired + private XhpcInternetUserRepository xhpcInternetUserRepository; @PostMapping(value = "/v1/query_equip_auth") public CommonResponse queryEquipAuth(@RequestBody CommonRequest commonRequest) throws Exception { @@ -41,32 +47,43 @@ public class QueryEquipAuthController { String pileId = connectorId.substring(0, connectorId.length() - 2); Map pileDataModel = REDIS.getCacheMap("pile:" + pileId); Long stationId = Long.parseLong(pileDataModel.get("stationId").toString()); - XhpcStationInternetBlacklist xhpcStationInternetBlacklist = xhpcStationInternetBlacklistRepo.findByChargingStationIdAndInternetUserId(stationId, equipAuthSeq.substring(0, 10)).orElse(null); - resp.setRet("0"); - if (null != xhpcStationInternetBlacklist) { + List xhpcInternetUserList = + xhpcInternetUserRepository.findByCooperationStartTimeBeforeAndCooperationEndTimeAfterAndOperatorIdEvcsLike(Instant.now(), + Instant.now(), equipAuthSeq.substring(0, 9)); + if (xhpcInternetUserList.isEmpty()) { equipAuthResponse.setSuccStat(1); equipAuthResponse.setFailReason(2); resp.setMsg("auth denied"); } else { - Map realTimeTerminalData = REDIS.getCacheMap("gun:".concat(connectorId)); - String terminalStatus = (String) realTimeTerminalData.get("vehicleGunStatus"); - String status = (String) realTimeTerminalData.get("status"); - if (!"空闲".equals(status)) { - resp.setMsg("终端状态异常:[".concat(status == null ? "未注册" : status).concat("]")); - resp.setRet("1"); + Long internetUserId = xhpcInternetUserList.get(0).getId(); + XhpcStationInternetBlacklist xhpcStationInternetBlacklist = + xhpcStationInternetBlacklistRepo.findByChargingStationIdAndInternetUserId(stationId, internetUserId).orElse(null); + resp.setRet("0"); + if (null != xhpcStationInternetBlacklist) { equipAuthResponse.setSuccStat(1); - equipAuthResponse.setFailReason(1); - } else if ("否".equals(terminalStatus)) { - resp.setMsg("未插枪"); - resp.setRet("1"); - equipAuthResponse.setSuccStat(1); - equipAuthResponse.setFailReason(1); + equipAuthResponse.setFailReason(2); + resp.setMsg("auth denied"); } else { - resp.setMsg("success"); - equipAuthResponse.setSuccStat(0); - equipAuthResponse.setFailReason(0); - } + Map realTimeTerminalData = REDIS.getCacheMap("gun:".concat(connectorId)); + String terminalStatus = (String) realTimeTerminalData.get("vehicleGunStatus"); + String status = (String) realTimeTerminalData.get("status"); + if (!"空闲".equals(status)) { + resp.setMsg("终端状态异常:[".concat(status == null ? "未注册" : status).concat("]")); + resp.setRet("1"); + equipAuthResponse.setSuccStat(1); + equipAuthResponse.setFailReason(1); + } else if ("否".equals(terminalStatus)) { + resp.setMsg("未插枪"); + resp.setRet("1"); + equipAuthResponse.setSuccStat(1); + equipAuthResponse.setFailReason(1); + } else { + resp.setMsg("success"); + equipAuthResponse.setSuccStat(0); + equipAuthResponse.setFailReason(0); + } + } } resp.setData(JSONUtil.toJSONString(equipAuthResponse)); return resp; diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryEquipChargeStatusController.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryEquipChargeStatusController.java index 9bc7570e..6055aa6e 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryEquipChargeStatusController.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryEquipChargeStatusController.java @@ -66,8 +66,9 @@ public class QueryEquipChargeStatusController { break; } equipChargeStatus.setStartChargeSeqStat(startChargeSeqStat); - //充电设备接口编码 +//充电设备接口编码 String connectorId = internalOrderNum.substring(0, 16); + equipChargeStatus.setConnectorID(connectorId); //充电设备接口状态 Map cacheGunData = REDIS.getCacheMap("gun:" + connectorId); String gunStatus = (String) cacheGunData.get("status"); diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryStartChargeController.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryStartChargeController.java index 7927eea7..eb485c32 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryStartChargeController.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryStartChargeController.java @@ -70,7 +70,7 @@ public class QueryStartChargeController { Map etOrderData = (Map) res.getData(); EtOrderMapping etOrderMapping = new EtOrderMapping(); etOrderMapping.setEvcsOrderNo(startChargeSeq); - etOrderMapping.setXhOrderNo("123123");//String.valueOf(etOrderData.get("orderNo"))); + etOrderMapping.setXhOrderNo(String.valueOf(etOrderData.get("orderNo"))); etOrderMappingRepo.save(etOrderMapping); startChargeResponse.setStartChargeSeqStat(1); startChargeResponse.setSuccStat(0); diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/jpa/XhpcInternetUserRepository.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/jpa/XhpcInternetUserRepository.java index c1469354..8bc7d32d 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/jpa/XhpcInternetUserRepository.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/jpa/XhpcInternetUserRepository.java @@ -7,6 +7,7 @@ import org.springframework.data.repository.query.QueryByExampleExecutor; import org.springframework.stereotype.Repository; import java.time.Instant; +import java.util.List; @Repository public interface XhpcInternetUserRepository extends JpaRepository, @@ -16,4 +17,10 @@ public interface XhpcInternetUserRepository extends JpaRepository findByCooperationStartTimeBeforeAndCooperationEndTimeAfter(Instant now, Instant now1); + + List findByCooperationStartTimeBeforeAndCooperationEndTimeAfterAndOperatorIdEvcsLike(Instant now, + Instant now1, + String operatorIdEvcs); + } diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/jpa/XhpcStationInternetBlacklistRepository.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/jpa/XhpcStationInternetBlacklistRepository.java index a49c7919..cc581e48 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/jpa/XhpcStationInternetBlacklistRepository.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/jpa/XhpcStationInternetBlacklistRepository.java @@ -14,7 +14,7 @@ public interface XhpcStationInternetBlacklistRepository extends JpaRepository, JpaSpecificationExecutor { - Optional findByChargingStationIdAndInternetUserId(Long stationId, String substring); + Optional findByChargingStationIdAndInternetUserId(Long stationId, Long internetUserId); List findByInternetUserId(String substring); diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationCancelOrderTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationCancelOrderTask.java index 73b96a58..1136aeff 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationCancelOrderTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationCancelOrderTask.java @@ -9,7 +9,6 @@ import com.xhpc.evcs.dto.DTOJsonHelper; import com.xhpc.evcs.jpa.AuthSecretTokenRepository; import com.xhpc.evcs.utils.JSONUtil; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.ArrayList; @@ -30,7 +29,7 @@ public class NotificationCancelOrderTask extends CoreDispatcher { //private Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class); - @Scheduled(fixedRate = 1000 * 15) +// @Scheduled(fixedRate = 1000 * 15) public void run() throws JsonProcessingException { //Getting the orders, which need to be notified. diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoTask.java index 39fa409a..081f5bc3 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoTask.java @@ -18,6 +18,8 @@ import org.springframework.stereotype.Component; import java.util.List; +import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT; + /** * @Author HongYun on 2021/11/1 */ @@ -34,18 +36,22 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher { @Scheduled(fixedRate = 1000 * 15) public void run() throws JsonProcessingException { - List authSecretTokenList = authSecretTokenRepository.findAll(); + List authSecretTokenList = authSecretTokenRepository.findBySecretTokenType(SECRET_TOKEN_TYPE_OUT); List xhpcHistoryOrderList = xhpcHistoryOrderRepository.findByConfirmResultNotAndOperatorId3rdptyEvcsIsNotNull(0); for (XhpcHistoryOrder horder : xhpcHistoryOrderList) { - for (AuthSecretToken authSecretToken : authSecretTokenList) { - if (authSecretToken.getOperatorId3irdpty().equals(horder.getOperatorId3rdptyEvcs())) { + String operatorId3rdptyEvcs = horder.getOperatorId3rdptyEvcs(); + if (operatorId3rdptyEvcs == null) { + if (horder.getInternetSerialNumber() != null) operatorId3rdptyEvcs = + horder.getInternetSerialNumber().substring(0, 9); + } + if (authSecretToken.getOperatorId3irdpty().equals(operatorId3rdptyEvcs)) { ChargeOrderInfo chargeOrderInfo = new ChargeOrderInfo(horder); final ChargeOrderInfoResponse pushResp = notify(chargeOrderInfo, authSecretToken); horder.setConfirmResult(pushResp.getConfirmResult()); logger.info("3rd part order {} push result: {}", horder.getSerialNumber(), pushResp.getConfirmResult()); -// xhpcHistoryOrderRepository.save(horder); + xhpcHistoryOrderRepository.save(horder); } } } 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 bc5369f0..17f89db7 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 @@ -2,50 +2,68 @@ package com.xhpc.evcs.notification; import com.xhpc.common.api.dto.ChargingStationDto; import com.xhpc.evcs.domain.AuthSecretToken; +import com.xhpc.evcs.domain.XhpcInternetUser; +import com.xhpc.evcs.domain.XhpcStationInternetBlacklist; import com.xhpc.evcs.dto.*; import com.xhpc.evcs.jpa.AuthSecretTokenRepository; +import com.xhpc.evcs.jpa.XhpcInternetUserRepository; +import com.xhpc.evcs.jpa.XhpcStationInternetBlacklistRepository; import com.xhpc.evcs.utils.ChangePoleStatus; import com.xhpc.evcs.utils.JSONUtil; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.io.IOException; -import java.util.Collection; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; +import java.time.Instant; +import java.util.*; import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS; import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT; import static com.xhpc.evcs.dto.ConnectorStatusInfo.*; @Component +@Slf4j public class NotificationStationStatusTask extends CoreDispatcher { @Autowired private AuthSecretTokenRepository authSecretTokenRepository; + @Autowired + private XhpcInternetUserRepository xhpcInternetUserRepository; + @Autowired + private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo; - @Scheduled(fixedRate = 1000 * 15) + @Scheduled(fixedRate = 1000 * 45) protected void run() throws IOException { Collection stationTerminalKeys = REDIS.keys("stationTerminalStatus:*"); + + List xhpcInternetUserList = + xhpcInternetUserRepository.findByCooperationStartTimeBeforeAndCooperationEndTimeAfter(Instant.now(), + Instant.now()); for (String stationTerminalKey : stationTerminalKeys) { ChargingStationDto chargingStationDto = REDIS.getCacheObject(stationTerminalKey.replace("stationTerminalStatus", - "station")); //todo OperatorID + "station")); String operatorId = chargingStationDto.getOperatorId(); - operatorId = operatorId == null ? "MA6DFCTD5" : operatorId; - AuthSecretToken authSecretTokenOut = - authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType( - "765367656", operatorId, SECRET_TOKEN_TYPE_OUT).orElse(null); //todo - // maybe对接第三方 - if (authSecretTokenOut != null) { - Map terminalStatusMap = REDIS.getCacheMap(stationTerminalKey); - Set connectorStatusInfos = translateStatus(operatorId, terminalStatusMap); - if (!connectorStatusInfos.isEmpty()) { - Set changeStatus = ChangePoleStatus.getChangeStatus(connectorStatusInfos); - for (ConnectorStatusInfo statusInfo : changeStatus) { - notify(statusInfo, authSecretTokenOut); + Map terminalStatusMap = REDIS.getCacheMap(stationTerminalKey); + Set connectorStatusInfos = translateStatus(operatorId, terminalStatusMap); + Set changeStatus = ChangePoleStatus.getChangeStatus(connectorStatusInfos); + if (!connectorStatusInfos.isEmpty()) { + for (XhpcInternetUser xhpcInternetUser : xhpcInternetUserList) { + XhpcStationInternetBlacklist xhpcStationInternetBlacklist = + xhpcStationInternetBlacklistRepo.findByChargingStationIdAndInternetUserId(chargingStationDto.getStationId(), xhpcInternetUser.getId()).orElse(null); + if (xhpcStationInternetBlacklist != null) continue; + String operatorId3rdptyEvcs = xhpcInternetUser.getOperatorIdEvcs(); + operatorId3rdptyEvcs = operatorId3rdptyEvcs.length() == 9 ? operatorId3rdptyEvcs : + operatorId3rdptyEvcs.substring(9, 19); + AuthSecretToken authSecretTokenOut = + authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(xhpcInternetUser.getOperatorIdEvcs(), SECRET_TOKEN_TYPE_OUT).orElse(null); + operatorId = !operatorId3rdptyEvcs.equals("765367656") ? "MA6DFCTD5" : operatorId; + if (authSecretTokenOut != null) { + for (ConnectorStatusInfo statusInfo : changeStatus) { + notify(statusInfo, authSecretTokenOut); + } } } } @@ -92,7 +110,7 @@ public class NotificationStationStatusTask extends CoreDispatcher { connectorStatusInfo.getOperatorID()); EvcsStatus status = DTOJsonHelper.parseResponseData(responseBody, EvcsStatus.class, authSecretTokenOut); if (status == null || status.getStatus() != 0) { - throw new RuntimeException(String.format("push CD notification connector[%s] failed: %s", + log.error(String.format("push CD notification connector[%s] failed: %s", connectorStatusInfo.getConnectorID(), responseBody)); } return status; diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStopChargeResultTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStopChargeResultTask.java index 6638736f..6f8e7155 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStopChargeResultTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStopChargeResultTask.java @@ -5,6 +5,7 @@ import com.xhpc.evcs.domain.AuthSecretToken; import com.xhpc.evcs.dto.ChargeResultRequest; import com.xhpc.evcs.dto.ChargeResultResponse; import com.xhpc.evcs.dto.CommonRequest; +import com.xhpc.evcs.dto.DTOJsonHelper; import com.xhpc.evcs.jpa.AuthSecretTokenRepository; import com.xhpc.evcs.utils.JSONUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -86,7 +87,8 @@ public class NotificationStopChargeResultTask extends CoreDispatcher { chargeResultRequestCommonRequest.setData(jsonData); String result = ok(chargeResultRequestCommonRequest, "/notification_stop_charge_result", authSecretTokenOut, operatorId3rdpty); - ChargeResultResponse chargeResultResponse = JSONUtil.readParams(result, ChargeResultResponse.class); + ChargeResultResponse chargeResultResponse = DTOJsonHelper.parseResponseData(result, + ChargeResultResponse.class, authSecretTokenOut); succStat = chargeResultResponse.getSuccStat(); //推送成功则排除这个已推送的订单,否则则继续推送该订单 // 用于测试暂时注释 if (succStat == 0) { diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java index 8b9bf9c1..2337dc5f 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java @@ -363,6 +363,7 @@ public class XhpcPileOrderController extends BaseController { }else{ Map pushOrder = redisService.getCacheMap("pushOrder:"+orderNo); xhpcHistoryOrder.setInternetSerialNumber(pushOrder.get("internetSerialNumber").toString()); + xhpcChargeOrder.setOperatorId3rdptyEvcs((String) pushOrder.get("operatorId3rdpty")); } //结算 diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/controller/ChargingController.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/controller/ChargingController.java index 3bb404a2..b11d239a 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/controller/ChargingController.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/controller/ChargingController.java @@ -262,7 +262,7 @@ public class ChargingController { cacheOrder.put("tel", startChargingData.getTel()); cacheOrder.put("stopSoc", startChargingData.getSoc()); cacheOrder.put("startTime", - DateTimeFormatter.ofPattern("yyyyMMdd HH:mm:ss").withZone(ZoneId.systemDefault()).format(Instant.now())); + DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault()).format(Instant.now())); REDIS.setCacheMap(orderkey, cacheOrder); return R.ok("充电指令已下发"); } catch (IOException e) {