Commit 3cd256f7f2136ee6fc176908ed5992380194468b
1 parent
1dfb37b1
【修复】跨部门审核,当申请人与审批人不在同一部门,并且审批人的数据权限为“本部门数据权限”时,审批时有异常“手机号不存在”
Showing
2 changed files
with
2 additions
and
12 deletions
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 |
| 12 | 12 | import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; |
| 13 | 13 | import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper; |
| 14 | 14 | import cn.iocoder.yudao.module.infra.enums.config.ConfigTypeEnum; |
| 15 | -import cn.iocoder.yudao.module.infra.mq.producer.config.ConfigProducer; | |
| 16 | 15 | import org.junit.jupiter.api.Assertions; |
| 17 | 16 | import org.junit.jupiter.api.Test; |
| 18 | -import org.springframework.boot.test.mock.mockito.MockBean; | |
| 19 | 17 | import org.springframework.context.annotation.Import; |
| 20 | 18 | |
| 21 | 19 | import javax.annotation.Resource; |
| ... | ... | @@ -30,8 +28,6 @@ import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServic |
| 30 | 28 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; |
| 31 | 29 | import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; |
| 32 | 30 | import static org.junit.jupiter.api.Assertions.*; |
| 33 | -import static org.mockito.Mockito.times; | |
| 34 | -import static org.mockito.Mockito.verify; | |
| 35 | 31 | |
| 36 | 32 | @Import(ConfigServiceImpl.class) |
| 37 | 33 | public class ConfigServiceTest extends BaseDbUnitTest { |
| ... | ... | @@ -41,8 +37,6 @@ public class ConfigServiceTest extends BaseDbUnitTest { |
| 41 | 37 | |
| 42 | 38 | @Resource |
| 43 | 39 | private ConfigMapper configMapper; |
| 44 | - @MockBean | |
| 45 | - private ConfigProducer configProducer; | |
| 46 | 40 | |
| 47 | 41 | @Test |
| 48 | 42 | public void testCreateConfig_success() { |
| ... | ... | @@ -57,8 +51,6 @@ public class ConfigServiceTest extends BaseDbUnitTest { |
| 57 | 51 | ConfigDO config = configMapper.selectById(configId); |
| 58 | 52 | assertPojoEquals(reqVO, config); |
| 59 | 53 | Assertions.assertEquals(ConfigTypeEnum.CUSTOM.getType(), config.getType()); |
| 60 | - // 校验调用 | |
| 61 | - verify(configProducer, times(1)).sendConfigRefreshMessage(); | |
| 62 | 54 | } |
| 63 | 55 | |
| 64 | 56 | @Test |
| ... | ... | @@ -76,8 +68,6 @@ public class ConfigServiceTest extends BaseDbUnitTest { |
| 76 | 68 | // 校验是否更新正确 |
| 77 | 69 | ConfigDO config = configMapper.selectById(reqVO.getId()); // 获取最新的 |
| 78 | 70 | assertPojoEquals(reqVO, config); |
| 79 | - // 校验调用 | |
| 80 | - verify(configProducer, times(1)).sendConfigRefreshMessage(); | |
| 81 | 71 | } |
| 82 | 72 | |
| 83 | 73 | @Test |
| ... | ... | @@ -94,8 +84,6 @@ public class ConfigServiceTest extends BaseDbUnitTest { |
| 94 | 84 | configService.deleteConfig(id); |
| 95 | 85 | // 校验数据不存在了 |
| 96 | 86 | assertNull(configMapper.selectById(id)); |
| 97 | - // 校验调用 | |
| 98 | - verify(configProducer, times(1)).sendConfigRefreshMessage(); | |
| 99 | 87 | } |
| 100 | 88 | |
| 101 | 89 | @Test | ... | ... |
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; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.core.KeyValue; |
| 7 | 7 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 8 | 8 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; |
| 9 | +import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission; | |
| 9 | 10 | import cn.iocoder.yudao.framework.sms.core.client.SmsClient; |
| 10 | 11 | import cn.iocoder.yudao.framework.sms.core.client.SmsClientFactory; |
| 11 | 12 | import cn.iocoder.yudao.framework.sms.core.client.SmsCommonResult; |
| ... | ... | @@ -55,6 +56,7 @@ public class SmsSendServiceImpl implements SmsSendService { |
| 55 | 56 | private SmsProducer smsProducer; |
| 56 | 57 | |
| 57 | 58 | @Override |
| 59 | + @DataPermission(enable = false) // 发送短信时,无需考虑数据权限 | |
| 58 | 60 | public Long sendSingleSmsToAdmin(String mobile, Long userId, String templateCode, Map<String, Object> templateParams) { |
| 59 | 61 | // 如果 mobile 为空,则加载用户编号对应的手机号 |
| 60 | 62 | if (StrUtil.isEmpty(mobile)) { | ... | ... |