协议例外:若停止回复成功后实时数据中有两帧为空闲,按照最后一帧进行结算
This commit is contained in:
parent
64c00e13ef
commit
7ed701baea
@ -40,6 +40,48 @@ public class CacheOrderData extends BaseData {
|
||||
private Integer endSoc;
|
||||
private Integer status;//1自动结算,2异常
|
||||
|
||||
public CacheOrderData() {
|
||||
|
||||
}
|
||||
|
||||
public CacheOrderData(CacheRealtimeData cacheRData, String startTime, Integer startSoc, Integer endSoc) {
|
||||
|
||||
this.orderNo = cacheRData.getOrderNo();
|
||||
this.pileNo = cacheRData.getPileNo();
|
||||
this.gunId = cacheRData.getGunId();
|
||||
this.startTime = startTime;
|
||||
this.endTime = cacheRData.getCreateTime();
|
||||
// this.t1Price = cacheRData.gett1Price; //todo: after v1.1 realtime data from pile
|
||||
// this.t1PowerQuantity = t1PowerQuantity;
|
||||
// this.t1LossQuantity = t1LossQuantity;
|
||||
// this.t1Cost = t1Cost;
|
||||
// this.t2Price = t2Price;
|
||||
// this.t2PowerQuantity = t2PowerQuantity;
|
||||
// this.t2LossQuantity = t2LossQuantity;
|
||||
// this.t2Cost = t2Cost;
|
||||
// this.t3Price = t3Price;
|
||||
// this.t3PowerQuantity = t3PowerQuantity;
|
||||
// this.t3LossQuantity = t3LossQuantity;
|
||||
// this.t3Cost = t3Cost;
|
||||
// this.t4Price = t4Price;
|
||||
// this.t4PowerQuantity = t4PowerQuantity;
|
||||
// this.t4LossQuantity = t4LossQuantity;
|
||||
// this.t4Cost = t4Cost;
|
||||
// this.electricMeterStart = electricMeterStart; //不会有
|
||||
// this.electricMeterEnd = electricMeterEnd; //不会有
|
||||
this.totalPowerQuantity = cacheRData.getChargingDegree();
|
||||
this.totalLossPowerQuantity = cacheRData.getLossChargingDegree();
|
||||
this.cost = cacheRData.getAmountCharged();
|
||||
// this.vinNormal = vinNormal; //不会有
|
||||
// this.transactionFlag = transactionFlag;
|
||||
// this.transactionDatetime = transactionDatetime;
|
||||
// this.stopReason = stopReason;
|
||||
// this.cardNo = cardNo;
|
||||
this.startSoc = startSoc;
|
||||
this.endSoc = endSoc;
|
||||
// this.status = status; //todo 字段成谜
|
||||
}
|
||||
|
||||
public String getOrderNo() {
|
||||
|
||||
return orderNo;
|
||||
|
||||
@ -6,6 +6,7 @@ import com.xhpc.common.api.PileOrderService;
|
||||
import com.xhpc.common.api.SmsService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.data.down.StartChargingData;
|
||||
import com.xhpc.common.data.redis.CacheOrderData;
|
||||
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||
import com.xhpc.common.data.up.RealtimeData;
|
||||
import com.xhpc.pp.controller.ChargingController;
|
||||
@ -174,10 +175,23 @@ public class RealtimeDataLogic implements ServiceLogic {
|
||||
Integer errorfreecnt = (Integer) cacheOrder.get("errorfreecnt");
|
||||
errorfreecnt = errorfreecnt == null ? 1 : ++errorfreecnt;
|
||||
if (errorfreecnt == 2) {
|
||||
final R r = pileOrderService.abnormalOrder(orderNo);
|
||||
if (r.getCode() != 200) {
|
||||
CacheRealtimeData cacheRData = REDIS.getCacheObject(orderkey.concat(".lord"));
|
||||
R r = null;
|
||||
final String stopResult = (String) cacheOrder.get("stopResult");
|
||||
if (cacheRData == null) {
|
||||
r = pileOrderService.abnormalOrder(orderNo);
|
||||
} else if ("01".equals(stopResult)) {
|
||||
CacheOrderData lordAsOd = new CacheOrderData(cacheRData, (String) cacheOrder.get("orderstarttime"),
|
||||
(Integer) cacheOrder.get("startSoc"), (Integer) cacheOrder.get("stopSoc"));
|
||||
cacheOrder.put("orderData", lordAsOd);
|
||||
r = pileOrderService.pileEndOrder(orderNo);
|
||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
||||
}
|
||||
if (r == null || r.getCode() != 200) {
|
||||
log.error("errorfreecnt r{}", r);
|
||||
errorfreecnt = 1;
|
||||
}
|
||||
cacheOrder.put("abnormal.1", "lord as order data");
|
||||
log.error("abnormal.1 order[{}]", orderNo);
|
||||
}
|
||||
cacheOrder.put("errorfreecnt", errorfreecnt);
|
||||
|
||||
@ -54,17 +54,19 @@ public class RemoteStartReplyDataLogic implements ServiceLogic {
|
||||
cacheOrder.put("startResult", startResult);
|
||||
String gunkey = "gun:".concat(remoteStartReplyData.getPileNo()).concat(remoteStartReplyData.getGunId());
|
||||
Map<String, Object> cacheGun = REDIS.getCacheMap(gunkey);
|
||||
REDIS.setCacheMap(gunkey, cacheGun);
|
||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
||||
REDIS.setCacheMap(gunkey, cacheGun);
|
||||
if (HEX_01.equals(remoteStartReplyData.getStartResult())) {
|
||||
final String orderstarttime = DateUtil.format(Calendar.getInstance().getTime(), NORM_DATETIME_FORMAT);
|
||||
cacheOrder.put("startTime", orderstarttime);
|
||||
cacheGun.put("orderstarttime", orderstarttime);
|
||||
cacheGun.put("orderstoptime", null);
|
||||
cacheGun.put("orderkey", orderkey);
|
||||
cacheOrder.put("orderstarttime", orderstarttime);
|
||||
REDIS.setCacheMap(gunkey, cacheGun);
|
||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
||||
pileOrderService.pileStartup(orderNo, 1, "启动充电成功");
|
||||
} else {
|
||||
|
||||
final String remark = frs.get(remoteStartReplyData.getFailReason());
|
||||
pileOrderService.pileStartup(orderNo, 2, remark == null ? "未知错误" : remark);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user