From f70a4f7df0ac20ef25783193509bc313e7b82566 Mon Sep 17 00:00:00 2001 From: kira Date: Mon, 11 Mar 2024 11:27:24 +0800 Subject: [PATCH 1/6] =?UTF-8?q?yinruoxi=20feature=EF=BC=9A=20=20=20=20=201?= =?UTF-8?q?.=E4=BF=AE=E6=94=B9=EF=BC=9A=E6=95=B4=E5=90=88=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=A8=A1=E5=BC=8F=E5=92=8C=E9=97=B2=E8=81=8A=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xueyi/nlt/netty/server/handler/ChatServerHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/server/handler/ChatServerHandler.java b/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/server/handler/ChatServerHandler.java index b7cdc9c6..07a38e03 100644 --- a/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/server/handler/ChatServerHandler.java +++ b/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/server/handler/ChatServerHandler.java @@ -102,7 +102,7 @@ public class ChatServerHandler extends SimpleChannelInboundHandler Date: Mon, 11 Mar 2024 17:13:32 +0800 Subject: [PATCH 2/6] =?UTF-8?q?yinruoxi=20feature=EF=BC=9A=20=20=20=20=201?= =?UTF-8?q?.=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=B7=BB=E5=8A=A0=E4=BA=A4?= =?UTF-8?q?=E4=BA=92log=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/handler/ChatServerHandler.java | 62 ++++++++++++++++++- .../xueyi-nlt/src/main/resources/logback.xml | 28 +++++++++ 2 files changed, 88 insertions(+), 2 deletions(-) diff --git a/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/server/handler/ChatServerHandler.java b/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/server/handler/ChatServerHandler.java index 07a38e03..3694c4d2 100644 --- a/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/server/handler/ChatServerHandler.java +++ b/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/server/handler/ChatServerHandler.java @@ -3,13 +3,22 @@ package com.xueyi.nlt.netty.server.handler; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.xueyi.common.core.utils.core.ObjectUtil; +import com.xueyi.common.core.utils.core.SpringUtils; +import com.xueyi.common.core.web.result.AjaxResult; +import com.xueyi.common.core.web.result.R; import com.xueyi.nlt.api.nlt.domain.vo.DmIntentVo; import com.xueyi.nlt.api.nlt.domain.vo.response.DmIntentResponse; import com.xueyi.nlt.netty.server.config.ServerConfig; import com.xueyi.nlt.nlt.service.IDmIntentService; import com.xueyi.nlt.nlt.service.IDmRegularService; +import com.xueyi.nlt.nlt.service.impl.LogServiceImpl; import com.xueyi.nlt.nlt.template.FreeChatTemplate; import com.xueyi.nlt.nlt.template.MovieChatTemplate; +import com.xueyi.system.api.digitalmans.domain.dto.DmManDeviceDto; +import com.xueyi.system.api.digitalmans.feign.RemoteManDeviceService; +import com.xueyi.system.api.organize.domain.dto.SysEnterpriseDto; +import com.xueyi.system.api.organize.feign.RemoteEnterpriseService; +import com.yomahub.tlog.context.TLogContext; import com.yomahub.tlog.core.annotation.TLogAspect; import com.yomahub.tlog.core.rpc.TLogLabelBean; import com.yomahub.tlog.core.rpc.TLogRPCHandler; @@ -25,18 +34,25 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; +import javax.annotation.Resource; import java.net.InetSocketAddress; @Component public class ChatServerHandler extends SimpleChannelInboundHandler { // 添加log private static final Logger log = LoggerFactory.getLogger(ChatServerHandler.class); + private static final Logger intentLog = LoggerFactory.getLogger("intentLog"); public static ChatServerHandler INSTANCE; + @Autowired + private RemoteManDeviceService manDeviceService; @Autowired private FreeChatTemplate freeChatTemplate; + @Autowired + private RemoteEnterpriseService remoteEnterpriseService; + @Autowired private IDmIntentService intentService; @@ -44,6 +60,9 @@ public class ChatServerHandler extends SimpleChannelInboundHandler manDeviceDtoR = INSTANCE.manDeviceService.manDeviceInfoInner(devId); + if (!manDeviceDtoR.isOk() || manDeviceDtoR.getData() == null) { + JSONObject jo = new JSONObject(); + jo.put("action",""); + jo.put("motion","idle"); + jo.put("traceId",""); + jo.put("status",2); + jo.put("code",1); + jo.put("tts","设备号未激活或已过期。"); + channel.writeAndFlush(new TextWebSocketFrame(jo.toJSONString())); + } + String enterpriseName = ""; + // 获取当前数字人租户信息 + R enterpriseDtoR = INSTANCE.remoteEnterpriseService.getInfo(manDeviceDtoR.getData().getTId()); + if (enterpriseDtoR.isOk()) { + enterpriseName = enterpriseDtoR.getData().getName(); + } synchronized (ServerConfig.class) { @@ -97,14 +137,15 @@ public class ChatServerHandler extends SimpleChannelInboundHandler + + + ${log.path}/intent/intentInfo.log + + + + ${log.path}/intent/intentInfo.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + + + @@ -70,5 +97,6 @@ + \ No newline at end of file From 725121effdf436b9cdedf14e9c3060ea0904d470 Mon Sep 17 00:00:00 2001 From: kira Date: Mon, 11 Mar 2024 17:14:48 +0800 Subject: [PATCH 3/6] =?UTF-8?q?yinruoxi=20feature=EF=BC=9A=20=20=20=20=201?= =?UTF-8?q?.=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=B7=BB=E5=8A=A0=E4=BA=A4?= =?UTF-8?q?=E4=BA=92log=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nlt/nlt/service/impl/LogServiceImpl.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/service/impl/LogServiceImpl.java diff --git a/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/service/impl/LogServiceImpl.java b/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/service/impl/LogServiceImpl.java new file mode 100644 index 00000000..10d7b59c --- /dev/null +++ b/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/service/impl/LogServiceImpl.java @@ -0,0 +1,18 @@ +package com.xueyi.nlt.nlt.service.impl; + +import com.alibaba.fastjson2.JSONObject; +import com.yomahub.tlog.core.annotation.TLogAspect; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +@Component +public class LogServiceImpl { + + private static final Logger intentLog = LoggerFactory.getLogger("intentLog"); + + @TLogAspect({"enterpriseName","type"}) + public void record(JSONObject jo,String enterpriseName, String type) { + intentLog.info("{}", jo.toJSONString()); + } +} From f76662ea5bfec7ca945e7faa1afd4cc524038ec2 Mon Sep 17 00:00:00 2001 From: kira Date: Mon, 11 Mar 2024 17:38:18 +0800 Subject: [PATCH 4/6] =?UTF-8?q?yinruoxi=20feature=EF=BC=9A=20=20=20=20=201?= =?UTF-8?q?.=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=B7=BB=E5=8A=A0=E4=BA=A4?= =?UTF-8?q?=E4=BA=92log=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nlt/netty/server/handler/ChatServerHandler.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/server/handler/ChatServerHandler.java b/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/server/handler/ChatServerHandler.java index 3694c4d2..dbf7d192 100644 --- a/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/server/handler/ChatServerHandler.java +++ b/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/server/handler/ChatServerHandler.java @@ -137,7 +137,7 @@ public class ChatServerHandler extends SimpleChannelInboundHandler Date: Mon, 11 Mar 2024 17:41:04 +0800 Subject: [PATCH 5/6] =?UTF-8?q?yinruoxi=20feature=EF=BC=9A=20=20=20=20=201?= =?UTF-8?q?.=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=B7=BB=E5=8A=A0=E4=BA=A4?= =?UTF-8?q?=E4=BA=92log=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xueyi/nlt/nlt/service/impl/LogServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/service/impl/LogServiceImpl.java b/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/service/impl/LogServiceImpl.java index 10d7b59c..6f3c82cb 100644 --- a/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/service/impl/LogServiceImpl.java +++ b/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/service/impl/LogServiceImpl.java @@ -12,7 +12,8 @@ public class LogServiceImpl { private static final Logger intentLog = LoggerFactory.getLogger("intentLog"); @TLogAspect({"enterpriseName","type"}) - public void record(JSONObject jo,String enterpriseName, String type) { + public void record(JSONObject jo,String text,String enterpriseName, String type) { + jo.put("text",text); intentLog.info("{}", jo.toJSONString()); } } From 388a6c846b30ce84cfe590a9b123025e41e48756 Mon Sep 17 00:00:00 2001 From: kira Date: Mon, 11 Mar 2024 17:49:44 +0800 Subject: [PATCH 6/6] =?UTF-8?q?yinruoxi=20feature=EF=BC=9A=20=20=20=20=201?= =?UTF-8?q?.=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=B7=BB=E5=8A=A0=E4=BA=A4?= =?UTF-8?q?=E4=BA=92log=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xueyi/nlt/netty/server/handler/ChatServerHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/server/handler/ChatServerHandler.java b/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/server/handler/ChatServerHandler.java index dbf7d192..d6bff226 100644 --- a/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/server/handler/ChatServerHandler.java +++ b/xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/netty/server/handler/ChatServerHandler.java @@ -153,7 +153,7 @@ public class ChatServerHandler extends SimpleChannelInboundHandler