接口不变但去除协议版本依赖

This commit is contained in:
ZZ 2022-03-10 10:32:35 +08:00
parent d70ac317c4
commit 409d9bad6c
2 changed files with 4 additions and 14 deletions

View File

@ -511,10 +511,6 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
return r; return r;
} }
//获取桩信息
Map<String, Object> xhpcChargingPileById =
xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId(),null);
//启动充电 //启动充电
//订单流水号 终端号+年月日时分秒+自增4位 共32位 //订单流水号 终端号+年月日时分秒+自增4位 共32位
Date date = Calendar.getInstance().getTime(); Date date = Calendar.getInstance().getTime();
@ -525,11 +521,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
startChargingData.setOrderNo(orderNo); startChargingData.setOrderNo(orderNo);
startChargingData.setPileNo(xhpcTerminal.getPileSerialNumber()); startChargingData.setPileNo(xhpcTerminal.getPileSerialNumber());
startChargingData.setGunId(xhpcTerminal.getSerialNumber().substring(14)); startChargingData.setGunId(xhpcTerminal.getSerialNumber().substring(14));
if (xhpcChargingPileById.get("communicationProtocolVersion") != null && !"".equals(xhpcChargingPileById.get("communicationProtocolVersion").toString())) { startChargingData.setVersion("0A");
startChargingData.setVersion(xhpcChargingPileById.get("communicationProtocolVersion").toString());
} else {
startChargingData.setVersion("0A");
}
//平台最小的 //平台最小的

View File

@ -302,7 +302,7 @@ public class ChargingController {
String gunkey = "gun:".concat(connectorId); String gunkey = "gun:".concat(connectorId);
String skey = gunkey.concat(".seqhex"); String skey = gunkey.concat(".seqhex");
String seq = seqHex(skey); String seq = seqHex(skey);
byte[] msg = translateStop(connectorId, version, seq); byte[] msg = translateStop(connectorId, seq);
if (!handler.isOpen()) { if (!handler.isOpen()) {
log.error("send message failed. [{}]({}) connection lost", handler.getName(), pileNo); log.error("send message failed. [{}]({}) connection lost", handler.getName(), pileNo);
removeHandler(pileNo); removeHandler(pileNo);
@ -349,13 +349,11 @@ public class ChargingController {
return HexUtils.toBytes(msg); return HexUtils.toBytes(msg);
} }
private byte[] translateStop(String connectorId, String version, String seq) { private byte[] translateStop(String connectorId, String seq) {
byte[] data = new byte[0]; byte[] data = new byte[0];
data = ArrayUtils.addAll(data, HexUtils.toBytes("680C".concat(seq).concat("0036"))); data = ArrayUtils.addAll(data, HexUtils.toBytes("680C".concat(seq).concat("0036")));
if (default_version.equals(version)) { data = ArrayUtils.addAll(data, HexUtils.toBytes(connectorId));
data = ArrayUtils.addAll(data, HexUtils.toBytes(connectorId));
}
String msg = HexUtils.toHex(data); String msg = HexUtils.toHex(data);
msg = msg.concat(CRCCalculator.calcCrc(msg)); msg = msg.concat(CRCCalculator.calcCrc(msg));
log.debug("stop charging, send msg to terminal ({}) >>>> {}", connectorId, msg); log.debug("stop charging, send msg to terminal ({}) >>>> {}", connectorId, msg);