mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-16 21:30:28 +08:00
uploadFirmware 上传固件接口
This commit is contained in:
@@ -71,6 +71,9 @@ public enum YKCFrameTypeCode {
|
|||||||
BILLING_TEMPLATE_SETTING_CODE(0x58, "计费模型设置"),
|
BILLING_TEMPLATE_SETTING_CODE(0x58, "计费模型设置"),
|
||||||
BILLING_TEMPLATE_SETTING_ANSWER_CODE(0x57, "计费模型设置应答"),
|
BILLING_TEMPLATE_SETTING_ANSWER_CODE(0x57, "计费模型设置应答"),
|
||||||
|
|
||||||
|
RESERVE_CHARGING_CODE(0x60, "预约充电设置"),
|
||||||
|
RESERVE_CHARGING_ANSWER_CODE(0x59, "预约充电设置响应"),
|
||||||
|
|
||||||
GROUND_LOCK_DATA_UPLOAD_CODE(0x61, "地锁数据上送"),
|
GROUND_LOCK_DATA_UPLOAD_CODE(0x61, "地锁数据上送"),
|
||||||
REMOTE_CONTROL_GROUND_LOCK_LIFTING_CODE(0x62, "遥控地锁升降"),
|
REMOTE_CONTROL_GROUND_LOCK_LIFTING_CODE(0x62, "遥控地锁升降"),
|
||||||
CHARGING_PILE_RESPOND_GROUND_LOCK_LIFTING_CODE(0X63, "充电桩响应地锁升降数据"),
|
CHARGING_PILE_RESPOND_GROUND_LOCK_LIFTING_CODE(0X63, "充电桩响应地锁升降数据"),
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.jsowell.netty.handler;
|
||||||
|
|
||||||
|
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||||
|
import com.jsowell.common.util.YKCUtils;
|
||||||
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约充电
|
||||||
|
* @deprecated 桩不会发送这个指令,由平台主动发送
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class ReserveChargingHandler extends AbstractHandler{
|
||||||
|
|
||||||
|
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.RESERVE_CHARGING_CODE.getBytes());
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet() throws Exception {
|
||||||
|
YKCOperateFactory.register(type, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.jsowell.netty.handler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约充电响应
|
||||||
|
*/
|
||||||
|
public class ReserveChargingResponseHandler extends AbstractHandler{
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -248,4 +248,11 @@ public class PileRemoteService {
|
|||||||
public void remoteControlGroundLock(RemoteControlGroundLockCommand command) {
|
public void remoteControlGroundLock(RemoteControlGroundLockCommand command) {
|
||||||
ykcPushCommandService.pushRemoteControlGroundLock(command);
|
ykcPushCommandService.pushRemoteControlGroundLock(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约充电指令
|
||||||
|
*/
|
||||||
|
public void reserveCharging(ReserveChargingCommand command) {
|
||||||
|
ykcPushCommandService.pushReserveChargingCommand(command);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,4 +77,10 @@ public interface YKCPushCommandService {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void pushRemoteControlGroundLock(RemoteControlGroundLockCommand command);
|
void pushRemoteControlGroundLock(RemoteControlGroundLockCommand command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送预约充电命令
|
||||||
|
* @param command
|
||||||
|
*/
|
||||||
|
void pushReserveChargingCommand(ReserveChargingCommand command);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,19 +262,17 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
|||||||
public void pushProofreadTimeCommand(ProofreadTimeCommand command) {
|
public void pushProofreadTimeCommand(ProofreadTimeCommand command) {
|
||||||
// log.info("充电桩对时,thread:{}", Thread.currentThread().getName());
|
// log.info("充电桩对时,thread:{}", Thread.currentThread().getName());
|
||||||
String pileSn = command.getPileSn();
|
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[] 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);
|
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);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user