update 预约充电响应

This commit is contained in:
Guoqs
2024-05-21 10:05:57 +08:00
parent b91f6689a6
commit 8c7a341fca
6 changed files with 17 additions and 63 deletions

View File

@@ -6,7 +6,7 @@ package com.jsowell.common.enums.ykc;
public enum StartTypeEnum { public enum StartTypeEnum {
NOW("now", "立即启动"), NOW("now", "立即启动"),
APPOINTMENT("appointment", "预约启动"), RESERVED("reserved", "预约启动"),
; ;

View File

@@ -1,53 +0,0 @@
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

@@ -22,6 +22,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -218,9 +220,16 @@ public class PileRemoteService {
if (pileFirmwareInfo == null) { if (pileFirmwareInfo == null) {
throw new BusinessException(ReturnCodeEnum.CODE_FIRMWARE_NOT_FOUND_ERROR); throw new BusinessException(ReturnCodeEnum.CODE_FIRMWARE_NOT_FOUND_ERROR);
} }
String ip;
try {
ip = InetAddress.getByName(serverAddress).getHostAddress();
} catch (UnknownHostException e) {
throw new BusinessException("", "无法解析出IP");
}
UpdateFirmwareCommand command = UpdateFirmwareCommand.builder() UpdateFirmwareCommand command = UpdateFirmwareCommand.builder()
.pileSnList(dto.getPileSns()) .pileSnList(dto.getPileSns())
.serverAddress(serverAddress) .serverAddress(ip)
.port(port) .port(port)
.username(username) .username(username)
.password(password) .password(password)
@@ -252,7 +261,7 @@ public class PileRemoteService {
/** /**
* 预约充电指令 * 预约充电指令
*/ */
public void reserveCharging(ReserveChargingCommand command) { public void reservedCharging(ReservedChargingCommand command) {
ykcPushCommandService.pushReserveChargingCommand(command); ykcPushCommandService.pushReservedChargingCommand(command);
} }
} }

View File

@@ -82,5 +82,5 @@ public interface YKCPushCommandService {
* 发送预约充电命令 * 发送预约充电命令
* @param command * @param command
*/ */
void pushReserveChargingCommand(ReserveChargingCommand command); void pushReservedChargingCommand(ReservedChargingCommand command);
} }

View File

@@ -3051,7 +3051,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
sendStartCharging = false; sendStartCharging = false;
} else if (StartModeEnum.VIN_CODE.getValue().equals(dto.getStartMode())) { } else if (StartModeEnum.VIN_CODE.getValue().equals(dto.getStartMode())) {
sendStartCharging = false; sendStartCharging = false;
} else if (StartTypeEnum.APPOINTMENT.getValue().equals(orderInfo.getStartType())) { } else if (StartTypeEnum.RESERVED.getValue().equals(orderInfo.getStartType())) {
sendStartCharging = false; sendStartCharging = false;
} else if (OrderStatusEnum.STAY_RETROACTIVE_AMOUNT.getValue().equals(orderInfo.getOrderStatus())) { } else if (OrderStatusEnum.STAY_RETROACTIVE_AMOUNT.getValue().equals(orderInfo.getOrderStatus())) {
sendStartCharging = false; sendStartCharging = false;
@@ -3548,7 +3548,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
} }
} }
if (StringUtils.equals(dto.getStartType(), StartTypeEnum.APPOINTMENT.getValue())) { if (StringUtils.equals(dto.getStartType(), StartTypeEnum.RESERVED.getValue())) {
orderBasicInfo.setAppointmentTime(DateUtils.parseDate(dto.getAppointmentTime(), DateUtils.YYYY_MM_DD_HH_MM_SS)); orderBasicInfo.setAppointmentTime(DateUtils.parseDate(dto.getAppointmentTime(), DateUtils.YYYY_MM_DD_HH_MM_SS));
} }

View File

@@ -24,8 +24,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@@ -477,7 +475,7 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
* @param command * @param command
*/ */
@Override @Override
public void pushReserveChargingCommand(ReserveChargingCommand command) { public void pushReservedChargingCommand(ReservedChargingCommand command) {
// 交易流水号 // 交易流水号
String transactionCode = command.getTransactionCode(); String transactionCode = command.getTransactionCode();
byte[] transactionCodeArr = BytesUtil.str2Bcd(transactionCode); byte[] transactionCodeArr = BytesUtil.str2Bcd(transactionCode);