mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-26 10:09:52 +08:00
uploadFirmware 上传固件接口
This commit is contained in:
@@ -186,3 +186,8 @@ aMap:
|
|||||||
appId: 202306150188103814
|
appId: 202306150188103814
|
||||||
apiUrl: https://restapi.amap.com/rest/openmp/devgw?key=7967738241f0a580b5a1342f43793a61
|
apiUrl: https://restapi.amap.com/rest/openmp/devgw?key=7967738241f0a580b5a1342f43793a61
|
||||||
openId: 2089000923284502
|
openId: 2089000923284502
|
||||||
|
|
||||||
|
# 远程升级服务器信息
|
||||||
|
remoteUpdate:
|
||||||
|
server: http://apitest.jsowellcloud.com
|
||||||
|
port: 21
|
||||||
@@ -182,3 +182,8 @@ aMap:
|
|||||||
# apiUrl: https://restapi.amap.com/rest/openmp/devgw?key=7967738241f0a580b5a1342f43793a61
|
# apiUrl: https://restapi.amap.com/rest/openmp/devgw?key=7967738241f0a580b5a1342f43793a61
|
||||||
apiUrl: https://restapi.amap.com/rest/openmp/gw?key=7967738241f0a580b5a1342f43793a61
|
apiUrl: https://restapi.amap.com/rest/openmp/gw?key=7967738241f0a580b5a1342f43793a61
|
||||||
openId: 2089000923284502
|
openId: 2089000923284502
|
||||||
|
|
||||||
|
# 远程升级服务器信息
|
||||||
|
remoteUpdate:
|
||||||
|
server: http://apitest.jsowellcloud.com
|
||||||
|
port: 21
|
||||||
@@ -182,3 +182,8 @@ aMap:
|
|||||||
# apiUrl: https://restapi.amap.com/rest/openmp/devgw?key=7967738241f0a580b5a1342f43793a61
|
# apiUrl: https://restapi.amap.com/rest/openmp/devgw?key=7967738241f0a580b5a1342f43793a61
|
||||||
apiUrl: https://restapi.amap.com/rest/openmp/gw?key=7967738241f0a580b5a1342f43793a61
|
apiUrl: https://restapi.amap.com/rest/openmp/gw?key=7967738241f0a580b5a1342f43793a61
|
||||||
openId: 2089000923284502
|
openId: 2089000923284502
|
||||||
|
|
||||||
|
# 远程升级服务器信息
|
||||||
|
remoteUpdate:
|
||||||
|
server: http://apitest.jsowellcloud.com
|
||||||
|
port: 21
|
||||||
@@ -4,6 +4,7 @@ jsowell:
|
|||||||
profile: /var/ftp/firmware
|
profile: /var/ftp/firmware
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 数据源配置
|
# 数据源配置
|
||||||
spring:
|
spring:
|
||||||
# redis 配置
|
# redis 配置
|
||||||
@@ -186,3 +187,8 @@ aMap:
|
|||||||
appId: 202306150188103814
|
appId: 202306150188103814
|
||||||
apiUrl: https://restapi.amap.com/rest/openmp/devgw?key=7967738241f0a580b5a1342f43793a61
|
apiUrl: https://restapi.amap.com/rest/openmp/devgw?key=7967738241f0a580b5a1342f43793a61
|
||||||
openId: 2089000923284502
|
openId: 2089000923284502
|
||||||
|
|
||||||
|
# 远程升级服务器信息
|
||||||
|
remoteUpdate:
|
||||||
|
server: http://apitest.jsowellcloud.com
|
||||||
|
port: 21
|
||||||
@@ -567,6 +567,7 @@ public class BytesUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 十六进制字符串 转 bytes数组
|
||||||
* @param src 16进制字符串
|
* @param src 16进制字符串
|
||||||
* @return 字节数组
|
* @return 字节数组
|
||||||
* @Title hexString2Bytes
|
* @Title hexString2Bytes
|
||||||
|
|||||||
@@ -14,7 +14,13 @@ import java.util.List;
|
|||||||
public class UpdateFirmwareCommand {
|
public class UpdateFirmwareCommand {
|
||||||
private List<String> pileSnList;
|
private List<String> pileSnList;
|
||||||
|
|
||||||
// /update.bin
|
// 远程更新服务器地址
|
||||||
|
private String serverAddress;
|
||||||
|
|
||||||
|
// 远程更新服务器端口
|
||||||
|
private int port;
|
||||||
|
|
||||||
|
// 文件路径
|
||||||
private String filePath;
|
private String filePath;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
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;
|
||||||
@@ -42,6 +43,12 @@ public class PileRemoteService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisCache redisCache;
|
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()
|
UpdateFirmwareCommand command = UpdateFirmwareCommand.builder()
|
||||||
.pileSnList(dto.getPileSns())
|
.pileSnList(dto.getPileSns())
|
||||||
|
.serverAddress(serverAddress)
|
||||||
|
.port(port)
|
||||||
.filePath(pileFirmwareInfo.getFilePath())
|
.filePath(pileFirmwareInfo.getFilePath())
|
||||||
.build();
|
.build();
|
||||||
ykcPushCommandService.pushUpdateFileCommand(command);
|
ykcPushCommandService.pushUpdateFileCommand(command);
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ 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;
|
||||||
@@ -291,6 +293,14 @@ 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
|
@Override
|
||||||
public void pushUpdateFileCommand(UpdateFirmwareCommand command) {
|
public void pushUpdateFileCommand(UpdateFirmwareCommand command) {
|
||||||
List<String> pileSns = command.getPileSnList();
|
List<String> pileSns = command.getPileSnList();
|
||||||
@@ -323,11 +333,12 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
|||||||
byte[] ratedPowerByteArr = BytesUtil.checkLengthAndBehindAppendZero(Constants.zeroByteArray, 4);
|
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(Constants.updateServerPort, 4);
|
||||||
// byte[] updateServerPortByteArr = BytesUtil.checkLengthAndBehindAppendZero(BytesUtil.str2Bcd("15"), 4);
|
byte[] updateServerPortByteArr = BytesUtil.checkLengthAndBehindAppendZero(BytesUtil.hexString2Bytes(Integer.toHexString(command.getPort())), 4);
|
||||||
|
|
||||||
// 用户名
|
// 用户名
|
||||||
byte[] userNameByteArr = BytesUtil.checkLengthAndBehindAppendZero(BytesUtil.str2Asc(Constants.updateServerUserName), 32);
|
byte[] userNameByteArr = BytesUtil.checkLengthAndBehindAppendZero(BytesUtil.str2Asc(Constants.updateServerUserName), 32);
|
||||||
|
|||||||
Reference in New Issue
Block a user