完善NotificationStopChargeResultTask
完善QueryEquipChargeStatusController
This commit is contained in:
parent
83575b1b4a
commit
8fb329ea06
@ -41,11 +41,9 @@ public class QueryEquipChargeStatusController {
|
||||
equipChargeStatus.setStartChargeSeq(startChargeSeq);
|
||||
//充电订单状态
|
||||
EtOrderMapping etOrderMapping = orderMappingRepository.findByEvcsOrderNo(startChargeSeq).orElse(null);
|
||||
// XhpcHistoryOrder xhpcHistoryOrder = xhpcHistoryOrderRepository.findByInternetSerialNumber(startChargeSeq).orElse(null);
|
||||
if (etOrderMapping == null) {
|
||||
throw new ServerInternalException("未查询到该订单编号数据");
|
||||
}
|
||||
// String internalOrderNum = xhpcHistoryOrder.getSerialNumber();
|
||||
String internalOrderNum = etOrderMapping.getXhOrderNo();
|
||||
Map<String, Object> order = REDIS.getCacheMap("order:" + internalOrderNum);
|
||||
String orderStatus = (String) order.get("status");
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package com.xhpc.evcs.notification;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.xhpc.common.data.redis.CacheOrderData;
|
||||
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.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
@ -27,7 +27,7 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
|
||||
@Scheduled(fixedRate = 1000 * 20)
|
||||
public void run() throws IOException {
|
||||
|
||||
notifyService3();
|
||||
notifyService();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -41,7 +41,7 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
|
||||
* 出现异常逻辑
|
||||
* 如果当充电桩因为异常停止充电时,那么谁告诉我订单是个异常订单?
|
||||
*/
|
||||
public void notifyService3() throws JsonProcessingException {
|
||||
public void notifyService() throws IOException {
|
||||
|
||||
//获取Redis中的所有订单状态数据
|
||||
Collection<String> pushOrders = REDIS.keys("pushOrder:*");
|
||||
@ -68,24 +68,30 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
|
||||
//获取内部的充电订单号
|
||||
//通过充电订单号,获取指定的订单
|
||||
//判断订单充电状态
|
||||
// 获取指定的订单的数据
|
||||
//获取指定的订单的数据
|
||||
CacheOrderData orderData = (CacheOrderData) order.get("orderData");
|
||||
String internetSerialNumber = (String) pushOrder.get("internetSerialNumber");
|
||||
chargeResultRequest.setStartChargeSeq(internetSerialNumber);
|
||||
chargeResultRequest.setConnectorID(orderNo.substring(0, 14));
|
||||
if (orderData != null) {
|
||||
//使用指定包装类封装数据
|
||||
chargeResultRequest.setConnectorID(orderData.getPileNo() + orderData.getGunId());
|
||||
int succStat = 0;
|
||||
int failReason = 0;
|
||||
chargeResultRequest.setStartChargeSeqStat(4);
|
||||
chargeResultRequest.setSuccStat(succStat);
|
||||
chargeResultRequest.setFailReason(failReason);
|
||||
//将其转换为json
|
||||
REDIS.deleteObject(pushOrderKey);
|
||||
|
||||
//将其转换为json
|
||||
String jsonData = JSONUtil.toJSONString(chargeResultRequest);
|
||||
chargeResultRequestCommonRequest.setData(jsonData);
|
||||
String result = ok(chargeResultRequestCommonRequest, "/notification_stop_charge_result", authSecretTokenOut, operatorId3rdpty);
|
||||
|
||||
ChargeResultResponse chargeResultResponse = JSONUtil.readParams(result, ChargeResultResponse.class);
|
||||
succStat = chargeResultResponse.getSuccStat();
|
||||
//推送成功则排除这个已推送的订单,否则则继续推送该订单 //todo 用于测试暂时注释
|
||||
// if (succStat==0){
|
||||
// REDIS.deleteObject(pushOrderKey);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user