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);