增加返回信息
This commit is contained in:
parent
4377939cb7
commit
1c4b640d85
@ -38,7 +38,7 @@ public class ChargingController {
|
|||||||
private PowerPileService powerPileService;
|
private PowerPileService powerPileService;
|
||||||
|
|
||||||
@PostMapping("test/pile/charging/order")
|
@PostMapping("test/pile/charging/order")
|
||||||
public Object test(@Validated @RequestBody StartChargingData startChargingData) {
|
public R test(@Validated @RequestBody StartChargingData startChargingData) {
|
||||||
|
|
||||||
R r = R.ok();
|
R r = R.ok();
|
||||||
for (int i = 0; i < startChargingData.getBalance(); i++) {
|
for (int i = 0; i < startChargingData.getBalance(); i++) {
|
||||||
@ -48,7 +48,7 @@ public class ChargingController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("charging/balance/refresh")
|
@PostMapping("charging/balance/refresh")
|
||||||
public Object refreshBalance(@Validated @RequestBody StartChargingData balanceRefreshData) {
|
public R refreshBalance(@Validated @RequestBody StartChargingData balanceRefreshData) {
|
||||||
|
|
||||||
String pileNo = balanceRefreshData.getPileNo();
|
String pileNo = balanceRefreshData.getPileNo();
|
||||||
String pkey = "pile:".concat(pileNo);
|
String pkey = "pile:".concat(pileNo);
|
||||||
@ -77,7 +77,7 @@ public class ChargingController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("charging/start")
|
@PostMapping("charging/start")
|
||||||
public Object startCharging(@Validated @RequestBody StartChargingData startChargingData) {
|
public R startCharging(@Validated @RequestBody StartChargingData startChargingData) {
|
||||||
|
|
||||||
String pileNo = startChargingData.getPileNo();
|
String pileNo = startChargingData.getPileNo();
|
||||||
String pkey = "pile:".concat(pileNo);
|
String pkey = "pile:".concat(pileNo);
|
||||||
@ -136,7 +136,7 @@ public class ChargingController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("charging/stop/{pileNo}/{gunId}/{version}")
|
@PutMapping("charging/stop/{pileNo}/{gunId}/{version}")
|
||||||
public Object stopCharging(@PathVariable("pileNo") String pileNo, @PathVariable("gunId") String gunId, @PathVariable("version") String version) {
|
public R stopCharging(@PathVariable("pileNo") String pileNo, @PathVariable("gunId") String gunId, @PathVariable("version") String version) {
|
||||||
|
|
||||||
String pkey = "pile:".concat(pileNo);
|
String pkey = "pile:".concat(pileNo);
|
||||||
Map<String, String> cachePile = REDIS.getCacheMap(pkey);
|
Map<String, String> cachePile = REDIS.getCacheMap(pkey);
|
||||||
@ -167,7 +167,7 @@ public class ChargingController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("native/charging/balance/refresh")
|
@PostMapping("native/charging/balance/refresh")
|
||||||
public Object nativeRefreshBalance(@Validated @RequestBody StartChargingData refreshBalanceData) {
|
public R nativeRefreshBalance(@Validated @RequestBody StartChargingData refreshBalanceData) {
|
||||||
|
|
||||||
String pileNo = refreshBalanceData.getPileNo();
|
String pileNo = refreshBalanceData.getPileNo();
|
||||||
String gunkey = "gun:".concat(pileNo).concat(refreshBalanceData.getGunId());
|
String gunkey = "gun:".concat(pileNo).concat(refreshBalanceData.getGunId());
|
||||||
@ -193,7 +193,7 @@ public class ChargingController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("native/charging/start")
|
@PostMapping("native/charging/start")
|
||||||
public Object nativeStartCharging(@Validated @RequestBody StartChargingData startChargingData) {
|
public R nativeStartCharging(@Validated @RequestBody StartChargingData startChargingData) {
|
||||||
|
|
||||||
String pileNo = startChargingData.getPileNo();
|
String pileNo = startChargingData.getPileNo();
|
||||||
ClientHandler clientHandler = ChargingPileServer.getHandler(pileNo);
|
ClientHandler clientHandler = ChargingPileServer.getHandler(pileNo);
|
||||||
@ -212,7 +212,7 @@ public class ChargingController {
|
|||||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
REDIS.setCacheMap(orderkey, cacheOrder);
|
||||||
Map<String, Object> cacheGun = REDIS.getCacheMap(gunkey);
|
Map<String, Object> cacheGun = REDIS.getCacheMap(gunkey);
|
||||||
cacheGun.put("orderkey", orderkey);
|
cacheGun.put("orderkey", orderkey);
|
||||||
return R.ok();
|
return R.ok("订单启动指令已下发至充电桩");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("send message failed. " + e.getMessage(), e);
|
log.error("send message failed. " + e.getMessage(), e);
|
||||||
return R.fail(e.getMessage());
|
return R.fail(e.getMessage());
|
||||||
@ -220,7 +220,7 @@ public class ChargingController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("native/charging/stop/{pileNo}/{gunId}/{version}")
|
@GetMapping("native/charging/stop/{pileNo}/{gunId}/{version}")
|
||||||
public Object nativeStopCharging(@PathVariable("pileNo") String pileNo, @PathVariable("gunId") String gunId, @PathVariable("version") String version) {
|
public R nativeStopCharging(@PathVariable("pileNo") String pileNo, @PathVariable("gunId") String gunId, @PathVariable("version") String version) {
|
||||||
|
|
||||||
ClientHandler clientHandler = ChargingPileServer.getHandler(pileNo);
|
ClientHandler clientHandler = ChargingPileServer.getHandler(pileNo);
|
||||||
if (clientHandler == null) return R.fail("充电桩没有连接到上次注册的服务器");
|
if (clientHandler == null) return R.fail("充电桩没有连接到上次注册的服务器");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user