只能对充电中的端口停止充电

This commit is contained in:
ZZ 2021-09-14 14:26:24 +08:00
parent ac5d959214
commit 38b04df6a5
2 changed files with 26 additions and 19 deletions

View File

@ -74,11 +74,10 @@ public class ChargingController {
r = R.fail("Native服务调用失败");
} else {
int code = responseJson.getInteger("code");
log.info(response);
if (code != 200) {//todo rat
log.error("!200:" + response);
r = R.fail(code, responseJson.getString("msg"));
} else {
log.error("200:" + response);
r = R.ok(responseJson.get("data"), responseJson.getString("msg"));
}
}
@ -146,6 +145,9 @@ public class ChargingController {
if (!REGISTERED.equals(status)) {
r = R.fail("充电桩离线");
}
String gunkey = pkey.concat(gunId);
String gunStatus = REDIS.getCacheMapValue(gunkey, "status");
if (!("空闲".equals(gunStatus) || "离线".equals(gunStatus) || "故障".equals(gunStatus))) {
if (r.getCode() == 200) {
String svcSrv = cachePile.get("svcSrv");
String response = HttpUtils.get(fmt(svcSrv)
@ -155,6 +157,9 @@ public class ChargingController {
.concat(version));
r = getRR(response);
}
} else {
r = R.fail("端口不在充电中");
}
return r;
}

View File

@ -36,6 +36,7 @@ public class RemoteStopReplyDataLogic implements ServiceLogic {
String gunkey = "gun:".concat(remoteStopReplyData.getPileNo()).concat(remoteStopReplyData.getGunId());
Map<String, Object> cacheGun = REDIS.getCacheMap(gunkey);
String orderkey = (String) cacheGun.get("orderkey");
if (orderkey != null) {
Map<String, Object> cacheOrder = REDIS.getCacheMap(orderkey);
String stopResult = remoteStopReplyData.getStopResult();
cacheOrder.put("stopResult", stopResult);
@ -46,6 +47,7 @@ public class RemoteStopReplyDataLogic implements ServiceLogic {
} else {
pileOrderService.pileStop(orderNo, 2, frs[Integer.parseInt(remoteStopReplyData.getFailReason())]);
}
}
return new ServiceResult(false);
}