mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-08 12:00:11 +08:00
uploadFirmware 上传固件接口
This commit is contained in:
@@ -185,4 +185,9 @@ aMap:
|
||||
aMapPublicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArqmh0JZrIhk+tMbF+VE63WaqqLRs+OHZkX3HGyr4cokujgdZb0kAq4jBJa/VjWK2qDXHr2KpoY2/ppmA73oJvNPcuVxR6nwYddcASg6uFCK/vfH5PKVV0W/xKTeOIQ6NTd0wRFZs9zNo1endqgQDvn1d1Rvl1r+18MJ3BXLMjkzCUUurgeO84AIlksYV5Z46hoScyXjSc8lsmwX5r7cwHLajFXdjKo1yOCbzClMqLM29THYuegwHFcT/zp64Nd7+nawWWuPOgfkr0MTGrNCkV8ywpbyG0XVewMkdN6pTaZNvhMnLH00VkXASPB51vUjhs4WBiFZth9q3rZBkaEYSMQIDAQAB
|
||||
appId: 202306150188103814
|
||||
apiUrl: https://restapi.amap.com/rest/openmp/devgw?key=7967738241f0a580b5a1342f43793a61
|
||||
openId: 2089000923284502
|
||||
openId: 2089000923284502
|
||||
|
||||
# 远程升级服务器信息
|
||||
remoteUpdate:
|
||||
server: http://apitest.jsowellcloud.com
|
||||
port: 21
|
||||
@@ -181,4 +181,9 @@ aMap:
|
||||
appId: 202306150188103814
|
||||
# apiUrl: https://restapi.amap.com/rest/openmp/devgw?key=7967738241f0a580b5a1342f43793a61
|
||||
apiUrl: https://restapi.amap.com/rest/openmp/gw?key=7967738241f0a580b5a1342f43793a61
|
||||
openId: 2089000923284502
|
||||
openId: 2089000923284502
|
||||
|
||||
# 远程升级服务器信息
|
||||
remoteUpdate:
|
||||
server: http://apitest.jsowellcloud.com
|
||||
port: 21
|
||||
@@ -181,4 +181,9 @@ aMap:
|
||||
appId: 202306150188103814
|
||||
# apiUrl: https://restapi.amap.com/rest/openmp/devgw?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
|
||||
|
||||
|
||||
|
||||
# 数据源配置
|
||||
spring:
|
||||
# redis 配置
|
||||
@@ -185,4 +186,9 @@ aMap:
|
||||
aMapPublicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArqmh0JZrIhk+tMbF+VE63WaqqLRs+OHZkX3HGyr4cokujgdZb0kAq4jBJa/VjWK2qDXHr2KpoY2/ppmA73oJvNPcuVxR6nwYddcASg6uFCK/vfH5PKVV0W/xKTeOIQ6NTd0wRFZs9zNo1endqgQDvn1d1Rvl1r+18MJ3BXLMjkzCUUurgeO84AIlksYV5Z46hoScyXjSc8lsmwX5r7cwHLajFXdjKo1yOCbzClMqLM29THYuegwHFcT/zp64Nd7+nawWWuPOgfkr0MTGrNCkV8ywpbyG0XVewMkdN6pTaZNvhMnLH00VkXASPB51vUjhs4WBiFZth9q3rZBkaEYSMQIDAQAB
|
||||
appId: 202306150188103814
|
||||
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进制字符串
|
||||
* @return 字节数组
|
||||
* @Title hexString2Bytes
|
||||
|
||||
@@ -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