diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/jpa/XhpcHistoryOrderRepository.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/jpa/XhpcHistoryOrderRepository.java index c9638a7a..898c1bca 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/jpa/XhpcHistoryOrderRepository.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/jpa/XhpcHistoryOrderRepository.java @@ -16,5 +16,4 @@ public interface XhpcHistoryOrderRepository extends JpaRepository findByHistoryOrderIdGreaterThanAndStateGreaterThanOrderByHistoryOrderIdAsc(Long hisOrderId, int i); Optional findByInternetSerialNumber(String startChargeSeq); - } 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 f1a75585..b6ab6783 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 @@ -45,8 +45,6 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher { //Getting the internetSerialNumbers to load the requestData. Collection pushOrders = REDIS.keys("pushOrder:*"); -// System.out.println(pushOrderKeys); -// List pushOrders = (List) REDIS.keys("pushOrder:*"); List internetSerialNumbers = new ArrayList<>(); List connectorIdMap = new ArrayList<>(); List orderNos = new ArrayList<>(); @@ -120,6 +118,8 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher { if (null != xhpcHistoryOrder.getStopReasonEvcs()) { chargeOrderInfo.setStopReason(xhpcHistoryOrder.getStopReasonEvcs()); + } else { + continue; } notify(chargeOrderInfo, authSecretToken, orderNo); } @@ -139,10 +139,14 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher { ChargeOrderInfoResponse chargeOrderInfoResponse = DTOJsonHelper.parseResponseData(responseBody, ChargeOrderInfoResponse.class, authSecretTokenOut); if (null != chargeOrderInfoResponse) { - Integer succStat = chargeOrderInfoResponse.getConfirmResult(); - //O means that the response is not success. - //todo add a logic, which will be constructed by the value of confirmResult. - if (succStat == 0) { + Integer confirmResult = chargeOrderInfoResponse.getConfirmResult(); + XhpcHistoryOrder horder = xhpcHistoryOrderRepository.findByInternetSerialNumber(chargeOrderInfo.getStartChargeSeq()).orElse(null); + if (horder != null) { + horder.setConfirmResult(confirmResult); + xhpcHistoryOrderRepository.save(horder); + } + //O means that the response is success. + if (confirmResult == 0) { REDIS.setCacheMapValue(orderNo, "chargeOrderInfoNotificationStat", -1); } else { throw new RuntimeException(String.format("push CD start order status [%s] failed: %s", diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/order/domain/XhpcHistoryOrder.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/order/domain/XhpcHistoryOrder.java index f26b160e..9b7644d9 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/order/domain/XhpcHistoryOrder.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/order/domain/XhpcHistoryOrder.java @@ -240,6 +240,20 @@ public class XhpcHistoryOrder extends BaseEntity { */ private String phone; + + /** + * 推送第三方订单返回的确认结果 + */ + private Integer confirmResult; + + public Integer getConfirmResult() { + return confirmResult; + } + + public void setConfirmResult(Integer confirmResult) { + this.confirmResult = confirmResult; + } + public Double getMeterValueEndEvcs() { return meterValueEndEvcs;