mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 10:18:42 +08:00 
			
		
		
		
	crm: 增加基于客户查询回款计划分页
This commit is contained in:
		| @@ -1,4 +0,0 @@ | ||||
| /** | ||||
|  * 线索 | ||||
|  */ | ||||
| package cn.iocoder.yudao.module.crm.controller.admin.clue; | ||||
| @@ -1,4 +0,0 @@ | ||||
| /** | ||||
|  * 产品表 | ||||
|  */ | ||||
| package cn.iocoder.yudao.module.crm.controller.admin.product; | ||||
| @@ -99,7 +99,7 @@ public class CrmReceivableController { | ||||
|  | ||||
|     @GetMapping("/page-by-customer") | ||||
|     @Operation(summary = "获得回款分页,基于指定客户") | ||||
|     public CommonResult<PageResult<CrmReceivableRespVO>> getContractPageByCustomer(@Valid CrmReceivablePageReqVO pageReqVO) { | ||||
|     public CommonResult<PageResult<CrmReceivableRespVO>> getReceivablePageByCustomer(@Valid CrmReceivablePageReqVO pageReqVO) { | ||||
|         Assert.notNull(pageReqVO.getCustomerId(), "客户编号不能为空"); | ||||
|         PageResult<CrmReceivableDO> pageResult = receivableService.getReceivablePageByCustomer(pageReqVO); | ||||
|         return success(convertDetailReceivablePage(pageResult)); | ||||
| @@ -125,19 +125,19 @@ public class CrmReceivableController { | ||||
|      * @return 详细的回款分页 | ||||
|      */ | ||||
|     private PageResult<CrmReceivableRespVO> convertDetailReceivablePage(PageResult<CrmReceivableDO> pageResult) { | ||||
|         List<CrmReceivableDO> contactList = pageResult.getList(); | ||||
|         if (CollUtil.isEmpty(contactList)) { | ||||
|         List<CrmReceivableDO> receivableList = pageResult.getList(); | ||||
|         if (CollUtil.isEmpty(receivableList)) { | ||||
|             return PageResult.empty(pageResult.getTotal()); | ||||
|         } | ||||
|         // 1. 获取客户列表 | ||||
|         List<CrmCustomerDO> customerList = customerService.getCustomerList( | ||||
|                 convertSet(contactList, CrmReceivableDO::getCustomerId)); | ||||
|                 convertSet(receivableList, CrmReceivableDO::getCustomerId)); | ||||
|         // 2. 获取创建人、负责人列表 | ||||
|         Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(contactList, | ||||
|         Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(receivableList, | ||||
|                 contact -> Stream.of(NumberUtils.parseLong(contact.getCreator()), contact.getOwnerUserId()))); | ||||
|         // 3. 获得合同列表 | ||||
|         List<CrmContractDO> contractList = contractService.getContractList( | ||||
|                 convertSet(contactList, CrmReceivableDO::getContractId)); | ||||
|                 convertSet(receivableList, CrmReceivableDO::getContractId)); | ||||
|         return CrmReceivableConvert.INSTANCE.convertPage(pageResult, userMap, customerList, contractList); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -1,13 +1,27 @@ | ||||
| package cn.iocoder.yudao.module.crm.controller.admin.receivable; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.lang.Assert; | ||||
| import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||
| import cn.iocoder.yudao.framework.common.util.number.NumberUtils; | ||||
| import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||||
| import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*; | ||||
| 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.CrmReceivablePlanRespVO; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanUpdateReqVO; | ||||
| import cn.iocoder.yudao.module.crm.convert.receivable.CrmReceivablePlanConvert; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO; | ||||
| import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; | ||||
| import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; | ||||
| import cn.iocoder.yudao.module.crm.service.receivable.CrmReceivablePlanService; | ||||
| import cn.iocoder.yudao.module.crm.service.receivable.CrmReceivableService; | ||||
| import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | ||||
| import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | ||||
| import io.swagger.v3.oas.annotations.Operation; | ||||
| import io.swagger.v3.oas.annotations.Parameter; | ||||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||||
| @@ -20,8 +34,12 @@ import javax.servlet.http.HttpServletResponse; | ||||
| import javax.validation.Valid; | ||||
| import java.io.IOException; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.stream.Stream; | ||||
|  | ||||
| import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertListByFlatMap; | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||||
| import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | ||||
|  | ||||
| @Tag(name = "管理后台 - CRM 回款计划") | ||||
| @@ -31,20 +49,29 @@ import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.E | ||||
| public class CrmReceivablePlanController { | ||||
|  | ||||
|     @Resource | ||||
|     private CrmReceivablePlanService crmReceivablePlanService; | ||||
|     private CrmReceivablePlanService receivablePlanService; | ||||
|     @Resource | ||||
|     private CrmReceivableService receivableService; | ||||
|     @Resource | ||||
|     private CrmContractService contractService; | ||||
|     @Resource | ||||
|     private CrmCustomerService customerService; | ||||
|  | ||||
|     @Resource | ||||
|     private AdminUserApi adminUserApi; | ||||
|  | ||||
|     @PostMapping("/create") | ||||
|     @Operation(summary = "创建回款计划") | ||||
|     @PreAuthorize("@ss.hasPermission('crm:receivable-plan:create')") | ||||
|     public CommonResult<Long> createReceivablePlan(@Valid @RequestBody CrmReceivablePlanCreateReqVO createReqVO) { | ||||
|         return success(crmReceivablePlanService.createReceivablePlan(createReqVO)); | ||||
|         return success(receivablePlanService.createReceivablePlan(createReqVO)); | ||||
|     } | ||||
|  | ||||
|     @PutMapping("/update") | ||||
|     @Operation(summary = "更新回款计划") | ||||
|     @PreAuthorize("@ss.hasPermission('crm:receivable-plan:update')") | ||||
|     public CommonResult<Boolean> updateReceivablePlan(@Valid @RequestBody CrmReceivablePlanUpdateReqVO updateReqVO) { | ||||
|         crmReceivablePlanService.updateReceivablePlan(updateReqVO); | ||||
|         receivablePlanService.updateReceivablePlan(updateReqVO); | ||||
|         return success(true); | ||||
|     } | ||||
|  | ||||
| @@ -53,7 +80,7 @@ public class CrmReceivablePlanController { | ||||
|     @Parameter(name = "id", description = "编号", required = true) | ||||
|     @PreAuthorize("@ss.hasPermission('crm:receivable-plan:delete')") | ||||
|     public CommonResult<Boolean> deleteReceivablePlan(@RequestParam("id") Long id) { | ||||
|         crmReceivablePlanService.deleteReceivablePlan(id); | ||||
|         receivablePlanService.deleteReceivablePlan(id); | ||||
|         return success(true); | ||||
|     } | ||||
|  | ||||
| @@ -62,28 +89,63 @@ public class CrmReceivablePlanController { | ||||
|     @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||||
|     @PreAuthorize("@ss.hasPermission('crm:receivable-plan:query')") | ||||
|     public CommonResult<CrmReceivablePlanRespVO> getReceivablePlan(@RequestParam("id") Long id) { | ||||
|         CrmReceivablePlanDO receivablePlan = crmReceivablePlanService.getReceivablePlan(id); | ||||
|         CrmReceivablePlanDO receivablePlan = receivablePlanService.getReceivablePlan(id); | ||||
|         return success(CrmReceivablePlanConvert.INSTANCE.convert(receivablePlan)); | ||||
|     } | ||||
|  | ||||
|     @GetMapping("/page") | ||||
|     @Operation(summary = "获得回款计划分页") | ||||
|     @PreAuthorize("@ss.hasPermission('crm:receivable-plan:query')") | ||||
|     public CommonResult<PageResult<CrmReceivablePlanRespVO>> getReceivablePlanPage(@Valid CrmReceivablePlanPageReqVO pageVO) { | ||||
|         PageResult<CrmReceivablePlanDO> pageResult = crmReceivablePlanService.getReceivablePlanPage(pageVO); | ||||
|         return success(CrmReceivablePlanConvert.INSTANCE.convertPage(pageResult)); | ||||
|     public CommonResult<PageResult<CrmReceivablePlanRespVO>> getReceivablePlanPage(@Valid CrmReceivablePlanPageReqVO pageReqVO) { | ||||
|         PageResult<CrmReceivablePlanDO> pageResult = receivablePlanService.getReceivablePlanPage(pageReqVO); | ||||
|         return success(convertDetailReceivablePlanPage(pageResult)); | ||||
|     } | ||||
|  | ||||
|     @GetMapping("/page-by-customer") | ||||
|     @Operation(summary = "获得回款计划分页,基于指定客户") | ||||
|     public CommonResult<PageResult<CrmReceivablePlanRespVO>> getReceivablePlanPageByCustomer(@Valid CrmReceivablePlanPageReqVO pageReqVO) { | ||||
|         Assert.notNull(pageReqVO.getCustomerId(), "客户编号不能为空"); | ||||
|         PageResult<CrmReceivablePlanDO> pageResult = receivablePlanService.getReceivablePlanPageByCustomer(pageReqVO); | ||||
|         return success(convertDetailReceivablePlanPage(pageResult)); | ||||
|     } | ||||
|  | ||||
|     // TODO 芋艿:后面在优化导出 | ||||
|     @GetMapping("/export-excel") | ||||
|     @Operation(summary = "导出回款计划 Excel") | ||||
|     @PreAuthorize("@ss.hasPermission('crm:receivable-plan:export')") | ||||
|     @OperateLog(type = EXPORT) | ||||
|     public void exportReceivablePlanExcel(@Valid CrmReceivablePlanExportReqVO exportReqVO, | ||||
|     public void exportReceivablePlanExcel(@Valid CrmReceivablePlanPageReqVO exportReqVO, | ||||
|               HttpServletResponse response) throws IOException { | ||||
|         List<CrmReceivablePlanDO> list = crmReceivablePlanService.getReceivablePlanList(exportReqVO); | ||||
|         PageResult<CrmReceivablePlanDO> pageResult = receivablePlanService.getReceivablePlanPage(exportReqVO); | ||||
|         // 导出 Excel | ||||
|         List<CrmReceivablePlanExcelVO> datas = CrmReceivablePlanConvert.INSTANCE.convertList02(list); | ||||
|         ExcelUtils.write(response, "回款计划.xls", "数据", CrmReceivablePlanExcelVO.class, datas); | ||||
|         ExcelUtils.write(response, "回款计划.xls", "数据", CrmReceivablePlanRespVO.class, | ||||
|                 convertDetailReceivablePlanPage(pageResult).getList()); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 转换成详细的回款计划分页,即读取关联信息 | ||||
|      * | ||||
|      * @param pageResult 回款计划分页 | ||||
|      * @return 详细的回款计划分页 | ||||
|      */ | ||||
|     private PageResult<CrmReceivablePlanRespVO> convertDetailReceivablePlanPage(PageResult<CrmReceivablePlanDO> pageResult) { | ||||
|         List<CrmReceivablePlanDO> receivablePlanList = pageResult.getList(); | ||||
|         if (CollUtil.isEmpty(receivablePlanList)) { | ||||
|             return PageResult.empty(pageResult.getTotal()); | ||||
|         } | ||||
|         // 1. 获取客户列表 | ||||
|         List<CrmCustomerDO> customerList = customerService.getCustomerList( | ||||
|                 convertSet(receivablePlanList, CrmReceivablePlanDO::getCustomerId)); | ||||
|         // 2. 获取创建人、负责人列表 | ||||
|         Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(receivablePlanList, | ||||
|                 contact -> Stream.of(NumberUtils.parseLong(contact.getCreator()), contact.getOwnerUserId()))); | ||||
|         // 3. 获得合同列表 | ||||
|         List<CrmContractDO> contractList = contractService.getContractList( | ||||
|                 convertSet(receivablePlanList, CrmReceivablePlanDO::getContractId)); | ||||
|         // 4. 获得还款列表 | ||||
|         List<CrmReceivableDO> receivableList = receivableService.getReceivableList( | ||||
|                 convertSet(receivablePlanList, CrmReceivablePlanDO::getReceivableId)); | ||||
|         return CrmReceivablePlanConvert.INSTANCE.convertPage(pageResult, userMap, customerList, contractList, receivableList); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -1,70 +0,0 @@ | ||||
| package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||||
| import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||||
| import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | ||||
| import com.alibaba.excel.annotation.ExcelProperty; | ||||
| import lombok.Data; | ||||
|  | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| // TODO liuhongfeng:导出可以等其它功能做完,统一在搞; | ||||
| /** | ||||
|  * CRM 回款计划 Excel VO | ||||
|  * | ||||
|  * @author 芋道源码 | ||||
|  */ | ||||
| @Data | ||||
| public class CrmReceivablePlanExcelVO { | ||||
|  | ||||
|     @ExcelProperty("ID") | ||||
|     private Long id; | ||||
|  | ||||
|     @ExcelProperty("期数") | ||||
|     private Integer period; | ||||
|  | ||||
|     @ExcelProperty("回款ID") | ||||
|     private Long receivableId; | ||||
|  | ||||
|     @ExcelProperty(value = "状态", converter = DictConvert.class) | ||||
|     @DictFormat(DictTypeConstants.COMMON_STATUS) | ||||
|     private Integer status; | ||||
|  | ||||
|     @ExcelProperty(value = "审批状态", converter = DictConvert.class) | ||||
|     @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_AUDIT_STATUS) | ||||
|     private Integer checkStatus; | ||||
|  | ||||
|     //@ExcelProperty("工作流编号") | ||||
|     //private Long processInstanceId; | ||||
|  | ||||
|     @ExcelProperty("计划回款金额") | ||||
|     private Integer price; | ||||
|  | ||||
|     @ExcelProperty("计划回款日期") | ||||
|     private LocalDateTime returnTime; | ||||
|  | ||||
|     @ExcelProperty("提前几天提醒") | ||||
|     private Integer remindDays; | ||||
|  | ||||
|     @ExcelProperty("提醒日期") | ||||
|     private LocalDateTime remindTime; | ||||
|  | ||||
|     @ExcelProperty("客户ID") | ||||
|     private Long customerId; | ||||
|  | ||||
|     @ExcelProperty("合同名称") | ||||
|     private Long contractId; | ||||
|  | ||||
|     @ExcelProperty("负责人") | ||||
|     private Long ownerUserId; | ||||
|  | ||||
|     //@ExcelProperty("显示顺序") | ||||
|     //private Integer sort; | ||||
|  | ||||
|     @ExcelProperty("备注") | ||||
|     private String remark; | ||||
|  | ||||
|     @ExcelProperty("创建时间") | ||||
|     private LocalDateTime createTime; | ||||
|  | ||||
| } | ||||
| @@ -1,52 +0,0 @@ | ||||
| package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import lombok.Data; | ||||
| import org.springframework.format.annotation.DateTimeFormat; | ||||
|  | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||||
|  | ||||
| // TODO liuhongfeng:导出可以等其它功能做完,统一在搞; | ||||
| @Schema(description = "管理后台 - CRM 回款计划 Excel 导出 Request VO,参数和 CrmReceivablePlanPageReqVO 是一致的") | ||||
| @Data | ||||
| public class CrmReceivablePlanExportReqVO { | ||||
|  | ||||
|     @Schema(description = "期数") | ||||
|     private Integer period; | ||||
|  | ||||
|     @Schema(description = "完成状态", example = "2") | ||||
|     private Integer status; | ||||
|  | ||||
|     @Schema(description = "审批状态", example = "1") | ||||
|     private Integer checkStatus; | ||||
|  | ||||
|     @Schema(description = "计划回款日期") | ||||
|     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||||
|     private LocalDateTime[] returnTime; | ||||
|  | ||||
|     @Schema(description = "提前几天提醒") | ||||
|     private Integer remindDays; | ||||
|  | ||||
|     @Schema(description = "提醒日期") | ||||
|     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||||
|     private LocalDateTime[] remindTime; | ||||
|  | ||||
|     @Schema(description = "客户名称", example = "18026") | ||||
|     private Long customerId; | ||||
|  | ||||
|     @Schema(description = "合同名称", example = "3473") | ||||
|     private Long contractId; | ||||
|  | ||||
|     @Schema(description = "负责人", example = "17828") | ||||
|     private Long ownerUserId; | ||||
|  | ||||
|     @Schema(description = "备注", example = "随便") | ||||
|     private String remark; | ||||
|  | ||||
|     @Schema(description = "创建时间") | ||||
|     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||||
|     private LocalDateTime[] createTime; | ||||
|  | ||||
| } | ||||
| @@ -1,49 +0,0 @@ | ||||
| package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | ||||
| import lombok.ToString; | ||||
| import org.springframework.format.annotation.DateTimeFormat; | ||||
|  | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||||
|  | ||||
| @Schema(description = "管理后台 - CRM 回款计划分页 Request VO") | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = true) | ||||
| @ToString(callSuper = true) | ||||
| public class CrmReceivablePlanPageReqVO extends PageParam { | ||||
|  | ||||
|     // TODO @liuhongfeng:可以根据需求,去除掉一些不要的过滤条件;另外,customerId、contractId、ownerUserId 注释不正确,应该都是对应的编号 | ||||
|  | ||||
|     @Schema(description = "完成状态", example = "2") | ||||
|     private Integer status; | ||||
|  | ||||
|     @Schema(description = "审批状态", example = "1") | ||||
|     private Integer checkStatus; | ||||
|  | ||||
|     @Schema(description = "计划回款日期") | ||||
|     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||||
|     private LocalDateTime[] returnTime; | ||||
|  | ||||
|     @Schema(description = "提醒日期") | ||||
|     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||||
|     private LocalDateTime[] remindTime; | ||||
|  | ||||
|     @Schema(description = "客户名称", example = "18026") | ||||
|     private Long customerId; | ||||
|  | ||||
|     @Schema(description = "合同名称", example = "3473") | ||||
|     private Long contractId; | ||||
|  | ||||
|     @Schema(description = "负责人", example = "17828") | ||||
|     private Long ownerUserId; | ||||
|  | ||||
|     @Schema(description = "创建时间") | ||||
|     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||||
|     private LocalDateTime[] createTime; | ||||
|  | ||||
| } | ||||
| @@ -1,19 +0,0 @@ | ||||
| package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import lombok.*; | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| @Schema(description = "管理后台 - CRM 回款计划 Response VO") | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = true) | ||||
| @ToString(callSuper = true) | ||||
| public class CrmReceivablePlanRespVO extends CrmReceivablePlanBaseVO { | ||||
|  | ||||
|     @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25153") | ||||
|     private Long id; | ||||
|  | ||||
|     @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||||
|     private LocalDateTime createTime; | ||||
|  | ||||
| } | ||||
| @@ -1,7 +1,5 @@ | ||||
| package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo; | ||||
| package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan; | ||||
| 
 | ||||
| import cn.iocoder.yudao.framework.common.validation.InEnum; | ||||
| import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import lombok.Data; | ||||
| import org.springframework.format.annotation.DateTimeFormat; | ||||
| @@ -20,17 +18,9 @@ public class CrmReceivablePlanBaseVO { | ||||
|     @Schema(description = "期数", example = "1") | ||||
|     private Integer period; | ||||
| 
 | ||||
|     // TODO @liuhongfeng:回款计划编号 | ||||
|     @Schema(description = "回款计划", example = "19852") | ||||
|     @Schema(description = "回款计划编号", example = "19852") | ||||
|     private Long receivableId; | ||||
| 
 | ||||
|     @Schema(description = "完成状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||||
|     private Integer status; | ||||
| 
 | ||||
|     @Schema(description = "审批状态", example = "1") | ||||
|     @InEnum(CrmAuditStatusEnum.class) | ||||
|     private Integer checkStatus; | ||||
| 
 | ||||
|     @Schema(description = "计划回款金额", example = "29675") | ||||
|     private Integer price; | ||||
| 
 | ||||
| @@ -45,16 +35,14 @@ public class CrmReceivablePlanBaseVO { | ||||
|     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||||
|     private LocalDateTime remindTime; | ||||
| 
 | ||||
|     // TODO @liuhongfeng:客户编号 | ||||
|     @Schema(description = "客户名称", example = "18026") | ||||
|     private Long customerId; | ||||
| 
 | ||||
|     // TODO @liuhongfeng:合同编号 | ||||
|     @Schema(description = "合同名称", example = "3473") | ||||
|     @Schema(description = "合同编号", example = "3473") | ||||
|     private Long contractId; | ||||
| 
 | ||||
|     // TODO @liuhongfeng:负责人编号 | ||||
|     @Schema(description = "负责人", example = "17828") | ||||
|     @Schema(description = "负责人编号", example = "17828") | ||||
|     private Long ownerUserId; | ||||
| 
 | ||||
|     @Schema(description = "显示顺序") | ||||
| @@ -1,4 +1,4 @@ | ||||
| package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo; | ||||
| package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan; | ||||
| 
 | ||||
| import lombok.*; | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| @@ -0,0 +1,22 @@ | ||||
| package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | ||||
| import lombok.ToString; | ||||
|  | ||||
| @Schema(description = "管理后台 - CRM 回款计划分页 Request VO") | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = true) | ||||
| @ToString(callSuper = true) | ||||
| public class CrmReceivablePlanPageReqVO extends PageParam { | ||||
|  | ||||
|     @Schema(description = "客户编号", example = "18026") | ||||
|     private Long customerId; | ||||
|  | ||||
|     // TODO @芋艿:这个搜的应该是合同编号 no | ||||
|     @Schema(description = "合同名称", example = "3473") | ||||
|     private Long contractId; | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,40 @@ | ||||
| package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import lombok.*; | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| @Schema(description = "管理后台 - CRM 回款计划 Response VO") | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = true) | ||||
| @ToString(callSuper = true) | ||||
| public class CrmReceivablePlanRespVO extends CrmReceivablePlanBaseVO { | ||||
|  | ||||
|     @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25153") | ||||
|     private Long id; | ||||
|  | ||||
|     @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||||
|     private LocalDateTime createTime; | ||||
|  | ||||
|     @Schema(description = "客户名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "test") | ||||
|     private String customerName; | ||||
|  | ||||
|     @Schema(description = "合同编号", example = "Q110") | ||||
|     private String contractNo; | ||||
|  | ||||
|     @Schema(description = "负责人", example = "test") | ||||
|     private String ownerUserName; | ||||
|  | ||||
|     @Schema(description = "创建人", example = "25682") | ||||
|     private String creator; | ||||
|  | ||||
|     @Schema(description = "创建人名字", example = "test") | ||||
|     private String creatorName; | ||||
|  | ||||
|     @Schema(description = "完成状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||||
|     private Boolean finishStatus; | ||||
|  | ||||
|     @Schema(description = "回款方式", example = "1") // 来自 Receivable 的 returnType 字段 | ||||
|     private Integer returnType; | ||||
|  | ||||
| } | ||||
| @@ -1,4 +1,4 @@ | ||||
| package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo; | ||||
| package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan; | ||||
| 
 | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import lombok.*; | ||||
| @@ -42,7 +42,7 @@ public class CrmReceivableBaseVO { | ||||
|     private LocalDateTime returnTime; | ||||
|  | ||||
|     @Schema(description = "回款方式", example = "2") | ||||
|     private String returnType; | ||||
|     private Integer returnType; | ||||
|  | ||||
|     @Schema(description = "回款金额,单位:分", example = "31859") | ||||
|     private Integer price; | ||||
| @@ -51,9 +51,6 @@ public class CrmReceivableBaseVO { | ||||
|     @Schema(description = "负责人", example = "22202") | ||||
|     private Long ownerUserId; | ||||
|  | ||||
|     @Schema(description = "批次", example = "2539") | ||||
|     private Long batchId; | ||||
|  | ||||
|     @Schema(description = "显示顺序") | ||||
|     private Integer sort; | ||||
|  | ||||
|   | ||||
| @@ -1,13 +1,22 @@ | ||||
| package cn.iocoder.yudao.module.crm.convert.receivable; | ||||
|  | ||||
| import java.util.*; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||
|  | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanCreateReqVO; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanRespVO; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanUpdateReqVO; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO; | ||||
| import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | ||||
| import org.mapstruct.Mapper; | ||||
| import org.mapstruct.factory.Mappers; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*; | ||||
|  | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen; | ||||
|  | ||||
| /** | ||||
|  * 回款计划 Convert | ||||
| @@ -27,8 +36,31 @@ public interface CrmReceivablePlanConvert { | ||||
|  | ||||
|     List<CrmReceivablePlanRespVO> convertList(List<CrmReceivablePlanDO> list); | ||||
|  | ||||
|     PageResult<CrmReceivablePlanRespVO> convertPage(PageResult<CrmReceivablePlanDO> page); | ||||
|     default PageResult<CrmReceivablePlanRespVO> convertPage(PageResult<CrmReceivablePlanDO> pageResult, Map<Long, AdminUserRespDTO> userMap, | ||||
|                                                             List<CrmCustomerDO> customerList, List<CrmContractDO> contractList, | ||||
|                                                             List<CrmReceivableDO> receivableList) { | ||||
|         return new PageResult<>(converList(pageResult.getList(), userMap, customerList, contractList, receivableList), pageResult.getTotal()); | ||||
|     } | ||||
|  | ||||
|     List<CrmReceivablePlanExcelVO> convertList02(List<CrmReceivablePlanDO> list); | ||||
|     default List<CrmReceivablePlanRespVO> converList(List<CrmReceivablePlanDO> receivablePlanList, Map<Long, AdminUserRespDTO> userMap, | ||||
|                                                      List<CrmCustomerDO> customerList, List<CrmContractDO> contractList, | ||||
|                                                      List<CrmReceivableDO> receivableList) { | ||||
|         List<CrmReceivablePlanRespVO> result = convertList(receivablePlanList); | ||||
|         Map<Long, CrmCustomerDO> customerMap = convertMap(customerList, CrmCustomerDO::getId); | ||||
|         Map<Long, CrmContractDO> contractMap = convertMap(contractList, CrmContractDO::getId); | ||||
|         Map<Long, CrmReceivableDO> receivableMap = convertMap(receivableList, CrmReceivableDO::getId); | ||||
|         result.forEach(item -> { | ||||
|             setUserInfo(item, userMap); | ||||
|             findAndThen(customerMap, item.getCustomerId(), customer -> item.setCustomerName(customer.getName())); | ||||
|             findAndThen(contractMap, item.getContractId(), contract -> item.setContractNo(contract.getNo())); | ||||
|             findAndThen(receivableMap, item.getReceivableId(), receivable -> item.setReturnType(receivable.getReturnType())); | ||||
|         }); | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
|     static void setUserInfo(CrmReceivablePlanRespVO receivablePlan, Map<Long, AdminUserRespDTO> userMap) { | ||||
|         findAndThen(userMap, receivablePlan.getOwnerUserId(), user -> receivablePlan.setOwnerUserName(user.getNickname())); | ||||
|         findAndThen(userMap, Long.parseLong(receivablePlan.getCreator()), user -> receivablePlan.setCreatorName(user.getNickname())); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -68,7 +68,7 @@ public class CrmReceivableDO extends BaseDO { | ||||
|     /** | ||||
|      * 回款方式 | ||||
|      */ | ||||
|     private String returnType; | ||||
|     private Integer returnType; | ||||
|     /** | ||||
|      * 回款金额 | ||||
|      */ | ||||
|   | ||||
| @@ -38,26 +38,10 @@ public class CrmReceivablePlanDO extends BaseDO { | ||||
|      * TODO @liuhongfeng:少关联实体; | ||||
|      */ | ||||
|     private Long receivableId; | ||||
|     // TODO @liuhongfeng:还款计划,没有 status 和 checkStatus,改成 finishStatus Boolean;是否完成 | ||||
|     /** | ||||
|      * 状态 | ||||
|      * | ||||
|      * 枚举 {@link cn.iocoder.yudao.framework.common.enums.CommonStatusEnum} | ||||
|      * 完成状态 | ||||
|      */ | ||||
|     private Integer status; | ||||
|     /** | ||||
|      * 审批状态 | ||||
|      * | ||||
|      * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_AUDIT_STATUS} | ||||
|      * // TODO @liuhongfeng:关联的枚举 | ||||
|      */ | ||||
|     private Integer checkStatus; | ||||
|     /** | ||||
|      * 工作流编号 | ||||
|      * | ||||
|      * TODO @liuhongfeng:少关联实体; | ||||
|      */ | ||||
|     private Long processInstanceId; | ||||
|     private Boolean finishStatus; | ||||
|     /** | ||||
|      * 计划回款金额,单位:分 | ||||
|      */ | ||||
|   | ||||
| @@ -1,13 +1,11 @@ | ||||
| package cn.iocoder.yudao.module.crm.dal.mysql.receivable; | ||||
|  | ||||
| import java.util.*; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||
| import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||||
| import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||||
| import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanPageReqVO; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO; | ||||
| import org.apache.ibatis.annotations.Mapper; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*; | ||||
|  | ||||
| /** | ||||
|  * 回款计划 Mapper | ||||
| @@ -19,30 +17,15 @@ public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO | ||||
|  | ||||
|     default PageResult<CrmReceivablePlanDO> selectPage(CrmReceivablePlanPageReqVO reqVO) { | ||||
|         return selectPage(reqVO, new LambdaQueryWrapperX<CrmReceivablePlanDO>() | ||||
|                 .eqIfPresent(CrmReceivablePlanDO::getStatus, reqVO.getStatus()) | ||||
|                 .eqIfPresent(CrmReceivablePlanDO::getCheckStatus, reqVO.getCheckStatus()) | ||||
|                 .betweenIfPresent(CrmReceivablePlanDO::getReturnTime, reqVO.getReturnTime()) | ||||
|                 .betweenIfPresent(CrmReceivablePlanDO::getRemindTime, reqVO.getRemindTime()) | ||||
|                 .eqIfPresent(CrmReceivablePlanDO::getCustomerId, reqVO.getCustomerId()) | ||||
|                 .eqIfPresent(CrmReceivablePlanDO::getContractId, reqVO.getContractId()) | ||||
|                 .eqIfPresent(CrmReceivablePlanDO::getOwnerUserId, reqVO.getOwnerUserId()) | ||||
|                 .betweenIfPresent(CrmReceivablePlanDO::getCreateTime, reqVO.getCreateTime()) | ||||
|                 .orderByDesc(CrmReceivablePlanDO::getId)); | ||||
|     } | ||||
|  | ||||
|     default List<CrmReceivablePlanDO> selectList(CrmReceivablePlanExportReqVO reqVO) { | ||||
|         return selectList(new LambdaQueryWrapperX<CrmReceivablePlanDO>() | ||||
|                 .eqIfPresent(CrmReceivablePlanDO::getPeriod, reqVO.getPeriod()) | ||||
|                 .eqIfPresent(CrmReceivablePlanDO::getStatus, reqVO.getStatus()) | ||||
|                 .eqIfPresent(CrmReceivablePlanDO::getCheckStatus, reqVO.getCheckStatus()) | ||||
|                 .betweenIfPresent(CrmReceivablePlanDO::getReturnTime, reqVO.getReturnTime()) | ||||
|                 .eqIfPresent(CrmReceivablePlanDO::getRemindDays, reqVO.getRemindDays()) | ||||
|                 .betweenIfPresent(CrmReceivablePlanDO::getRemindTime, reqVO.getRemindTime()) | ||||
|                 .eqIfPresent(CrmReceivablePlanDO::getCustomerId, reqVO.getCustomerId()) | ||||
|     default PageResult<CrmReceivablePlanDO> selectPageByCustomer(CrmReceivablePlanPageReqVO reqVO) { | ||||
|         return selectPage(reqVO, new LambdaQueryWrapperX<CrmReceivablePlanDO>() | ||||
|                 .eq(CrmReceivablePlanDO::getCustomerId, reqVO.getCustomerId()) // 必须传递 | ||||
|                 .eqIfPresent(CrmReceivablePlanDO::getContractId, reqVO.getContractId()) | ||||
|                 .eqIfPresent(CrmReceivablePlanDO::getOwnerUserId, reqVO.getOwnerUserId()) | ||||
|                 .eqIfPresent(CrmReceivablePlanDO::getRemark, reqVO.getRemark()) | ||||
|                 .betweenIfPresent(CrmReceivablePlanDO::getCreateTime, reqVO.getCreateTime()) | ||||
|                 .orderByDesc(CrmReceivablePlanDO::getId)); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -1,13 +1,18 @@ | ||||
| package cn.iocoder.yudao.module.crm.service.receivable; | ||||
|  | ||||
| import java.util.*; | ||||
| import javax.validation.*; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO; | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||
| 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.customer.CrmCustomerDO; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO; | ||||
|  | ||||
| import javax.validation.Valid; | ||||
| import java.util.Collection; | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * 回款计划 Service 接口 | ||||
|  * CRM 回款计划 Service 接口 | ||||
|  * | ||||
|  * @author 芋道源码 | ||||
|  */ | ||||
| @@ -54,17 +59,21 @@ public interface CrmReceivablePlanService { | ||||
|     /** | ||||
|      * 获得回款计划分页 | ||||
|      * | ||||
|      * 数据权限:基于 {@link CrmReceivablePlanDO} 读取 | ||||
|      * | ||||
|      * @param pageReqVO 分页查询 | ||||
|      * @return 回款计划分页 | ||||
|      */ | ||||
|     PageResult<CrmReceivablePlanDO> getReceivablePlanPage(CrmReceivablePlanPageReqVO pageReqVO); | ||||
|  | ||||
|     /** | ||||
|      * 获得回款计划列表, 用于 Excel 导出 | ||||
|      * 获得回款计划分页,基于指定客户 | ||||
|      * | ||||
|      * @param exportReqVO 查询条件 | ||||
|      * @return 回款计划列表 | ||||
|      * 数据权限:基于 {@link CrmCustomerDO} 读取 | ||||
|      * | ||||
|      * @param pageReqVO 分页查询 | ||||
|      * @return 回款计划分页 | ||||
|      */ | ||||
|     List<CrmReceivablePlanDO> getReceivablePlanList(CrmReceivablePlanExportReqVO exportReqVO); | ||||
|     PageResult<CrmReceivablePlanDO> getReceivablePlanPageByCustomer(CrmReceivablePlanPageReqVO pageReqVO); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -3,18 +3,18 @@ package cn.iocoder.yudao.module.crm.service.receivable; | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.collection.ListUtil; | ||||
| import cn.hutool.core.util.ObjectUtil; | ||||
| import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||
| 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.convert.receivable.CrmReceivablePlanConvert; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO; | ||||
| import cn.iocoder.yudao.module.crm.dal.mysql.receivable.CrmReceivablePlanMapper; | ||||
| import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; | ||||
| import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | ||||
| import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | ||||
| import cn.iocoder.yudao.module.crm.framework.core.annotations.CrmPermission; | ||||
| import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; | ||||
| import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; | ||||
| import org.springframework.stereotype.Service; | ||||
| @@ -28,6 +28,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU | ||||
| import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; | ||||
|  | ||||
| // TODO @liuhongfeng:参考 CrmReceivableServiceImpl 写的 todo 哈; | ||||
| // TODO @puhui999:数据权限 | ||||
| /** | ||||
|  * 回款计划 Service 实现类 | ||||
|  * | ||||
| @@ -38,26 +39,22 @@ import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; | ||||
| public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService { | ||||
|  | ||||
|     @Resource | ||||
|     private CrmReceivablePlanMapper crmReceivablePlanMapper; | ||||
|     private CrmReceivablePlanMapper receivablePlanMapper; | ||||
|  | ||||
|     @Resource | ||||
|     private CrmContractService contractService; | ||||
|     @Resource | ||||
|     private CrmCustomerService crmCustomerService; | ||||
|     private CrmCustomerService customerService; | ||||
|  | ||||
|     @Override | ||||
|     public Long createReceivablePlan(CrmReceivablePlanCreateReqVO createReqVO) { | ||||
|         // 插入 | ||||
|         CrmReceivablePlanDO receivablePlan = CrmReceivablePlanConvert.INSTANCE.convert(createReqVO); | ||||
|         if (ObjectUtil.isNull(receivablePlan.getStatus())){ | ||||
|             receivablePlan.setStatus(CommonStatusEnum.ENABLE.getStatus()); | ||||
|         } | ||||
|         if (ObjectUtil.isNull(receivablePlan.getCheckStatus())){ | ||||
|             receivablePlan.setCheckStatus(CrmAuditStatusEnum.DRAFT.getStatus()); | ||||
|         } | ||||
|         receivablePlan.setFinishStatus(false); | ||||
|  | ||||
|         checkReceivablePlan(receivablePlan); | ||||
|  | ||||
|         crmReceivablePlanMapper.insert(receivablePlan); | ||||
|         receivablePlanMapper.insert(receivablePlan); | ||||
|         // 返回 | ||||
|         return receivablePlan.getId(); | ||||
|     } | ||||
| @@ -73,7 +70,7 @@ public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService { | ||||
|             throw exception(CONTRACT_NOT_EXISTS); | ||||
|         } | ||||
|  | ||||
|         CrmCustomerDO customer = crmCustomerService.getCustomer(receivablePlan.getCustomerId()); | ||||
|         CrmCustomerDO customer = customerService.getCustomer(receivablePlan.getCustomerId()); | ||||
|         if(ObjectUtil.isNull(customer)){ | ||||
|             throw exception(CUSTOMER_NOT_EXISTS); | ||||
|         } | ||||
| @@ -87,7 +84,7 @@ public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService { | ||||
|  | ||||
|         // 更新 | ||||
|         CrmReceivablePlanDO updateObj = CrmReceivablePlanConvert.INSTANCE.convert(updateReqVO); | ||||
|         crmReceivablePlanMapper.updateById(updateObj); | ||||
|         receivablePlanMapper.updateById(updateObj); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -95,18 +92,18 @@ public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService { | ||||
|         // 校验存在 | ||||
|         validateReceivablePlanExists(id); | ||||
|         // 删除 | ||||
|         crmReceivablePlanMapper.deleteById(id); | ||||
|         receivablePlanMapper.deleteById(id); | ||||
|     } | ||||
|  | ||||
|     private void validateReceivablePlanExists(Long id) { | ||||
|         if (crmReceivablePlanMapper.selectById(id) == null) { | ||||
|         if (receivablePlanMapper.selectById(id) == null) { | ||||
|             throw exception(RECEIVABLE_PLAN_NOT_EXISTS); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public CrmReceivablePlanDO getReceivablePlan(Long id) { | ||||
|         return crmReceivablePlanMapper.selectById(id); | ||||
|         return receivablePlanMapper.selectById(id); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -114,17 +111,18 @@ public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService { | ||||
|         if (CollUtil.isEmpty(ids)) { | ||||
|             return ListUtil.empty(); | ||||
|         } | ||||
|         return crmReceivablePlanMapper.selectBatchIds(ids); | ||||
|         return receivablePlanMapper.selectBatchIds(ids); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public PageResult<CrmReceivablePlanDO> getReceivablePlanPage(CrmReceivablePlanPageReqVO pageReqVO) { | ||||
|         return crmReceivablePlanMapper.selectPage(pageReqVO); | ||||
|         return receivablePlanMapper.selectPage(pageReqVO); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<CrmReceivablePlanDO> getReceivablePlanList(CrmReceivablePlanExportReqVO exportReqVO) { | ||||
|         return crmReceivablePlanMapper.selectList(exportReqVO); | ||||
|     @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#pageReqVO.customerId", level = CrmPermissionLevelEnum.READ) | ||||
|     public PageResult<CrmReceivablePlanDO> getReceivablePlanPageByCustomer(CrmReceivablePlanPageReqVO pageReqVO) { | ||||
|         return receivablePlanMapper.selectPageByCustomer(pageReqVO); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -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
	 YunaiV
					YunaiV