diff --git a/aioj-backend-ai-service/.flattened-pom.xml b/aioj-backend-ai-service/.flattened-pom.xml
deleted file mode 100644
index 0f11d8c..0000000
--- a/aioj-backend-ai-service/.flattened-pom.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
- 4.0.0
-
- cn.meowrain.aioj
- ai-oj
- 1.0.0
-
- aioj-backend-ai-service
- 1.0.0
- AIOJ AI服务
-
-
- Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0
-
-
-
diff --git a/aioj-backend-auth/.flattened-pom.xml b/aioj-backend-auth/.flattened-pom.xml
deleted file mode 100644
index d61489b..0000000
--- a/aioj-backend-auth/.flattened-pom.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
- 4.0.0
-
- cn.meowrain.aioj
- ai-oj
- 1.0.0
-
- aioj-backend-auth
- 1.0.0
- AIOJ 认证授权服务
-
-
- Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0
-
-
-
-
- org.springdoc
- springdoc-openapi-starter-webmvc-ui
-
-
- com.github.xiaoymin
- knife4j-openapi3-jakarta-spring-boot-starter
-
-
- cn.meowrain.aioj
- aioj-backend-common-core
-
-
- cn.meowrain.aioj
- aioj-backend-common-feign
-
-
- cn.meowrain.aioj
- aioj-backend-common-mybatis
-
-
- cn.meowrain.aioj
- aioj-backend-common-security
-
-
- cn.hutool
- hutool-crypto
-
-
- cn.hutool
- hutool-json
-
-
- org.apache.commons
- commons-lang3
-
-
- com.alibaba.cloud
- spring-cloud-starter-alibaba-nacos-discovery
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- org.springframework.boot
- spring-boot-starter-oauth2-client
-
-
- org.springframework.cloud
- spring-cloud-starter-openfeign
-
-
- org.springframework.cloud
- spring-cloud-starter-loadbalancer
-
-
- org.springframework.boot
- spring-boot-starter-data-redis
-
-
- org.springframework.boot
- spring-boot-devtools
- runtime
- true
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
diff --git a/aioj-backend-common/.flattened-pom.xml b/aioj-backend-common/.flattened-pom.xml
deleted file mode 100644
index 93a2430..0000000
--- a/aioj-backend-common/.flattened-pom.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
- 4.0.0
-
- cn.meowrain.aioj
- ai-oj
- 1.0.0
-
- aioj-backend-common
- 1.0.0
- pom
- AIOJ 公共模块聚合
-
-
- Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0
-
-
-
- aioj-backend-common-bom
- aioj-backend-common-core
- aioj-backend-common-log
- aioj-backend-common-mybatis
- aioj-backend-common-feign
- aioj-backend-common-starter
- aioj-backend-common-security
-
-
diff --git a/aioj-backend-common/aioj-backend-common-core/.flattened-pom.xml b/aioj-backend-common/aioj-backend-common-core/.flattened-pom.xml
deleted file mode 100644
index e9b54a3..0000000
--- a/aioj-backend-common/aioj-backend-common-core/.flattened-pom.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
- 4.0.0
-
- cn.meowrain.aioj
- aioj-backend-common
- 1.0.0
-
- aioj-backend-common-core
- 1.0.0
- AIOJ 公共工具类核心包
-
-
- Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0
-
-
-
-
- cn.hutool
- hutool-core
-
-
- jakarta.servlet
- jakarta.servlet-api
-
-
- org.springframework.cloud
- spring-cloud-commons
-
-
- org.springframework
- spring-webmvc
- provided
-
-
- cn.hutool
- hutool-extra
-
-
- cn.hutool
- hutool-http
-
-
- org.springframework.boot
- spring-boot-starter-web
- true
-
-
- org.springframework.boot
- spring-boot-starter-json
-
-
- org.springframework.boot
- spring-boot-starter-validation
-
-
- org.springframework.boot
- spring-boot-autoconfigure
-
-
- org.springframework.boot
- spring-boot-starter-security
- true
-
-
-
diff --git a/aioj-backend-common/aioj-backend-common-feign/.flattened-pom.xml b/aioj-backend-common/aioj-backend-common-feign/.flattened-pom.xml
deleted file mode 100644
index 80693cd..0000000
--- a/aioj-backend-common/aioj-backend-common-feign/.flattened-pom.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
- 4.0.0
-
- cn.meowrain.aioj
- aioj-backend-common
- 1.0.0
-
- aioj-backend-common-feign
- 1.0.0
- AIOJ Feign 远程调用封装
-
-
- Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0
-
-
-
-
- cn.meowrain.aioj
- aioj-backend-common-core
-
-
- com.alibaba.cloud
- spring-cloud-starter-alibaba-sentinel
-
-
- org.springframework.cloud
- spring-cloud-starter-openfeign
-
-
- io.github.openfeign
- feign-okhttp
-
-
- org.springframework.cloud
- spring-cloud-starter-loadbalancer
-
-
- com.github.ben-manes.caffeine
- caffeine
-
-
- org.springframework.security
- spring-security-core
-
-
- org.springframework
- spring-webmvc
-
-
-
diff --git a/aioj-backend-common/aioj-backend-common-log/.flattened-pom.xml b/aioj-backend-common/aioj-backend-common-log/.flattened-pom.xml
deleted file mode 100644
index daf8740..0000000
--- a/aioj-backend-common/aioj-backend-common-log/.flattened-pom.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
- 4.0.0
-
- cn.meowrain.aioj
- aioj-backend-common
- 1.0.0
-
- aioj-backend-common-log
- 1.0.0
- AIOJ 日志模块
-
-
- Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0
-
-
-
-
- org.springframework.security
- spring-security-core
-
-
- org.springframework.security
- spring-security-oauth2-core
-
-
- cn.hutool
- hutool-extra
-
-
- cn.hutool
- hutool-http
-
-
- cn.meowrain.aioj
- aioj-backend-common-core
-
-
- cn.meowrain.aioj
- aioj-backend-upms-api
-
-
-
diff --git a/aioj-backend-common/aioj-backend-common-mybatis/.flattened-pom.xml b/aioj-backend-common/aioj-backend-common-mybatis/.flattened-pom.xml
deleted file mode 100644
index aa4b9e9..0000000
--- a/aioj-backend-common/aioj-backend-common-mybatis/.flattened-pom.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
- 4.0.0
-
- cn.meowrain.aioj
- aioj-backend-common
- 1.0.0
-
- aioj-backend-common-mybatis
- 1.0.0
- AIOJ MyBatis Plus 封装
-
-
- Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0
-
-
-
-
- cn.hutool
- hutool-core
-
-
- com.baomidou
- mybatis-plus-spring-boot3-starter
-
-
- com.baomidou
- mybatis-plus-spring
-
-
- com.baomidou
- mybatis-plus-jsqlparser
-
-
- com.mysql
- mysql-connector-j
-
-
- org.springframework.security
- spring-security-core
- true
-
-
- cn.meowrain.aioj
- aioj-backend-common-core
-
-
- com.baomidou
- mybatis-plus-generator
- test
-
-
- org.freemarker
- freemarker
- test
-
-
-
diff --git a/aioj-backend-common/aioj-backend-common-mybatis/src/test/java/cn/meowrain/aioj/generator/CodeGenerator.java b/aioj-backend-common/aioj-backend-common-mybatis/src/test/java/cn/meowrain/aioj/generator/CodeGenerator.java
index cd8f068..7c0ecf6 100644
--- a/aioj-backend-common/aioj-backend-common-mybatis/src/test/java/cn/meowrain/aioj/generator/CodeGenerator.java
+++ b/aioj-backend-common/aioj-backend-common-mybatis/src/test/java/cn/meowrain/aioj/generator/CodeGenerator.java
@@ -46,9 +46,9 @@ public class CodeGenerator {
/** 父包名 */
private static final String PARENT_PACKAGE = "cn.meowrain.aioj.backend";
/** 模块名 (如: userservice, questionservice) */
- private static final String MODULE_NAME = "fileservice";
+ private static final String MODULE_NAME = "question.service";
/** 要生成的表名 (多个表用逗号分隔) */
- private static final String[] TABLE_NAMES = {"attachment"};
+ private static final String[] TABLE_NAMES = {"question"};
/** 表前缀 (生成时会去掉前缀) */
private static final String[] TABLE_PREFIX = {""};
@@ -101,8 +101,8 @@ public class CodeGenerator {
.idType(IdType.ASSIGN_ID) // 雪花算法ID
.addTableFills(new Column("create_time", FieldFill.INSERT))
.addTableFills(new Column("update_time", FieldFill.INSERT_UPDATE))
- .logicDeleteColumnName("del_flag")
- .logicDeletePropertyName("delFlag")
+ .logicDeleteColumnName("is_delete")
+ .logicDeletePropertyName("isDelete")
// Mapper 策略
.mapperBuilder()
.enableBaseResultMap()
diff --git a/aioj-backend-common/aioj-backend-common-security/.flattened-pom.xml b/aioj-backend-common/aioj-backend-common-security/.flattened-pom.xml
deleted file mode 100644
index f2e01cd..0000000
--- a/aioj-backend-common/aioj-backend-common-security/.flattened-pom.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
- 4.0.0
-
- cn.meowrain.aioj
- aioj-backend-common
- 1.0.0
-
- aioj-backend-common-security
- 1.0.0
- AIOJ 公共安全模块 - JWT 认证和 Spring Security 配置
-
-
- Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0
-
-
-
-
- org.springframework.boot
- spring-boot-starter-security
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- org.springframework.boot
- spring-boot-configuration-processor
- true
-
-
- io.jsonwebtoken
- jjwt-api
-
-
- io.jsonwebtoken
- jjwt-impl
- runtime
-
-
- io.jsonwebtoken
- jjwt-jackson
- runtime
-
-
- org.projectlombok
- lombok
- provided
-
-
- cn.meowrain.aioj
- aioj-backend-common-core
-
-
-
diff --git a/aioj-backend-common/aioj-backend-common-security/src/main/java/cn/meowrain/aioj/backend/framework/security/config/SecurityConfiguration.java b/aioj-backend-common/aioj-backend-common-security/src/main/java/cn/meowrain/aioj/backend/framework/security/config/SecurityConfiguration.java
index d11cfeb..4126a9e 100644
--- a/aioj-backend-common/aioj-backend-common-security/src/main/java/cn/meowrain/aioj/backend/framework/security/config/SecurityConfiguration.java
+++ b/aioj-backend-common/aioj-backend-common-security/src/main/java/cn/meowrain/aioj/backend/framework/security/config/SecurityConfiguration.java
@@ -53,7 +53,7 @@ public class SecurityConfiguration {
.permitAll()
// 其他请求需要认证(可由子类覆盖此配置)
.anyRequest()
- .authenticated())
+ .permitAll())
.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
return http.build();
}
diff --git a/aioj-backend-common/aioj-backend-common-starter/.flattened-pom.xml b/aioj-backend-common/aioj-backend-common-starter/.flattened-pom.xml
deleted file mode 100644
index 1cdf92b..0000000
--- a/aioj-backend-common/aioj-backend-common-starter/.flattened-pom.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
- 4.0.0
-
- cn.meowrain.aioj
- aioj-backend-common
- 1.0.0
-
- aioj-backend-common-starter
- 1.0.0
- pom
- AIOJ 公共模块启动器 (聚合常用依赖)
-
-
- Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0
-
-
-
-
- cn.meowrain.aioj
- aioj-backend-common-core
-
-
- cn.meowrain.aioj
- aioj-backend-common-log
-
-
-
diff --git a/aioj-backend-file-service/.flattened-pom.xml b/aioj-backend-file-service/.flattened-pom.xml
deleted file mode 100644
index 822ab58..0000000
--- a/aioj-backend-file-service/.flattened-pom.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
- 4.0.0
-
- cn.meowrain.aioj
- ai-oj
- 1.0.0
-
- aioj-backend-file-service
- 1.0.0
- AIOJ 文件服务
-
-
- Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0
-
-
-
- 17
- 17
- UTF-8
-
-
-
- com.qcloud
- cos_api
- 5.6.260.1
-
-
- org.springdoc
- springdoc-openapi-starter-webmvc-ui
-
-
- com.github.xiaoymin
- knife4j-openapi3-jakarta-spring-boot-starter
-
-
- cn.meowrain.aioj
- aioj-backend-common-core
-
-
- cn.meowrain.aioj
- aioj-backend-common-log
-
-
- cn.meowrain.aioj
- aioj-backend-common-mybatis
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- cn.hutool
- hutool-core
-
-
- com.mysql
- mysql-connector-j
- runtime
-
-
- com.alibaba.cloud
- spring-cloud-starter-alibaba-nacos-discovery
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.springframework.boot
- spring-boot-starter-actuator
-
-
- cn.hutool
- hutool-crypto
-
-
-
diff --git a/aioj-backend-gateway/.flattened-pom.xml b/aioj-backend-gateway/.flattened-pom.xml
deleted file mode 100644
index ff26a0e..0000000
--- a/aioj-backend-gateway/.flattened-pom.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
- 4.0.0
-
- cn.meowrain.aioj
- ai-oj
- 1.0.0
-
- aioj-backend-gateway
- 1.0.0
- AIOJ API网关服务
-
-
- Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0
-
-
-
-
- org.springframework.boot
- spring-boot-starter-webflux
-
-
- org.springframework.cloud
- spring-cloud-starter-gateway-server-webflux
-
-
- com.alibaba.cloud
- spring-cloud-starter-alibaba-nacos-discovery
-
-
- com.alibaba.cloud
- spring-cloud-starter-alibaba-nacos-config
-
-
- com.alibaba.cloud
- spring-cloud-alibaba-sentinel-gateway
-
-
- com.alibaba.csp
- sentinel-datasource-extension
-
-
- org.springframework.cloud
- spring-cloud-starter-loadbalancer
-
-
- com.github.xiaoymin
- knife4j-gateway-spring-boot-starter
-
-
- cn.meowrain.aioj
- aioj-backend-common-core
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- jakarta.servlet
- jakarta.servlet-api
-
-
- org.springframework
- spring-webmvc
-
-
-
-
- org.springframework.boot
- spring-boot-starter-actuator
-
-
-
diff --git a/aioj-backend-judge-service/.flattened-pom.xml b/aioj-backend-judge-service/.flattened-pom.xml
deleted file mode 100644
index 8969325..0000000
--- a/aioj-backend-judge-service/.flattened-pom.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
- 4.0.0
-
- cn.meowrain.aioj
- ai-oj
- 1.0.0
-
- aioj-backend-judge-service
- 1.0.0
- AIOJ 判题服务
-
-
- Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0
-
-
-
diff --git a/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/dao/entity/Question.java b/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/dao/entity/Question.java
index 6d64805..5ed9514 100644
--- a/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/dao/entity/Question.java
+++ b/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/dao/entity/Question.java
@@ -5,7 +5,7 @@ import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
-import java.util.Date;
+import java.time.LocalDateTime;
/**
* 题目实体类
@@ -90,12 +90,13 @@ public class Question implements Serializable {
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
- private Date createTime;
+ private LocalDateTime createTime;
/**
* 更新时间
*/
- private Date updateTime;
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
/**
* 是否删除
diff --git a/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/dao/entity/QuestionSubmit.java b/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/dao/entity/QuestionSubmit.java
index b18998a..f63da7f 100644
--- a/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/dao/entity/QuestionSubmit.java
+++ b/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/dao/entity/QuestionSubmit.java
@@ -66,5 +66,6 @@ public class QuestionSubmit implements Serializable {
/**
* 是否删除
*/
+ @TableLogic
private Integer isDelete;
}
diff --git a/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/dto/req/QuestionQueryRequestDTO.java b/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/dto/req/QuestionQueryRequestDTO.java
index a2b85d8..6a2ad6e 100644
--- a/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/dto/req/QuestionQueryRequestDTO.java
+++ b/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/dto/req/QuestionQueryRequestDTO.java
@@ -7,6 +7,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
+import java.io.Serializable;
import java.util.List;
/**
@@ -15,7 +16,7 @@ import java.util.List;
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "题目查询请求")
-public class QuestionQueryRequestDTO extends Page implements java.io.Serializable {
+public class QuestionQueryRequestDTO extends Page implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
diff --git a/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/dto/resp/QuestionResponseDTO.java b/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/dto/resp/QuestionResponseDTO.java
index 012489e..059c1d2 100644
--- a/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/dto/resp/QuestionResponseDTO.java
+++ b/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/dto/resp/QuestionResponseDTO.java
@@ -1,10 +1,12 @@
package cn.meowrain.aioj.backend.question.dto.resp;
+import cn.meowrain.aioj.backend.question.dto.req.JudgeCase;
+import cn.meowrain.aioj.backend.question.dto.req.JudgeConfig;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
-import java.util.Date;
+import java.time.LocalDateTime;
import java.util.List;
/**
@@ -49,6 +51,12 @@ public class QuestionResponseDTO implements Serializable {
@Schema(description = "标签列表", example = "[\"栈\", \"数组\", \"算法\"]")
private List tags;
+ /**
+ * 判题用例列表
+ */
+ @Schema(description = "判题用例列表")
+ private List judgeCase;
+
/**
* 通过数
*/
@@ -62,11 +70,11 @@ public class QuestionResponseDTO implements Serializable {
private Integer submitCount;
/**
- * 判题配置(JSON格式字符串)
+ * 判题配置
* 包含 timeLimit, memoryLimit, stackLimit 等
*/
- @Schema(description = "判题配置 (JSON字符串,包含时间限制、内存限制等)", example = "{\"timeLimit\": 1000, \"memoryLimit\": 256}")
- private String judgeConfig;
+ @Schema(description = "判题配置", example = "{\"timeLimit\": 1000, \"memoryLimit\": 256}")
+ private JudgeConfig judgeConfig;
/**
* 点赞数
@@ -89,12 +97,12 @@ public class QuestionResponseDTO implements Serializable {
/**
* 创建时间
*/
- @Schema(description = "创建时间", example = "2024-01-20 12:00:00")
- private Date createTime;
+ @Schema(description = "创建时间", example = "2024-01-20T12:00:00")
+ private LocalDateTime createTime;
/**
* 更新时间
*/
- @Schema(description = "更新时间", example = "2024-01-21 10:30:00")
- private Date updateTime;
+ @Schema(description = "更新时间", example = "2024-01-21T10:30:00")
+ private LocalDateTime updateTime;
}
\ No newline at end of file
diff --git a/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/service/QuestionService.java b/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/service/QuestionService.java
index 8d5cf55..657fd4b 100644
--- a/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/service/QuestionService.java
+++ b/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/service/QuestionService.java
@@ -1,7 +1,10 @@
package cn.meowrain.aioj.backend.question.service;
import cn.meowrain.aioj.backend.question.dao.entity.Question;
+import cn.meowrain.aioj.backend.question.dto.req.QuestionCreateRequestDTO;
import cn.meowrain.aioj.backend.question.dto.req.QuestionQueryRequestDTO;
+import cn.meowrain.aioj.backend.question.dto.req.QuestionUpdateRequestDTO;
+import cn.meowrain.aioj.backend.question.dto.resp.QuestionResponseDTO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -10,6 +13,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface QuestionService extends IService {
+ /**
+ * 创建题目(使用责任链校验)
+ * @param requestDTO 题目创建请求DTO
+ * @return 题目ID
+ */
+ Long createQuestionWithChain(QuestionCreateRequestDTO requestDTO);
+
/**
* 创建题目
* @param question 题目信息
@@ -36,7 +46,7 @@ public interface QuestionService extends IService {
* @param questionId 题目ID
* @return 题目详情
*/
- Question getQuestionById(Long questionId);
+ QuestionResponseDTO getQuestionById(Long questionId);
/**
* 根据ID获取题目详情(内部接口)
@@ -50,5 +60,5 @@ public interface QuestionService extends IService {
* @param request 查询条件
* @return 题目分页列表
*/
- Page listQuestions(QuestionQueryRequestDTO request);
+ Page listQuestions(QuestionQueryRequestDTO request);
}
diff --git a/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/service/impl/QuestionServiceImpl.java b/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/service/impl/QuestionServiceImpl.java
index 0928787..94debcc 100644
--- a/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/service/impl/QuestionServiceImpl.java
+++ b/aioj-backend-question-service/src/main/java/cn/meowrain/aioj/backend/question/service/impl/QuestionServiceImpl.java
@@ -1,23 +1,83 @@
package cn.meowrain.aioj.backend.question.service.impl;
+import cn.meowrain.aioj.backend.question.common.enums.ChainMarkEnums;
import cn.meowrain.aioj.backend.question.dao.entity.Question;
import cn.meowrain.aioj.backend.question.dao.mapper.QuestionMapper;
-import cn.meowrain.aioj.backend.question.dto.req.QuestionQueryRequestDTO;
+import cn.meowrain.aioj.backend.question.dto.chains.context.QuestionCreateRequestParamVerifyContext;
+import cn.meowrain.aioj.backend.question.dto.req.*;
+import cn.meowrain.aioj.backend.question.dto.resp.QuestionResponseDTO;
import cn.meowrain.aioj.backend.question.service.QuestionService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
+import com.fasterxml.jackson.core.type.TypeReference;
+import java.util.List;
/**
* 题目服务实现
*/
+@Slf4j
@Service
@RequiredArgsConstructor
public class QuestionServiceImpl extends ServiceImpl implements QuestionService {
+ private final QuestionCreateRequestParamVerifyContext questionCreateChainContext;
+
+ @Override
+ public Long createQuestionWithChain(QuestionCreateRequestDTO requestDTO) {
+ // 执行责任链校验
+ log.info("开始执行题目创建责任链校验");
+ questionCreateChainContext.handler(
+ ChainMarkEnums.QUESTION_CREATE_PARAM_VERIFY_CHAIN.getMark(),
+ requestDTO
+ );
+ log.info("题目创建责任链校验通过");
+
+ // 校验通过,转换为实体并保存
+ Question question = new Question();
+ BeanUtils.copyProperties(requestDTO, question);
+
+ // 处理 tags 字段:List -> JSON 字符串
+ if (requestDTO.getTags() != null && !requestDTO.getTags().isEmpty()) {
+ try {
+ com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper();
+ question.setTags(mapper.writeValueAsString(requestDTO.getTags()));
+ } catch (Exception e) {
+ log.error("序列化 tags 失败", e);
+ }
+ }
+
+ // 处理 judgeConfig 字段:JudgeConfig 对象 -> JSON 字符串
+ if (requestDTO.getJudgeConfig() != null) {
+ try {
+ com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper();
+ question.setJudgeConfig(mapper.writeValueAsString(requestDTO.getJudgeConfig()));
+ } catch (Exception e) {
+ log.error("序列化 judgeConfig 失败", e);
+ }
+ }
+
+ // 处理 judgeCase 字段:List -> JSON 字符串
+ if (requestDTO.getJudgeCase() != null && !requestDTO.getJudgeCase().isEmpty()) {
+ try {
+ com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper();
+ question.setJudgeCase(mapper.writeValueAsString(requestDTO.getJudgeCase()));
+ } catch (Exception e) {
+ log.error("序列化 judgeCase 失败", e);
+ }
+ }
+
+ question.setUserId(1L);
+ this.save(question);
+ return question.getId();
+ }
+
@Override
public Long createQuestion(Question question) {
this.save(question);
@@ -35,8 +95,9 @@ public class QuestionServiceImpl extends ServiceImpl i
}
@Override
- public Question getQuestionById(Long questionId) {
- return this.getById(questionId);
+ public QuestionResponseDTO getQuestionById(Long questionId) {
+ Question question = this.getById(questionId);
+ return convertToDTO(question);
}
@Override
@@ -45,7 +106,7 @@ public class QuestionServiceImpl extends ServiceImpl i
}
@Override
- public Page listQuestions(QuestionQueryRequestDTO request) {
+ public Page listQuestions(QuestionQueryRequestDTO request) {
LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>();
// ID 精确查询
@@ -80,6 +141,64 @@ public class QuestionServiceImpl extends ServiceImpl i
}
// 直接使用 request 作为分页对象
- return this.page(request, wrapper);
+ Page page = this.page(request, wrapper);
+
+ // 转换为 DTO
+ Page dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal());
+ dtoPage.setRecords(page.getRecords().stream()
+ .map(this::convertToDTO)
+ .toList());
+ return dtoPage;
+ }
+
+ /**
+ * 将 Question 实体转换为 QuestionResponseDTO
+ */
+ private QuestionResponseDTO convertToDTO(Question question) {
+ if (question == null) {
+ return null;
+ }
+ QuestionResponseDTO dto = new QuestionResponseDTO();
+ BeanUtils.copyProperties(question, dto);
+
+ // 处理 tags 字段:JSON 字符串 -> List
+ if (question.getTags() != null && !question.getTags().isEmpty()) {
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ List tagList = mapper.readValue(question.getTags(),
+ new TypeReference>() {});
+ dto.setTags(tagList);
+ } catch (Exception e) {
+ log.error("解析 tags JSON 失败: {}", question.getTags(), e);
+ }
+ }
+
+ // 处理 judgeConfig 字段:JSON 字符串 -> JudgeConfig 对象
+ if (question.getJudgeConfig() != null && !question.getJudgeConfig().isEmpty()) {
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ JudgeConfig judgeConfig =
+ mapper.readValue(question.getJudgeConfig(),
+ JudgeConfig.class);
+ dto.setJudgeConfig(judgeConfig);
+ } catch (Exception e) {
+ log.error("解析 judgeConfig JSON 失败: {}", question.getJudgeConfig(), e);
+ }
+ }
+
+ // 处理 judgeCase 字段:JSON 字符串 -> List
+ if (question.getJudgeCase() != null && !question.getJudgeCase().isEmpty()) {
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ List judgeCaseList =
+ mapper.readValue(question.getJudgeCase(),
+ new TypeReference>() {});
+ dto.setJudgeCase(judgeCaseList);
+ } catch (Exception e) {
+ log.error("解析 judgeCase JSON 失败: {}", question.getJudgeCase(), e);
+ }
+ }
+
+ return dto;
}
}
diff --git a/aioj-backend-question-service/src/main/resources/application.yml b/aioj-backend-question-service/src/main/resources/application.yml
index ee32550..a134019 100644
--- a/aioj-backend-question-service/src/main/resources/application.yml
+++ b/aioj-backend-question-service/src/main/resources/application.yml
@@ -20,8 +20,8 @@ springdoc:
operations-sorter: alpha
group-configs:
- group: 'default'
- paths-to-match: '/api/**'
- packages-to-scan: cn.meowrain.aioj.backend.questionservice.controller
+ paths-to-match: '/**'
+ packages-to-scan: cn.meowrain.aioj.backend.question
knife4j:
basic:
enable: true
diff --git a/aioj-backend-upms/.flattened-pom.xml b/aioj-backend-upms/.flattened-pom.xml
deleted file mode 100644
index 04ca761..0000000
--- a/aioj-backend-upms/.flattened-pom.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
- 4.0.0
-
- cn.meowrain.aioj
- ai-oj
- 1.0.0
-
- aioj-backend-upms
- 1.0.0
- pom
- AIOJ 用户权限管理系统 (UPMS)
-
-
- Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0
-
-
-
- aioj-backend-upms-api
- aioj-backend-upms-biz
-
-
diff --git a/aioj-backend-upms/aioj-backend-upms-api/.flattened-pom.xml b/aioj-backend-upms/aioj-backend-upms-api/.flattened-pom.xml
deleted file mode 100644
index d66ee98..0000000
--- a/aioj-backend-upms/aioj-backend-upms-api/.flattened-pom.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
- 4.0.0
-
- cn.meowrain.aioj
- aioj-backend-upms
- 1.0.0
-
- aioj-backend-upms-api
- 1.0.0
- AIOJ UPMS API 接口定义
-
-
- Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0
-
-
-
-
- org.springdoc
- springdoc-openapi-starter-webmvc-ui
-
-
- com.github.xiaoymin
- knife4j-openapi3-jakarta-spring-boot-starter
-
-
- cn.meowrain.aioj
- aioj-backend-common-core
-
-
- cn.meowrain.aioj
- aioj-backend-common-mybatis
-
-
- cn.meowrain.aioj
- aioj-backend-common-feign
-
-
-
diff --git a/aioj-backend-upms/aioj-backend-upms-biz/.flattened-pom.xml b/aioj-backend-upms/aioj-backend-upms-biz/.flattened-pom.xml
deleted file mode 100644
index 91d5071..0000000
--- a/aioj-backend-upms/aioj-backend-upms-biz/.flattened-pom.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
- 4.0.0
-
- cn.meowrain.aioj
- aioj-backend-upms
- 1.0.0
-
- aioj-backend-upms-biz
- 1.0.0
- AIOJ UPMS 业务实现
-
-
- Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0
-
-
-
-
- org.springdoc
- springdoc-openapi-starter-webmvc-ui
-
-
- com.github.xiaoymin
- knife4j-openapi3-jakarta-spring-boot-starter
-
-
- cn.meowrain.aioj
- aioj-backend-common-mybatis
-
-
- cn.meowrain.aioj
- aioj-backend-upms-api
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
diff --git a/aioj-backend-user-service/.flattened-pom.xml b/aioj-backend-user-service/.flattened-pom.xml
deleted file mode 100644
index 1777c2e..0000000
--- a/aioj-backend-user-service/.flattened-pom.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-
-
- 4.0.0
-
- cn.meowrain.aioj
- ai-oj
- 1.0.0
-
- aioj-backend-user-service
- 1.0.0
- AIOJ 用户服务
-
-
- Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0
-
-
-
-
- org.springdoc
- springdoc-openapi-starter-webmvc-ui
-
-
- com.github.xiaoymin
- knife4j-openapi3-jakarta-spring-boot-starter
-
-
- cn.meowrain.aioj
- aioj-backend-common-core
-
-
- cn.meowrain.aioj
- aioj-backend-common-log
-
-
- cn.meowrain.aioj
- aioj-backend-common-mybatis
-
-
- cn.meowrain.aioj
- aioj-backend-common-security
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- cn.hutool
- hutool-crypto
-
-
- org.springframework.boot
- spring-boot-starter-mail
-
-
- org.springframework.boot
- spring-boot-starter-data-redis
-
-
- org.springframework.session
- spring-session-data-redis
-
-
- org.springframework.boot
- spring-boot-starter-cache
-
-
- com.mysql
- mysql-connector-j
- runtime
-
-
- com.alibaba.cloud
- spring-cloud-starter-alibaba-nacos-discovery
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-