费率模型下发数据长度应该是0x5E

This commit is contained in:
ZZ 2021-09-08 17:39:56 +08:00
parent 5d7965914b
commit fb7f3426ff
2 changed files with 4 additions and 3 deletions

View File

@ -91,6 +91,7 @@ public class ChargingController {
@PostMapping("charging/start") @PostMapping("charging/start")
public R startCharging(@Validated @RequestBody StartChargingData startChargingData) { public R startCharging(@Validated @RequestBody StartChargingData startChargingData) {
//todo protocol versioning
String pileNo = startChargingData.getPileNo(); String pileNo = startChargingData.getPileNo();
String pkey = "pile:".concat(pileNo); String pkey = "pile:".concat(pileNo);
Map<String, Object> cachePile = REDIS.getCacheMap(pkey); Map<String, Object> cachePile = REDIS.getCacheMap(pkey);
@ -108,7 +109,7 @@ public class ChargingController {
String gunkey = "gun:".concat(pileNo).concat(startChargingData.getGunId()); String gunkey = "gun:".concat(pileNo).concat(startChargingData.getGunId());
String skey = gunkey.concat(".seqhex"); String skey = gunkey.concat(".seqhex");
String seq = seqHex(skey); String seq = seqHex(skey);
String rateModelMsg = "680E".concat(seq).concat("0058").concat(pileNo) String rateModelMsg = "685E".concat(seq).concat("0058").concat(pileNo)
.concat(String.format("%04X", stationRateModelId)) .concat(String.format("%04X", stationRateModelId))
.concat(rateModel); .concat(rateModel);
rateModelMsg = rateModelMsg.concat(CRCCalculator.calcCrc(rateModel)); rateModelMsg = rateModelMsg.concat(CRCCalculator.calcCrc(rateModel));

View File

@ -66,9 +66,9 @@ public class PileController {
if (handler != null) { if (handler != null) {
try { try {
handler.sendClientBinary(HexUtils.toBytes(msg)); handler.sendClientBinary(HexUtils.toBytes(msg));
r = R.ok("费率模型已下发"); r = R.ok("费率模型已下发,请再次启动充电");
} catch (IOException e) { } catch (IOException e) {
r = R.fail("费率模型下发失败:".concat(e.getMessage())); r = R.fail("费率模型下发失败:".concat(e.getMessage()).concat(".无法启动充电"));
} }
} else { } else {
r = R.fail("费率模型下发失败,充电桩离线"); r = R.fail("费率模型下发失败,充电桩离线");