修改banner,添加 rocketmq 集成

This commit is contained in:
陈博文
2025-06-18 09:19:34 +08:00
parent 439dc9f709
commit 16cfd06a77
16 changed files with 95 additions and 93 deletions

View File

@@ -36,7 +36,7 @@
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-spring-boot-starter</artifactId>
<optional>true</optional>
<!-- <optional>true</optional>-->
</dependency>
</dependencies>

View File

@@ -25,26 +25,26 @@ public class BannerApplicationRunner implements ApplicationRunner {
"开发文档: \t{} \n\t" +
"视频教程: \t{} \n" +
"----------------------------------------------------------",
"https://172.16.46.63:30888/api-doc/",
"https://172.16.46.63:30888",
"http://172.16.46.63:30888/api-doc/",
"http://172.16.46.63:30888",
"https://t.zsxq.com/02Yf6M7Qn");
// 数据报表
System.out.println("[报表模块 yudao-module-report 教程][参考 https://172.16.46.63:30888/report/ 开启]");
System.out.println("[报表模块 yudao-module-report 教程][参考 http://172.16.46.63:30888/report/ 开启]");
// 工作流
System.out.println("[工作流模块 yudao-module-bpm 教程][参考 https://172.16.46.63:30888/bpm/ 开启]");
System.out.println("[工作流模块 yudao-module-bpm 教程][参考 http://172.16.46.63:30888/bpm/ 开启]");
// 商城系统
System.out.println("[商城系统 yudao-module-mall 教程][参考 https://172.16.46.63:30888/mall/build/ 开启]");
System.out.println("[商城系统 yudao-module-mall 教程][参考 http://172.16.46.63:30888/mall/build/ 开启]");
// ERP 系统
System.out.println("[ERP 系统 yudao-module-erp - 教程][参考 https://172.16.46.63:30888/erp/build/ 开启]");
System.out.println("[ERP 系统 yudao-module-erp - 教程][参考 http://172.16.46.63:30888/erp/build/ 开启]");
// CRM 系统
System.out.println("[CRM 系统 yudao-module-crm - 教程][参考 https://172.16.46.63:30888/crm/build/ 开启]");
System.out.println("[CRM 系统 yudao-module-crm - 教程][参考 http://172.16.46.63:30888/crm/build/ 开启]");
// 微信公众号
System.out.println("[微信公众号 yudao-module-mp 教程][参考 https://172.16.46.63:30888/mp/build/ 开启]");
System.out.println("[微信公众号 yudao-module-mp 教程][参考 http://172.16.46.63:30888/mp/build/ 开启]");
// 支付平台
System.out.println("[支付系统 yudao-module-pay - 教程][参考 https://172.16.46.63:30888/pay/build/ 开启]");
System.out.println("[支付系统 yudao-module-pay - 教程][参考 http://172.16.46.63:30888/pay/build/ 开启]");
// AI 大模型
System.out.println("[AI 大模型 yudao-module-ai - 教程][参考 https://172.16.46.63:30888/ai/build/ 开启]");
System.out.println("[AI 大模型 yudao-module-ai - 教程][参考 http://172.16.46.63:30888/ai/build/ 开启]");
});
}

View File

