增加停止充电订单号参数
This commit is contained in:
parent
392a696319
commit
e16a5a3f99
@ -12,7 +12,8 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import java.util.Set;
|
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 {
|
public interface PowerPileService {
|
||||||
|
|
||||||
// @PreAuthorize(hasPermi = "user:privilege:add") todo
|
// @PreAuthorize(hasPermi = "user:privilege:add") todo
|
||||||
@ -22,8 +23,9 @@ public interface PowerPileService {
|
|||||||
@PostMapping("/charging/balance/refresh")
|
@PostMapping("/charging/balance/refresh")
|
||||||
R refreshBalance(@Validated @RequestBody StartChargingData balanceRefreshData);
|
R refreshBalance(@Validated @RequestBody StartChargingData balanceRefreshData);
|
||||||
|
|
||||||
@PutMapping("charging/stop/{pileNo}/{gunId}/{version}")
|
@PutMapping("charging/stop/{orderNo}/{pileNo}/{gunId}/{version}")
|
||||||
R stopCharging(@PathVariable("pileNo") String pileNo, @PathVariable("gunId") String gunId, @PathVariable("version") String version);
|
R stopCharging(@PathVariable("orderNo") String orderNo, @PathVariable("pileNo") String pileNo,
|
||||||
|
@PathVariable("gunId") String gunId, @PathVariable("version") String version);
|
||||||
|
|
||||||
@PostMapping("/pile/whitelist/add/{stationId}")
|
@PostMapping("/pile/whitelist/add/{stationId}")
|
||||||
R addPileWhitelist(@PathVariable("stationId") Long stationId, @RequestBody Set<String> pileNoSet);
|
R addPileWhitelist(@PathVariable("stationId") Long stationId, @RequestBody Set<String> pileNoSet);
|
||||||
@ -32,6 +34,8 @@ public interface PowerPileService {
|
|||||||
R deletePileWhitelist(@PathVariable("stationId") Long stationId, @RequestBody Set<String> pileNoSet);
|
R deletePileWhitelist(@PathVariable("stationId") Long stationId, @RequestBody Set<String> pileNoSet);
|
||||||
|
|
||||||
@PostMapping("/station/rateModel/{stationId}/{rateModelId}")
|
@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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,7 @@ public class PowerPileFallbackFactory implements FallbackFactory<PowerPileServic
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R stopCharging(String pileNo, String gunId, String version) {
|
public R stopCharging(String orderNo, String pileNo, String gunId, String version) {
|
||||||
|
|
||||||
return R.fail("停止充电失败:" + cause.getMessage());
|
return R.fail("停止充电失败:" + cause.getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -132,8 +132,11 @@ public class ChargingController {
|
|||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("charging/stop/{pileNo}/{gunId}/{version}")
|
@PutMapping("charging/stop/{orderNo}/{pileNo}/{gunId}/{version}")
|
||||||
public R stopCharging(@PathVariable("pileNo") String pileNo, @PathVariable("gunId") String gunId, @PathVariable("version") String version) {
|
public R stopCharging(@PathVariable("orderNo") String orderNo, @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);
|
||||||
@ -146,6 +149,10 @@ public class ChargingController {
|
|||||||
r = R.fail("充电桩离线");
|
r = R.fail("充电桩离线");
|
||||||
}
|
}
|
||||||
String gunkey = pkey.concat(gunId);
|
String gunkey = pkey.concat(gunId);
|
||||||
|
final Map<String, Object> 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");
|
String gunStatus = REDIS.getCacheMapValue(gunkey, "status");
|
||||||
if (!("空闲".equals(gunStatus) || "离线".equals(gunStatus) || "故障".equals(gunStatus))) {
|
if (!("空闲".equals(gunStatus) || "离线".equals(gunStatus) || "故障".equals(gunStatus))) {
|
||||||
if (r.getCode() == 200) {
|
if (r.getCode() == 200) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user