mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-08-08 07:11:53 +08:00
CRM-回款计划:添加数据权限
This commit is contained in:
@@ -7,12 +7,12 @@ import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceiv
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO;
|
||||
import cn.iocoder.yudao.module.crm.dal.mysql.receivable.CrmReceivablePlanMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.PageParam.PAGE_SIZE_NONE;
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
||||
@@ -22,6 +22,7 @@ import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.RECEIVABLE_PL
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
// TODO 芋艿:后续,需要补充测试用例
|
||||
|
||||
/**
|
||||
* {@link CrmReceivablePlanServiceImpl} 的单元测试类
|
||||
*
|
||||
@@ -43,7 +44,7 @@ public class CrmCrmReceivablePlanServiceImplTest extends BaseDbUnitTest {
|
||||
CrmReceivablePlanCreateReqVO reqVO = randomPojo(CrmReceivablePlanCreateReqVO.class);
|
||||
|
||||
// 调用
|
||||
Long receivablePlanId = receivablePlanService.createReceivablePlan(reqVO);
|
||||
Long receivablePlanId = receivablePlanService.createReceivablePlan(reqVO, 1L);
|
||||
// 断言
|
||||
assertNotNull(receivablePlanId);
|
||||
// 校验记录的属性是否正确
|
||||
@@ -87,8 +88,8 @@ public class CrmCrmReceivablePlanServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
// 调用
|
||||
receivablePlanService.deleteReceivablePlan(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(crmReceivablePlanMapper.selectById(id));
|
||||
// 校验数据不存在了
|
||||
assertNull(crmReceivablePlanMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -103,34 +104,34 @@ public class CrmCrmReceivablePlanServiceImplTest extends BaseDbUnitTest {
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetReceivablePlanPage() {
|
||||
// mock 数据
|
||||
CrmReceivablePlanDO dbReceivablePlan = randomPojo(CrmReceivablePlanDO.class, o -> { // 等会查询到
|
||||
o.setPeriod(null);
|
||||
o.setReturnTime(null);
|
||||
o.setRemindDays(null);
|
||||
o.setRemindTime(null);
|
||||
o.setCustomerId(null);
|
||||
o.setContractId(null);
|
||||
o.setOwnerUserId(null);
|
||||
o.setRemark(null);
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
crmReceivablePlanMapper.insert(dbReceivablePlan);
|
||||
// 测试 customerId 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCustomerId(null)));
|
||||
// 测试 contractId 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setContractId(null)));
|
||||
// 准备参数
|
||||
CrmReceivablePlanPageReqVO reqVO = new CrmReceivablePlanPageReqVO();
|
||||
reqVO.setCustomerId(null);
|
||||
reqVO.setContractId(null);
|
||||
|
||||
// 调用
|
||||
PageResult<CrmReceivablePlanDO> pageResult = receivablePlanService.getReceivablePlanPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbReceivablePlan, pageResult.getList().get(0));
|
||||
// mock 数据
|
||||
CrmReceivablePlanDO dbReceivablePlan = randomPojo(CrmReceivablePlanDO.class, o -> { // 等会查询到
|
||||
o.setPeriod(null);
|
||||
o.setReturnTime(null);
|
||||
o.setRemindDays(null);
|
||||
o.setRemindTime(null);
|
||||
o.setCustomerId(null);
|
||||
o.setContractId(null);
|
||||
o.setOwnerUserId(null);
|
||||
o.setRemark(null);
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
crmReceivablePlanMapper.insert(dbReceivablePlan);
|
||||
// 测试 customerId 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCustomerId(null)));
|
||||
// 测试 contractId 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setContractId(null)));
|
||||
// 准备参数
|
||||
CrmReceivablePlanPageReqVO reqVO = new CrmReceivablePlanPageReqVO();
|
||||
reqVO.setCustomerId(null);
|
||||
reqVO.setContractId(null);
|
||||
reqVO.setPageSize(PAGE_SIZE_NONE);
|
||||
// 调用
|
||||
PageResult<CrmReceivablePlanDO> pageResult = receivablePlanService.getReceivablePlanPage(reqVO, 1L);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbReceivablePlan, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user