update 将桩与连接channel的关系改为一对多

This commit is contained in:
Lemon
2025-05-27 10:34:35 +08:00
parent 8ec72f0f12
commit 9731a53205
6 changed files with 333 additions and 9 deletions

View File

@@ -22,7 +22,7 @@ public interface YKCBusinessService {
/**
* 桩退出
* @param channelId channelId
* @param ctx channelId
*/
void exit(ChannelId channelId);
void exit(ChannelHandlerContext ctx);
}

View File

@@ -66,9 +66,9 @@ public class YKCBusinessServiceImpl implements YKCBusinessService {
}
@Override
public void exit(ChannelId channelId) {
public void exit(ChannelHandlerContext ctx) {
// 获取桩编号
String pileSn = PileChannelEntity.getPileSnByChannelId(channelId.asLongText());
String pileSn = PileChannelEntity.getPileSnByChannelId(ctx.channel().id().asLongText());
if (StringUtils.isBlank(pileSn)) {
return;
}
@@ -86,6 +86,9 @@ public class YKCBusinessServiceImpl implements YKCBusinessService {
String jsonMsg = YKCFrameTypeCode.PILE_LOG_OUT.getValue() + ": 充电桩主动断开链接";
pileMsgRecordService.save(pileSn, pileSn, type, jsonMsg, "");
// 删除连接
// PileChannelEntity.deleteChannel(pileSn, ctx);
// 删除桩编号和channel的关系
// PileChannelEntity.removeByPileSn(pileSn);
}