mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
uploadFirmware 上传固件接口
This commit is contained in:
@@ -14,7 +14,13 @@ import java.util.List;
|
||||
public class UpdateFirmwareCommand {
|
||||
private List<String> pileSnList;
|
||||
|
||||
// /update.bin
|
||||
// 远程更新服务器地址
|
||||
private String serverAddress;
|
||||
|
||||
// 远程更新服务器端口
|
||||
private int port;
|
||||
|
||||
// 文件路径
|
||||
private String filePath;
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -42,6 +43,12 @@ public class PileRemoteService {
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Value("${remoteUpdate.server}")
|
||||
private String serverAddress;
|
||||
|
||||
@Value("${remoteUpdate.port}")
|
||||
private int port;
|
||||
/**
|
||||
* 获取充电桩实时数据信息
|
||||
*
|
||||
@@ -206,6 +213,8 @@ public class PileRemoteService {
|
||||
}
|
||||
UpdateFirmwareCommand command = UpdateFirmwareCommand.builder()
|
||||
.pileSnList(dto.getPileSns())
|
||||
.serverAddress(serverAddress)
|
||||
.port(port)
|
||||
.filePath(pileFirmwareInfo.getFilePath())
|
||||
.build();
|
||||
ykcPushCommandService.pushUpdateFileCommand(command);
|
||||
|
||||
@@ -24,6 +24,8 @@ 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;
|
||||
@@ -291,8 +293,16 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(Constants.updateServerPort);
|
||||
String numHex = Integer.toHexString(21);
|
||||
byte[] bytes = BytesUtil.hexString2Bytes(numHex);
|
||||
System.out.println(bytes);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pushUpdateFileCommand(UpdateFirmwareCommand command) {
|
||||
public void pushUpdateFileCommand(UpdateFirmwareCommand command) {
|
||||
List<String> pileSns = command.getPileSnList();
|
||||
if (CollectionUtils.isEmpty(pileSns)) {
|
||||
return;
|
||||
@@ -323,11 +333,12 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
||||
byte[] ratedPowerByteArr = BytesUtil.checkLengthAndBehindAppendZero(Constants.zeroByteArray, 4);
|
||||
|
||||
// 升级服务器地址
|
||||
byte[] updateServerAddressByteArr = BytesUtil.checkLengthAndBehindAppendZero(BytesUtil.str2Asc(Constants.updateServerIP), 32);
|
||||
// byte[] updateServerAddressByteArr = BytesUtil.checkLengthAndBehindAppendZero(BytesUtil.str2Asc(Constants.updateServerIP), 32);
|
||||
byte[] updateServerAddressByteArr = BytesUtil.checkLengthAndBehindAppendZero(BytesUtil.str2Asc(command.getServerAddress()), 32);
|
||||
|
||||
// 升级服务器端口
|
||||
byte[] updateServerPortByteArr = BytesUtil.checkLengthAndBehindAppendZero(Constants.updateServerPort, 4);
|
||||
// byte[] updateServerPortByteArr = BytesUtil.checkLengthAndBehindAppendZero(BytesUtil.str2Bcd("15"), 4);
|
||||
// byte[] updateServerPortByteArr = BytesUtil.checkLengthAndBehindAppendZero(Constants.updateServerPort, 4);
|
||||
byte[] updateServerPortByteArr = BytesUtil.checkLengthAndBehindAppendZero(BytesUtil.hexString2Bytes(Integer.toHexString(command.getPort())), 4);
|
||||
|
||||
// 用户名
|
||||
byte[] userNameByteArr = BytesUtil.checkLengthAndBehindAppendZero(BytesUtil.str2Asc(Constants.updateServerUserName), 32);
|
||||
|
||||
Reference in New Issue
Block a user