【新增】模块exam,judgement并修改pom文件,新增rabbitmq依赖

This commit is contained in:
任维炳
2025-04-18 13:50:04 +08:00
parent f7948b935f
commit 72532b1a98
27 changed files with 235 additions and 133 deletions

View File

@@ -31,7 +31,7 @@
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit</artifactId>
<optional>true</optional>
<!-- <optional>true</optional>-->
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>

View File

@@ -3,8 +3,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-module-exam</artifactId>
<groupId>pc.exam</groupId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -18,9 +18,16 @@
<dependencies>
<dependency>
<groupId>pc.exam</groupId>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-common</artifactId>
</dependency>
<!-- 参数校验 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@@ -3,8 +3,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-module-exam</artifactId>
<groupId>pc.exam</groupId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -17,48 +17,112 @@
</description>
<dependencies>
<!-- Spring Boot 核心 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-module-system-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-module-infra-api</artifactId>
<version>${revision}</version>
</dependency>
<!-- 业务组件 -->
<dependency>
<groupId>pc.exam</groupId>
<artifactId>exam-module-exam-api</artifactId>
<version>${revision}</version>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-biz-tenant</artifactId>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>pc.exam</groupId>
<artifactId>exam-spring-boot-starter-web</artifactId>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>pc.exam</groupId>
<artifactId>exam-spring-boot-starter-security</artifactId>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-websocket</artifactId>
</dependency>
<!-- DB 相关 -->
<dependency>
<groupId>pc.exam</groupId>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-mybatis</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId> <!-- 代码生成器,使用它解析表结构 -->
</dependency>
<dependency>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-redis</artifactId>
</dependency>
<!-- Config 配置中心相关 -->
<!-- Job 定时任务相关 -->
<dependency>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-job</artifactId>
</dependency>
<!-- 消息队列相关 -->
<dependency>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-mq</artifactId>
</dependency>
<!-- Test 测试相关 -->
<dependency>
<groupId>pc.exam</groupId>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- 工具类相关 -->
<dependency>
<groupId>pc.exam</groupId>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-excel</artifactId>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId> <!-- 实现代码生成 -->
</dependency>
<!-- 监控相关 -->
<dependency>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-monitor</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId> <!-- 实现 Spring Boot Admin Server 服务端 -->
</dependency>
<!-- 三方云服务相关 -->
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId> <!-- 文件客户端:解决 ftp 连接 -->
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId> <!-- 文件客户端:解决 sftp 连接 -->
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId><!-- 文件客户端解决阿里云、腾讯云、minio 等 S3 连接 -->
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId> <!-- 文件客户端:文件类型的识别 -->
</dependency>
</dependencies>
</project>

View File

@@ -1,84 +1,14 @@
package pc.exam.pp.module.exam.controller.admin;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import pc.exam.pp.framework.common.pojo.CommonResult;
import pc.exam.pp.framework.common.pojo.PageResult;
import pc.exam.pp.module.exam.controller.admin.vo.ExamPageReqVO;
import pc.exam.pp.module.exam.dal.dataobject.ExamDO;
import pc.exam.pp.module.exam.service.ExamService;
import static pc.exam.pp.framework.common.pojo.CommonResult.success;
/**
* 管理后台 - 考试信息
* 管理后台 - 授权信息
*
* @author pengchen
*/
@RestController
@RequestMapping("/exam")
@RequestMapping("/exam/authorize")
public class ExamController {
@Resource
private ExamService examService;
/**
* 创建考试
*
* @param createReqVO 创建信息
* @return 考试编号
*/
@PostMapping("/create")
public CommonResult<Long> createExam(@Valid @RequestBody ExamDO createReqVO) {
return success(examService.createExam(createReqVO));
}
/**
* 更新考试
*
* @param updateReqVO 更新信息
* @return 成功状态
*/
@PutMapping("/update")
public CommonResult<Boolean> updateExam(@Valid @RequestBody ExamDO updateReqVO) {
examService.updateExam(updateReqVO);
return success(true);
}
/**
* 删除考试
*
* @param id 编号
* @return 成功状态
*/
@DeleteMapping("/delete")
public CommonResult<Boolean> deleteExam(@RequestParam("id") Long id) {
examService.deleteExam(id);
return success(true);
}
/**
* 获得考试
*
* @param id 编号
* @return 考试
*/
@GetMapping("/get")
public CommonResult<ExamDO> getExam(@RequestParam("id") Long id) {
return success(examService.getExam(id));
}
/**
* 获得考试分页
*
* @param pageVO 分页查询
* @return 考试分页
*/
@GetMapping("/page")
public CommonResult<PageResult<ExamDO>> getExamPage(@Valid ExamPageReqVO pageVO) {
return success(examService.getExamPage(pageVO));
}
}

View File

