完成Notification_Stop_Charge_ResultTask,Notification_Charge_Order_Info,CheckCharge_Orders.

This commit is contained in:
wen 2021-11-11 14:44:28 +08:00
parent e2cd9cea69
commit 93cb85a7f6
4 changed files with 16 additions and 7 deletions

View File

@ -43,7 +43,7 @@ public class QueryStationsInfoController {
@PostMapping("/v1/query_stations_info")
public CommonResponse queryStationsInfo(@RequestBody(required = false) CommonRequest<PageRequest> commonRequest) throws Exception {
// todo 电站状态更新逻辑,没必要做全推
// 电站状态更新逻辑,没必要做全推
// chargingStationPushStatusService.editStationStatus();
// chargingStationPushStatusService.saveStationStatus();

View File

@ -52,7 +52,7 @@ public class CheckChargeOrders extends CoreDispatcher {
}
String orderNo = pushOrderKey.substring(10);
Map<String, Object> order = REDIS.getCacheMap("order:" + orderNo);
String operatorId3rdpty = (String) order.get("operatorId3rdpty"); //todo zz
String operatorId3rdpty = (String) pushOrder.get("operatorId3rdpty");
if (operatorId3rdpty == null) {
continue;
}

View File

@ -58,7 +58,7 @@ public class NotificationChargeOrderInfo extends CoreDispatcher {
}
String orderNo = pushOrderKey.substring(10);
Map<String, Object> order = REDIS.getCacheMap("order:" + orderNo);
String operatorId3rdpty = (String) order.get("operatorId3rdpty"); //todo zz
String operatorId3rdpty = (String) pushOrder.get("operatorId3rdpty");
if (operatorId3rdpty == null) {
continue;
}

View File

@ -27,7 +27,7 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
@Scheduled(fixedRate = 1000 * 20)
public void run() throws IOException {
notifyService();
//notifyService();
}
/**
@ -41,7 +41,7 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
* 出现异常逻辑
* 如果当充电桩因为异常停止充电时那么谁告诉我订单是个异常订单
*/
public void notifyService() throws IOException {
public void notifyService() throws Exception {
//获取Redis中的所有订单状态数据
Collection<String> pushOrders = REDIS.keys("pushOrder:*");
@ -54,7 +54,7 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
}
String orderNo = pushOrderKey.substring(10);
Map<String, Object> order = REDIS.getCacheMap("order:" + orderNo);
String operatorId3rdpty = (String) order.get("operatorId3rdpty"); //todo zz
String operatorId3rdpty = (String) pushOrder.get("operatorId3rdpty");
if (operatorId3rdpty == null) {
continue;
}
@ -82,18 +82,27 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
chargeResultRequest.setFailReason(failReason);
//将其转换为json
chargeResultRequestCommonRequest.setOperatorId(operatorId3rdpty);
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);
// }
}
}
}
//推送充电订单信息
new NotificationChargeOrderInfo().pushChargeOrderInfo();
//进行账单对账
new CheckChargeOrders().checkChargeOrder();
}
}