From e16a5a3f997a28e58dd26876db2c6c642f24e1a9 Mon Sep 17 00:00:00 2001 From: ZZ Date: Tue, 28 Sep 2021 14:14:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=81=9C=E6=AD=A2=E5=85=85?= =?UTF-8?q?=E7=94=B5=E8=AE=A2=E5=8D=95=E5=8F=B7=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xhpc/common/api/PowerPileService.java | 12 ++++++++---- .../common/api/factory/PowerPileFallbackFactory.java | 2 +- .../com/xhpc/pp/controller/ChargingController.java | 11 +++++++++-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/PowerPileService.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/PowerPileService.java index 424f143b..944b6f5e 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/PowerPileService.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/PowerPileService.java @@ -12,7 +12,8 @@ import org.springframework.web.bind.annotation.*; import java.util.Set; -@FeignClient(contextId = "powerPileService", value = ServiceNameConstants.PILE_SERVICE, fallbackFactory = PowerPileFallbackFactory.class) +@FeignClient(contextId = "powerPileService", value = ServiceNameConstants.PILE_SERVICE, fallbackFactory = + PowerPileFallbackFactory.class) public interface PowerPileService { // @PreAuthorize(hasPermi = "user:privilege:add") todo @@ -22,8 +23,9 @@ public interface PowerPileService { @PostMapping("/charging/balance/refresh") R refreshBalance(@Validated @RequestBody StartChargingData balanceRefreshData); - @PutMapping("charging/stop/{pileNo}/{gunId}/{version}") - R stopCharging(@PathVariable("pileNo") String pileNo, @PathVariable("gunId") String gunId, @PathVariable("version") String version); + @PutMapping("charging/stop/{orderNo}/{pileNo}/{gunId}/{version}") + R stopCharging(@PathVariable("orderNo") String orderNo, @PathVariable("pileNo") String pileNo, + @PathVariable("gunId") String gunId, @PathVariable("version") String version); @PostMapping("/pile/whitelist/add/{stationId}") R addPileWhitelist(@PathVariable("stationId") Long stationId, @RequestBody Set pileNoSet); @@ -32,6 +34,8 @@ public interface PowerPileService { R deletePileWhitelist(@PathVariable("stationId") Long stationId, @RequestBody Set pileNoSet); @PostMapping("/station/rateModel/{stationId}/{rateModelId}") - R setStationRateModel(@PathVariable("stationId") @Param("stationId") Long stationId, @PathVariable("rateModelId") @Param("rateModelId") Long rateModelId, @RequestBody @Param("rateModel") CacheRateModel rateModel); + R setStationRateModel(@PathVariable("stationId") @Param("stationId") Long stationId, + @PathVariable("rateModelId") @Param("rateModelId") Long rateModelId, + @RequestBody @Param("rateModel") CacheRateModel rateModel); } diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/PowerPileFallbackFactory.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/PowerPileFallbackFactory.java index 45a590f9..e341ee23 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/PowerPileFallbackFactory.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/PowerPileFallbackFactory.java @@ -35,7 +35,7 @@ public class PowerPileFallbackFactory implements FallbackFactory cachePile = REDIS.getCacheMap(pkey); @@ -146,6 +149,10 @@ public class ChargingController { r = R.fail("充电桩离线"); } String gunkey = pkey.concat(gunId); + final Map cacheGun = REDIS.getCacheMap(gunkey); + if (cacheGun.get("orderkey") == null || !cacheGun.get("orderkey").toString().endsWith(orderNo) || !orderNo.contains(pileNo)) { + r = R.fail("错误的订单号"); + } String gunStatus = REDIS.getCacheMapValue(gunkey, "status"); if (!("空闲".equals(gunStatus) || "离线".equals(gunStatus) || "故障".equals(gunStatus))) { if (r.getCode() == 200) {