qas = Qa.getQas(getQaListPort);
+ return qas;
+ }
+
+
+}
diff --git a/qa-service/qa-service-application/src/main/java/com/example/qa/service/application/service/UpdateQasUseService.java b/qa-service/qa-service-application/src/main/java/com/example/qa/service/application/service/UpdateQasUseService.java
new file mode 100644
index 0000000000000000000000000000000000000000..eb7410bc8fb1884db50e4b94ec6b3716a8ea0f26
--- /dev/null
+++ b/qa-service/qa-service-application/src/main/java/com/example/qa/service/application/service/UpdateQasUseService.java
@@ -0,0 +1,33 @@
+package com.example.qa.service.application.service;
+
+import com.example.qa.service.application.command.UpdateQasCommand;
+import com.example.qa.service.application.port.in.UpdateQasUseCase;
+import com.example.qa.service.domain.Qa;
+import com.example.qa.service.domain.port.UpdateQaPort;
+import com.example.qa.service.domain.valueobject.Answer;
+import com.example.qa.service.domain.valueobject.QaId;
+import com.example.qa.service.domain.valueobject.Question;
+import jakarta.annotation.Resource;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @program: qa-sys
+ * @description:
+ * @author: fks
+ * @create: 2025-09-10 23:09
+ **/
+@Component
+public class UpdateQasUseService implements UpdateQasUseCase {
+ @Resource
+ private UpdateQaPort updateQaPort;
+ @Override
+ public Void updateQas(UpdateQasCommand command) {
+ Qa qa = new Qa(
+ new Answer(command.answer()),
+ new QaId(command.id().longValue()),
+ new Question(command.question()));
+ updateQaPort.updateQa(qa);
+ return null;
+ }
+}
diff --git a/qa-service/qa-service-bootstrap/.gitignore b/qa-service/qa-service-bootstrap/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..549e00a2a96fa9d7c5dbc9859664a78d980158c2
--- /dev/null
+++ b/qa-service/qa-service-bootstrap/.gitignore
@@ -0,0 +1,33 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
diff --git a/qa-service/qa-service-bootstrap/pom.xml b/qa-service/qa-service-bootstrap/pom.xml
new file mode 100644
index 0000000000000000000000000000000000000000..4069b26996ba4cd6064a021bdbffe77e209f96f8
--- /dev/null
+++ b/qa-service/qa-service-bootstrap/pom.xml
@@ -0,0 +1,84 @@
+
+
+ 4.0.0
+ com.example
+ qa-service-bootstrap
+ 0.0.1-SNAPSHOT
+ qa-service-bootstrap
+ qa-service-bootstrap
+
+ com.example
+ qa-service
+ 0.0.1-SNAPSHOT
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+ com.example
+ qa-adapter-in-web
+ 0.0.1-SNAPSHOT
+
+
+
+ com.example
+ qa-adapter-out-persistence
+ 0.0.1-SNAPSHOT
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+ 21
+ 21
+ UTF-8
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot.version}
+
+ com.example.user.service.bootstrap.UserServiceBootstrapApplication
+ false
+
+
+
+ repackage
+
+ repackage
+
+
+
+
+
+
+
+
diff --git a/qa-service/qa-service-bootstrap/src/main/java/com/example/qa/service/bootstrap/QaServiceBootstrapApplication.java b/qa-service/qa-service-bootstrap/src/main/java/com/example/qa/service/bootstrap/QaServiceBootstrapApplication.java
new file mode 100644
index 0000000000000000000000000000000000000000..714d3f969228260d37ee452aa12d7197e49ab1ce
--- /dev/null
+++ b/qa-service/qa-service-bootstrap/src/main/java/com/example/qa/service/bootstrap/QaServiceBootstrapApplication.java
@@ -0,0 +1,15 @@
+package com.example.qa.service.bootstrap;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication(scanBasePackages = "com.example")
+@MapperScan("com.example.qa.adapter.out.persistence.mapper")
+public class QaServiceBootstrapApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(QaServiceBootstrapApplication.class, args);
+ }
+
+}
diff --git a/qa-service/qa-service-bootstrap/src/main/resources/application.properties b/qa-service/qa-service-bootstrap/src/main/resources/application.properties
new file mode 100644
index 0000000000000000000000000000000000000000..b9d0097696c3a0a6f367f2a86a09781293345b6c
--- /dev/null
+++ b/qa-service/qa-service-bootstrap/src/main/resources/application.properties
@@ -0,0 +1,46 @@
+server.port=28081
+
+spring.application.name=qa-service
+spring.datasource.url=jdbc:mysql://localhost:3306/shixun
+spring.datasource.username=root
+spring.datasource.password=root
+spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
+
+moonshot.url=https://api.moonshot.cn/v1/chat/completions
+moonshot.key=sk-jWpzVWAR2tJfj6kf1ofzZnE3dNV5RklEOCxaN9il2HMhxEEq
+moonshot.model=kimi-k2-0905-preview
+
+# RabbitMQ配置
+spring.rabbitmq.host=192.168.98.129
+spring.rabbitmq.port=5672
+spring.rabbitmq.virtual-host=/hmall
+spring.rabbitmq.username=hmall
+spring.rabbitmq.password=123
+
+# 信任所有反序列化类
+spring.amqp.deserialization.trust.all=true
+## Nacos\u8BA4\u8BC1\u4FE1\u606F
+#spring.cloud.nacos.discovery.username=nacos
+#spring.cloud.nacos.discovery.password=nacos
+## Nacos \u670D\u52A1\u53D1\u73B0\u4E0E\u6CE8\u518C\u914D\u7F6E\uFF0C\u5176\u4E2D\u5B50\u5C5E\u6027 server-addr \u6307\u5B9A Nacos \u670D\u52A1\u5668\u4E3B\u673A\u548C\u7AEF\u53E3
+#spring.cloud.nacos.discovery.server-addr=localhost:8848
+## \u6CE8\u518C\u5230 nacos \u7684\u6307\u5B9A namespace\uFF0C\u9ED8\u8BA4\u4E3A public
+#spring.cloud.nacos.discovery.namespace=public
+#
+## Nacos\u5E2E\u52A9\u6587\u6863: https://nacos.io/zh-cn/docs/concepts.html
+## Nacos\u8BA4\u8BC1\u4FE1\u606F
+#spring.cloud.nacos.config.username=nacos
+#spring.cloud.nacos.config.password=nacos
+#spring.cloud.nacos.config.contextPath=/nacos
+## \u8BBE\u7F6E\u914D\u7F6E\u4E2D\u5FC3\u670D\u52A1\u7AEF\u5730\u5740
+#spring.cloud.nacos.config.server-addr=localhost::8848
+## Nacos \u914D\u7F6E\u4E2D\u5FC3\u7684namespace\u3002\u9700\u8981\u6CE8\u610F\uFF0C\u5982\u679C\u4F7F\u7528 public \u7684 namcespace \uFF0C\u8BF7\u4E0D\u8981\u586B\u5199\u8FD9\u4E2A\u503C\uFF0C\u76F4\u63A5\u7559\u7A7A\u5373\u53EF
+## spring.cloud.nacos.config.namespace=
+#spring.config.import=nacos:${spring.application.name}.properties?refresh=true
+
+
+
+
+
+
+
diff --git a/qa-service/qa-service-bootstrap/src/main/resources/static/index.html b/qa-service/qa-service-bootstrap/src/main/resources/static/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..89bb8ba4ff248cd6e3b8b5e2f89af4e3062a37a8
--- /dev/null
+++ b/qa-service/qa-service-bootstrap/src/main/resources/static/index.html
@@ -0,0 +1,6 @@
+
+
+hello word!!!
+this is a html page
+
+
\ No newline at end of file
diff --git a/qa-service/qa-service-bootstrap/src/test/java/com/example/qa/service/bootstrap/QaServiceBootstrapApplicationTests.java b/qa-service/qa-service-bootstrap/src/test/java/com/example/qa/service/bootstrap/QaServiceBootstrapApplicationTests.java
new file mode 100644
index 0000000000000000000000000000000000000000..153ddf1989c7fe0269bdf4085b4e7e054849d3e5
--- /dev/null
+++ b/qa-service/qa-service-bootstrap/src/test/java/com/example/qa/service/bootstrap/QaServiceBootstrapApplicationTests.java
@@ -0,0 +1,13 @@
+package com.example.qa.service.bootstrap;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class QaServiceBootstrapApplicationTests {
+
+ @Test
+ void contextLoads() {
+ }
+
+}
diff --git a/qa-service/qa-service-common/.gitignore b/qa-service/qa-service-common/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..549e00a2a96fa9d7c5dbc9859664a78d980158c2
--- /dev/null
+++ b/qa-service/qa-service-common/.gitignore
@@ -0,0 +1,33 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
diff --git a/qa-service/qa-service-common/pom.xml b/qa-service/qa-service-common/pom.xml
new file mode 100644
index 0000000000000000000000000000000000000000..aeb6c42c5fb48ae3ab82e6342a124854796acf8e
--- /dev/null
+++ b/qa-service/qa-service-common/pom.xml
@@ -0,0 +1,55 @@
+
+
+ 4.0.0
+ com.example
+ qa-service-common
+ 0.0.1-SNAPSHOT
+ qa-service-common
+ qa-service-common
+
+
+ com.example
+ qa-service
+ 0.0.1-SNAPSHOT
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring-boot.version}
+ pom
+ import
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+ 21
+ 21
+ UTF-8
+
+
+
+
+
+
diff --git a/qa-service/qa-service-common/src/main/java/com/example/qa/service/common/demos/web/IdWorker.java b/qa-service/qa-service-common/src/main/java/com/example/qa/service/common/demos/web/IdWorker.java
new file mode 100644
index 0000000000000000000000000000000000000000..c6d3735e2ce4cff18fa66756f1171b0d89d3b25e
--- /dev/null
+++ b/qa-service/qa-service-common/src/main/java/com/example/qa/service/common/demos/web/IdWorker.java
@@ -0,0 +1,199 @@
+package com.example.qa.service.common.demos.web;
+
+import java.lang.management.ManagementFactory;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+
+/**
+ * @author wuyunbin
+ * 名称:IdWorker.java
+ * 描述:分布式自增长ID
+ *
+ * Twitter的 Snowflake JAVA实现方案
+ *
+ * 核心代码为其IdWorker这个类实现,其原理结构如下,我分别用一个0表示一位,用—分割开部分的作用:
+ * 1||0---0000000000 0000000000 0000000000 0000000000 0 --- 00000 ---00000 ---000000000000
+ * 在上面的字符串中,第一位为未使用(实际上也可作为long的符号位),接下来的41位为毫秒级时间,
+ * 然后5位datacenter标识位,5位机器ID(并不算标识符,实际是为线程标识),
+ * 然后12位该毫秒内的当前毫秒内的计数,加起来刚好64位,为一个Long型。
+ * 这样的好处是,整体上按照时间自增排序,并且整个分布式系统内不会产生ID碰撞(由datacenter和机器ID作区分),
+ * 并且效率较高,经测试,snowflake每秒能够产生26万ID左右,完全满足需要。
+ *
+ * 64位ID (42(毫秒)+5(机器ID)+5(业务编码)+12(重复累加))
+ * @author Polim
+ */
+public class IdWorker {
+ /**
+ * 时间起始标记点,作为基准,一般取系统的最近时间(一旦确定不能变动)
+ */
+ private final static long TWEPOCH = 1288834974657L;
+
+ /**
+ * 机器标识位数
+ */
+ private final static long WORKER_ID_BITS = 5L;
+
+ /**
+ * 数据中心标识位数
+ */
+ private final static long DATA_CENTER_ID_BITS = 5L;
+
+ /**
+ * 机器ID最大值
+ */
+ private final static long MAX_WORKER_ID = -1L ^ (-1L << WORKER_ID_BITS);
+
+ /**
+ * 数据中心ID最大值
+ */
+ private final static long MAX_DATACENTER_ID = -1L ^ (-1L << DATA_CENTER_ID_BITS);
+
+ /**
+ * 毫秒内自增位
+ */
+ private final static long SEQUENCE_BITS = 12L;
+
+ /**
+ * 机器ID偏左移12位
+ */
+ private final static long WORKER_ID_SHIFT = SEQUENCE_BITS;
+
+ /**
+ * 数据中心ID左移17位
+ */
+ private final static long DATACENTER_ID_SHIFT = SEQUENCE_BITS + WORKER_ID_BITS;
+
+ /**
+ * 时间毫秒左移22位
+ */
+ private final static long TIMESTAMP_LEFT_SHIFT = SEQUENCE_BITS + WORKER_ID_BITS + DATA_CENTER_ID_BITS;
+
+ private final static long SEQUENCE_MASK = ~(-1L << SEQUENCE_BITS);
+
+ /**
+ * 上次生产id时间戳
+ */
+ private static long lastTimestamp = -1L;
+
+ /**
+ * 0,并发控制
+ */
+ private long sequence = 0L;
+
+ private final long workerId;
+
+ /**
+ * 数据标识id部分
+ */
+ private final long datacenterId;
+
+ public IdWorker() {
+ this.datacenterId = getDatacenterId();
+ this.workerId = getMaxWorkerId(datacenterId);
+ }
+
+ /**
+ * @param workerId 工作机器ID
+ * @param datacenterId 序列号
+ */
+ public IdWorker(long workerId, long datacenterId) {
+ if (workerId > MAX_WORKER_ID || workerId < 0) {
+ throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", MAX_WORKER_ID));
+ }
+ if (datacenterId > MAX_DATACENTER_ID || datacenterId < 0) {
+ throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", MAX_DATACENTER_ID));
+ }
+ this.workerId = workerId;
+ this.datacenterId = datacenterId;
+ }
+
+ /**
+ * 获取下一个ID
+ *
+ * @return
+ */
+ public synchronized long nextId() {
+ long timestamp = timeGen();
+ if (timestamp < lastTimestamp) {
+ throw new RuntimeException(String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
+ }
+
+ if (lastTimestamp == timestamp) {
+ // 当前毫秒内,则+1
+ sequence = (sequence + 1) & SEQUENCE_MASK;
+ if (sequence == 0) {
+ // 当前毫秒内计数满了,则等待下一秒
+ timestamp = tilNextMillis(lastTimestamp);
+ }
+ } else {
+ sequence = 0L;
+ }
+ lastTimestamp = timestamp;
+ // ID偏移组合生成最终的ID,并返回ID
+
+ return ((timestamp - TWEPOCH) << TIMESTAMP_LEFT_SHIFT)
+ | (datacenterId << DATACENTER_ID_SHIFT)
+ | (workerId << WORKER_ID_SHIFT) | sequence;
+ }
+
+ private long tilNextMillis(final long lastTimestamp) {
+ long timestamp = this.timeGen();
+ while (timestamp <= lastTimestamp) {
+ timestamp = this.timeGen();
+ }
+ return timestamp;
+ }
+
+ private long timeGen() {
+ return System.currentTimeMillis();
+ }
+
+ /**
+ *
+ * 获取 MAX_WORKER_ID
+ *
+ */
+ protected static long getMaxWorkerId(long datacenterId) {
+ StringBuilder mpid = new StringBuilder();
+ mpid.append(datacenterId);
+ String name = ManagementFactory.getRuntimeMXBean().getName();
+ if (!name.isEmpty()) {
+ /*
+ * GET jvmPid
+ */
+ mpid.append(name.split("@")[0]);
+ }
+ /*
+ * MAC + PID 的 hashcode 获取16个低位
+ */
+ return (mpid.toString().hashCode() & 0xffff) % (IdWorker.MAX_WORKER_ID + 1);
+ }
+
+ /**
+ *
+ * 数据标识id部分
+ *
+ */
+ protected static long getDatacenterId() {
+ long id = 0L;
+ try {
+ InetAddress ip = InetAddress.getLocalHost();
+ NetworkInterface network = NetworkInterface.getByInetAddress(ip);
+ if (network == null) {
+ id = 1L;
+ } else {
+ byte[] mac = network.getHardwareAddress();
+ id = ((0x000000FF & (long) mac[mac.length - 1])
+ | (0x0000FF00 & (((long) mac[mac.length - 2]) << 8))) >> 6;
+ id = id % (IdWorker.MAX_DATACENTER_ID + 1);
+ }
+ } catch (Exception e) {
+ System.out.println(" getDatacenterId: " + e.getMessage());
+ }
+ return id;
+ }
+
+
+
+
+}
diff --git a/qa-service/qa-service-domain/.gitignore b/qa-service/qa-service-domain/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..549e00a2a96fa9d7c5dbc9859664a78d980158c2
--- /dev/null
+++ b/qa-service/qa-service-domain/.gitignore
@@ -0,0 +1,33 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
diff --git a/qa-service/qa-service-domain/pom.xml b/qa-service/qa-service-domain/pom.xml
new file mode 100644
index 0000000000000000000000000000000000000000..8202a534b51ec27ab63dbe38e589c51ee6b17f5f
--- /dev/null
+++ b/qa-service/qa-service-domain/pom.xml
@@ -0,0 +1,69 @@
+
+
+ 4.0.0
+ com.example
+ qa-service-domain
+ 0.0.1-SNAPSHOT
+ qa-service-domain
+ qa-service-domain
+
+
+ com.example
+ qa-service
+ 0.0.1-SNAPSHOT
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+ org.springframework.amqp
+ spring-rabbit-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-amqp
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.projectlombok
+ lombok
+ provided
+
+
+
+ com.example
+ qa-service-common
+ 0.0.1-SNAPSHOT
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+ 21
+ 21
+ UTF-8
+
+
+
+
+
+
+
diff --git a/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/ChatCompletionRequestDTO.java b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/ChatCompletionRequestDTO.java
new file mode 100644
index 0000000000000000000000000000000000000000..d04a1ad8e7a53f2815f700fce4d118be55cf785a
--- /dev/null
+++ b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/ChatCompletionRequestDTO.java
@@ -0,0 +1,19 @@
+package com.example.qa.service.domain;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @program: qa-sys
+ * @description:
+ * @author: fks
+ * @create: 2025-09-16 23:00
+ **/
+
+@Data
+public class ChatCompletionRequestDTO {
+ private String model;
+ private List messages;
+ private double temperature;
+}
diff --git a/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/ChatCompletionResponseDTO.java b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/ChatCompletionResponseDTO.java
new file mode 100644
index 0000000000000000000000000000000000000000..1b9e52cd7a50eb9fe65d8e86b0599489a7796294
--- /dev/null
+++ b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/ChatCompletionResponseDTO.java
@@ -0,0 +1,21 @@
+package com.example.qa.service.domain;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @program: qa-sys
+ * @description:
+ * @author: fks
+ * @create: 2025-09-16 23:00
+ **/
+
+@Data
+public class ChatCompletionResponseDTO {
+ private String id;
+ private String object;
+ private long created;
+ private String model;
+ private List choices;
+}
\ No newline at end of file
diff --git a/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/Choice.java b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/Choice.java
new file mode 100644
index 0000000000000000000000000000000000000000..9cfb8c360dc5f4f984f9ecd0eaaf96c769b475fe
--- /dev/null
+++ b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/Choice.java
@@ -0,0 +1,16 @@
+package com.example.qa.service.domain;
+
+import lombok.Data;
+
+/**
+ * @program: qa-sys
+ * @description:
+ * @author: fks
+ * @create: 2025-09-16 22:53
+ **/
+@Data
+public class Choice {
+ private int index;
+ private Message message;
+ private String finish_reason;
+}
diff --git a/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/Message.java b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/Message.java
new file mode 100644
index 0000000000000000000000000000000000000000..4f82cedd0a508e7b96853244e45dbef4d647c092
--- /dev/null
+++ b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/Message.java
@@ -0,0 +1,15 @@
+package com.example.qa.service.domain;
+
+import lombok.Data;
+
+/**
+ * @program: qa-sys
+ * @description:
+ * @author: fks
+ * @create: 2025-09-16 22:53
+ **/
+@Data
+public class Message {
+ private String role;
+ private String content;
+}
diff --git a/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/Qa.java b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/Qa.java
new file mode 100644
index 0000000000000000000000000000000000000000..ccd1eab5b5e8e73f08a12e2067ea2856713cf611
--- /dev/null
+++ b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/Qa.java
@@ -0,0 +1,47 @@
+package com.example.qa.service.domain;
+
+import com.example.qa.service.common.demos.web.IdWorker;
+import com.example.qa.service.domain.port.DeleteAllQasPort;
+import com.example.qa.service.domain.port.GetQaListPort;
+import com.example.qa.service.domain.valueobject.Answer;
+import com.example.qa.service.domain.valueobject.QaId;
+import com.example.qa.service.domain.valueobject.Question;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.util.List;
+
+@Setter
+@Getter
+@ToString
+public class Qa {
+ private QaId id;
+ private Question question;
+ private Answer answer;
+
+ public Qa() {
+ }
+
+ public Qa(Answer answer, QaId id, Question question) {
+ this.answer = answer;
+ this.id = id;
+ this.question = question;
+ }
+
+ public Qa(Question question, Answer answer) {
+ this.id = this.genId();
+ this.question = question;
+ this.answer = answer;
+ }
+ public QaId genId(){
+ return new QaId(new IdWorker().nextId());
+ }
+
+ public static List getQas(GetQaListPort getQaListPort) {
+ return getQaListPort.getQas();
+ }
+ public static void deleteAllQas(DeleteAllQasPort deleteAllQasPort) {
+ deleteAllQasPort.deleteAllQas();
+ }
+}
diff --git a/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/config/MoonShotConfig.java b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/config/MoonShotConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..8ed0fa970280a54de14db6f4b384fb84855cd20c
--- /dev/null
+++ b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/config/MoonShotConfig.java
@@ -0,0 +1,14 @@
+package com.example.qa.service.domain.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+@Data
+@Configuration
+@ConfigurationProperties(prefix = "moonshot")
+public class MoonShotConfig {
+ private String url;
+ private String key;
+ private String model;
+}
diff --git a/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/config/RabbitConfig.java b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/config/RabbitConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..9291b492e0363a1d8e47607bc2404208d10307bf
--- /dev/null
+++ b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/config/RabbitConfig.java
@@ -0,0 +1,48 @@
+package com.example.qa.service.domain.config;
+
+
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.core.Queue;
+import org.springframework.amqp.rabbit.connection.ConnectionFactory;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.amqp.support.converter.DefaultJackson2JavaTypeMapper;
+import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
+import org.springframework.amqp.support.converter.MessageConverter;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Configuration
+public class RabbitConfig {
+ //让springboot启动时自动创建队列
+
+ @Bean
+ public Queue queue() {
+ return new Queue("test");
+ }
+
+
+ @Bean
+ public MessageConverter messageConverter() {
+ Jackson2JsonMessageConverter converter = new Jackson2JsonMessageConverter();
+ // 配置类型映射器以支持 Student 类的反序列化
+ DefaultJackson2JavaTypeMapper typeMapper = new DefaultJackson2JavaTypeMapper();
+ Map> idClassMapping = new HashMap<>();
+ // 添加 Student 类的映射 如果有更多的类需要转换,则继续添加
+ idClassMapping.put("com.example.qa.service.domain", Message.class);
+ typeMapper.setIdClassMapping(idClassMapping);
+ typeMapper.setTrustedPackages("com.example.qa.service.domain");
+ converter.setJavaTypeMapper(typeMapper);
+
+ return converter;
+ }
+
+ @Bean
+ public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
+ RabbitTemplate template = new RabbitTemplate(connectionFactory);
+ template.setMessageConverter(messageConverter());
+ return template;
+ }
+}
\ No newline at end of file
diff --git a/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/config/RestConfig.java b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/config/RestConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..7704bd7ac316d94fb7cb07dfc7981c96f90c806f
--- /dev/null
+++ b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/config/RestConfig.java
@@ -0,0 +1,13 @@
+package com.example.qa.service.domain.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+@Configuration
+public class RestConfig {
+ @Bean
+ public RestTemplate getRestTemplate(){
+ return new RestTemplate();
+ }
+}
diff --git a/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/listener/chatListener.java b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/listener/chatListener.java
new file mode 100644
index 0000000000000000000000000000000000000000..81f1f5948b2a626922705b075d9bc45d093e9f47
--- /dev/null
+++ b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/listener/chatListener.java
@@ -0,0 +1,22 @@
+package com.example.qa.service.domain.listener;
+
+
+import com.example.qa.service.domain.Message;
+import com.example.qa.service.domain.port.CreateChatContentPort;
+import jakarta.annotation.Resource;
+import org.springframework.amqp.rabbit.annotation.RabbitHandler;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+@Component
+@RabbitListener(queues = "test")
+public class chatListener {
+ @Resource
+ private CreateChatContentPort createChatContentPort;
+ @RabbitHandler
+ public void handler(Message message){
+ createChatContentPort.createChatContent(message);
+ }
+}
diff --git a/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/CreateChatContentPort.java b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/CreateChatContentPort.java
new file mode 100644
index 0000000000000000000000000000000000000000..0bbe23493a656dabc2857668400a1487e1dd633a
--- /dev/null
+++ b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/CreateChatContentPort.java
@@ -0,0 +1,9 @@
+package com.example.qa.service.domain.port;
+
+import com.example.qa.service.domain.Message;
+
+import java.util.List;
+
+public interface CreateChatContentPort {
+ void createChatContent(Message message);
+}
diff --git a/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/CreateQaPort.java b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/CreateQaPort.java
new file mode 100644
index 0000000000000000000000000000000000000000..5ac360216929316528165938960ff997c51193d3
--- /dev/null
+++ b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/CreateQaPort.java
@@ -0,0 +1,7 @@
+package com.example.qa.service.domain.port;
+
+import com.example.qa.service.domain.Qa;
+
+public interface CreateQaPort {
+ Qa createQa(Qa qa);
+}
diff --git a/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/DeleteAllQasPort.java b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/DeleteAllQasPort.java
new file mode 100644
index 0000000000000000000000000000000000000000..854a127d36279d9340dc822bbf9e8a3899c0b334
--- /dev/null
+++ b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/DeleteAllQasPort.java
@@ -0,0 +1,5 @@
+package com.example.qa.service.domain.port;
+
+public interface DeleteAllQasPort {
+ void deleteAllQas();
+}
\ No newline at end of file
diff --git a/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/DeleteOneQaPort.java b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/DeleteOneQaPort.java
new file mode 100644
index 0000000000000000000000000000000000000000..b856a1f54610d5d262ec3560232ca444541fce86
--- /dev/null
+++ b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/DeleteOneQaPort.java
@@ -0,0 +1,5 @@
+package com.example.qa.service.domain.port;
+
+public interface DeleteOneQaPort {
+ void deleteOneQa(Long id);
+}
diff --git a/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/GetQaListPort.java b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/GetQaListPort.java
new file mode 100644
index 0000000000000000000000000000000000000000..ad52920908cbfe38e267bd39cb6f600e25e54454
--- /dev/null
+++ b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/GetQaListPort.java
@@ -0,0 +1,9 @@
+package com.example.qa.service.domain.port;
+
+import com.example.qa.service.domain.Qa;
+
+import java.util.List;
+
+public interface GetQaListPort {
+ List getQas();
+}
diff --git a/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/GetQaonePort.java b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/GetQaonePort.java
new file mode 100644
index 0000000000000000000000000000000000000000..e0353b55ddc584c8448b598953376d2883f147bb
--- /dev/null
+++ b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/GetQaonePort.java
@@ -0,0 +1,10 @@
+package com.example.qa.service.domain.port;
+
+import com.example.qa.service.domain.Qa;
+
+import com.example.qa.service.domain.valueobject.QaId;
+
+public interface GetQaonePort {
+
+ Qa getQa(long id);
+}
diff --git a/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/UpdateQaPort.java b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/UpdateQaPort.java
new file mode 100644
index 0000000000000000000000000000000000000000..974c5f6e0321fcecb19769e31afcefda4881ed0b
--- /dev/null
+++ b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/port/UpdateQaPort.java
@@ -0,0 +1,7 @@
+package com.example.qa.service.domain.port;
+
+import com.example.qa.service.domain.Qa;
+
+public interface UpdateQaPort {
+ void updateQa(Qa qa);
+}
diff --git a/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/valueobject/Answer.java b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/valueobject/Answer.java
new file mode 100644
index 0000000000000000000000000000000000000000..4d0e1d456207970fb214c33663e629aed7276d7c
--- /dev/null
+++ b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/valueobject/Answer.java
@@ -0,0 +1,7 @@
+package com.example.qa.service.domain.valueobject;
+
+public record Answer(String answer) {
+ public String getValue() {
+ return answer;
+ }
+}
diff --git a/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/valueobject/QaId.java b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/valueobject/QaId.java
new file mode 100644
index 0000000000000000000000000000000000000000..69700f02e5dd3207f6f915a4442cc48917064dc4
--- /dev/null
+++ b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/valueobject/QaId.java
@@ -0,0 +1,7 @@
+package com.example.qa.service.domain.valueobject;
+
+public record QaId (Long id){
+ public Long getValue() {
+ return id;
+ }
+}
diff --git a/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/valueobject/Question.java b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/valueobject/Question.java
new file mode 100644
index 0000000000000000000000000000000000000000..27bbf25cdd7eb94e72c19b986e77322d32c31070
--- /dev/null
+++ b/qa-service/qa-service-domain/src/main/java/com/example/qa/service/domain/valueobject/Question.java
@@ -0,0 +1,7 @@
+package com.example.qa.service.domain.valueobject;
+
+public record Question(String question ) {
+ public String getValue() {
+ return question;
+ }
+}