|
@@ -148,32 +148,26 @@ public class MsgCharngingRunner {
|
|
|
log.info("======Charging status push task ending=====");
|
|
log.info("======Charging status push task ending=====");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //尝试下发103 避免下发太频繁
|
|
|
public void try103(OrderStatus orderStatus){
|
|
public void try103(OrderStatus orderStatus){
|
|
|
-
|
|
|
|
|
String key = "try103:_"+orderStatus.getDeviceImei();
|
|
String key = "try103:_"+orderStatus.getDeviceImei();
|
|
|
if(redisCache.hasKey(key)){
|
|
if(redisCache.hasKey(key)){
|
|
|
log.info("{}-{}忽略下发103", orderStatus.getPileCode(), orderStatus.getGunsCode());
|
|
log.info("{}-{}忽略下发103", orderStatus.getPileCode(), orderStatus.getGunsCode());
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
log.info("{}-{}2分钟内无状态下发一次103", orderStatus.getPileCode(), orderStatus.getGunsCode());
|
|
log.info("{}-{}2分钟内无状态下发一次103", orderStatus.getPileCode(), orderStatus.getGunsCode());
|
|
|
deviceControlerService.sendImeiDetail(orderStatus.getDeviceImei());
|
|
deviceControlerService.sendImeiDetail(orderStatus.getDeviceImei());
|
|
|
redisCache.setCacheObject(key, System.currentTimeMillis(),120, TimeUnit.SECONDS);
|
|
redisCache.setCacheObject(key, System.currentTimeMillis(),120, TimeUnit.SECONDS);
|
|
|
- return;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public void stopOne(OrderStatus orderStatus){
|
|
|
|
|
|
|
+ //停止一个订单
|
|
|
|
|
+ public void stopOneOrder(OrderStatus orderStatus){
|
|
|
|
|
+ log.info("{}--id:{}设置订单关闭",orderStatus.getPileCode(),orderStatus.getId());
|
|
|
int port = (int) orderStatus.getGunsCode();
|
|
int port = (int) orderStatus.getGunsCode();
|
|
|
- orderStatus.setNowOrderStatus(StatusConstant.NOW_ORDER_STATUS_CHARGING_ENDING);
|
|
|
|
|
- orderStatus.setEndTime(System.currentTimeMillis());
|
|
|
|
|
- orderStatusService.save(orderStatus);
|
|
|
|
|
- //发送停止充电指令
|
|
|
|
|
- orderStatus.setEndTime(System.currentTimeMillis() - 1000 * 60 * 5);
|
|
|
|
|
- orderStatus.setReasonStopCharging(TransConstant.INSUFFICIENT_BALANCE_EXCEPTION_STOP);
|
|
|
|
|
|
|
+ orderStatus.setEndTime(System.currentTimeMillis() - 1000 * 60 * 2);
|
|
|
orderStatus.setNowOrderStatus(StatusConstant.NOW_ORDER_STATUS_CHARGING_ENDING);
|
|
orderStatus.setNowOrderStatus(StatusConstant.NOW_ORDER_STATUS_CHARGING_ENDING);
|
|
|
orderStatusService.updateById(orderStatus);
|
|
orderStatusService.updateById(orderStatus);
|
|
|
deviceControlerService.stopCharge(orderStatus.getDeviceImei(), orderStatus.getDeviceImei(), port);
|
|
deviceControlerService.stopCharge(orderStatus.getDeviceImei(), orderStatus.getDeviceImei(), port);
|
|
|
- log.info("{}--id:{}已停止充电",orderStatus.getPileCode(),orderStatus.getId());
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void reportOne(OrderStatus orderStatus, BillingModel billingModel, DeviceConnectionMsg deviceConnectionMsg) {
|
|
public void reportOne(OrderStatus orderStatus, BillingModel billingModel, DeviceConnectionMsg deviceConnectionMsg) {
|
|
@@ -182,9 +176,7 @@ public class MsgCharngingRunner {
|
|
|
DeviceStatus deviceStatus = redisCache.getCacheMapValue(cacheKey, orderStatus.getPileCode());
|
|
DeviceStatus deviceStatus = redisCache.getCacheMapValue(cacheKey, orderStatus.getPileCode());
|
|
|
|
|
|
|
|
long t = System.currentTimeMillis()-orderStatus.getCreateTime();
|
|
long t = System.currentTimeMillis()-orderStatus.getCreateTime();
|
|
|
-
|
|
|
|
|
int port = (int) orderStatus.getGunsCode();
|
|
int port = (int) orderStatus.getGunsCode();
|
|
|
-
|
|
|
|
|
if(deviceStatus==null){
|
|
if(deviceStatus==null){
|
|
|
if(t<15*60*1000){
|
|
if(t<15*60*1000){
|
|
|
try103(orderStatus);
|
|
try103(orderStatus);
|
|
@@ -192,7 +184,8 @@ public class MsgCharngingRunner {
|
|
|
}else{
|
|
}else{
|
|
|
log.info("{}-{}无15分钟还没有记录要停止充电", orderStatus.getPileCode(), orderStatus.getGunsCode());
|
|
log.info("{}-{}无15分钟还没有记录要停止充电", orderStatus.getPileCode(), orderStatus.getGunsCode());
|
|
|
//状态那我为
|
|
//状态那我为
|
|
|
- stopOne(orderStatus);
|
|
|
|
|
|
|
+ orderStatus.setReasonStopCharging(TransConstant.OTHER_STOP);
|
|
|
|
|
+ stopOneOrder(orderStatus);
|
|
|
}
|
|
}
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -205,7 +198,8 @@ public class MsgCharngingRunner {
|
|
|
}else{
|
|
}else{
|
|
|
log.info("{}-{}5分钟后还不是充电状态录要停止充电", orderStatus.getPileCode(), orderStatus.getGunsCode());
|
|
log.info("{}-{}5分钟后还不是充电状态录要停止充电", orderStatus.getPileCode(), orderStatus.getGunsCode());
|
|
|
//状态那我为
|
|
//状态那我为
|
|
|
- stopOne(orderStatus);
|
|
|
|
|
|
|
+ orderStatus.setReasonStopCharging(TransConstant.OTHER_STOP);
|
|
|
|
|
+ stopOneOrder(orderStatus);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -260,15 +254,8 @@ public class MsgCharngingRunner {
|
|
|
if (money.compareTo(orderStatus.getStartMoney()) > 0) {
|
|
if (money.compareTo(orderStatus.getStartMoney()) > 0) {
|
|
|
//余额没有了,停充
|
|
//余额没有了,停充
|
|
|
log.info("{},{},{}实时状态校验时余额不足>>>>>>停充>>>>",orderStatus.getPileCode(),orderStatus.getGunsCode(),orderStatus.getId());
|
|
log.info("{},{},{}实时状态校验时余额不足>>>>>>停充>>>>",orderStatus.getPileCode(),orderStatus.getGunsCode(),orderStatus.getId());
|
|
|
- DeviceParam deviceParam = new DeviceParam();
|
|
|
|
|
- deviceParam.setDeviceId(orderStatus.getDeviceImei());
|
|
|
|
|
- deviceParam.setCcid(orderStatus.getDeviceImei());
|
|
|
|
|
-
|
|
|
|
|
- orderStatus.setEndTime(System.currentTimeMillis() - 1000 * 60 * 5);
|
|
|
|
|
orderStatus.setReasonStopCharging(TransConstant.INSUFFICIENT_BALANCE_EXCEPTION_STOP);
|
|
orderStatus.setReasonStopCharging(TransConstant.INSUFFICIENT_BALANCE_EXCEPTION_STOP);
|
|
|
- orderStatus.setNowOrderStatus(StatusConstant.NOW_ORDER_STATUS_CHARGING_ENDING);
|
|
|
|
|
- orderStatusService.updateById(orderStatus);
|
|
|
|
|
- deviceControlerService.stopCharge(orderStatus.getDeviceImei(), orderStatus.getDeviceImei(), 1);
|
|
|
|
|
|
|
+ stopOneOrder(orderStatus);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
int mi = (int) (System.currentTimeMillis() - orderStatus.getCreateTime()) / 1000 / 60;
|
|
int mi = (int) (System.currentTimeMillis() - orderStatus.getCreateTime()) / 1000 / 60;
|