uploadFirmware 上传固件接口

This commit is contained in:
Guoqs
2024-05-20 16:51:11 +08:00
parent aa102d2f71
commit 885b192a40
7 changed files with 151 additions and 10 deletions

View File

@@ -0,0 +1,53 @@
package com.jsowell.pile.domain.ykcCommond;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.Date;
/**
* 预约充电指令
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ReserveChargingCommand {
/**
* 交易流水号
*/
private String transactionCode;
/**
* 充电桩编号
*/
private String pileSn;
/**
* 枪口号
*/
private String connectorCode;
/**
* 操作
*/
private String operation;
/**
* 开始时间
*/
private Date appointmentStartTime;
/**
* 结束时间
*/
private Date appointmentEndTime;
/**
* 启动金额
*/
private BigDecimal amount;
}

View File

@@ -248,4 +248,11 @@ public class PileRemoteService {
public void remoteControlGroundLock(RemoteControlGroundLockCommand command) {
ykcPushCommandService.pushRemoteControlGroundLock(command);
}
/**
* 预约充电指令
*/
public void reserveCharging(ReserveChargingCommand command) {
ykcPushCommandService.pushReserveChargingCommand(command);
}
}

View File

@@ -77,4 +77,10 @@ public interface YKCPushCommandService {
*
*/
void pushRemoteControlGroundLock(RemoteControlGroundLockCommand command);
/**
* 发送预约充电命令
* @param command
*/
void pushReserveChargingCommand(ReserveChargingCommand command);
}

View File

@@ -262,19 +262,17 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
public void pushProofreadTimeCommand(ProofreadTimeCommand command) {
// log.info("充电桩对时thread:{}", Thread.currentThread().getName());
String pileSn = command.getPileSn();
// Date date = new Date();
// Date parseDate = DateUtils.parseDate("2023-02-28 16:45:20");
Date date = DateUtils.parseDate(DateUtils.getDateTime());
// 根据不同程序版本获取工具类
// String programVersion = redisCache.getCacheMapValue(CacheConstants.PILE_PROGRAM_VERSION, pileSn);
// AbsCp56Time2aUtil cp56Time2aUtil = Cp56Time2aFactory.getInvokeStrategy(programVersion);
// String encodeCP56Time2a = cp56Time2aUtil.date2HexStr(date);
byte[] bytes = Cp56Time2aUtil.date2Hbyte(date);
byte[] pileSnByteArr = BytesUtil.str2Bcd(pileSn);
byte[] msg = Bytes.concat(pileSnByteArr, bytes);
// 时间
Date date = DateUtils.parseDate(DateUtils.getDateTime());
byte[] dateBytes = Cp56Time2aUtil.date2Hbyte(date);
// 拼装msg
byte[] msg = Bytes.concat(pileSnByteArr, dateBytes);
this.push(msg, pileSn, YKCFrameTypeCode.TIME_CHECK_SETTING_CODE);
log.info("[充电桩:{}对时, 时间:{}, CP56Time2a:{}]", pileSn, DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, date), BytesUtil.binary(bytes, 16));
log.info("[充电桩:{}对时, 时间:{}, CP56Time2a:{}]", pileSn, DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, date), BytesUtil.binary(dateBytes, 16));
}
/**
@@ -473,4 +471,44 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
this.push(msg, pileSn, YKCFrameTypeCode.REMOTE_CONTROL_GROUND_LOCK_LIFTING_CODE);
}
/**
* 发送预约充电命令
* @param command
*/
@Override
public void pushReserveChargingCommand(ReserveChargingCommand command) {
// 交易流水号
String transactionCode = command.getTransactionCode();
byte[] transactionCodeArr = BytesUtil.str2Bcd(transactionCode);
// 桩编号
String pileSn = command.getPileSn();
byte[] pileSnByteArr = BytesUtil.str2Bcd(pileSn);
// 枪口号
String connectorCode = command.getConnectorCode();
byte[] connectorCodeByteArr = BytesUtil.str2Bcd(connectorCode);
// 枪口号
String operation = command.getOperation();
byte[] operateByteArr = BytesUtil.str2Bcd(operation);
// 开始时间
Date appointmentStartTime = command.getAppointmentStartTime();
byte[] appointmentStartTimeByteArr = Cp56Time2aUtil.date2Hbyte(DateUtils.parseDate(appointmentStartTime));
// 结束时间
Date appointmentEndTime = command.getAppointmentEndTime();
byte[] appointmentEndTimeByteArr = Cp56Time2aUtil.date2Hbyte(DateUtils.parseDate(appointmentEndTime));
// 启动金额
BigDecimal amount = command.getAmount();
byte[] amountByteArr = YKCUtils.getPriceByte(amount.toString(), 2);
// 拼装msg信息
byte[] msg = Bytes.concat(transactionCodeArr, pileSnByteArr, connectorCodeByteArr, operateByteArr,
appointmentStartTimeByteArr, appointmentEndTimeByteArr, amountByteArr);
this.push(msg, pileSn, YKCFrameTypeCode.RESERVE_CHARGING_CODE);
}
}