diff --git a/pom.xml b/pom.xml index 04bfab075def9001c2837d5dd5fe3b62ed6b88f6..9267a85fdf76f3c53e388a253e3865941c87696e 100644 --- a/pom.xml +++ b/pom.xml @@ -53,6 +53,13 @@ 3.8 + + org.projectlombok + lombok + 1.18.26 + + + diff --git a/smart-chatbot-domain/pom.xml b/smart-chatbot-domain/pom.xml index 99d1ab638dcb0b295c060bc39a1eac33e7c365cd..53a6a4c3be3d18c5f4cae539b76cc97aad53ba5f 100644 --- a/smart-chatbot-domain/pom.xml +++ b/smart-chatbot-domain/pom.xml @@ -16,4 +16,42 @@ 8 + + + org.springframework.boot + spring-boot-starter-web + 2.3.5.RELEASE + + + + org.springframework.boot + spring-boot-starter-test + 2.3.5.RELEASE + test + + + junit + junit + 4.12 + test + + + + cn.hutool + hutool-all + + + com.alibaba + fastjson + + + org.apache.commons + commons-lang3 + + + org.projectlombok + lombok + + + \ No newline at end of file diff --git a/smart-chatbot-domain/src/main/java/cn/huazheng/smartchatbot/domain/zsxq/module/req/AnswerReq.java b/smart-chatbot-domain/src/main/java/cn/huazheng/smartchatbot/domain/zsxq/module/req/AnswerReq.java new file mode 100644 index 0000000000000000000000000000000000000000..1132892b2c62c47b29b86a1ecb4d2296b24bcb4e --- /dev/null +++ b/smart-chatbot-domain/src/main/java/cn/huazheng/smartchatbot/domain/zsxq/module/req/AnswerReq.java @@ -0,0 +1,10 @@ +package cn.huazheng.smartchatbot.domain.zsxq.module.req; + +/** + * @Author zhanghuazheng + * @Date 2023-02-05 12:19 + * @Description: TODO + * @Version 1.0 + */ +public class AnswerReq { +} diff --git a/smart-chatbot-domain/src/main/java/cn/huazheng/smartchatbot/domain/zsxq/module/req/ReqData.java b/smart-chatbot-domain/src/main/java/cn/huazheng/smartchatbot/domain/zsxq/module/req/ReqData.java new file mode 100644 index 0000000000000000000000000000000000000000..8d9b96be1669b88732c61a6bfc5df30652c4e745 --- /dev/null +++ b/smart-chatbot-domain/src/main/java/cn/huazheng/smartchatbot/domain/zsxq/module/req/ReqData.java @@ -0,0 +1,10 @@ +package cn.huazheng.smartchatbot.domain.zsxq.module.req; + +/** + * @Author zhanghuazheng + * @Date 2023-02-05 12:19 + * @Description: TODO + * @Version 1.0 + */ +public class ReqData { +} diff --git a/smart-chatbot-domain/src/main/java/cn/huazheng/smartchatbot/domain/zsxq/module/res/AnswerRes.java b/smart-chatbot-domain/src/main/java/cn/huazheng/smartchatbot/domain/zsxq/module/res/AnswerRes.java new file mode 100644 index 0000000000000000000000000000000000000000..a41265dd0b0e979ae578d2f704b177f54d306aaa --- /dev/null +++ b/smart-chatbot-domain/src/main/java/cn/huazheng/smartchatbot/domain/zsxq/module/res/AnswerRes.java @@ -0,0 +1,19 @@ +package cn.huazheng.smartchatbot.domain.zsxq.module.res; + +import lombok.Data; + +/** + * @Author zhanghuazheng + * @Date 2023-02-05 12:19 + * @Description: TODO + * @Version 1.0 + */ +@Data +public class AnswerRes { + + private boolean succeeded; + + private int code; + + private String info; +} diff --git a/smart-chatbot-domain/src/main/java/cn/huazheng/smartchatbot/domain/zsxq/module/res/ResData.java b/smart-chatbot-domain/src/main/java/cn/huazheng/smartchatbot/domain/zsxq/module/res/ResData.java new file mode 100644 index 0000000000000000000000000000000000000000..0257201333ed82ed93934792c9a3e7352077e6bc --- /dev/null +++ b/smart-chatbot-domain/src/main/java/cn/huazheng/smartchatbot/domain/zsxq/module/res/ResData.java @@ -0,0 +1,11 @@ +package cn.huazheng.smartchatbot.domain.zsxq.module.res; + +/** + * @Author zhanghuazheng + * @Date 2023-02-05 12:13 + * @Description: TODO + * @Version 1.0 + */ +public class ResData { + +} diff --git a/smart-chatbot-domain/src/main/java/cn/huazheng/smartchatbot/domain/zsxq/service/IZsxqAPI.java b/smart-chatbot-domain/src/main/java/cn/huazheng/smartchatbot/domain/zsxq/service/IZsxqAPI.java new file mode 100644 index 0000000000000000000000000000000000000000..5b21d02c4ac44ed3be3dd0d47df70bfb4ebc4642 --- /dev/null +++ b/smart-chatbot-domain/src/main/java/cn/huazheng/smartchatbot/domain/zsxq/service/IZsxqAPI.java @@ -0,0 +1,13 @@ +package cn.huazheng.smartchatbot.domain.zsxq.service; + +/** + * @Author zhanghuazheng + * @Date 2023-02-05 00:14 + * @Description: 知识星球知识问答相关接口 + * @Version 1.0 + */ +public interface IZsxqAPI { + void queryUnAnswerQuesion(); + + Boolean answerQuestion(); +} diff --git a/smart-chatbot-domain/src/main/java/cn/huazheng/smartchatbot/domain/zsxq/service/ZsxqAPIImpl.java b/smart-chatbot-domain/src/main/java/cn/huazheng/smartchatbot/domain/zsxq/service/ZsxqAPIImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..9ca735257092e44e910ece79ea001738e6dd27a2 --- /dev/null +++ b/smart-chatbot-domain/src/main/java/cn/huazheng/smartchatbot/domain/zsxq/service/ZsxqAPIImpl.java @@ -0,0 +1,26 @@ +package cn.huazheng.smartchatbot.domain.zsxq.service; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +/** + * @Author zhanghuazheng + * @Date 2023-02-05 00:16 + * @Description: 知识星球知识问答实现 + * @Version 1.0 + */ +@Service +public class ZsxqAPIImpl implements IZsxqAPI{ + private Logger logger = LoggerFactory.getLogger(ZsxqAPIImpl.class); + + @Override + public void queryUnAnswerQuesion() { + + } + + @Override + public Boolean answerQuestion() { + return null; + } +} diff --git a/smart-chatbot-interfaces/pom.xml b/smart-chatbot-interfaces/pom.xml index d9233146f2fb3e62d7a42414291a9f00550b314d..a271df73d9487386541c6a6e4b0d3c5245499ad2 100644 --- a/smart-chatbot-interfaces/pom.xml +++ b/smart-chatbot-interfaces/pom.xml @@ -50,5 +50,11 @@ commons-lang3 + + cn.huazheng + smart-chatbot-domain + 1.0.0-SNAPSHOT + + \ No newline at end of file diff --git a/smart-chatbot-interfaces/src/test/java/cn/huazheng/smartchatbot/interfaces/utils/HttpClientTest.java b/smart-chatbot-interfaces/src/test/java/cn/huazheng/smartchatbot/interfaces/utils/HttpClientTest.java new file mode 100644 index 0000000000000000000000000000000000000000..141de0a81dc7290dad51a5c7e6bb32a130a0bb11 --- /dev/null +++ b/smart-chatbot-interfaces/src/test/java/cn/huazheng/smartchatbot/interfaces/utils/HttpClientTest.java @@ -0,0 +1,38 @@ +package cn.huazheng.smartchatbot.interfaces.utils; + +import cn.huazheng.smartchatbot.domain.zsxq.module.res.AnswerRes; +import cn.hutool.http.Header; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import com.alibaba.fastjson.JSON; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @Author zhanghuazheng + * @Date 2023-02-05 11:50 + * @Description: 网络测试 + * @Version 1.0 + */ +public class HttpClientTest { + private Logger logger = LoggerFactory.getLogger(HttpClientTest.class); + @Test + public void test_http_get(){ + String url = "https://api.zsxq.com/v2/groups/48844155242818/topics?scope=unanswered_questions&count=20"; + String cookie="zsxq_access_token=D6F26C45-A7E4-F887-C923-612E6D7D7668_D55526EAC6062B36; abtest_env=product; zsxqsessionid=9e6ce16ca9ab4b33e010b1032b468bd9"; + String accept="application/json, text/plain, */*"; + String use_agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"; + + HttpResponse response = HttpRequest.get(url).header(Header.COOKIE, cookie) + .header(Header.ACCEPT, accept) + .header(Header.USER_AGENT, use_agent) + .execute(); + String body = response.body(); + logger.info("响应结果={}",body); + + AnswerRes answerRes = JSON.parseObject(body, AnswerRes.class); + logger.info("解析后的对象answerRes={}",answerRes); + + } +}