update 预约充电

This commit is contained in:
2023-03-29 13:45:10 +08:00
parent c40fe4e2b7
commit 1aaff6aff4
5 changed files with 90 additions and 18 deletions

View File

@@ -2,6 +2,7 @@ package com.jsowell.netty.service.yunkuaichong;
import com.jsowell.netty.command.ykc.GetRealTimeMonitorDataCommand;
import com.jsowell.netty.command.ykc.IssueQRCodeCommand;
import com.jsowell.netty.command.ykc.PileSettingCommand;
import com.jsowell.netty.command.ykc.ProofreadTimeCommand;
import com.jsowell.netty.command.ykc.PublishPileBillingTemplateCommand;
import com.jsowell.netty.command.ykc.RebootCommand;
@@ -61,4 +62,9 @@ public interface YKCPushCommandService {
* @param command
*/
void pushUpdateFileCommand(UpdateFileCommand command);
/**
* 发送充电桩设置命令
*/
void pushPileSettingCommand(PileSettingCommand command);
}

View File

@@ -14,6 +14,7 @@ import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.YKCUtils;
import com.jsowell.netty.command.ykc.GetRealTimeMonitorDataCommand;
import com.jsowell.netty.command.ykc.IssueQRCodeCommand;
import com.jsowell.netty.command.ykc.PileSettingCommand;
import com.jsowell.netty.command.ykc.ProofreadTimeCommand;
import com.jsowell.netty.command.ykc.PublishPileBillingTemplateCommand;
import com.jsowell.netty.command.ykc.RebootCommand;
@@ -183,6 +184,10 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
transactionCode, pileSn, BytesUtil.bcd2Str(connectorCodeByteArr), logicCardNum, physicsCardNum, chargeAmount);
}
/**
* 发送停止ch
* @param command
*/
@Override
public void pushStopChargingCommand(StopChargingCommand command) {
String pileSn = command.getPileSn();
@@ -342,4 +347,37 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
BytesUtil.binary(filePathByteArr, 16));
}
}
public static void main(String[] args) {
Integer integer = new Integer(100);
String s = Integer.toHexString(integer);
byte[] bytes = s.getBytes();
System.out.println(s);
System.out.println(bytes);
}
@Override
public void pushPileSettingCommand(PileSettingCommand command) {
// 充电桩编号
String pileSn = command.getPileSn();
byte[] pileSnByteArr = BytesUtil.str2Bcd(pileSn);
// 工作状态
String workingState = command.getWorkingState();
byte[] workingStateByteArr;
if (StringUtils.equals(workingState, "0")) {
workingStateByteArr = Constants.zeroByteArray;
} else {
workingStateByteArr = Constants.oneByteArray;
}
// 最大功率
Integer maxPower = command.getMaxPower();
byte[] maxPowerByteArr = BytesUtil.str2Bcd(maxPower.toString());
byte[] msg = Bytes.concat(pileSnByteArr, workingStateByteArr, maxPowerByteArr);
this.push(msg, pileSn, YKCFrameTypeCode.CHARGING_PILE_WORKING_PARAMETER_SETTING_CODE);
}
}