@@ -349,51 +349,51 @@ public class GlobalExceptionHandler {
}
// 1. 数据报表
if (message.contains("report_")) {
log.error("[报表模块 yudao-module-report - 表结构未导入][参考 https://172.16.46.63:30888/report/ 开启]");
log.error("[报表模块 yudao-module-report - 表结构未导入][参考 http://172.16.46.63:30888/report/ 开启]");
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
"[报表模块 yudao-module-report - 表结构未导入][参考 https://172.16.46.63:30888/report/ 开启]");
"[报表模块 yudao-module-report - 表结构未导入][参考 http://172.16.46.63:30888/report/ 开启]");
}
// 2. 工作流
if (message.contains("bpm_")) {
log.error("[工作流模块 yudao-module-bpm - 表结构未导入][参考 https://172.16.46.63:30888/bpm/ 开启]");
log.error("[工作流模块 yudao-module-bpm - 表结构未导入][参考 http://172.16.46.63:30888/bpm/ 开启]");
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
"[工作流模块 yudao-module-bpm - 表结构未导入][参考 https://172.16.46.63:30888/bpm/ 开启]");
"[工作流模块 yudao-module-bpm - 表结构未导入][参考 http://172.16.46.63:30888/bpm/ 开启]");
}
// 3. 微信公众号
if (message.contains("mp_")) {
log.error("[微信公众号 yudao-module-mp - 表结构未导入][参考 https://172.16.46.63:30888/mp/build/ 开启]");
log.error("[微信公众号 yudao-module-mp - 表结构未导入][参考 http://172.16.46.63:30888/mp/build/ 开启]");
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
"[微信公众号 yudao-module-mp - 表结构未导入][参考 https://172.16.46.63:30888/mp/build/ 开启]");
"[微信公众号 yudao-module-mp - 表结构未导入][参考 http://172.16.46.63:30888/mp/build/ 开启]");
}
// 4. 商城系统
if (StrUtil.containsAny(message, "product_", "promotion_", "trade_")) {
log.error("[商城系统 yudao-module-mall - 已禁用][参考 https://172.16.46.63:30888/mall/build/ 开启]");
log.error("[商城系统 yudao-module-mall - 已禁用][参考 http://172.16.46.63:30888/mall/build/ 开启]");
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
"[商城系统 yudao-module-mall - 已禁用][参考 https://172.16.46.63:30888/mall/build/ 开启]");
"[商城系统 yudao-module-mall - 已禁用][参考 http://172.16.46.63:30888/mall/build/ 开启]");
}
// 5. ERP 系统
if (message.contains("erp_")) {
log.error("[ERP 系统 yudao-module-erp - 表结构未导入][参考 https://172.16.46.63:30888/erp/build/ 开启]");
log.error("[ERP 系统 yudao-module-erp - 表结构未导入][参考 http://172.16.46.63:30888/erp/build/ 开启]");
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
"[ERP 系统 yudao-module-erp - 表结构未导入][参考 https://172.16.46.63:30888/erp/build/ 开启]");
"[ERP 系统 yudao-module-erp - 表结构未导入][参考 http://172.16.46.63:30888/erp/build/ 开启]");
}
// 6. CRM 系统
if (message.contains("crm_")) {
log.error("[CRM 系统 yudao-module-crm - 表结构未导入][参考 https://172.16.46.63:30888/crm/build/ 开启]");
log.error("[CRM 系统 yudao-module-crm - 表结构未导入][参考 http://172.16.46.63:30888/crm/build/ 开启]");
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
"[CRM 系统 yudao-module-crm - 表结构未导入][参考 https://172.16.46.63:30888/crm/build/ 开启]");
"[CRM 系统 yudao-module-crm - 表结构未导入][参考 http://172.16.46.63:30888/crm/build/ 开启]");
}
// 7. 支付平台
if (message.contains("pay_")) {
log.error("[支付模块 yudao-module-pay - 表结构未导入][参考 https://172.16.46.63:30888/pay/build/ 开启]");
log.error("[支付模块 yudao-module-pay - 表结构未导入][参考 http://172.16.46.63:30888/pay/build/ 开启]");
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
"[支付模块 yudao-module-pay - 表结构未导入][参考 https://172.16.46.63:30888/pay/build/ 开启]");
"[支付模块 yudao-module-pay - 表结构未导入][参考 http://172.16.46.63:30888/pay/build/ 开启]");
}
// 8. AI 大模型
if (message.contains("ai_")) {
log.error("[AI 大模型 yudao-module-ai - 表结构未导入][参考 https://172.16.46.63:30888/ai/build/ 开启]");
log.error("[AI 大模型 yudao-module-ai - 表结构未导入][参考 http://172.16.46.63:30888/ai/build/ 开启]");
return CommonResult.error(NOT_IMPLEMENTED.getCode(),
"[AI 大模型 yudao-module-ai - 表结构未导入][参考 https://172.16.46.63:30888/ai/build/ 开启]");
"[AI 大模型 yudao-module-ai - 表结构未导入][参考 http://172.16.46.63:30888/ai/build/ 开启]");
}
// 9. IOT 物联网
if (message.contains("iot_")) {

View File

@@ -1,4 +1,4 @@
芋道源码 http://www.iocoder.cn
参考文档 http://172.16.46.63:30888/
Application Version: ${yudao.info.version}
Spring Boot Version: ${spring-boot.version}

View File

@@ -6,9 +6,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* 项目的启动类
* <p>
* 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
*
* @author 芋道源码
*/
@@ -19,15 +19,15 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
public class AiServerApplication {
public static void main(String[] args) {
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
SpringApplication.run(AiServerApplication.class, args);
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
}
}

View File

@@ -6,9 +6,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* 项目的启动类
*
* 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
*
* @author 芋道源码
*/
@@ -16,15 +16,15 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
public class BpmServerApplication {
public static void main(String[] args) {
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
SpringApplication.run(BpmServerApplication.class, args);
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
}
}

View File

@@ -6,9 +6,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* 项目的启动类
* <p>
* 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
*
* @author 芋道源码
*/
@@ -16,15 +16,15 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
public class InfraServerApplication {
public static void main(String[] args) {
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
SpringApplication.run(InfraServerApplication.class, args);
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
}
}

View File

@@ -21,7 +21,7 @@ public class JobController {
@Operation(summary = "获得定时任务分页")
@PreAuthorize("@ss.hasPermission('infra:job:query')")
public CommonResult<String> getJobPage() {
return error(-1, "Cloud 版本使用 XXL-Job 作为定时任务!请参考 https://172.16.46.63:30888/job/ 文档操作");
return error(-1, "Cloud 版本使用 XXL-Job 作为定时任务!请参考 http://172.16.46.63:30888/job/ 文档操作");
}
}

View File

@@ -6,9 +6,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* 项目的启动类
*
* 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
*
* @author 芋道源码
*/
@@ -16,15 +16,15 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
public class ReportServerApplication {
public static void main(String[] args) {
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
SpringApplication.run(ReportServerApplication.class, args);
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
}
}

View File

@@ -163,6 +163,11 @@
<artifactId>hutool-extra</artifactId> <!-- 邮件 -->
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-mq</artifactId>
</dependency>
</dependencies>
<build>

View File

@@ -6,9 +6,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* 项目的启动类
*
* 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
*
* @author 芋道源码
*/
@@ -16,15 +16,15 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
public class SystemServerApplication {
public static void main(String[] args) {
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到 启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到 启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
SpringApplication.run(SystemServerApplication.class, args);
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
}
}

View File

@@ -7,14 +7,7 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.config.SecurityProperties;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginReqVO;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginRespVO;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthPermissionInfoRespVO;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthRegisterReqVO;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthResetPasswordReqVO;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthSmsLoginReqVO;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthSmsSendReqVO;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthSocialLoginReqVO;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.*;
import cn.iocoder.yudao.module.system.convert.auth.AuthConvert;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
@@ -36,12 +29,7 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Collections;
import java.util.List;

View File

@@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataRespVO;
import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataSaveReqVO;
@@ -63,6 +64,7 @@ public class DictDataController {
return success(true);
}
@TenantIgnore
@GetMapping(value = {"/list-all-simple", "simple-list"})
@Operation(summary = "获得全部字典数据列表", description = "一般用于管理后台缓存字典数据在本地")
// 无需添加权限认证,因为前端全局都需要

View File

@@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.system.mq.consumer.sms;
import cn.iocoder.yudao.module.system.mq.message.sms.SmsSendMessage;
import cn.iocoder.yudao.module.system.service.sms.SmsSendService;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
@@ -15,14 +17,17 @@ import jakarta.annotation.Resource;
* @author zzf
*/
@Component
@RocketMQMessageListener( // 重点:添加 @RocketMQMessageListener 注解,声明消费的 topic
topic = SmsSendMessage.TOPIC,
consumerGroup = SmsSendMessage.TOPIC + "_CONSUMER"
)
@Slf4j
public class SmsSendConsumer {
public class SmsSendConsumer implements RocketMQListener<SmsSendMessage> {
@Resource
private SmsSendService smsSendService;
@EventListener
@Async // Spring Event 默认在 Producer 发送的线程,通过 @Async 实现异步
@Override
public void onMessage(SmsSendMessage message) {
log.info("[onMessage][消息内容({})]", message);
smsSendService.doSendSms(message);

View File

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

View File

@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.mq.producer.sms;
import cn.iocoder.yudao.framework.common.core.KeyValue;
import cn.iocoder.yudao.module.system.mq.message.sms.SmsSendMessage;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
@@ -20,7 +21,7 @@ import java.util.List;
public class SmsProducer {
@Resource
private ApplicationContext applicationContext;
private RocketMQTemplate rocketMQTemplate;
/**
* 发送 {@link SmsSendMessage} 消息
@@ -35,7 +36,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);
rocketMQTemplate.syncSend(SmsSendMessage.TOPIC, message);
}
}