From 8c7a341fcac597de64994ca15aa47af408c10fd6 Mon Sep 17 00:00:00 2001 From: Guoqs <123@jsowell.com> Date: Tue, 21 May 2024 10:05:57 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E9=A2=84=E7=BA=A6=E5=85=85=E7=94=B5?= =?UTF-8?q?=E5=93=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/enums/ykc/StartTypeEnum.java | 2 +- .../ykcCommond/ReserveChargingCommand.java | 53 ------------------- .../pile/service/PileRemoteService.java | 15 ++++-- .../pile/service/YKCPushCommandService.java | 2 +- .../impl/OrderBasicInfoServiceImpl.java | 4 +- .../impl/YKCPushCommandServiceImpl.java | 4 +- 6 files changed, 17 insertions(+), 63 deletions(-) delete mode 100644 jsowell-pile/src/main/java/com/jsowell/pile/domain/ykcCommond/ReserveChargingCommand.java diff --git a/jsowell-common/src/main/java/com/jsowell/common/enums/ykc/StartTypeEnum.java b/jsowell-common/src/main/java/com/jsowell/common/enums/ykc/StartTypeEnum.java index 4b1d412b1..53576a2e8 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/enums/ykc/StartTypeEnum.java +++ b/jsowell-common/src/main/java/com/jsowell/common/enums/ykc/StartTypeEnum.java @@ -6,7 +6,7 @@ package com.jsowell.common.enums.ykc; public enum StartTypeEnum { NOW("now", "立即启动"), - APPOINTMENT("appointment", "预约启动"), + RESERVED("reserved", "预约启动"), ; diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/domain/ykcCommond/ReserveChargingCommand.java b/jsowell-pile/src/main/java/com/jsowell/pile/domain/ykcCommond/ReserveChargingCommand.java deleted file mode 100644 index 1e1b33063..000000000 --- a/jsowell-pile/src/main/java/com/jsowell/pile/domain/ykcCommond/ReserveChargingCommand.java +++ /dev/null @@ -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; -} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileRemoteService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileRemoteService.java index 53fe21aec..fccf99619 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileRemoteService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileRemoteService.java @@ -22,6 +22,8 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.math.BigDecimal; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.util.Date; import java.util.List; @@ -218,9 +220,16 @@ public class PileRemoteService { if (pileFirmwareInfo == null) { 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() .pileSnList(dto.getPileSns()) - .serverAddress(serverAddress) + .serverAddress(ip) .port(port) .username(username) .password(password) @@ -252,7 +261,7 @@ public class PileRemoteService { /** * 预约充电指令 */ - public void reserveCharging(ReserveChargingCommand command) { - ykcPushCommandService.pushReserveChargingCommand(command); + public void reservedCharging(ReservedChargingCommand command) { + ykcPushCommandService.pushReservedChargingCommand(command); } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/YKCPushCommandService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/YKCPushCommandService.java index a87f67fa1..d98742e90 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/YKCPushCommandService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/YKCPushCommandService.java @@ -82,5 +82,5 @@ public interface YKCPushCommandService { * 发送预约充电命令 * @param command */ - void pushReserveChargingCommand(ReserveChargingCommand command); + void pushReservedChargingCommand(ReservedChargingCommand command); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java index 9254b50e7..0716c1a84 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java @@ -3051,7 +3051,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { sendStartCharging = false; } else if (StartModeEnum.VIN_CODE.getValue().equals(dto.getStartMode())) { sendStartCharging = false; - } else if (StartTypeEnum.APPOINTMENT.getValue().equals(orderInfo.getStartType())) { + } else if (StartTypeEnum.RESERVED.getValue().equals(orderInfo.getStartType())) { sendStartCharging = false; } else if (OrderStatusEnum.STAY_RETROACTIVE_AMOUNT.getValue().equals(orderInfo.getOrderStatus())) { 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)); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/YKCPushCommandServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/YKCPushCommandServiceImpl.java index 978cab0e7..bfbb27dda 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/YKCPushCommandServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/YKCPushCommandServiceImpl.java @@ -24,8 +24,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; -import java.net.InetAddress; -import java.net.UnknownHostException; import java.util.Date; import java.util.List; import java.util.Objects; @@ -477,7 +475,7 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService { * @param command */ @Override - public void pushReserveChargingCommand(ReserveChargingCommand command) { + public void pushReservedChargingCommand(ReservedChargingCommand command) { // 交易流水号 String transactionCode = command.getTransactionCode(); byte[] transactionCodeArr = BytesUtil.str2Bcd(transactionCode);