From dc2a311eade6f0b0ddccc87b416baa776bd31fd4 Mon Sep 17 00:00:00 2001 From: PL <774412461@qq.com> Date: Thu, 29 Aug 2024 17:25:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9D=E5=AF=B9=E8=B7=AF=E5=BE=84=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E7=9B=B8=E5=AF=B9=E8=B7=AF=E5=BE=84=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/teammodel/service/impl/ChatMessageServiceImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java index 53d8823..92f9a72 100644 --- a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java +++ b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java @@ -25,6 +25,7 @@ import cn.teammodel.utils.RepositoryUtil; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.TypeReference; import com.azure.cosmos.models.CosmosPatchOperations; +import com.sun.xml.internal.ws.transport.http.ResourceLoader; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; @@ -33,6 +34,7 @@ import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; import javax.annotation.Resource; import java.io.*; +import java.net.URL; import java.time.Instant; import java.util.*; @@ -296,7 +298,9 @@ public class ChatMessageServiceImpl implements ChatMessageService { StringBuilder builder = new StringBuilder(); String strData = JSON.toJSONString(chatCommentsDto.getData()); - File file = new File("src/main/resources/Json/ChatModel.json"); + File file = new File(ClassLoader.getSystemResource("Json/ChatModel.json").getPath()); //相对路径获取文件信息 + //File file = new File("src/main/resources/Json/ChatModel.json"); //绝对路径获取文件信息 + List chatModels = new ArrayList<>(); ChatModelDto chatModel = null; //chatModel = readerMethod(file);