fix: 在 processPackageData 方法中添加了 Session 自动绑定逻辑
All checks were successful
iot-test-platform CI/CD / build-and-deploy (push) Successful in 27s
All checks were successful
iot-test-platform CI/CD / build-and-deploy (push) Successful in 27s
This commit is contained in:
@@ -54,8 +54,22 @@ public class TCPServerHandler extends ChannelInboundHandlerAdapter { // (1)
|
||||
|
||||
PackHead header = packageData.getPackHead();
|
||||
Integer msgId = header.getId();
|
||||
String terminalPhone = header.getTerminalPhone();
|
||||
|
||||
logger.info("消息头部:msgid={}, phone={}, flowid={}", msgId, header.getTerminalPhone(), header.getFlowId());
|
||||
logger.info("消息头部:msgid={}, phone={}, flowid={}", msgId, terminalPhone, header.getFlowId());
|
||||
|
||||
// Update Session with Phone Number if available
|
||||
if (terminalPhone != null && !terminalPhone.isEmpty()) {
|
||||
Session session = sessionManager.findBySessionId(Session.buildId(packageData.getChannel()));
|
||||
if (session != null) {
|
||||
// Check if phone mapping needs update
|
||||
if (!terminalPhone.equals(session.getTerminalPhone())) {
|
||||
session.setTerminalPhone(terminalPhone);
|
||||
sessionManager.put(session.getId(), session);
|
||||
logger.info("Bound phone {} to session {}", terminalPhone, session.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Broadcast to UI
|
||||
if (apiLogService != null) {
|
||||
|
||||
Reference in New Issue
Block a user