mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-26 14:05:04 +08:00
update 电单车协议
This commit is contained in:
@@ -4,7 +4,7 @@ import com.jsowell.common.enums.ykc.PileChannelEntity;
|
||||
import com.jsowell.common.protocol.SyncPromise;
|
||||
import com.jsowell.common.util.*;
|
||||
import com.jsowell.common.util.id.IdUtils;
|
||||
import com.jsowell.pile.domain.ebike.AbsEBikeMessage;
|
||||
import com.jsowell.pile.domain.ebike.AbsEBikeMessage2;
|
||||
import com.jsowell.pile.domain.ebike.deviceupload.ChargingOperationResponse;
|
||||
import com.jsowell.pile.domain.ebike.serversend.EBikeMessageCmd82;
|
||||
import com.jsowell.pile.domain.ykcCommond.StartChargingCommand;
|
||||
@@ -46,36 +46,34 @@ public class EBikeSendCommandServiceImpl implements EBikeSendCommandService {
|
||||
message.setMessageId(RandomUtil.getRandomNumber(4));
|
||||
message.setCommand("82");
|
||||
|
||||
EBikeMessageCmd82.SpecificData data = new EBikeMessageCmd82.SpecificData();
|
||||
// 充电模式
|
||||
data.setRateMode(3);
|
||||
message.setRateMode(3);
|
||||
// 余额(分)或有效期
|
||||
int balance = command.getChargeAmount().multiply(new BigDecimal("100")).intValue();
|
||||
data.setBalanceOrValidity(balance);
|
||||
message.setBalanceOrValidity(balance);
|
||||
// 端口号
|
||||
data.setPortNumber(Integer.parseInt(connectorCode));
|
||||
message.setPortNumber(Integer.parseInt(connectorCode));
|
||||
// 充电命令
|
||||
data.setChargeCommand(1);
|
||||
message.setChargeCommand(1);
|
||||
// 充电时长/功率
|
||||
int chargeDurationOrPower = 0;
|
||||
data.setChargeTimeOrPower(chargeDurationOrPower);
|
||||
message.setChargeTimeOrPower(chargeDurationOrPower);
|
||||
|
||||
// 订单编号
|
||||
data.setTransactionCode(transactionCode);
|
||||
message.setTransactionCode(transactionCode);
|
||||
|
||||
// 最大充电时长
|
||||
data.setMaxChargeTime(0);
|
||||
message.setMaxChargeTime(0);
|
||||
// 过载功率
|
||||
data.setOverloadPower(OVER_LOAD_POWER);
|
||||
data.setQrCodeLight(0);
|
||||
data.setLongChargeMode(0);
|
||||
data.setExtraFloatChargeTime(0);
|
||||
data.setSkipShortCircuitDetection(0);
|
||||
data.setNoUserPullOutCheck(0);
|
||||
data.setForceAutoStopWhenFull(0);
|
||||
data.setFullChargePower(0);
|
||||
data.setMaxFullChargePowerCheckTime(0);
|
||||
message.setData(data);
|
||||
message.setOverloadPower(OVER_LOAD_POWER);
|
||||
message.setQrCodeLight(0);
|
||||
message.setLongChargeMode(0);
|
||||
message.setExtraFloatChargeTime(0);
|
||||
message.setSkipShortCircuitDetection(0);
|
||||
message.setNoUserPullOutCheck(0);
|
||||
message.setForceAutoStopWhenFull(0);
|
||||
message.setFullChargePower(0);
|
||||
message.setMaxFullChargePowerCheckTime(0);
|
||||
byte[] response = this.send(message);
|
||||
log.info("电单车发送启动充电指令response:{}", BytesUtil.binary(response, 16));
|
||||
return new ChargingOperationResponse(response);
|
||||
@@ -97,35 +95,33 @@ public class EBikeSendCommandServiceImpl implements EBikeSendCommandService {
|
||||
message.setMessageId(RandomUtil.getRandomNumber(4));
|
||||
message.setCommand("82");
|
||||
|
||||
EBikeMessageCmd82.SpecificData data = new EBikeMessageCmd82.SpecificData();
|
||||
// 充电模式
|
||||
data.setRateMode(3);
|
||||
message.setRateMode(3);
|
||||
// 余额或有效期
|
||||
data.setBalanceOrValidity(1234);
|
||||
message.setBalanceOrValidity(1234);
|
||||
// 端口号
|
||||
data.setPortNumber(Integer.parseInt(connectorCode));
|
||||
message.setPortNumber(Integer.parseInt(connectorCode));
|
||||
// 充电命令
|
||||
data.setChargeCommand(0);
|
||||
message.setChargeCommand(0);
|
||||
// 充电时长/功率
|
||||
int chargeDurationOrPower = 0;
|
||||
data.setChargeTimeOrPower(chargeDurationOrPower);
|
||||
message.setChargeTimeOrPower(chargeDurationOrPower);
|
||||
|
||||
// 订单编号
|
||||
data.setTransactionCode(transactionCode);
|
||||
message.setTransactionCode(transactionCode);
|
||||
|
||||
// 最大充电时长
|
||||
data.setMaxChargeTime(0);
|
||||
message.setMaxChargeTime(0);
|
||||
// 过载功率
|
||||
data.setOverloadPower(OVER_LOAD_POWER);
|
||||
data.setQrCodeLight(0);
|
||||
data.setLongChargeMode(0);
|
||||
data.setExtraFloatChargeTime(0);
|
||||
data.setSkipShortCircuitDetection(0);
|
||||
data.setNoUserPullOutCheck(0);
|
||||
data.setForceAutoStopWhenFull(0);
|
||||
data.setFullChargePower(0);
|
||||
data.setMaxFullChargePowerCheckTime(0);
|
||||
message.setData(data);
|
||||
message.setOverloadPower(OVER_LOAD_POWER);
|
||||
message.setQrCodeLight(0);
|
||||
message.setLongChargeMode(0);
|
||||
message.setExtraFloatChargeTime(0);
|
||||
message.setSkipShortCircuitDetection(0);
|
||||
message.setNoUserPullOutCheck(0);
|
||||
message.setForceAutoStopWhenFull(0);
|
||||
message.setFullChargePower(0);
|
||||
message.setMaxFullChargePowerCheckTime(0);
|
||||
byte[] response = this.send(message);
|
||||
log.info("电单车发送停止充电指令response:{}", BytesUtil.binary(response, 16));
|
||||
return new ChargingOperationResponse(response);
|
||||
@@ -135,10 +131,10 @@ public class EBikeSendCommandServiceImpl implements EBikeSendCommandService {
|
||||
* 公共方法, 发送指令
|
||||
* @param msg
|
||||
*/
|
||||
private byte[] send(AbsEBikeMessage msg) throws Exception {
|
||||
private byte[] send(AbsEBikeMessage2 msg) throws Exception {
|
||||
return this.send(msg, 5, TimeUnit.SECONDS);
|
||||
}
|
||||
private byte[] send(AbsEBikeMessage msg, long timeout, TimeUnit unit) throws Exception {
|
||||
private byte[] send(AbsEBikeMessage2 msg, long timeout, TimeUnit unit) throws Exception {
|
||||
String pileSn = msg.getPhysicalId() + "";
|
||||
byte[] messageBytes = msg.getMessageBytes();
|
||||
String command = YKCUtils.frameType2Str(msg.getCommand());
|
||||
|
||||
@@ -1279,8 +1279,7 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
basicInfo.setDelFlag(DelFlagEnum.NORMAL.getValue()); // 删除标识
|
||||
basicInfoList.add(basicInfo);
|
||||
|
||||
EBikeMessageCmd20.DeviceRegister deviceRegister = message.getDeviceRegister();
|
||||
int portNumber = deviceRegister.getPortNumber();
|
||||
int portNumber = message.getPortNumber();
|
||||
PileConnectorInfo connectorInfo;
|
||||
for (int i = 1; i < portNumber + 1; i++) {
|
||||
// 组装pile_connector_info表数据
|
||||
|
||||
@@ -10,7 +10,10 @@ import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.enums.ykc.*;
|
||||
import com.jsowell.common.enums.ykc.CardStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.OrderPayModeEnum;
|
||||
import com.jsowell.common.enums.ykc.OrderPayRecordEnum;
|
||||
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.*;
|
||||
|
||||
Reference in New Issue
Block a user