mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-08-08 15:21:52 +08:00
crm: 增加基于客户查询回款计划分页
This commit is contained in:
@@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.crm.service.business;
|
||||
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessCreateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessExportReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
|
||||
import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessMapper;
|
||||
@@ -11,9 +10,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||
@@ -21,7 +18,8 @@ import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServic
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||
import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_NOT_EXISTS;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
/**
|
||||
* {@link CrmBusinessServiceImpl} 的单元测试类
|
||||
@@ -181,84 +179,4 @@ public class CrmBusinessServiceImplTest extends BaseDbUnitTest {
|
||||
//assertPojoEquals(dbBusiness, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetBusinessList() {
|
||||
// mock 数据
|
||||
CrmBusinessDO dbBusiness = randomPojo(CrmBusinessDO.class, o -> { // 等会查询到
|
||||
o.setName(null);
|
||||
o.setStatusTypeId(null);
|
||||
o.setStatusId(null);
|
||||
o.setContactNextTime(null);
|
||||
o.setCustomerId(null);
|
||||
o.setDealTime(null);
|
||||
o.setPrice(null);
|
||||
o.setDiscountPercent(null);
|
||||
o.setProductPrice(null);
|
||||
o.setRemark(null);
|
||||
o.setCreateTime(null);
|
||||
o.setEndStatus(null);
|
||||
o.setEndRemark(null);
|
||||
o.setContactLastTime(null);
|
||||
o.setFollowUpStatus(null);
|
||||
});
|
||||
businessMapper.insert(dbBusiness);
|
||||
// 测试 name 不匹配
|
||||
businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setName(null)));
|
||||
// 测试 statusTypeId 不匹配
|
||||
businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setStatusTypeId(null)));
|
||||
// 测试 statusId 不匹配
|
||||
businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setStatusId(null)));
|
||||
// 测试 contactNextTime 不匹配
|
||||
businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setContactNextTime(null)));
|
||||
// 测试 customerId 不匹配
|
||||
businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setCustomerId(null)));
|
||||
// 测试 dealTime 不匹配
|
||||
businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setDealTime(null)));
|
||||
// 测试 price 不匹配
|
||||
businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setPrice(null)));
|
||||
// 测试 discountPercent 不匹配
|
||||
businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setDiscountPercent(null)));
|
||||
// 测试 productPrice 不匹配
|
||||
businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setProductPrice(null)));
|
||||
// 测试 remark 不匹配
|
||||
businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setRemark(null)));
|
||||
// 测试 createTime 不匹配
|
||||
businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setCreateTime(null)));
|
||||
// 测试 endStatus 不匹配
|
||||
businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setEndStatus(null)));
|
||||
// 测试 endRemark 不匹配
|
||||
businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setEndRemark(null)));
|
||||
// 测试 contactLastTime 不匹配
|
||||
businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setContactLastTime(null)));
|
||||
// 测试 followUpStatus 不匹配
|
||||
businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setFollowUpStatus(null)));
|
||||
// 准备参数
|
||||
CrmBusinessExportReqVO reqVO = new CrmBusinessExportReqVO();
|
||||
reqVO.setName(null);
|
||||
reqVO.setStatusTypeId(null);
|
||||
reqVO.setStatusId(null);
|
||||
reqVO.setContactNextTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setCustomerId(null);
|
||||
reqVO.setDealTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setPrice(null);
|
||||
reqVO.setDiscountPercent(null);
|
||||
reqVO.setProductPrice(null);
|
||||
reqVO.setRemark(null);
|
||||
reqVO.setOwnerUserId(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setRoUserIds(null);
|
||||
reqVO.setRwUserIds(null);
|
||||
reqVO.setEndStatus(null);
|
||||
reqVO.setEndRemark(null);
|
||||
reqVO.setContactLastTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setFollowUpStatus(null);
|
||||
|
||||
// 调用
|
||||
List<CrmBusinessDO> list = businessService.getBusinessList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbBusiness, list.get(0));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.crm.service.contract;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractCreateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractExportReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
|
||||
@@ -13,9 +12,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||
@@ -120,25 +117,14 @@ public class ContractServiceImplTest extends BaseDbUnitTest {
|
||||
contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setName(null)));
|
||||
// 测试 customerId 不匹配
|
||||
contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setCustomerId(null)));
|
||||
// 测试 businessId 不匹配
|
||||
contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setBusinessId(null)));
|
||||
// 测试 orderDate 不匹配
|
||||
contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setOrderDate(null)));
|
||||
// 测试 no 不匹配
|
||||
contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setNo(null)));
|
||||
// 测试 discountPercent 不匹配
|
||||
contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setDiscountPercent(null)));
|
||||
// 测试 productPrice 不匹配
|
||||
contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setProductPrice(null)));
|
||||
// 准备参数
|
||||
CrmContractPageReqVO reqVO = new CrmContractPageReqVO();
|
||||
reqVO.setName(null);
|
||||
reqVO.setCustomerId(null);
|
||||
reqVO.setBusinessId(null);
|
||||
reqVO.setOrderDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setNo(null);
|
||||
reqVO.setDiscountPercent(null);
|
||||
reqVO.setProductPrice(null);
|
||||
|
||||
// 调用
|
||||
PageResult<CrmContractDO> pageResult = contractService.getContractPage(reqVO);
|
||||
@@ -148,49 +134,4 @@ public class ContractServiceImplTest extends BaseDbUnitTest {
|
||||
assertPojoEquals(dbContract, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetContractList() {
|
||||
// mock 数据
|
||||
CrmContractDO dbContract = randomPojo(CrmContractDO.class, o -> { // 等会查询到
|
||||
o.setName("合同名称");
|
||||
o.setCustomerId(null);
|
||||
o.setBusinessId(null);
|
||||
o.setOrderDate(null);
|
||||
o.setNo(null);
|
||||
o.setDiscountPercent(null);
|
||||
o.setProductPrice(null);
|
||||
});
|
||||
contractMapper.insert(dbContract);
|
||||
// 测试 name 不匹配
|
||||
contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setName(null)));
|
||||
// 测试 customerId 不匹配
|
||||
contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setCustomerId(null)));
|
||||
// 测试 businessId 不匹配
|
||||
contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setBusinessId(null)));
|
||||
// 测试 orderDate 不匹配
|
||||
contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setOrderDate(null)));
|
||||
// 测试 no 不匹配
|
||||
contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setNo(null)));
|
||||
// 测试 discountPercent 不匹配
|
||||
contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setDiscountPercent(null)));
|
||||
// 测试 productPrice 不匹配
|
||||
contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setProductPrice(null)));
|
||||
// 准备参数
|
||||
ContractExportReqVO reqVO = new ContractExportReqVO();
|
||||
reqVO.setName(null);
|
||||
reqVO.setCustomerId(null);
|
||||
reqVO.setBusinessId(null);
|
||||
reqVO.setOrderDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setNo(null);
|
||||
reqVO.setDiscountPercent(null);
|
||||
reqVO.setProductPrice(null);
|
||||
|
||||
// 调用
|
||||
List<CrmContractDO> list = contractService.getContractList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbContract, list.get(0));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,10 +2,9 @@ package cn.iocoder.yudao.module.crm.service.receivable;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePlanCreateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePlanExportReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePlanPageReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePlanUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanCreateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanPageReqVO;
|
||||
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 org.junit.jupiter.api.Disabled;
|
||||
@@ -13,9 +12,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
|
||||
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;
|
||||
@@ -108,8 +105,6 @@ public class CrmCrmReceivablePlanServiceImplTest extends BaseDbUnitTest {
|
||||
// mock 数据
|
||||
CrmReceivablePlanDO dbReceivablePlan = randomPojo(CrmReceivablePlanDO.class, o -> { // 等会查询到
|
||||
o.setPeriod(null);
|
||||
o.setStatus(null);
|
||||
o.setCheckStatus(null);
|
||||
o.setReturnTime(null);
|
||||
o.setRemindDays(null);
|
||||
o.setRemindTime(null);
|
||||
@@ -120,38 +115,14 @@ public class CrmCrmReceivablePlanServiceImplTest extends BaseDbUnitTest {
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
crmReceivablePlanMapper.insert(dbReceivablePlan);
|
||||
// 测试 Period 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setPeriod(null)));
|
||||
// 测试 status 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setStatus(null)));
|
||||
// 测试 checkStatus 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCheckStatus(null)));
|
||||
// 测试 returnTime 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setReturnTime(null)));
|
||||
// 测试 remindDays 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setRemindDays(null)));
|
||||
// 测试 remindTime 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setRemindTime(null)));
|
||||
// 测试 customerId 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCustomerId(null)));
|
||||
// 测试 contractId 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setContractId(null)));
|
||||
// 测试 ownerUserId 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setOwnerUserId(null)));
|
||||
// 测试 remark 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setRemark(null)));
|
||||
// 测试 createTime 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
CrmReceivablePlanPageReqVO reqVO = new CrmReceivablePlanPageReqVO();
|
||||
reqVO.setStatus(null);
|
||||
reqVO.setCheckStatus(null);
|
||||
reqVO.setReturnTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setRemindTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setCustomerId(null);
|
||||
reqVO.setContractId(null);
|
||||
reqVO.setOwnerUserId(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
|
||||
// 调用
|
||||
PageResult<CrmReceivablePlanDO> pageResult = receivablePlanService.getReceivablePlanPage(reqVO);
|
||||
@@ -161,65 +132,4 @@ public class CrmCrmReceivablePlanServiceImplTest extends BaseDbUnitTest {
|
||||
assertPojoEquals(dbReceivablePlan, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetReceivablePlanList() {
|
||||
// mock 数据
|
||||
CrmReceivablePlanDO dbReceivablePlan = randomPojo(CrmReceivablePlanDO.class, o -> { // 等会查询到
|
||||
o.setPeriod(null);
|
||||
o.setStatus(null);
|
||||
o.setCheckStatus(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);
|
||||
// 测试 Period 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setPeriod(null)));
|
||||
// 测试 status 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setStatus(null)));
|
||||
// 测试 checkStatus 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCheckStatus(null)));
|
||||
// 测试 returnTime 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setReturnTime(null)));
|
||||
// 测试 remindDays 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setRemindDays(null)));
|
||||
// 测试 remindTime 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setRemindTime(null)));
|
||||
// 测试 customerId 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCustomerId(null)));
|
||||
// 测试 contractId 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setContractId(null)));
|
||||
// 测试 ownerUserId 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setOwnerUserId(null)));
|
||||
// 测试 remark 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setRemark(null)));
|
||||
// 测试 createTime 不匹配
|
||||
crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
CrmReceivablePlanExportReqVO reqVO = new CrmReceivablePlanExportReqVO();
|
||||
reqVO.setPeriod(null);
|
||||
reqVO.setStatus(null);
|
||||
reqVO.setCheckStatus(null);
|
||||
reqVO.setReturnTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setRemindDays(null);
|
||||
reqVO.setRemindTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setCustomerId(null);
|
||||
reqVO.setContractId(null);
|
||||
reqVO.setOwnerUserId(null);
|
||||
reqVO.setRemark(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
|
||||
// 调用
|
||||
List<CrmReceivablePlanDO> list = receivablePlanService.getReceivablePlanList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbReceivablePlan, list.get(0));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user