update 修复离线bug

This commit is contained in:
Guoqs
2026-03-21 09:20:58 +08:00
parent c9d7f505b6
commit 0e763d4fe2
9 changed files with 687 additions and 207 deletions

View File

@@ -168,6 +168,16 @@ public class CacheConstants {
*/
public static final String PILE_LAST_CONNECTION = "pile_last_connection:";
/**
* 充电桩待确认断链标记
*/
public static final String PILE_PENDING_DISCONNECT = "pile_pending_disconnect:";
/**
* 充电桩已确认离线标记
*/
public static final String PILE_OFFLINE_CONFIRMED = "pile_offline_confirmed:";
/**
* 查询枪口信息列表前缀
*/

View File

@@ -137,6 +137,21 @@ public class PileChannelEntity {
manager.remove(pileSn);
}
public static boolean removeByPileSnAndChannelId(String pileSn, String expectedChannelId) {
if (StringUtils.isBlank(pileSn) || StringUtils.isBlank(expectedChannelId)) {
return false;
}
ChannelHandlerContext currentCtx = manager.get(pileSn);
if (currentCtx == null || currentCtx.channel() == null) {
return false;
}
String currentChannelId = currentCtx.channel().id().asLongText();
if (!StringUtils.equals(currentChannelId, expectedChannelId)) {
return false;
}
return manager.remove(pileSn, currentCtx);
}
public static void removeByChannelId(String channelId){
if (StringUtils.isBlank(channelId)) {
return;
@@ -147,4 +162,4 @@ public class PileChannelEntity {
}
}
}
}