处理充电桩传来的程序版本

This commit is contained in:
jsowell
2026-06-10 16:41:58 +08:00
parent b0049ffc85
commit b001d036e0
3 changed files with 20 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.util.BytesUtil; import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage; import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import com.jsowell.common.util.PileProgramVersionUtils;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
@@ -109,7 +110,7 @@ public class Data0x01 extends YKCBaseMessage {
startIndex += length; startIndex += length;
length = 8; length = 8;
byte[] programVersionByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length); byte[] programVersionByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.programVersion = BytesUtil.ascii2Str(programVersionByteArr); this.programVersion = PileProgramVersionUtils.normalize(BytesUtil.ascii2Str(programVersionByteArr));
// log.info("程序版本:{} length:{}", programVersion, programVersion.length()); // log.info("程序版本:{} length:{}", programVersion, programVersion.length());
// 网络连接类型 0x00 SIM 卡 0x01 LAN 0x02 WAN 0x03 其他 // 网络连接类型 0x00 SIM 卡 0x01 LAN 0x02 WAN 0x03 其他

View File

@@ -8,6 +8,7 @@ import com.jsowell.common.core.domain.ykc.LoginRequestData;
import com.jsowell.common.core.domain.ykc.YKCDataProtocol; import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode; import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
import com.jsowell.common.util.BytesUtil; import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.util.PileProgramVersionUtils;
import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.YKCUtils; import com.jsowell.common.util.YKCUtils;
import com.jsowell.common.util.spring.SpringUtils; import com.jsowell.common.util.spring.SpringUtils;
@@ -162,7 +163,7 @@ public class LoginRequestHandler extends AbstractYkcHandler {
startIndex += length; startIndex += length;
length = 8; length = 8;
byte[] programVersionByteArr = BytesUtil.copyBytes(msgBody, startIndex, length); byte[] programVersionByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
String programVersion = BytesUtil.ascii2Str(programVersionByteArr); String programVersion = PileProgramVersionUtils.normalize(BytesUtil.ascii2Str(programVersionByteArr));
// log.info("程序版本:{} length:{}", programVersion, programVersion.length()); // log.info("程序版本:{} length:{}", programVersion, programVersion.length());
// 网络连接类型 0x00 SIM 卡 0x01 LAN 0x02 WAN 0x03 其他 // 网络连接类型 0x00 SIM 卡 0x01 LAN 0x02 WAN 0x03 其他
@@ -219,6 +220,14 @@ public class LoginRequestHandler extends AbstractYkcHandler {
} }
}, executor); }, executor);
CompletableFuture.runAsync(() -> {
try {
pileBasicInfoService.updateProgramVersion(pileSn, programVersion);
} catch (Exception e) {
log.error("更新充电桩程序版本失败pileSn:{}, programVersion:{}", pileSn, programVersion, e);
}
}, executor);
// 异步发送对时指令 // 异步发送对时指令
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
try { try {

View File

@@ -174,6 +174,14 @@ public class PileRabbitListener {
} }
}, executor); }, executor);
CompletableFuture.runAsync(() -> {
try {
pileBasicInfoService.updateProgramVersion(pileSn, programVersion);
} catch (Exception e) {
log.error("更新充电桩程序版本失败pileSn:{}, programVersion:{}", pileSn, programVersion, e);
}
}, executor);
// 异步发送对时指令 // 异步发送对时指令
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
try { try {