Browse Source

fix消息转发

liuyongxin 8 months ago
parent
commit
02a9f569af

+ 3 - 2
src/main/java/com/lutao/tcp/server/tcptest/BootNettyChannelInboundHandlerAdapter.java

@@ -33,6 +33,7 @@ public class BootNettyChannelInboundHandlerAdapter extends ChannelInboundHandler
     @PostConstruct
     public void init() {
         nettyServerHandler = this;
+        nettyServerHandler.recSendLogService = this.recSendLogService;
     }
 
     /**
@@ -60,7 +61,7 @@ public class BootNettyChannelInboundHandlerAdapter extends ChannelInboundHandler
              recSendLog.setCreateTime(LocalDateTime.now());
              recSendLog.setUpdateTime(LocalDateTime.now());
              recSendLog.setId(uuid);
-             recSendLogService.save(recSendLog);
+             nettyServerHandler.recSendLogService.save(recSendLog);
              //http://115.85.203.230:45002/utility/scopeScan/warnData/submit  转发
 
              String body = HttpUtil.createPost("http://115.85.203.230:45002/utility/scopeScan/warnData/submit")
@@ -71,7 +72,7 @@ public class BootNettyChannelInboundHandlerAdapter extends ChannelInboundHandler
              if (code == 200){
                  log.info("======转发成功======【" + ctx.channel().id() + "】" + " :" + jsonObject.toJSONString());
                  recSendLog.setSend(jsonObject.toJSONString());
-                 recSendLogService.updateById(recSendLog);
+                 nettyServerHandler.recSendLogService.updateById(recSendLog);
              }else{
                  log.info("======转发失败======【" + ctx.channel().id() + "】" + " :" + jsonObject.toJSONString());
              }