订单回调
This commit is contained in:
parent
a551e3a531
commit
be2be40e9b
@ -2,7 +2,6 @@ package com.xhpc.common.api.factory;
|
|||||||
|
|
||||||
import com.xhpc.common.api.PileOrderService;
|
import com.xhpc.common.api.PileOrderService;
|
||||||
import com.xhpc.common.core.domain.R;
|
import com.xhpc.common.core.domain.R;
|
||||||
import com.xhpc.common.dto.PileEndOrder;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
@ -37,7 +36,7 @@ public class PileOrderFallbackFactory implements FallbackFactory<PileOrderServic
|
|||||||
@Override
|
@Override
|
||||||
public R pileEndOrder(String orderNo) {
|
public R pileEndOrder(String orderNo) {
|
||||||
|
|
||||||
return R.fail("桩订单结束回调接口失败:" + cause.getMessage());
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -52,7 +52,7 @@ public class OrderDataLogic implements ServiceLogic {
|
|||||||
String seq = seqHex(skey);
|
String seq = seqHex(skey);
|
||||||
String resultStr = "6815".concat(seq).concat("0040").concat(orderNo).concat(ServiceResult.HEX_OK);
|
String resultStr = "6815".concat(seq).concat("0040").concat(orderNo).concat(ServiceResult.HEX_OK);
|
||||||
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
|
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
|
||||||
return new ServiceResult(HexUtils.toBytes(resultStr), ServiceResult.OK);
|
return new ServiceResult(HexUtils.toBytes(resultStr), ServiceResult.OK, orderNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CacheOrderData translate(OrderData orderData) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException {
|
private CacheOrderData translate(OrderData orderData) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException {
|
||||||
|
|||||||
@ -110,6 +110,7 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
cacheOrder.put("realtimeDataList", realtimeDataList);
|
cacheOrder.put("realtimeDataList", realtimeDataList);
|
||||||
orderkey = (String) cacheGun.get("orderkey");
|
orderkey = (String) cacheGun.get("orderkey");
|
||||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
REDIS.setCacheMap(orderkey, cacheOrder);
|
||||||
|
pileOrderService.pileRimeOrder(orderNo);
|
||||||
if ((balance - cacheRealtimeData.getAmountCharged()) < 500) {
|
if ((balance - cacheRealtimeData.getAmountCharged()) < 500) {
|
||||||
String alerted = (String) cacheOrder.get("lt5alerted");
|
String alerted = (String) cacheOrder.get("lt5alerted");
|
||||||
String tel = (String) cacheOrder.get("tel");
|
String tel = (String) cacheOrder.get("tel");
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import com.alibaba.nacos.api.exception.NacosException;
|
import com.alibaba.nacos.api.exception.NacosException;
|
||||||
import com.xhpc.common.api.PileOrderService;
|
import com.xhpc.common.api.PileOrderService;
|
||||||
import com.xhpc.common.api.dto.ChargingStationDto;
|
import com.xhpc.common.api.dto.ChargingStationDto;
|
||||||
|
import com.xhpc.common.core.domain.R;
|
||||||
import com.xhpc.pp.domain.ServiceField;
|
import com.xhpc.pp.domain.ServiceField;
|
||||||
import com.xhpc.pp.logic.FieldLogic;
|
import com.xhpc.pp.logic.FieldLogic;
|
||||||
import com.xhpc.pp.logic.ServiceMainLogic;
|
import com.xhpc.pp.logic.ServiceMainLogic;
|
||||||
@ -105,7 +106,8 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler {
|
|||||||
} else if (SERVICE_RMCR.equals(serviceName) && OK.equals(resultCode)) {
|
} else if (SERVICE_RMCR.equals(serviceName) && OK.equals(resultCode)) {
|
||||||
setCachePileRM(pilekey);
|
setCachePileRM(pilekey);
|
||||||
} else if (SERVICE_OD.equals(serviceName) && OK.equals(resultCode)) {
|
} else if (SERVICE_OD.equals(serviceName) && OK.equals(resultCode)) {
|
||||||
// pileOrderService.pileEndOrder(); todo
|
R r = pileOrderService.pileEndOrder(result.getMsg());
|
||||||
|
if (r.getCode() != 200) return;
|
||||||
}
|
}
|
||||||
if (result.getBinary() != null) {
|
if (result.getBinary() != null) {
|
||||||
log.info("server send msg >>>> ({}) |{}|", pileNo, toHex(result.getBinary()));
|
log.info("server send msg >>>> ({}) |{}|", pileNo, toHex(result.getBinary()));
|
||||||
|
|||||||
@ -48,6 +48,13 @@ public class ServiceResult {
|
|||||||
this.code = OK;
|
this.code = OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ServiceResult(byte[] binary, String code, String msg) {
|
||||||
|
|
||||||
|
this.binary = binary;
|
||||||
|
this.code = code;
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
public ServiceResult(byte[] binary, String code) {
|
public ServiceResult(byte[] binary, String code) {
|
||||||
|
|
||||||
this.binary = binary;
|
this.binary = binary;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user