Perfecting the notification_charge_order_info's logic.

This commit is contained in:
little-cat-sweet 2021-11-04 16:21:34 +08:00
parent a3deb63185
commit af42f2011e
3 changed files with 24 additions and 7 deletions

View File

@ -16,5 +16,4 @@ public interface XhpcHistoryOrderRepository extends JpaRepository<XhpcHistoryOrd
List<XhpcHistoryOrder> findByHistoryOrderIdGreaterThanAndStateGreaterThanOrderByHistoryOrderIdAsc(Long hisOrderId, int i); List<XhpcHistoryOrder> findByHistoryOrderIdGreaterThanAndStateGreaterThanOrderByHistoryOrderIdAsc(Long hisOrderId, int i);
Optional<XhpcHistoryOrder> findByInternetSerialNumber(String startChargeSeq); Optional<XhpcHistoryOrder> findByInternetSerialNumber(String startChargeSeq);
} }

View File

@ -45,8 +45,6 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
//Getting the internetSerialNumbers to load the requestData. //Getting the internetSerialNumbers to load the requestData.
Collection<String> pushOrders = REDIS.keys("pushOrder:*"); Collection<String> pushOrders = REDIS.keys("pushOrder:*");
// System.out.println(pushOrderKeys);
// List<String> pushOrders = (List<String>) REDIS.keys("pushOrder:*");
List<String> internetSerialNumbers = new ArrayList<>(); List<String> internetSerialNumbers = new ArrayList<>();
List<String> connectorIdMap = new ArrayList<>(); List<String> connectorIdMap = new ArrayList<>();
List<String> orderNos = new ArrayList<>(); List<String> orderNos = new ArrayList<>();
@ -120,6 +118,8 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
if (null != xhpcHistoryOrder.getStopReasonEvcs()) { if (null != xhpcHistoryOrder.getStopReasonEvcs()) {
chargeOrderInfo.setStopReason(xhpcHistoryOrder.getStopReasonEvcs()); chargeOrderInfo.setStopReason(xhpcHistoryOrder.getStopReasonEvcs());
} else {
continue;
} }
notify(chargeOrderInfo, authSecretToken, orderNo); notify(chargeOrderInfo, authSecretToken, orderNo);
} }
@ -139,10 +139,14 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
ChargeOrderInfoResponse chargeOrderInfoResponse = DTOJsonHelper.parseResponseData(responseBody, ChargeOrderInfoResponse chargeOrderInfoResponse = DTOJsonHelper.parseResponseData(responseBody,
ChargeOrderInfoResponse.class, authSecretTokenOut); ChargeOrderInfoResponse.class, authSecretTokenOut);
if (null != chargeOrderInfoResponse) { if (null != chargeOrderInfoResponse) {
Integer succStat = chargeOrderInfoResponse.getConfirmResult(); Integer confirmResult = chargeOrderInfoResponse.getConfirmResult();
//O means that the response is not success. XhpcHistoryOrder horder = xhpcHistoryOrderRepository.findByInternetSerialNumber(chargeOrderInfo.getStartChargeSeq()).orElse(null);
//todo add a logic, which will be constructed by the value of confirmResult. if (horder != null) {
if (succStat == 0) { horder.setConfirmResult(confirmResult);
xhpcHistoryOrderRepository.save(horder);
}
//O means that the response is success.
if (confirmResult == 0) {
REDIS.setCacheMapValue(orderNo, "chargeOrderInfoNotificationStat", -1); REDIS.setCacheMapValue(orderNo, "chargeOrderInfoNotificationStat", -1);
} else { } else {
throw new RuntimeException(String.format("push CD start order status [%s] failed: %s", throw new RuntimeException(String.format("push CD start order status [%s] failed: %s",

View File

@ -240,6 +240,20 @@ public class XhpcHistoryOrder extends BaseEntity {
*/ */
private String phone; private String phone;
/**
* 推送第三方订单返回的确认结果
*/
private Integer confirmResult;
public Integer getConfirmResult() {
return confirmResult;
}
public void setConfirmResult(Integer confirmResult) {
this.confirmResult = confirmResult;
}
public Double getMeterValueEndEvcs() { public Double getMeterValueEndEvcs() {
return meterValueEndEvcs; return meterValueEndEvcs;