[1078] 支持终端属性和链路检测的UI

This commit is contained in:
lin
2025-07-16 11:00:43 +08:00
parent 5874d4d1fa
commit 45af124eb0
9 changed files with 308 additions and 54 deletions

View File

@@ -49,7 +49,7 @@ public class Jt808Decoder extends ByteToMessageDecoder {
try {
// 按照部标定义执行校验和转义
ByteBuf buf = unEscapeAndCheck(in);
buf.retain();
Header header = new Header();
header.setMsgId(ByteBufUtil.hexDump(buf.readSlice(2)));
header.setMsgPro(buf.readUnsignedShort());
@@ -79,7 +79,7 @@ public class Jt808Decoder extends ByteToMessageDecoder {
log.error("get msgId is null {}", header.getMsgId());
return;
}
buf.retain();
Rs decode = handler.decode(buf, header, session, service);
ApplicationEvent applicationEvent = handler.getEvent();
if (applicationEvent != null) {

View File

@@ -9,6 +9,7 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.timeout.IdleState;
import io.netty.handler.timeout.IdleStateEvent;
import io.netty.util.ReferenceCountUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationEventPublisher;
@@ -35,6 +36,8 @@ public class Jt808Handler extends ChannelInboundHandlerAdapter {
} else {
ctx.fireChannelRead(msg);
}
// 读取完成后的消息释放
ReferenceCountUtil.release(msg);
}
@Override

View File

@@ -506,17 +506,10 @@ public class JT1078Controller {
@Operation(summary = "JT-链路检测", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
@GetMapping("/link-detection")
public WVPResult<Integer> linkDetection(String phoneNumber){
public Integer linkDetection(String phoneNumber){
log.info("[JT-链路检测] phoneNumber: {}", phoneNumber);
int result = service.linkDetection(phoneNumber);
if (result == 0) {
return WVPResult.success(result);
}else {
WVPResult<Integer> fail = WVPResult.fail(ErrorCode.ERROR100);
fail.setData(result);
return fail;
}
return service.linkDetection(phoneNumber);
}
@Operation(summary = "JT-文本信息下发", security = @SecurityRequirement(name = JwtUtils.HEADER))