mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-17 21:59:52 +08:00
update 电单车协议
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
package com.jsowell.netty.domain.ebike;
|
package com.jsowell.netty.domain.ebike;
|
||||||
|
|
||||||
import com.jsowell.common.util.BytesUtil;
|
import com.jsowell.common.util.BytesUtil;
|
||||||
|
import com.jsowell.netty.domain.ebike.deviceupload.DeviceRegister;
|
||||||
import com.jsowell.netty.domain.ebike.deviceupload.EBikeMessageCmd03;
|
import com.jsowell.netty.domain.ebike.deviceupload.EBikeMessageCmd03;
|
||||||
|
import com.jsowell.netty.domain.ebike.deviceupload.EBikeMessageCmd20;
|
||||||
import com.jsowell.netty.domain.ebike.deviceupload.SettlementInfo;
|
import com.jsowell.netty.domain.ebike.deviceupload.SettlementInfo;
|
||||||
import com.jsowell.netty.domain.ebike.serversend.EBikeMessageCmd82;
|
import com.jsowell.netty.domain.ebike.serversend.EBikeMessageCmd82;
|
||||||
import com.jsowell.netty.domain.ebike.serversend.SpecificDataCmd82;
|
import com.jsowell.netty.domain.ebike.serversend.SpecificDataCmd82;
|
||||||
@@ -40,6 +42,8 @@ public abstract class AbsEBikeMessage {
|
|||||||
return new EBikeMessageCmd82(header, length, physicalId, messageId, command, null, checksum, new SpecificDataCmd82(dataBytes));
|
return new EBikeMessageCmd82(header, length, physicalId, messageId, command, null, checksum, new SpecificDataCmd82(dataBytes));
|
||||||
case "03":
|
case "03":
|
||||||
return new EBikeMessageCmd03(header, length, physicalId, messageId, command, null, checksum, new SettlementInfo(dataBytes));
|
return new EBikeMessageCmd03(header, length, physicalId, messageId, command, null, checksum, new SettlementInfo(dataBytes));
|
||||||
|
case "20":
|
||||||
|
return new EBikeMessageCmd20(header, length, physicalId, messageId, command, null, checksum, new DeviceRegister(dataBytes));
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Unsupported command: " + command);
|
throw new IllegalArgumentException("Unsupported command: " + command);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package com.jsowell.netty.domain.ebike.deviceupload;
|
||||||
|
|
||||||
|
import com.jsowell.common.util.BytesUtil;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DeviceRegister {
|
||||||
|
/**
|
||||||
|
* 固件版本,如100则表示V1.00版本
|
||||||
|
*/
|
||||||
|
private String firmwareVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 端口数量 表示设备总共有多少个端口
|
||||||
|
*/
|
||||||
|
private String portNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 虚拟ID:需要内部组网的设备的本地地址,如485、LORA系列,如不需组网的设备,默认为00
|
||||||
|
*/
|
||||||
|
private String virtualId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型: 见01指令中的设备类型表
|
||||||
|
*/
|
||||||
|
private String deviceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作模式:第0位:0=联网,1=刷卡。第1位:0=RN8209,1=BL0939。第2位:0=无短路预检,1=有短路预检。第3位:0=光耦检测模式,1=带灯模式。
|
||||||
|
*/
|
||||||
|
private String workMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电源板版本号:电源板的固件版本号,如没有电源板的机型则为0
|
||||||
|
*/
|
||||||
|
private String powerBoardVersion;
|
||||||
|
|
||||||
|
public DeviceRegister(byte[] dataBytes) {
|
||||||
|
this.firmwareVersion = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 0, 2)) + "";
|
||||||
|
this.portNumber = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 2, 3)) + "";
|
||||||
|
this.virtualId = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 3, 4)) + "";
|
||||||
|
this.deviceType = BytesUtil.bcd2StrLittle(Arrays.copyOfRange(dataBytes, 4, 5));
|
||||||
|
this.workMode = BytesUtil.bcd2StrLittle(Arrays.copyOfRange(dataBytes, 5, 6));
|
||||||
|
this.powerBoardVersion = BytesUtil.bcd2StrLittle(Arrays.copyOfRange(dataBytes, 6, 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.jsowell.netty.domain.ebike.deviceupload;
|
||||||
|
|
||||||
|
import com.jsowell.netty.domain.ebike.AbsEBikeMessage;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备注册包(20指令)
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EBikeMessageCmd20 extends AbsEBikeMessage {
|
||||||
|
|
||||||
|
private DeviceRegister deviceRegister;
|
||||||
|
|
||||||
|
public EBikeMessageCmd20(String header, int length, int physicalId, int messageId, String command, Object payload, int checksum, DeviceRegister deviceRegister) {
|
||||||
|
super(header, length, physicalId, messageId, command, payload, checksum);
|
||||||
|
this.deviceRegister = deviceRegister;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void parsePayload(byte[] dataBytes) {
|
||||||
|
this.deviceRegister = new DeviceRegister(dataBytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DeviceRegister getDeviceRegister() {
|
||||||
|
return deviceRegister;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1220,7 +1220,6 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
|||||||
dto.setMerchantId(pileConnectorDetailVO.getMerchantId());
|
dto.setMerchantId(pileConnectorDetailVO.getMerchantId());
|
||||||
dto.setStationId(pileConnectorDetailVO.getStationId());
|
dto.setStationId(pileConnectorDetailVO.getStationId());
|
||||||
// 获取处理逻辑
|
// 获取处理逻辑
|
||||||
// String mode = pileMerchantInfoService.getDelayModeByAppIdAndRequestSource(dto.getAppId(), dto.getRequestSource());
|
|
||||||
String mode = pileMerchantInfoService.getDelayModeByMerchantId(pileConnectorDetailVO.getMerchantId());
|
String mode = pileMerchantInfoService.getDelayModeByMerchantId(pileConnectorDetailVO.getMerchantId());
|
||||||
AbstractProgramLogic orderLogic = ProgramLogicFactory.getProgramLogic(mode);
|
AbstractProgramLogic orderLogic = ProgramLogicFactory.getProgramLogic(mode);
|
||||||
return orderLogic.startPersonalPileCharging(dto);
|
return orderLogic.startPersonalPileCharging(dto);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
2
pom.xml
2
pom.xml
@@ -307,7 +307,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
<artifactId>hutool-all</artifactId>
|
<artifactId>hutool-all</artifactId>
|
||||||
<version>5.7.3</version>
|
<version>5.8.30</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.huifu.adapay.core/adapay-core-sdk -->
|
<!-- https://mvnrepository.com/artifact/com.huifu.adapay.core/adapay-core-sdk -->
|
||||||
|
|||||||
Reference in New Issue
Block a user