【修复】跨部门审核,当申请人与审批人不在同一部门,并且审批人的数据权限为“本部门数据权限”时,审批时有异常“手机号不存在”

pull/2/head
YunaiV 2022-11-12 12:16:42 +08:00
parent 1dfb37b11f
commit 3cd256f7f2
2 changed files with 2 additions and 12 deletions

View File

@ -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

View File

@ -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<String, Object> templateParams) {
// 如果 mobile 为空,则加载用户编号对应的手机号
if (StrUtil.isEmpty(mobile)) {