WIP:三方对接逻辑
This commit is contained in:
parent
69c0825b7b
commit
21ffb9ffee
@ -89,7 +89,7 @@ public class CDChargeOrderInfo4BonusReq {
|
||||
|
||||
this.startChargeSeq = etOrderMapping.getEvcsOrderNo();
|
||||
this.connectorID = xhpcHistoryOrder.getSerialNumber().substring(0, 16);
|
||||
this.endTime = DateUtil.date2String(xhpcHistoryOrder.getCreateTime(), DateUtil.DATE_FORMAT_DATE_TIME);
|
||||
this.endTime = DateUtil.date2String(xhpcHistoryOrder.getEndTime(), DateUtil.DATE_FORMAT_DATE_TIME);
|
||||
this.startTime = DateUtil.date2String(xhpcHistoryOrder.getStartTime(), DateUtil.DATE_FORMAT_DATE_TIME);
|
||||
this.chargeModel = xhpcHistoryOrder.getChargeModelEvcs();
|
||||
this.totalPower = xhpcHistoryOrder.getTotalPower();
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.xhpc.evcs.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
import com.xhpc.evcs.domain.XhpcStatisticsTimeInterval;
|
||||
import com.xhpc.evcs.utils.DateUtil;
|
||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@ -9,8 +11,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Transient;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
//@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
@ -23,7 +24,8 @@ import java.util.Map;
|
||||
"TotalSeviceMoney",
|
||||
"TotalMoney",
|
||||
"StopReason",
|
||||
"SumPeriod"
|
||||
"SumPeriod",
|
||||
"ChargeDetails"
|
||||
})
|
||||
@Setter
|
||||
@Getter
|
||||
@ -77,7 +79,37 @@ public class ChargeOrderInfo {
|
||||
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
|
||||
|
||||
public ChargeOrderInfo(XhpcHistoryOrder xhpcHistoryOrder) {
|
||||
// this.connectorID = xhpcHistoryOrder.getTerminalId()
|
||||
|
||||
this.connectorID = xhpcHistoryOrder.getSerialNumber().substring(0, 16);
|
||||
this.startChargeSeq = xhpcHistoryOrder.getInternetSerialNumber();
|
||||
this.endTime = DateUtil.date2StringDt(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);
|
||||
this.chargeModel = xhpcHistoryOrder.getChargeModelEvcs();
|
||||
this.totalPower = xhpcHistoryOrder.getTotalPower();
|
||||
this.totalElecMoney = xhpcHistoryOrder.getTotalPrice().doubleValue();
|
||||
this.totalSeviceMoney = xhpcHistoryOrder.getServicePriceTotal().doubleValue();
|
||||
this.totalMoney = xhpcHistoryOrder.getTotalPrice().doubleValue();
|
||||
this.stopReason = xhpcHistoryOrder.getStopReasonEvcs();
|
||||
this.sumPeriod = xhpcHistoryOrder.getXhpcStatisticsTimeIntervalList().size();
|
||||
this.chargeDetails = translate(xhpcHistoryOrder.getXhpcStatisticsTimeIntervalList());
|
||||
Date starttime = xhpcHistoryOrder.getStartTime();
|
||||
Date endtime = xhpcHistoryOrder.getEndTime();
|
||||
int cl = 0;
|
||||
if (starttime != null && endtime != null) {
|
||||
cl = Math.toIntExact((endtime.getTime() - starttime.getTime()) / 1000);
|
||||
}
|
||||
}
|
||||
|
||||
private ChargeDetails[] translate(List<XhpcStatisticsTimeInterval> xhpcStatisticsTimeIntervalList) {
|
||||
|
||||
List<ChargeDetails> details = new LinkedList<>();
|
||||
for (XhpcStatisticsTimeInterval statistics : xhpcStatisticsTimeIntervalList) {
|
||||
details.add(new ChargeDetails(statistics));
|
||||
}
|
||||
ChargeDetails[] a = new ChargeDetails[details.size()];
|
||||
return details.toArray(a);
|
||||
}
|
||||
|
||||
public ChargeOrderInfo() {
|
||||
|
||||
@ -76,6 +76,11 @@ public class DateUtil {
|
||||
return date2String(date, DEFAULT_DATE_FORMAT);
|
||||
}
|
||||
|
||||
public static final String date2StringDt(Date date) {
|
||||
|
||||
return date2String(date, DATE_FORMAT_DATE_TIME);
|
||||
}
|
||||
|
||||
/**
|
||||
* convert date to string, and the format is same to SimpleDateFormat for
|
||||
* example "yyyyMMdd" "yyyy-MM-dd HH:mm" etc please see
|
||||
|
||||
@ -7,7 +7,6 @@ import org.springframework.data.repository.query.QueryByExampleExecutor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public interface XhpcHistoryOrderRepository extends JpaRepository<XhpcHistoryOrder, Long>,
|
||||
@ -15,5 +14,6 @@ public interface XhpcHistoryOrderRepository extends JpaRepository<XhpcHistoryOrd
|
||||
|
||||
List<XhpcHistoryOrder> findByHistoryOrderIdGreaterThanAndStateGreaterThanOrderByHistoryOrderIdAsc(Long hisOrderId, int i);
|
||||
|
||||
Optional<XhpcHistoryOrder> findByInternetSerialNumber(String startChargeSeq);
|
||||
List<XhpcHistoryOrder> findByConfirmResultNotAndOperatorId3rdptyEvcsIsNotNull(int succCode);
|
||||
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ import static com.xhpc.evcs.config.EvcsFilter.encryptReqOut;
|
||||
@Slf4j
|
||||
public class CoreDispatcher {
|
||||
|
||||
@Value("${xhpc.evcs.oklog:true}")
|
||||
@Value("${xhpc.evcs.oklog:false}")
|
||||
private boolean oklog;
|
||||
@Autowired
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@ -46,6 +46,10 @@ public class CoreDispatcher {
|
||||
@Transactional
|
||||
public String ok(Object object, String url, AuthSecretToken authSecretTokenOut, String operatorID) {
|
||||
|
||||
if (authSecretTokenOut == null) {
|
||||
log.error("authSecretTokenOut is null");
|
||||
throw new RuntimeException();
|
||||
}
|
||||
okhttp3.RequestBody body = null;
|
||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||
if (oklog) {
|
||||
@ -58,10 +62,6 @@ public class CoreDispatcher {
|
||||
.writeTimeout(10, TimeUnit.SECONDS);
|
||||
Calendar cal = Calendar.getInstance();
|
||||
String bearerToken = null;
|
||||
if (authSecretTokenOut == null) {
|
||||
String error = String.format("secret/token not found for [%s/%s](opId3pt/opId)", authSecretTokenOut.getOperatorId3irdpty(), operatorID);
|
||||
throw new RuntimeException(error);
|
||||
}
|
||||
try {
|
||||
if (object.getClass().getSimpleName().equals("CommonRequest")) {
|
||||
CommonRequest commonRequest = (CommonRequest) object;
|
||||
|
||||
@ -39,7 +39,7 @@ public class NotificationChargeOrderInfo4BonusTask extends CoreDispatcher {
|
||||
private XhpcChargingStationRepository chargingStationRepo;
|
||||
private Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfo4BonusTask.class);
|
||||
|
||||
@Scheduled(fixedRate = 1000 * 60)
|
||||
@Scheduled(fixedDelay = 1000 * 60)
|
||||
public void run() throws IOException {
|
||||
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
|
||||
@ -1,157 +1,66 @@
|
||||
//package com.xhpc.evcs.notification;
|
||||
//
|
||||
//import cn.hutool.core.date.DateUtil;
|
||||
//import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
//import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
//import com.xhpc.evcs.dto.ChargeOrderInfo;
|
||||
//import com.xhpc.evcs.dto.ChargeOrderInfoResponse;
|
||||
//import com.xhpc.evcs.dto.CommonRequest;
|
||||
//import com.xhpc.evcs.dto.DTOJsonHelper;
|
||||
//import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
//import com.xhpc.evcs.jpa.XhpcHistoryOrderRepository;
|
||||
//import com.xhpc.evcs.utils.JSONUtil;
|
||||
//import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//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.ArrayList;
|
||||
//import java.util.Collection;
|
||||
//import java.util.Date;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
//import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
//
|
||||
///**
|
||||
// * @Author HongYun on 2021/11/1
|
||||
// */
|
||||
//
|
||||
//@Component
|
||||
//public class NotificationChargeOrderInfoTask extends CoreDispatcher {
|
||||
//
|
||||
// @Autowired
|
||||
// private XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
|
||||
// @Autowired
|
||||
// private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
//
|
||||
// private Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
||||
//
|
||||
// @Scheduled(fixedRate = 1000 * 60)
|
||||
// public void run() throws IOException {
|
||||
//
|
||||
// //Getting the internetSerialNumbers to load the requestData.
|
||||
// Collection<String> pushOrders = REDIS.keys("pushOrder:*");
|
||||
// List<String> internetSerialNumbers = new ArrayList<>();
|
||||
// List<String> connectorIdMap = new ArrayList<>();
|
||||
// List<String> orderNos = new ArrayList<>();
|
||||
// for (String pushOrder : pushOrders) {
|
||||
// Integer chargeOrderInfoNotificationStat = REDIS.getCacheMapValue(pushOrder, "chargeOrderInfoNotificationStat");
|
||||
//
|
||||
// if (0 == chargeOrderInfoNotificationStat) {
|
||||
// internetSerialNumbers.add(REDIS.getCacheMapValue(pushOrder, "internetSerialNumber"));
|
||||
// connectorIdMap.add(REDIS.getCacheMapValue(pushOrder, "connectorID"));
|
||||
// orderNos.add(pushOrder);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //Ensuring that the connectorId is following the handling of the data, which named interSerialNumber.
|
||||
// int times = 0;
|
||||
// //Loading the requestData, and also notifying.
|
||||
// for (String internetSerialNumber : internetSerialNumbers) {
|
||||
// String connector = connectorIdMap.get(times);
|
||||
// String orderNo = orderNos.get(times);
|
||||
// ++times;
|
||||
// String operatorId = internetSerialNumber.substring(0, 9);
|
||||
// AuthSecretToken authSecretToken = authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId, SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
// if (null != authSecretToken) {
|
||||
// XhpcHistoryOrder xhpcHistoryOrder = xhpcHistoryOrderRepository.findByInternetSerialNumber(internetSerialNumber).orElse(null);
|
||||
// if (null != xhpcHistoryOrder) {
|
||||
// ChargeOrderInfo chargeOrderInfo = new ChargeOrderInfo();
|
||||
// if (null != xhpcHistoryOrder.getInternetSerialNumber()) {
|
||||
// chargeOrderInfo.setStartChargeSeq(xhpcHistoryOrder.getInternetSerialNumber());
|
||||
// } else {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// //The connector is absolutely exists.
|
||||
// chargeOrderInfo.setConnectorID(connector);
|
||||
//
|
||||
// Date startTime = xhpcHistoryOrder.getStartTime();
|
||||
// if (null == startTime) {
|
||||
// continue;
|
||||
// }
|
||||
// String formatStartTime = DateUtil.format(startTime, "yyyy-MM-dd HH: mm: ss");
|
||||
// chargeOrderInfo.setStartTime(formatStartTime);
|
||||
//
|
||||
// Date endTime = xhpcHistoryOrder.getEndTime();
|
||||
// if (null == endTime) continue;
|
||||
// String formatEndTime = DateUtil.format(endTime, "yyyy-MM-dd HH: mm: ss");
|
||||
// chargeOrderInfo.setEndTime(formatEndTime);
|
||||
//
|
||||
// if (null != xhpcHistoryOrder.getTotalPower()) {
|
||||
// chargeOrderInfo.setTotalPower(xhpcHistoryOrder.getTotalPower());
|
||||
// } else {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (null != xhpcHistoryOrder.getActPowerPrice()) {
|
||||
// chargeOrderInfo.setTotalElecMoney(xhpcHistoryOrder.getActPowerPrice().doubleValue());
|
||||
// } else {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (null != xhpcHistoryOrder.getServicePriceTotal()) {
|
||||
// chargeOrderInfo.setTotalSeviceMoney(xhpcHistoryOrder.getServicePriceTotal().doubleValue());
|
||||
// } else {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (null != xhpcHistoryOrder.getTotalPrice()) {
|
||||
// chargeOrderInfo.setTotalMoney(xhpcHistoryOrder.getTotalPrice().doubleValue());
|
||||
// } else {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (null != xhpcHistoryOrder.getStopReasonEvcs()) {
|
||||
// chargeOrderInfo.setStopReason(xhpcHistoryOrder.getStopReasonEvcs());
|
||||
// } else {
|
||||
// continue;
|
||||
// }
|
||||
// notify(chargeOrderInfo, authSecretToken, orderNo);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void notify(ChargeOrderInfo chargeOrderInfo, AuthSecretToken authSecretTokenOut, String orderNo) throws JsonProcessingException {
|
||||
//
|
||||
// String operatorIdEvcs = "MA6DFCTD5";
|
||||
// String data = JSONUtil.toJSONString(chargeOrderInfo);
|
||||
// logger.debug(data);
|
||||
// CommonRequest<ChargeOrderInfo> commonRequest = new CommonRequest<>();
|
||||
// commonRequest.setOperatorId(operatorIdEvcs);
|
||||
// commonRequest.setData(data);
|
||||
// String responseBody = ok(commonRequest, "/notification_charge_order_info", authSecretTokenOut, operatorIdEvcs);
|
||||
// ChargeOrderInfoResponse chargeOrderInfoResponse = DTOJsonHelper.parseResponseData(responseBody,
|
||||
// ChargeOrderInfoResponse.class, authSecretTokenOut);
|
||||
// if (null != chargeOrderInfoResponse) {
|
||||
// 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",
|
||||
// chargeOrderInfoResponse.getStartChargeSeq(), responseBody));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
package com.xhpc.evcs.notification;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.dto.ChargeOrderInfo;
|
||||
import com.xhpc.evcs.dto.ChargeOrderInfoResponse;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.DTOJsonHelper;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcHistoryOrderRepository;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author HongYun on 2021/11/1
|
||||
*/
|
||||
@Component
|
||||
public class NotificationChargeOrderInfoTask extends CoreDispatcher {
|
||||
|
||||
@Autowired
|
||||
private XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
|
||||
@Autowired
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
||||
|
||||
@Scheduled(fixedRate = 1000 * 15)
|
||||
public void run() throws JsonProcessingException {
|
||||
|
||||
List<AuthSecretToken> authSecretTokenList = authSecretTokenRepository.findAll();
|
||||
List<XhpcHistoryOrder> xhpcHistoryOrderList =
|
||||
xhpcHistoryOrderRepository.findByConfirmResultNotAndOperatorId3rdptyEvcsIsNotNull(0);
|
||||
for (XhpcHistoryOrder horder : xhpcHistoryOrderList) {
|
||||
|
||||
for (AuthSecretToken authSecretToken : authSecretTokenList) {
|
||||
if (authSecretToken.getOperatorId3irdpty().equals(horder.getOperatorId3rdptyEvcs())) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ChargeOrderInfoResponse notify(ChargeOrderInfo chargeOrderInfo, AuthSecretToken authSecretTokenOut) throws JsonProcessingException {
|
||||
|
||||
String operatorIdEvcs = "MA6DFCTD5";
|
||||
String data = JSONUtil.toJSONString(chargeOrderInfo);
|
||||
CommonRequest<ChargeOrderInfo> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setOperatorId(operatorIdEvcs);
|
||||
commonRequest.setData(data);
|
||||
String responseBody = ok(commonRequest, "/notification_charge_order_info", authSecretTokenOut, operatorIdEvcs);
|
||||
return DTOJsonHelper.parseResponseData(responseBody,
|
||||
ChargeOrderInfoResponse.class, authSecretTokenOut);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher {
|
||||
EquipChargeStatusRes equipChargeStatusRes = DTOJsonHelper.parseResponseData(responseBody,
|
||||
EquipChargeStatusRes.class, authSecretTokenOut);
|
||||
if (equipChargeStatusRes != null && equipChargeStatusRes.getSuccStat() != 0) {
|
||||
throw new RuntimeException(String.format("push CD equipment order status [%s] failed: %s",
|
||||
throw new RuntimeException(String.format("push equipment order status [%s] failed: %s",
|
||||
equipChargeStatus.getStartChargeSeq(), responseBody));
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,7 +11,6 @@ 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.Map;
|
||||
|
||||
@ -24,10 +23,10 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
|
||||
@Autowired
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
|
||||
@Scheduled(fixedRate = 1000 * 20)
|
||||
public void run() throws IOException {
|
||||
@Scheduled(fixedRate = 1000 * 5)
|
||||
public void run() throws Exception {
|
||||
|
||||
//notifyService();
|
||||
notifyService();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,15 +52,15 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
|
||||
continue;
|
||||
}
|
||||
String orderNo = pushOrderKey.substring(10);
|
||||
Map<String, Object> order = REDIS.getCacheMap("order:" + orderNo);
|
||||
Map<String, Object> cacheOrder = REDIS.getCacheMap("order:" + orderNo);
|
||||
final Object stopResult = cacheOrder.get("stopResult");
|
||||
if (stopResult == null) {
|
||||
continue;
|
||||
}
|
||||
String operatorId3rdpty = (String) pushOrder.get("operatorId3rdpty");
|
||||
if (operatorId3rdpty == null) {
|
||||
continue;
|
||||
}
|
||||
AuthSecretToken authSecretTokenOut = authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId3rdpty, SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
if (authSecretTokenOut == null) {
|
||||
continue;
|
||||
}
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId3rdpty,
|
||||
SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
CommonRequest<ChargeResultRequest> chargeResultRequestCommonRequest = new CommonRequest<>();
|
||||
ChargeResultRequest chargeResultRequest = new ChargeResultRequest();
|
||||
if (stopCommandSent) {
|
||||
@ -69,7 +68,7 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
|
||||
//通过充电订单号,获取指定的订单
|
||||
//判断订单充电状态
|
||||
//获取指定的订单的数据
|
||||
CacheOrderData orderData = (CacheOrderData) order.get("orderData");
|
||||
CacheOrderData orderData = (CacheOrderData) cacheOrder.get("orderData");
|
||||
String internetSerialNumber = (String) pushOrder.get("internetSerialNumber");
|
||||
chargeResultRequest.setStartChargeSeq(internetSerialNumber);
|
||||
if (orderData != null) {
|
||||
@ -85,24 +84,25 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
|
||||
chargeResultRequestCommonRequest.setOperatorId(operatorId3rdpty);
|
||||
String jsonData = JSONUtil.toJSONString(chargeResultRequest);
|
||||
chargeResultRequestCommonRequest.setData(jsonData);
|
||||
String result = ok(chargeResultRequestCommonRequest, "/notification_stop_charge_result", authSecretTokenOut, operatorId3rdpty);
|
||||
String result = ok(chargeResultRequestCommonRequest, "/notification_stop_charge_result",
|
||||
authSecretTokenOut, operatorId3rdpty);
|
||||
|
||||
ChargeResultResponse chargeResultResponse = JSONUtil.readParams(result, ChargeResultResponse.class);
|
||||
succStat = chargeResultResponse.getSuccStat();
|
||||
//推送成功则排除这个已推送的订单,否则则继续推送该订单 // 用于测试暂时注释
|
||||
// if (succStat==0){
|
||||
// REDIS.deleteObject(pushOrderKey);
|
||||
// }
|
||||
|
||||
|
||||
if (succStat == 0) {
|
||||
REDIS.deleteObject(pushOrderKey);
|
||||
}
|
||||
// pushOrder.put("stopCommandSent", false);
|
||||
// REDIS.setCacheMap(pushOrderKey, pushOrder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//推送充电订单信息
|
||||
new NotificationChargeOrderInfo().pushChargeOrderInfo();
|
||||
|
||||
//进行账单对账
|
||||
new CheckChargeOrders().checkChargeOrder();
|
||||
// new NotificationChargeOrderInfo().pushChargeOrderInfo();
|
||||
//
|
||||
// //进行账单对账
|
||||
// new CheckChargeOrders().checkChargeOrder();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user