@@ -3,8 +3,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>pengchen-exam-java-new</artifactId>
<groupId>pc.exam</groupId>
<groupId>pc.exam.gg</groupId>
<artifactId>exam</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -12,7 +12,7 @@ import pc.exam.pp.module.infra.dal.dataobject.codegen.CodegenTableDO;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2025-04-17T13:07:54+0800",
date = "2025-04-18T13:31:34+0800",
comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.13 (Oracle Corporation)"
)
public class CodegenConvertImpl implements CodegenConvert {

View File

@@ -10,7 +10,7 @@ import pc.exam.pp.module.infra.dal.dataobject.config.ConfigDO;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2025-04-17T13:07:54+0800",
date = "2025-04-18T13:31:34+0800",
comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.13 (Oracle Corporation)"
)
public class ConfigConvertImpl implements ConfigConvert {

View File

@@ -6,7 +6,7 @@ import pc.exam.pp.module.infra.dal.dataobject.file.FileConfigDO;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2025-04-17T13:07:54+0800",
date = "2025-04-18T13:31:34+0800",
comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.13 (Oracle Corporation)"
)
public class FileConfigConvertImpl implements FileConfigConvert {

View File

@@ -4,7 +4,7 @@ import javax.annotation.processing.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2025-04-17T13:07:54+0800",
date = "2025-04-18T13:31:34+0800",
comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.13 (Oracle Corporation)"
)
public class RedisConvertImpl implements RedisConvert {

View File

@@ -3,8 +3,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-module-judgement</artifactId>
<groupId>pc.exam</groupId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -18,9 +18,16 @@
<dependencies>
<dependency>
<groupId>pc.exam</groupId>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-common</artifactId>
</dependency>
<!-- 参数校验 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@@ -3,8 +3,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-module-judgement</artifactId>
<groupId>pc.exam</groupId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -17,55 +17,112 @@
</description>
<dependencies>
<!-- Spring Boot 核心 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-module-system-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-module-infra-api</artifactId>
<version>${revision}</version>
</dependency>
<!-- 业务组件 -->
<dependency>
<groupId>pc.exam</groupId>
<artifactId>exam-module-judgement-api</artifactId>
<version>${revision}</version>
</dependency>
<!-- 考试模块 API -->
<dependency>
<groupId>pc.exam</groupId>
<artifactId>exam-module-exam-api</artifactId>
<version>${revision}</version>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-biz-tenant</artifactId>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>pc.exam</groupId>
<artifactId>exam-spring-boot-starter-web</artifactId>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>pc.exam</groupId>
<artifactId>exam-spring-boot-starter-security</artifactId>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-websocket</artifactId>
</dependency>
<!-- DB 相关 -->
<dependency>
<groupId>pc.exam</groupId>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-mybatis</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId> <!-- 代码生成器,使用它解析表结构 -->
</dependency>
<dependency>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-redis</artifactId>
</dependency>
<!-- Config 配置中心相关 -->
<!-- Job 定时任务相关 -->
<dependency>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-job</artifactId>
</dependency>
<!-- 消息队列相关 -->
<dependency>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-mq</artifactId>
</dependency>
<!-- Test 测试相关 -->
<dependency>
<groupId>pc.exam</groupId>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- 工具类相关 -->
<dependency>
<groupId>pc.exam</groupId>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-excel</artifactId>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId> <!-- 实现代码生成 -->
</dependency>
<!-- 监控相关 -->
<dependency>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-monitor</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId> <!-- 实现 Spring Boot Admin Server 服务端 -->
</dependency>
<!-- 三方云服务相关 -->
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId> <!-- 文件客户端:解决 ftp 连接 -->
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId> <!-- 文件客户端:解决 sftp 连接 -->
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId><!-- 文件客户端解决阿里云、腾讯云、minio 等 S3 连接 -->
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId> <!-- 文件客户端:文件类型的识别 -->
</dependency>
</dependencies>
</project>

View File

@@ -3,8 +3,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>pengchen-exam-java-new</artifactId>
<groupId>pc.exam</groupId>
<groupId>pc.exam.gg</groupId>
<artifactId>exam</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -29,6 +29,12 @@
<version>${revision}</version>
</dependency>
<!--RabbitMQ-->
<dependency>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-spring-boot-starter-mq</artifactId>
</dependency>
<!-- 业务组件 -->
<dependency>
<groupId>pc.exam.gg</groupId>

View File

@@ -1,5 +1,6 @@
package pc.exam.pp.module.system.mq.consumer.sms;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import pc.exam.pp.module.system.mq.message.sms.SmsSendMessage;
import pc.exam.pp.module.system.service.sms.SmsSendService;
import lombok.extern.slf4j.Slf4j;
@@ -15,6 +16,7 @@ import jakarta.annotation.Resource;
* @author zzf
*/
@Component
@RabbitListener(queues = SmsSendMessage.QUEUE)
@Slf4j
public class SmsSendConsumer {

View File

@@ -14,6 +14,8 @@ import java.util.List;
@Data
public class SmsSendMessage {
public static final String QUEUE = "SEND_MESSAGE_QUEUE"; // 重点:需要增加消息对应的 Queue
/**
* 短信日志编号
*/

View File

@@ -1,5 +1,6 @@
package pc.exam.pp.module.system.mq.producer.sms;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import pc.exam.pp.framework.common.core.KeyValue;
import pc.exam.pp.module.system.mq.message.sms.SmsSendMessage;
import lombok.extern.slf4j.Slf4j;
@@ -21,7 +22,23 @@ public class SmsProducer {
@Resource
private ApplicationContext applicationContext;
@Resource
private RabbitTemplate rabbitTemplate; // 重点:注入 RabbitTemplate 对象
/**
* 发送 {@link SmsSendMessage} 消息
*
* @param logId 短信日志编号
* @param mobile 手机号
* @param channelId 渠道编号
* @param apiTemplateId 短信模板编号
* @param templateParams 短信模板参数
*/
// public void sendSmsSendMessage(Long logId, String mobile,
// Long channelId, String apiTemplateId, List<KeyValue<String, Object>> templateParams) {
// SmsSendMessage message = new SmsSendMessage().setLogId(logId).setMobile(mobile);
// message.setChannelId(channelId).setApiTemplateId(apiTemplateId).setTemplateParams(templateParams);
// applicationContext.publishEvent(message);
// }
/**
* 发送 {@link SmsSendMessage} 消息
*
@@ -35,7 +52,7 @@ public class SmsProducer {
Long channelId, String apiTemplateId, List<KeyValue<String, Object>> templateParams) {
SmsSendMessage message = new SmsSendMessage().setLogId(logId).setMobile(mobile);
message.setChannelId(channelId).setApiTemplateId(apiTemplateId).setTemplateParams(templateParams);
applicationContext.publishEvent(message);
rabbitTemplate.convertAndSend(SmsSendMessage.QUEUE, message); // 重点:使用 RabbitTemplate 发送消息
}
}

View File

@@ -14,7 +14,7 @@ import pc.exam.pp.module.system.dal.dataobject.permission.MenuDO;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2025-04-17T13:07:54+0800",
date = "2025-04-18T13:31:34+0800",
comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.13 (Oracle Corporation)"
)
public class AuthConvertImpl implements AuthConvert {

View File

@@ -4,7 +4,7 @@ import javax.annotation.processing.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2025-04-17T13:07:54+0800",
date = "2025-04-18T13:31:34+0800",
comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.13 (Oracle Corporation)"
)
public class OAuth2OpenConvertImpl implements OAuth2OpenConvert {

View File

@@ -6,7 +6,7 @@ import pc.exam.pp.module.system.controller.admin.socail.vo.user.SocialUserBindRe
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2025-04-17T13:07:54+0800",
date = "2025-04-18T13:31:34+0800",
comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.13 (Oracle Corporation)"
)
public class SocialUserConvertImpl implements SocialUserConvert {

View File

@@ -4,7 +4,7 @@ import javax.annotation.processing.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2025-04-17T13:07:54+0800",
date = "2025-04-18T13:31:34+0800",
comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.13 (Oracle Corporation)"
)
public class TenantConvertImpl implements TenantConvert {

View File

@@ -4,7 +4,7 @@ import javax.annotation.processing.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2025-04-17T13:07:54+0800",
date = "2025-04-18T13:31:34+0800",
comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.13 (Oracle Corporation)"
)
public class UserConvertImpl implements UserConvert {

View File

@@ -31,6 +31,16 @@
<artifactId>exam-module-infra-biz</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-module-exam-biz</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-module-judgement-biz</artifactId>
<version>${revision}</version>
</dependency>
<!-- 会员中心。默认注释,保证编译速度 -->
<!-- <dependency>-->

View File

@@ -13,7 +13,7 @@ spring:
- org.springframework.ai.autoconfigure.vectorstore.milvus.MilvusVectorStoreAutoConfiguration # 禁用 AI 模块的 Milvus手动创建
# 数据源配置项
datasource:
druid: # Druid 【监控】相关的全局配置
druid: # Druid 【监控】相关的全局配置f
web-stat-filter:
enabled: true
stat-view-servlet:
@@ -126,8 +126,8 @@ spring:
rabbitmq:
host: 127.0.0.1 # RabbitMQ 服务的地址
port: 5672 # RabbitMQ 服务的端口
username: rabbit # RabbitMQ 服务的账号
password: rabbit # RabbitMQ 服务的密码
username: guest # RabbitMQ 服务的账号
password: guest # RabbitMQ 服务的密码
# Kafka 配置项,对应 KafkaProperties 配置类
kafka:
bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔

View File

@@ -13,7 +13,7 @@ spring:
- org.springframework.ai.autoconfigure.vectorstore.milvus.MilvusVectorStoreAutoConfiguration # 禁用 AI 模块的 Milvus手动创建
# 数据源配置项
datasource:
druid: # Druid 【监控】相关的全局配置
druid: # Druid 【监控】相关的全局配置f
web-stat-filter:
enabled: true
stat-view-servlet:
@@ -126,8 +126,8 @@ spring:
rabbitmq:
host: 127.0.0.1 # RabbitMQ 服务的地址
port: 5672 # RabbitMQ 服务的端口
username: rabbit # RabbitMQ 服务的账号
password: rabbit # RabbitMQ 服务的密码
username: guest # RabbitMQ 服务的账号
password: guest # RabbitMQ 服务的密码
# Kafka 配置项,对应 KafkaProperties 配置类
kafka:
bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