From 3cd256f7f2136ee6fc176908ed5992380194468b Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 12 Nov 2022 12:16:42 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E5=A4=8D=E3=80=91=E8=B7=A8?= =?UTF-8?q?=E9=83=A8=E9=97=A8=E5=AE=A1=E6=A0=B8=EF=BC=8C=E5=BD=93=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E4=BA=BA=E4=B8=8E=E5=AE=A1=E6=89=B9=E4=BA=BA=E4=B8=8D?= =?UTF-8?q?=E5=9C=A8=E5=90=8C=E4=B8=80=E9=83=A8=E9=97=A8=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E4=B8=94=E5=AE=A1=E6=89=B9=E4=BA=BA=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9D=83=E9=99=90=E4=B8=BA=E2=80=9C=E6=9C=AC=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90=E2=80=9D=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E5=AE=A1=E6=89=B9=E6=97=B6=E6=9C=89=E5=BC=82=E5=B8=B8=E2=80=9C?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=8F=B7=E4=B8=8D=E5=AD=98=E5=9C=A8=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infra/service/config/ConfigServiceTest.java | 12 ------------ .../system/service/sms/SmsSendServiceImpl.java | 2 ++ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceTest.java b/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceTest.java index fdbbbb66f..5220a8cad 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceTest.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceTest.java @@ -12,10 +12,8 @@ import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqV import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper; import cn.iocoder.yudao.module.infra.enums.config.ConfigTypeEnum; -import cn.iocoder.yudao.module.infra.mq.producer.config.ConfigProducer; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; import javax.annotation.Resource; @@ -30,8 +28,6 @@ import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServic import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; @Import(ConfigServiceImpl.class) public class ConfigServiceTest extends BaseDbUnitTest { @@ -41,8 +37,6 @@ public class ConfigServiceTest extends BaseDbUnitTest { @Resource private ConfigMapper configMapper; - @MockBean - private ConfigProducer configProducer; @Test public void testCreateConfig_success() { @@ -57,8 +51,6 @@ public class ConfigServiceTest extends BaseDbUnitTest { ConfigDO config = configMapper.selectById(configId); assertPojoEquals(reqVO, config); Assertions.assertEquals(ConfigTypeEnum.CUSTOM.getType(), config.getType()); - // 校验调用 - verify(configProducer, times(1)).sendConfigRefreshMessage(); } @Test @@ -76,8 +68,6 @@ public class ConfigServiceTest extends BaseDbUnitTest { // 校验是否更新正确 ConfigDO config = configMapper.selectById(reqVO.getId()); // 获取最新的 assertPojoEquals(reqVO, config); - // 校验调用 - verify(configProducer, times(1)).sendConfigRefreshMessage(); } @Test @@ -94,8 +84,6 @@ public class ConfigServiceTest extends BaseDbUnitTest { configService.deleteConfig(id); // 校验数据不存在了 assertNull(configMapper.selectById(id)); - // 校验调用 - verify(configProducer, times(1)).sendConfigRefreshMessage(); } @Test diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsSendServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsSendServiceImpl.java index 114642729..6e425b919 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsSendServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsSendServiceImpl.java @@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.core.KeyValue; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; +import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission; import cn.iocoder.yudao.framework.sms.core.client.SmsClient; import cn.iocoder.yudao.framework.sms.core.client.SmsClientFactory; import cn.iocoder.yudao.framework.sms.core.client.SmsCommonResult; @@ -55,6 +56,7 @@ public class SmsSendServiceImpl implements SmsSendService { private SmsProducer smsProducer; @Override + @DataPermission(enable = false) // 发送短信时,无需考虑数据权限 public Long sendSingleSmsToAdmin(String mobile, Long userId, String templateCode, Map templateParams) { // 如果 mobile 为空,则加载用户编号对应的手机号 if (StrUtil.isEmpty(mobile)) {