Commit 72969e921ecc2e0317592b8cf6e5f3c0cd16f56f

Authored by YunaiV
1 parent f02b9464

crm: 增加基于客户查询回款计划分页

Showing 23 changed files with 204 additions and 541 deletions
sql/mysql/crm.sql
1   -SET NAMES utf8mb4;
2   --- `ruoyi-vue-pro`.crm_contact definition
3   -
sql/mysql/crm_data.sql
1   -
2   -INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (184, '回款审批状态', 'crm_receivable_check_status', 0, '回款审批状态(0 未审核 1 审核通过 2 审核拒绝 3 审核中 4 已撤回)', '1', '2023-10-18 21:44:24', '1', '2023-10-18 21:44:24', b'0', '1970-01-01 00:00:00');
3   -
4   -INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (185, '回款-回款方式', 'crm_return_type', 0, '回款-回款方式', '1', '2023-10-18 21:54:10', '1', '2023-10-18 21:54:10', b'0', '1970-01-01 00:00:00');
5   -
6   -
7   -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1389, 0, '未审核', '0', 'crm_receivable_check_status', 0, 'default', '', '0 未审核 ', '1', '2023-10-18 21:46:00', '1', '2023-10-18 21:47:16', b'0');
8   -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1390, 1, '审核通过', '1', 'crm_receivable_check_status', 0, 'default', '', '1 审核通过', '1', '2023-10-18 21:46:18', '1', '2023-10-18 21:47:08', b'0');
9   -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1391, 2, '审核拒绝', '2', 'crm_receivable_check_status', 0, 'default', '', ' 2 审核拒绝', '1', '2023-10-18 21:46:58', '1', '2023-10-18 21:47:21', b'0');
10   -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1392, 3, '审核中', '3', 'crm_receivable_check_status', 0, 'default', '', ' 3 审核中', '1', '2023-10-18 21:47:35', '1', '2023-10-18 21:47:35', b'0');
11   -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1393, 4, '已撤回', '4', 'crm_receivable_check_status', 0, 'default', '', ' 4 已撤回', '1', '2023-10-18 21:47:46', '1', '2023-10-18 21:47:46', b'0');
12   -
13   -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1394, 1, '支票', '1', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:54:29', '1', '2023-10-18 21:54:29', b'0');
14   -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1395, 2, '现金', '2', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:54:41', '1', '2023-10-18 21:54:41', b'0');
15   -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1396, 3, '邮政汇款', '3', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:54:53', '1', '2023-10-18 21:54:53', b'0');
16   -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1397, 4, '电汇', '4', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:07', '1', '2023-10-18 21:55:07', b'0');
17   -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1398, 5, '网上转账', '5', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:24', '1', '2023-10-18 21:55:24', b'0');
18   -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1399, 6, '支付宝', '6', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:38', '1', '2023-10-18 21:55:38', b'0');
19   -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1400, 7, '微信支付', '7', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:53', '1', '2023-10-18 21:55:53', b'0');
20   -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1401, 8, '其他', '8', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:56:06', '1', '2023-10-18 21:56:06', b'0');
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/package-info.java deleted
1   -/**
2   - * 线索
3   - */
4   -package cn.iocoder.yudao.module.crm.controller.admin.clue;
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/package-info.java deleted
1   -/**
2   - * 产品表
3   - */
4   -package cn.iocoder.yudao.module.crm.controller.admin.product;
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivableController.java
... ... @@ -99,7 +99,7 @@ public class CrmReceivableController {
99 99  
100 100 @GetMapping("/page-by-customer")
101 101 @Operation(summary = "获得回款分页,基于指定客户")
102   - public CommonResult<PageResult<CrmReceivableRespVO>> getContractPageByCustomer(@Valid CrmReceivablePageReqVO pageReqVO) {
  102 + public CommonResult<PageResult<CrmReceivableRespVO>> getReceivablePageByCustomer(@Valid CrmReceivablePageReqVO pageReqVO) {
103 103 Assert.notNull(pageReqVO.getCustomerId(), "客户编号不能为空");
104 104 PageResult<CrmReceivableDO> pageResult = receivableService.getReceivablePageByCustomer(pageReqVO);
105 105 return success(convertDetailReceivablePage(pageResult));
... ... @@ -125,19 +125,19 @@ public class CrmReceivableController {
125 125 * @return 详细的回款分页
126 126 */
127 127 private PageResult<CrmReceivableRespVO> convertDetailReceivablePage(PageResult<CrmReceivableDO> pageResult) {
128   - List<CrmReceivableDO> contactList = pageResult.getList();
129   - if (CollUtil.isEmpty(contactList)) {
  128 + List<CrmReceivableDO> receivableList = pageResult.getList();
  129 + if (CollUtil.isEmpty(receivableList)) {
130 130 return PageResult.empty(pageResult.getTotal());
131 131 }
132 132 // 1. 获取客户列表
133 133 List<CrmCustomerDO> customerList = customerService.getCustomerList(
134   - convertSet(contactList, CrmReceivableDO::getCustomerId));
  134 + convertSet(receivableList, CrmReceivableDO::getCustomerId));
135 135 // 2. 获取创建人、负责人列表
136   - Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(contactList,
  136 + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(receivableList,
137 137 contact -> Stream.of(NumberUtils.parseLong(contact.getCreator()), contact.getOwnerUserId())));
138 138 // 3. 获得合同列表
139 139 List<CrmContractDO> contractList = contractService.getContractList(
140   - convertSet(contactList, CrmReceivableDO::getContractId));
  140 + convertSet(receivableList, CrmReceivableDO::getContractId));
141 141 return CrmReceivableConvert.INSTANCE.convertPage(pageResult, userMap, customerList, contractList);
142 142 }
143 143  
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivablePlanController.java
1 1 package cn.iocoder.yudao.module.crm.controller.admin.receivable;
2 2  
  3 +import cn.hutool.core.collection.CollUtil;
  4 +import cn.hutool.core.lang.Assert;
3 5 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
4 6 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  7 +import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
5 8 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
6 9 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
7   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
  10 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanCreateReqVO;
  11 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanPageReqVO;
  12 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanRespVO;
  13 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanUpdateReqVO;
8 14 import cn.iocoder.yudao.module.crm.convert.receivable.CrmReceivablePlanConvert;
  15 +import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
  16 +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
  17 +import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
9 18 import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO;
  19 +import cn.iocoder.yudao.module.crm.service.contract.CrmContractService;
  20 +import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
10 21 import cn.iocoder.yudao.module.crm.service.receivable.CrmReceivablePlanService;
  22 +import cn.iocoder.yudao.module.crm.service.receivable.CrmReceivableService;
  23 +import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
  24 +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
11 25 import io.swagger.v3.oas.annotations.Operation;
12 26 import io.swagger.v3.oas.annotations.Parameter;
13 27 import io.swagger.v3.oas.annotations.tags.Tag;
... ... @@ -20,8 +34,12 @@ import javax.servlet.http.HttpServletResponse;
20 34 import javax.validation.Valid;
21 35 import java.io.IOException;
22 36 import java.util.List;
  37 +import java.util.Map;
  38 +import java.util.stream.Stream;
23 39  
24 40 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  41 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertListByFlatMap;
  42 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
25 43 import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
26 44  
27 45 @Tag(name = "管理后台 - CRM 回款计划")
... ... @@ -31,20 +49,29 @@ import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.E
31 49 public class CrmReceivablePlanController {
32 50  
33 51 @Resource
34   - private CrmReceivablePlanService crmReceivablePlanService;
  52 + private CrmReceivablePlanService receivablePlanService;
  53 + @Resource
  54 + private CrmReceivableService receivableService;
  55 + @Resource
  56 + private CrmContractService contractService;
  57 + @Resource
  58 + private CrmCustomerService customerService;
  59 +
  60 + @Resource
  61 + private AdminUserApi adminUserApi;
35 62  
36 63 @PostMapping("/create")
37 64 @Operation(summary = "创建回款计划")
38 65 @PreAuthorize("@ss.hasPermission('crm:receivable-plan:create')")
39 66 public CommonResult<Long> createReceivablePlan(@Valid @RequestBody CrmReceivablePlanCreateReqVO createReqVO) {
40   - return success(crmReceivablePlanService.createReceivablePlan(createReqVO));
  67 + return success(receivablePlanService.createReceivablePlan(createReqVO));
41 68 }
42 69  
43 70 @PutMapping("/update")
44 71 @Operation(summary = "更新回款计划")
45 72 @PreAuthorize("@ss.hasPermission('crm:receivable-plan:update')")
46 73 public CommonResult<Boolean> updateReceivablePlan(@Valid @RequestBody CrmReceivablePlanUpdateReqVO updateReqVO) {
47   - crmReceivablePlanService.updateReceivablePlan(updateReqVO);
  74 + receivablePlanService.updateReceivablePlan(updateReqVO);
48 75 return success(true);
49 76 }
50 77  
... ... @@ -53,7 +80,7 @@ public class CrmReceivablePlanController {
53 80 @Parameter(name = "id", description = "编号", required = true)
54 81 @PreAuthorize("@ss.hasPermission('crm:receivable-plan:delete')")
55 82 public CommonResult<Boolean> deleteReceivablePlan(@RequestParam("id") Long id) {
56   - crmReceivablePlanService.deleteReceivablePlan(id);
  83 + receivablePlanService.deleteReceivablePlan(id);
57 84 return success(true);
58 85 }
59 86  
... ... @@ -62,28 +89,63 @@ public class CrmReceivablePlanController {
62 89 @Parameter(name = "id", description = "编号", required = true, example = "1024")
63 90 @PreAuthorize("@ss.hasPermission('crm:receivable-plan:query')")
64 91 public CommonResult<CrmReceivablePlanRespVO> getReceivablePlan(@RequestParam("id") Long id) {
65   - CrmReceivablePlanDO receivablePlan = crmReceivablePlanService.getReceivablePlan(id);
  92 + CrmReceivablePlanDO receivablePlan = receivablePlanService.getReceivablePlan(id);
66 93 return success(CrmReceivablePlanConvert.INSTANCE.convert(receivablePlan));
67 94 }
68 95  
69 96 @GetMapping("/page")
70 97 @Operation(summary = "获得回款计划分页")
71 98 @PreAuthorize("@ss.hasPermission('crm:receivable-plan:query')")
72   - public CommonResult<PageResult<CrmReceivablePlanRespVO>> getReceivablePlanPage(@Valid CrmReceivablePlanPageReqVO pageVO) {
73   - PageResult<CrmReceivablePlanDO> pageResult = crmReceivablePlanService.getReceivablePlanPage(pageVO);
74   - return success(CrmReceivablePlanConvert.INSTANCE.convertPage(pageResult));
  99 + public CommonResult<PageResult<CrmReceivablePlanRespVO>> getReceivablePlanPage(@Valid CrmReceivablePlanPageReqVO pageReqVO) {
  100 + PageResult<CrmReceivablePlanDO> pageResult = receivablePlanService.getReceivablePlanPage(pageReqVO);
  101 + return success(convertDetailReceivablePlanPage(pageResult));
75 102 }
76 103  
  104 + @GetMapping("/page-by-customer")
  105 + @Operation(summary = "获得回款计划分页,基于指定客户")
  106 + public CommonResult<PageResult<CrmReceivablePlanRespVO>> getReceivablePlanPageByCustomer(@Valid CrmReceivablePlanPageReqVO pageReqVO) {
  107 + Assert.notNull(pageReqVO.getCustomerId(), "客户编号不能为空");
  108 + PageResult<CrmReceivablePlanDO> pageResult = receivablePlanService.getReceivablePlanPageByCustomer(pageReqVO);
  109 + return success(convertDetailReceivablePlanPage(pageResult));
  110 + }
  111 +
  112 + // TODO 芋艿:后面在优化导出
77 113 @GetMapping("/export-excel")
78 114 @Operation(summary = "导出回款计划 Excel")
79 115 @PreAuthorize("@ss.hasPermission('crm:receivable-plan:export')")
80 116 @OperateLog(type = EXPORT)
81   - public void exportReceivablePlanExcel(@Valid CrmReceivablePlanExportReqVO exportReqVO,
  117 + public void exportReceivablePlanExcel(@Valid CrmReceivablePlanPageReqVO exportReqVO,
82 118 HttpServletResponse response) throws IOException {
83   - List<CrmReceivablePlanDO> list = crmReceivablePlanService.getReceivablePlanList(exportReqVO);
  119 + PageResult<CrmReceivablePlanDO> pageResult = receivablePlanService.getReceivablePlanPage(exportReqVO);
84 120 // 导出 Excel
85   - List<CrmReceivablePlanExcelVO> datas = CrmReceivablePlanConvert.INSTANCE.convertList02(list);
86   - ExcelUtils.write(response, "回款计划.xls", "数据", CrmReceivablePlanExcelVO.class, datas);
  121 + ExcelUtils.write(response, "回款计划.xls", "数据", CrmReceivablePlanRespVO.class,
  122 + convertDetailReceivablePlanPage(pageResult).getList());
  123 + }
  124 +
  125 + /**
  126 + * 转换成详细的回款计划分页,即读取关联信息
  127 + *
  128 + * @param pageResult 回款计划分页
  129 + * @return 详细的回款计划分页
  130 + */
  131 + private PageResult<CrmReceivablePlanRespVO> convertDetailReceivablePlanPage(PageResult<CrmReceivablePlanDO> pageResult) {
  132 + List<CrmReceivablePlanDO> receivablePlanList = pageResult.getList();
  133 + if (CollUtil.isEmpty(receivablePlanList)) {
  134 + return PageResult.empty(pageResult.getTotal());
  135 + }
  136 + // 1. 获取客户列表
  137 + List<CrmCustomerDO> customerList = customerService.getCustomerList(
  138 + convertSet(receivablePlanList, CrmReceivablePlanDO::getCustomerId));
  139 + // 2. 获取创建人、负责人列表
  140 + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(receivablePlanList,
  141 + contact -> Stream.of(NumberUtils.parseLong(contact.getCreator()), contact.getOwnerUserId())));
  142 + // 3. 获得合同列表
  143 + List<CrmContractDO> contractList = contractService.getContractList(
  144 + convertSet(receivablePlanList, CrmReceivablePlanDO::getContractId));
  145 + // 4. 获得还款列表
  146 + List<CrmReceivableDO> receivableList = receivableService.getReceivableList(
  147 + convertSet(receivablePlanList, CrmReceivablePlanDO::getReceivableId));
  148 + return CrmReceivablePlanConvert.INSTANCE.convertPage(pageResult, userMap, customerList, contractList, receivableList);
87 149 }
88 150  
89 151 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivablePlanExcelVO.java deleted
1   -package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
2   -
3   -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
4   -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
5   -import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
6   -import com.alibaba.excel.annotation.ExcelProperty;
7   -import lombok.Data;
8   -
9   -import java.time.LocalDateTime;
10   -
11   -// TODO liuhongfeng:导出可以等其它功能做完,统一在搞;
12   -/**
13   - * CRM 回款计划 Excel VO
14   - *
15   - * @author 芋道源码
16   - */
17   -@Data
18   -public class CrmReceivablePlanExcelVO {
19   -
20   - @ExcelProperty("ID")
21   - private Long id;
22   -
23   - @ExcelProperty("期数")
24   - private Integer period;
25   -
26   - @ExcelProperty("回款ID")
27   - private Long receivableId;
28   -
29   - @ExcelProperty(value = "状态", converter = DictConvert.class)
30   - @DictFormat(DictTypeConstants.COMMON_STATUS)
31   - private Integer status;
32   -
33   - @ExcelProperty(value = "审批状态", converter = DictConvert.class)
34   - @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_AUDIT_STATUS)
35   - private Integer checkStatus;
36   -
37   - //@ExcelProperty("工作流编号")
38   - //private Long processInstanceId;
39   -
40   - @ExcelProperty("计划回款金额")
41   - private Integer price;
42   -
43   - @ExcelProperty("计划回款日期")
44   - private LocalDateTime returnTime;
45   -
46   - @ExcelProperty("提前几天提醒")
47   - private Integer remindDays;
48   -
49   - @ExcelProperty("提醒日期")
50   - private LocalDateTime remindTime;
51   -
52   - @ExcelProperty("客户ID")
53   - private Long customerId;
54   -
55   - @ExcelProperty("合同名称")
56   - private Long contractId;
57   -
58   - @ExcelProperty("负责人")
59   - private Long ownerUserId;
60   -
61   - //@ExcelProperty("显示顺序")
62   - //private Integer sort;
63   -
64   - @ExcelProperty("备注")
65   - private String remark;
66   -
67   - @ExcelProperty("创建时间")
68   - private LocalDateTime createTime;
69   -
70   -}
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivablePlanExportReqVO.java deleted
1   -package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
2   -
3   -import io.swagger.v3.oas.annotations.media.Schema;
4   -import lombok.Data;
5   -import org.springframework.format.annotation.DateTimeFormat;
6   -
7   -import java.time.LocalDateTime;
8   -
9   -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
10   -
11   -// TODO liuhongfeng:导出可以等其它功能做完,统一在搞;
12   -@Schema(description = "管理后台 - CRM 回款计划 Excel 导出 Request VO,参数和 CrmReceivablePlanPageReqVO 是一致的")
13   -@Data
14   -public class CrmReceivablePlanExportReqVO {
15   -
16   - @Schema(description = "期数")
17   - private Integer period;
18   -
19   - @Schema(description = "完成状态", example = "2")
20   - private Integer status;
21   -
22   - @Schema(description = "审批状态", example = "1")
23   - private Integer checkStatus;
24   -
25   - @Schema(description = "计划回款日期")
26   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
27   - private LocalDateTime[] returnTime;
28   -
29   - @Schema(description = "提前几天提醒")
30   - private Integer remindDays;
31   -
32   - @Schema(description = "提醒日期")
33   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
34   - private LocalDateTime[] remindTime;
35   -
36   - @Schema(description = "客户名称", example = "18026")
37   - private Long customerId;
38   -
39   - @Schema(description = "合同名称", example = "3473")
40   - private Long contractId;
41   -
42   - @Schema(description = "负责人", example = "17828")
43   - private Long ownerUserId;
44   -
45   - @Schema(description = "备注", example = "随便")
46   - private String remark;
47   -
48   - @Schema(description = "创建时间")
49   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
50   - private LocalDateTime[] createTime;
51   -
52   -}
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivablePlanBaseVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanBaseVO.java
1   -package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
  1 +package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan;
2 2  
3   -import cn.iocoder.yudao.framework.common.validation.InEnum;
4   -import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum;
5 3 import io.swagger.v3.oas.annotations.media.Schema;
6 4 import lombok.Data;
7 5 import org.springframework.format.annotation.DateTimeFormat;
... ... @@ -20,17 +18,9 @@ public class CrmReceivablePlanBaseVO {
20 18 @Schema(description = "期数", example = "1")
21 19 private Integer period;
22 20  
23   - // TODO @liuhongfeng:回款计划编号
24   - @Schema(description = "回款计划", example = "19852")
  21 + @Schema(description = "回款计划编号", example = "19852")
25 22 private Long receivableId;
26 23  
27   - @Schema(description = "完成状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
28   - private Integer status;
29   -
30   - @Schema(description = "审批状态", example = "1")
31   - @InEnum(CrmAuditStatusEnum.class)
32   - private Integer checkStatus;
33   -
34 24 @Schema(description = "计划回款金额", example = "29675")
35 25 private Integer price;
36 26  
... ... @@ -45,16 +35,14 @@ public class CrmReceivablePlanBaseVO {
45 35 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
46 36 private LocalDateTime remindTime;
47 37  
48   - // TODO @liuhongfeng:客户编号
49 38 @Schema(description = "客户名称", example = "18026")
50 39 private Long customerId;
51 40  
52   - // TODO @liuhongfeng:合同编号
53   - @Schema(description = "合同名称", example = "3473")
  41 + @Schema(description = "合同编号", example = "3473")
54 42 private Long contractId;
55 43  
56 44 // TODO @liuhongfeng:负责人编号
57   - @Schema(description = "负责人", example = "17828")
  45 + @Schema(description = "负责人编号", example = "17828")
58 46 private Long ownerUserId;
59 47  
60 48 @Schema(description = "显示顺序")
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivablePlanCreateReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanCreateReqVO.java
1   -package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
  1 +package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan;
2 2  
3 3 import lombok.*;
4 4 import io.swagger.v3.oas.annotations.media.Schema;
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivablePlanPageReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanPageReqVO.java
1   -package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
  1 +package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageParam;
4 4 import io.swagger.v3.oas.annotations.media.Schema;
5 5 import lombok.Data;
6 6 import lombok.EqualsAndHashCode;
7 7 import lombok.ToString;
8   -import org.springframework.format.annotation.DateTimeFormat;
9   -
10   -import java.time.LocalDateTime;
11   -
12   -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
13 8  
14 9 @Schema(description = "管理后台 - CRM 回款计划分页 Request VO")
15 10 @Data
... ... @@ -17,33 +12,11 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
17 12 @ToString(callSuper = true)
18 13 public class CrmReceivablePlanPageReqVO extends PageParam {
19 14  
20   - // TODO @liuhongfeng:可以根据需求,去除掉一些不要的过滤条件;另外,customerId、contractId、ownerUserId 注释不正确,应该都是对应的编号
21   -
22   - @Schema(description = "完成状态", example = "2")
23   - private Integer status;
24   -
25   - @Schema(description = "审批状态", example = "1")
26   - private Integer checkStatus;
27   -
28   - @Schema(description = "计划回款日期")
29   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
30   - private LocalDateTime[] returnTime;
31   -
32   - @Schema(description = "提醒日期")
33   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
34   - private LocalDateTime[] remindTime;
35   -
36   - @Schema(description = "客户名称", example = "18026")
  15 + @Schema(description = "客户编号", example = "18026")
37 16 private Long customerId;
38 17  
  18 + // TODO @芋艿:这个搜的应该是合同编号 no
39 19 @Schema(description = "合同名称", example = "3473")
40 20 private Long contractId;
41 21  
42   - @Schema(description = "负责人", example = "17828")
43   - private Long ownerUserId;
44   -
45   - @Schema(description = "创建时间")
46   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
47   - private LocalDateTime[] createTime;
48   -
49 22 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivablePlanRespVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanRespVO.java
1   -package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
  1 +package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan;
2 2  
3 3 import io.swagger.v3.oas.annotations.media.Schema;
4 4 import lombok.*;
... ... @@ -16,4 +16,25 @@ public class CrmReceivablePlanRespVO extends CrmReceivablePlanBaseVO {
16 16 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
17 17 private LocalDateTime createTime;
18 18  
  19 + @Schema(description = "客户名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "test")
  20 + private String customerName;
  21 +
  22 + @Schema(description = "合同编号", example = "Q110")
  23 + private String contractNo;
  24 +
  25 + @Schema(description = "负责人", example = "test")
  26 + private String ownerUserName;
  27 +
  28 + @Schema(description = "创建人", example = "25682")
  29 + private String creator;
  30 +
  31 + @Schema(description = "创建人名字", example = "test")
  32 + private String creatorName;
  33 +
  34 + @Schema(description = "完成状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
  35 + private Boolean finishStatus;
  36 +
  37 + @Schema(description = "回款方式", example = "1") // 来自 Receivable 的 returnType 字段
  38 + private Integer returnType;
  39 +
19 40 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivablePlanUpdateReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanUpdateReqVO.java
1   -package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
  1 +package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan;
2 2  
3 3 import io.swagger.v3.oas.annotations.media.Schema;
4 4 import lombok.*;
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableBaseVO.java
... ... @@ -42,7 +42,7 @@ public class CrmReceivableBaseVO {
42 42 private LocalDateTime returnTime;
43 43  
44 44 @Schema(description = "回款方式", example = "2")
45   - private String returnType;
  45 + private Integer returnType;
46 46  
47 47 @Schema(description = "回款金额,单位:分", example = "31859")
48 48 private Integer price;
... ... @@ -51,9 +51,6 @@ public class CrmReceivableBaseVO {
51 51 @Schema(description = "负责人", example = "22202")
52 52 private Long ownerUserId;
53 53  
54   - @Schema(description = "批次", example = "2539")
55   - private Long batchId;
56   -
57 54 @Schema(description = "显示顺序")
58 55 private Integer sort;
59 56  
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/receivable/CrmReceivablePlanConvert.java
1 1 package cn.iocoder.yudao.module.crm.convert.receivable;
2 2  
3   -import java.util.*;
4   -
5 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
6   -
  4 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanCreateReqVO;
  5 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanRespVO;
  6 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanUpdateReqVO;
  7 +import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
  8 +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
  9 +import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
7 10 import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO;
  11 +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
8 12 import org.mapstruct.Mapper;
9 13 import org.mapstruct.factory.Mappers;
10   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
  14 +
  15 +import java.util.List;
  16 +import java.util.Map;
  17 +
  18 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
  19 +import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen;
11 20  
12 21 /**
13 22 * 回款计划 Convert
... ... @@ -27,8 +36,31 @@ public interface CrmReceivablePlanConvert {
27 36  
28 37 List<CrmReceivablePlanRespVO> convertList(List<CrmReceivablePlanDO> list);
29 38  
30   - PageResult<CrmReceivablePlanRespVO> convertPage(PageResult<CrmReceivablePlanDO> page);
  39 + default PageResult<CrmReceivablePlanRespVO> convertPage(PageResult<CrmReceivablePlanDO> pageResult, Map<Long, AdminUserRespDTO> userMap,
  40 + List<CrmCustomerDO> customerList, List<CrmContractDO> contractList,
  41 + List<CrmReceivableDO> receivableList) {
  42 + return new PageResult<>(converList(pageResult.getList(), userMap, customerList, contractList, receivableList), pageResult.getTotal());
  43 + }
  44 +
  45 + default List<CrmReceivablePlanRespVO> converList(List<CrmReceivablePlanDO> receivablePlanList, Map<Long, AdminUserRespDTO> userMap,
  46 + List<CrmCustomerDO> customerList, List<CrmContractDO> contractList,
  47 + List<CrmReceivableDO> receivableList) {
  48 + List<CrmReceivablePlanRespVO> result = convertList(receivablePlanList);
  49 + Map<Long, CrmCustomerDO> customerMap = convertMap(customerList, CrmCustomerDO::getId);
  50 + Map<Long, CrmContractDO> contractMap = convertMap(contractList, CrmContractDO::getId);
  51 + Map<Long, CrmReceivableDO> receivableMap = convertMap(receivableList, CrmReceivableDO::getId);
  52 + result.forEach(item -> {
  53 + setUserInfo(item, userMap);
  54 + findAndThen(customerMap, item.getCustomerId(), customer -> item.setCustomerName(customer.getName()));
  55 + findAndThen(contractMap, item.getContractId(), contract -> item.setContractNo(contract.getNo()));
  56 + findAndThen(receivableMap, item.getReceivableId(), receivable -> item.setReturnType(receivable.getReturnType()));
  57 + });
  58 + return result;
  59 + }
31 60  
32   - List<CrmReceivablePlanExcelVO> convertList02(List<CrmReceivablePlanDO> list);
  61 + static void setUserInfo(CrmReceivablePlanRespVO receivablePlan, Map<Long, AdminUserRespDTO> userMap) {
  62 + findAndThen(userMap, receivablePlan.getOwnerUserId(), user -> receivablePlan.setOwnerUserName(user.getNickname()));
  63 + findAndThen(userMap, Long.parseLong(receivablePlan.getCreator()), user -> receivablePlan.setCreatorName(user.getNickname()));
  64 + }
33 65  
34 66 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/receivable/CrmReceivableDO.java
... ... @@ -68,7 +68,7 @@ public class CrmReceivableDO extends BaseDO {
68 68 /**
69 69 * 回款方式
70 70 */
71   - private String returnType;
  71 + private Integer returnType;
72 72 /**
73 73 * 回款金额
74 74 */
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/receivable/CrmReceivablePlanDO.java
... ... @@ -38,26 +38,10 @@ public class CrmReceivablePlanDO extends BaseDO {
38 38 * TODO @liuhongfeng:少关联实体;
39 39 */
40 40 private Long receivableId;
41   - // TODO @liuhongfeng:还款计划,没有 status 和 checkStatus,改成 finishStatus Boolean;是否完成
42 41 /**
43   - * 状态
44   - *
45   - * 枚举 {@link cn.iocoder.yudao.framework.common.enums.CommonStatusEnum}
46   - */
47   - private Integer status;
48   - /**
49   - * 审批状态
50   - *
51   - * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_AUDIT_STATUS}
52   - * // TODO @liuhongfeng:关联的枚举
53   - */
54   - private Integer checkStatus;
55   - /**
56   - * 工作流编号
57   - *
58   - * TODO @liuhongfeng:少关联实体;
  42 + * 完成状态
59 43 */
60   - private Long processInstanceId;
  44 + private Boolean finishStatus;
61 45 /**
62 46 * 计划回款金额,单位:分
63 47 */
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivablePlanMapper.java
1 1 package cn.iocoder.yudao.module.crm.dal.mysql.receivable;
2 2  
3   -import java.util.*;
4   -
5 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
6   -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
7 4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  5 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  6 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanPageReqVO;
8 7 import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO;
9 8 import org.apache.ibatis.annotations.Mapper;
10   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
11 9  
12 10 /**
13 11 * 回款计划 Mapper
... ... @@ -19,30 +17,15 @@ public interface CrmReceivablePlanMapper extends BaseMapperX&lt;CrmReceivablePlanDO
19 17  
20 18 default PageResult<CrmReceivablePlanDO> selectPage(CrmReceivablePlanPageReqVO reqVO) {
21 19 return selectPage(reqVO, new LambdaQueryWrapperX<CrmReceivablePlanDO>()
22   - .eqIfPresent(CrmReceivablePlanDO::getStatus, reqVO.getStatus())
23   - .eqIfPresent(CrmReceivablePlanDO::getCheckStatus, reqVO.getCheckStatus())
24   - .betweenIfPresent(CrmReceivablePlanDO::getReturnTime, reqVO.getReturnTime())
25   - .betweenIfPresent(CrmReceivablePlanDO::getRemindTime, reqVO.getRemindTime())
26 20 .eqIfPresent(CrmReceivablePlanDO::getCustomerId, reqVO.getCustomerId())
27 21 .eqIfPresent(CrmReceivablePlanDO::getContractId, reqVO.getContractId())
28   - .eqIfPresent(CrmReceivablePlanDO::getOwnerUserId, reqVO.getOwnerUserId())
29   - .betweenIfPresent(CrmReceivablePlanDO::getCreateTime, reqVO.getCreateTime())
30 22 .orderByDesc(CrmReceivablePlanDO::getId));
31 23 }
32 24  
33   - default List<CrmReceivablePlanDO> selectList(CrmReceivablePlanExportReqVO reqVO) {
34   - return selectList(new LambdaQueryWrapperX<CrmReceivablePlanDO>()
35   - .eqIfPresent(CrmReceivablePlanDO::getPeriod, reqVO.getPeriod())
36   - .eqIfPresent(CrmReceivablePlanDO::getStatus, reqVO.getStatus())
37   - .eqIfPresent(CrmReceivablePlanDO::getCheckStatus, reqVO.getCheckStatus())
38   - .betweenIfPresent(CrmReceivablePlanDO::getReturnTime, reqVO.getReturnTime())
39   - .eqIfPresent(CrmReceivablePlanDO::getRemindDays, reqVO.getRemindDays())
40   - .betweenIfPresent(CrmReceivablePlanDO::getRemindTime, reqVO.getRemindTime())
41   - .eqIfPresent(CrmReceivablePlanDO::getCustomerId, reqVO.getCustomerId())
  25 + default PageResult<CrmReceivablePlanDO> selectPageByCustomer(CrmReceivablePlanPageReqVO reqVO) {
  26 + return selectPage(reqVO, new LambdaQueryWrapperX<CrmReceivablePlanDO>()
  27 + .eq(CrmReceivablePlanDO::getCustomerId, reqVO.getCustomerId()) // 必须传递
42 28 .eqIfPresent(CrmReceivablePlanDO::getContractId, reqVO.getContractId())
43   - .eqIfPresent(CrmReceivablePlanDO::getOwnerUserId, reqVO.getOwnerUserId())
44   - .eqIfPresent(CrmReceivablePlanDO::getRemark, reqVO.getRemark())
45   - .betweenIfPresent(CrmReceivablePlanDO::getCreateTime, reqVO.getCreateTime())
46 29 .orderByDesc(CrmReceivablePlanDO::getId));
47 30 }
48 31  
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivablePlanService.java
1 1 package cn.iocoder.yudao.module.crm.service.receivable;
2 2  
3   -import java.util.*;
4   -import javax.validation.*;
5   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
6   -import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO;
7 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanCreateReqVO;
  5 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanPageReqVO;
  6 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanUpdateReqVO;
  7 +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
  8 +import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO;
  9 +
  10 +import javax.validation.Valid;
  11 +import java.util.Collection;
  12 +import java.util.List;
8 13  
9 14 /**
10   - * 回款计划 Service 接口
  15 + * CRM 回款计划 Service 接口
11 16 *
12 17 * @author 芋道源码
13 18 */
... ... @@ -54,17 +59,21 @@ public interface CrmReceivablePlanService {
54 59 /**
55 60 * 获得回款计划分页
56 61 *
  62 + * 数据权限:基于 {@link CrmReceivablePlanDO} 读取
  63 + *
57 64 * @param pageReqVO 分页查询
58 65 * @return 回款计划分页
59 66 */
60 67 PageResult<CrmReceivablePlanDO> getReceivablePlanPage(CrmReceivablePlanPageReqVO pageReqVO);
61 68  
62 69 /**
63   - * 获得回款计划列表, 用于 Excel 导出
  70 + * 获得回款计划分页,基于指定客户
64 71 *
65   - * @param exportReqVO 查询条件
66   - * @return 回款计划列表
  72 + * 数据权限:基于 {@link CrmCustomerDO} 读取
  73 + *
  74 + * @param pageReqVO 分页查询
  75 + * @return 回款计划分页
67 76 */
68   - List<CrmReceivablePlanDO> getReceivablePlanList(CrmReceivablePlanExportReqVO exportReqVO);
  77 + PageResult<CrmReceivablePlanDO> getReceivablePlanPageByCustomer(CrmReceivablePlanPageReqVO pageReqVO);
69 78  
70 79 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivablePlanServiceImpl.java
... ... @@ -3,18 +3,18 @@ package cn.iocoder.yudao.module.crm.service.receivable;
3 3 import cn.hutool.core.collection.CollUtil;
4 4 import cn.hutool.core.collection.ListUtil;
5 5 import cn.hutool.core.util.ObjectUtil;
6   -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
7 6 import cn.iocoder.yudao.framework.common.pojo.PageResult;
8   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePlanCreateReqVO;
9   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePlanExportReqVO;
10   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePlanPageReqVO;
11   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePlanUpdateReqVO;
  7 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanCreateReqVO;
  8 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanPageReqVO;
  9 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanUpdateReqVO;
12 10 import cn.iocoder.yudao.module.crm.convert.receivable.CrmReceivablePlanConvert;
13 11 import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
14 12 import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
15 13 import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO;
16 14 import cn.iocoder.yudao.module.crm.dal.mysql.receivable.CrmReceivablePlanMapper;
17   -import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum;
  15 +import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum;
  16 +import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum;
  17 +import cn.iocoder.yudao.module.crm.framework.core.annotations.CrmPermission;
18 18 import cn.iocoder.yudao.module.crm.service.contract.CrmContractService;
19 19 import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
20 20 import org.springframework.stereotype.Service;
... ... @@ -28,6 +28,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
28 28 import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
29 29  
30 30 // TODO @liuhongfeng:参考 CrmReceivableServiceImpl 写的 todo 哈;
  31 +// TODO @puhui999:数据权限
31 32 /**
32 33 * 回款计划 Service 实现类
33 34 *
... ... @@ -38,26 +39,22 @@ import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
38 39 public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService {
39 40  
40 41 @Resource
41   - private CrmReceivablePlanMapper crmReceivablePlanMapper;
  42 + private CrmReceivablePlanMapper receivablePlanMapper;
  43 +
42 44 @Resource
43 45 private CrmContractService contractService;
44 46 @Resource
45   - private CrmCustomerService crmCustomerService;
  47 + private CrmCustomerService customerService;
46 48  
47 49 @Override
48 50 public Long createReceivablePlan(CrmReceivablePlanCreateReqVO createReqVO) {
49 51 // 插入
50 52 CrmReceivablePlanDO receivablePlan = CrmReceivablePlanConvert.INSTANCE.convert(createReqVO);
51   - if (ObjectUtil.isNull(receivablePlan.getStatus())){
52   - receivablePlan.setStatus(CommonStatusEnum.ENABLE.getStatus());
53   - }
54   - if (ObjectUtil.isNull(receivablePlan.getCheckStatus())){
55   - receivablePlan.setCheckStatus(CrmAuditStatusEnum.DRAFT.getStatus());
56   - }
  53 + receivablePlan.setFinishStatus(false);
57 54  
58 55 checkReceivablePlan(receivablePlan);
59 56  
60   - crmReceivablePlanMapper.insert(receivablePlan);
  57 + receivablePlanMapper.insert(receivablePlan);
61 58 // 返回
62 59 return receivablePlan.getId();
63 60 }
... ... @@ -73,7 +70,7 @@ public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService {
73 70 throw exception(CONTRACT_NOT_EXISTS);
74 71 }
75 72  
76   - CrmCustomerDO customer = crmCustomerService.getCustomer(receivablePlan.getCustomerId());
  73 + CrmCustomerDO customer = customerService.getCustomer(receivablePlan.getCustomerId());
77 74 if(ObjectUtil.isNull(customer)){
78 75 throw exception(CUSTOMER_NOT_EXISTS);
79 76 }
... ... @@ -87,7 +84,7 @@ public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService {
87 84  
88 85 // 更新
89 86 CrmReceivablePlanDO updateObj = CrmReceivablePlanConvert.INSTANCE.convert(updateReqVO);
90   - crmReceivablePlanMapper.updateById(updateObj);
  87 + receivablePlanMapper.updateById(updateObj);
91 88 }
92 89  
93 90 @Override
... ... @@ -95,18 +92,18 @@ public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService {
95 92 // 校验存在
96 93 validateReceivablePlanExists(id);
97 94 // 删除
98   - crmReceivablePlanMapper.deleteById(id);
  95 + receivablePlanMapper.deleteById(id);
99 96 }
100 97  
101 98 private void validateReceivablePlanExists(Long id) {
102   - if (crmReceivablePlanMapper.selectById(id) == null) {
  99 + if (receivablePlanMapper.selectById(id) == null) {
103 100 throw exception(RECEIVABLE_PLAN_NOT_EXISTS);
104 101 }
105 102 }
106 103  
107 104 @Override
108 105 public CrmReceivablePlanDO getReceivablePlan(Long id) {
109   - return crmReceivablePlanMapper.selectById(id);
  106 + return receivablePlanMapper.selectById(id);
110 107 }
111 108  
112 109 @Override
... ... @@ -114,17 +111,18 @@ public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService {
114 111 if (CollUtil.isEmpty(ids)) {
115 112 return ListUtil.empty();
116 113 }
117   - return crmReceivablePlanMapper.selectBatchIds(ids);
  114 + return receivablePlanMapper.selectBatchIds(ids);
118 115 }
119 116  
120 117 @Override
121 118 public PageResult<CrmReceivablePlanDO> getReceivablePlanPage(CrmReceivablePlanPageReqVO pageReqVO) {
122   - return crmReceivablePlanMapper.selectPage(pageReqVO);
  119 + return receivablePlanMapper.selectPage(pageReqVO);
123 120 }
124 121  
125 122 @Override
126   - public List<CrmReceivablePlanDO> getReceivablePlanList(CrmReceivablePlanExportReqVO exportReqVO) {
127   - return crmReceivablePlanMapper.selectList(exportReqVO);
  123 + @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#pageReqVO.customerId", level = CrmPermissionLevelEnum.READ)
  124 + public PageResult<CrmReceivablePlanDO> getReceivablePlanPageByCustomer(CrmReceivablePlanPageReqVO pageReqVO) {
  125 + return receivablePlanMapper.selectPageByCustomer(pageReqVO);
128 126 }
129 127  
130 128 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImplTest.java
... ... @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.crm.service.business;
2 2  
3 3 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
4 4 import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessCreateReqVO;
5   -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessExportReqVO;
6 5 import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessUpdateReqVO;
7 6 import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
8 7 import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessMapper;
... ... @@ -11,9 +10,7 @@ import org.junit.jupiter.api.Test;
11 10 import org.springframework.context.annotation.Import;
12 11  
13 12 import javax.annotation.Resource;
14   -import java.util.List;
15 13  
16   -import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
17 14 import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
18 15 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
19 16 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
21 18 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
22 19 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
23 20 import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_NOT_EXISTS;
24   -import static org.junit.jupiter.api.Assertions.*;
  21 +import static org.junit.jupiter.api.Assertions.assertNotNull;
  22 +import static org.junit.jupiter.api.Assertions.assertNull;
25 23  
26 24 /**
27 25 * {@link CrmBusinessServiceImpl} 的单元测试类
... ... @@ -181,84 +179,4 @@ public class CrmBusinessServiceImplTest extends BaseDbUnitTest {
181 179 //assertPojoEquals(dbBusiness, pageResult.getList().get(0));
182 180 }
183 181  
184   - @Test
185   - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
186   - public void testGetBusinessList() {
187   - // mock 数据
188   - CrmBusinessDO dbBusiness = randomPojo(CrmBusinessDO.class, o -> { // 等会查询到
189   - o.setName(null);
190   - o.setStatusTypeId(null);
191   - o.setStatusId(null);
192   - o.setContactNextTime(null);
193   - o.setCustomerId(null);
194   - o.setDealTime(null);
195   - o.setPrice(null);
196   - o.setDiscountPercent(null);
197   - o.setProductPrice(null);
198   - o.setRemark(null);
199   - o.setCreateTime(null);
200   - o.setEndStatus(null);
201   - o.setEndRemark(null);
202   - o.setContactLastTime(null);
203   - o.setFollowUpStatus(null);
204   - });
205   - businessMapper.insert(dbBusiness);
206   - // 测试 name 不匹配
207   - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setName(null)));
208   - // 测试 statusTypeId 不匹配
209   - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setStatusTypeId(null)));
210   - // 测试 statusId 不匹配
211   - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setStatusId(null)));
212   - // 测试 contactNextTime 不匹配
213   - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setContactNextTime(null)));
214   - // 测试 customerId 不匹配
215   - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setCustomerId(null)));
216   - // 测试 dealTime 不匹配
217   - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setDealTime(null)));
218   - // 测试 price 不匹配
219   - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setPrice(null)));
220   - // 测试 discountPercent 不匹配
221   - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setDiscountPercent(null)));
222   - // 测试 productPrice 不匹配
223   - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setProductPrice(null)));
224   - // 测试 remark 不匹配
225   - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setRemark(null)));
226   - // 测试 createTime 不匹配
227   - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setCreateTime(null)));
228   - // 测试 endStatus 不匹配
229   - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setEndStatus(null)));
230   - // 测试 endRemark 不匹配
231   - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setEndRemark(null)));
232   - // 测试 contactLastTime 不匹配
233   - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setContactLastTime(null)));
234   - // 测试 followUpStatus 不匹配
235   - businessMapper.insert(cloneIgnoreId(dbBusiness, o -> o.setFollowUpStatus(null)));
236   - // 准备参数
237   - CrmBusinessExportReqVO reqVO = new CrmBusinessExportReqVO();
238   - reqVO.setName(null);
239   - reqVO.setStatusTypeId(null);
240   - reqVO.setStatusId(null);
241   - reqVO.setContactNextTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
242   - reqVO.setCustomerId(null);
243   - reqVO.setDealTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
244   - reqVO.setPrice(null);
245   - reqVO.setDiscountPercent(null);
246   - reqVO.setProductPrice(null);
247   - reqVO.setRemark(null);
248   - reqVO.setOwnerUserId(null);
249   - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
250   - reqVO.setRoUserIds(null);
251   - reqVO.setRwUserIds(null);
252   - reqVO.setEndStatus(null);
253   - reqVO.setEndRemark(null);
254   - reqVO.setContactLastTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
255   - reqVO.setFollowUpStatus(null);
256   -
257   - // 调用
258   - List<CrmBusinessDO> list = businessService.getBusinessList(reqVO);
259   - // 断言
260   - assertEquals(1, list.size());
261   - assertPojoEquals(dbBusiness, list.get(0));
262   - }
263   -
264 182 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/contract/ContractServiceImplTest.java
... ... @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.crm.service.contract;
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 4 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
5 5 import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractCreateReqVO;
6   -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractExportReqVO;
7 6 import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO;
8 7 import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractUpdateReqVO;
9 8 import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
... ... @@ -13,9 +12,7 @@ import org.junit.jupiter.api.Test;
13 12 import org.springframework.context.annotation.Import;
14 13  
15 14 import javax.annotation.Resource;
16   -import java.util.List;
17 15  
18   -import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
19 16 import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
20 17 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
21 18 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
... ... @@ -120,25 +117,14 @@ public class ContractServiceImplTest extends BaseDbUnitTest {
120 117 contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setName(null)));
121 118 // 测试 customerId 不匹配
122 119 contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setCustomerId(null)));
123   - // 测试 businessId 不匹配
124   - contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setBusinessId(null)));
125   - // 测试 orderDate 不匹配
126   - contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setOrderDate(null)));
127 120 // 测试 no 不匹配
128 121 contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setNo(null)));
129   - // 测试 discountPercent 不匹配
130   - contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setDiscountPercent(null)));
131   - // 测试 productPrice 不匹配
132   - contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setProductPrice(null)));
133 122 // 准备参数
134 123 CrmContractPageReqVO reqVO = new CrmContractPageReqVO();
135 124 reqVO.setName(null);
136 125 reqVO.setCustomerId(null);
137 126 reqVO.setBusinessId(null);
138   - reqVO.setOrderDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
139 127 reqVO.setNo(null);
140   - reqVO.setDiscountPercent(null);
141   - reqVO.setProductPrice(null);
142 128  
143 129 // 调用
144 130 PageResult<CrmContractDO> pageResult = contractService.getContractPage(reqVO);
... ... @@ -148,49 +134,4 @@ public class ContractServiceImplTest extends BaseDbUnitTest {
148 134 assertPojoEquals(dbContract, pageResult.getList().get(0));
149 135 }
150 136  
151   - @Test
152   - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
153   - public void testGetContractList() {
154   - // mock 数据
155   - CrmContractDO dbContract = randomPojo(CrmContractDO.class, o -> { // 等会查询到
156   - o.setName("合同名称");
157   - o.setCustomerId(null);
158   - o.setBusinessId(null);
159   - o.setOrderDate(null);
160   - o.setNo(null);
161   - o.setDiscountPercent(null);
162   - o.setProductPrice(null);
163   - });
164   - contractMapper.insert(dbContract);
165   - // 测试 name 不匹配
166   - contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setName(null)));
167   - // 测试 customerId 不匹配
168   - contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setCustomerId(null)));
169   - // 测试 businessId 不匹配
170   - contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setBusinessId(null)));
171   - // 测试 orderDate 不匹配
172   - contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setOrderDate(null)));
173   - // 测试 no 不匹配
174   - contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setNo(null)));
175   - // 测试 discountPercent 不匹配
176   - contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setDiscountPercent(null)));
177   - // 测试 productPrice 不匹配
178   - contractMapper.insert(cloneIgnoreId(dbContract, o -> o.setProductPrice(null)));
179   - // 准备参数
180   - ContractExportReqVO reqVO = new ContractExportReqVO();
181   - reqVO.setName(null);
182   - reqVO.setCustomerId(null);
183   - reqVO.setBusinessId(null);
184   - reqVO.setOrderDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
185   - reqVO.setNo(null);
186   - reqVO.setDiscountPercent(null);
187   - reqVO.setProductPrice(null);
188   -
189   - // 调用
190   - List<CrmContractDO> list = contractService.getContractList(reqVO);
191   - // 断言
192   - assertEquals(1, list.size());
193   - assertPojoEquals(dbContract, list.get(0));
194   - }
195   -
196 137 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/receivable/CrmCrmReceivablePlanServiceImplTest.java
... ... @@ -2,10 +2,9 @@ package cn.iocoder.yudao.module.crm.service.receivable;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 4 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
5   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePlanCreateReqVO;
6   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePlanExportReqVO;
7   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePlanPageReqVO;
8   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePlanUpdateReqVO;
  5 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanCreateReqVO;
  6 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanPageReqVO;
  7 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanUpdateReqVO;
9 8 import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO;
10 9 import cn.iocoder.yudao.module.crm.dal.mysql.receivable.CrmReceivablePlanMapper;
11 10 import org.junit.jupiter.api.Disabled;
... ... @@ -13,9 +12,7 @@ import org.junit.jupiter.api.Test;
13 12 import org.springframework.context.annotation.Import;
14 13  
15 14 import javax.annotation.Resource;
16   -import java.util.List;
17 15  
18   -import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
19 16 import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
20 17 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
21 18 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
... ... @@ -108,8 +105,6 @@ public class CrmCrmReceivablePlanServiceImplTest extends BaseDbUnitTest {
108 105 // mock 数据
109 106 CrmReceivablePlanDO dbReceivablePlan = randomPojo(CrmReceivablePlanDO.class, o -> { // 等会查询到
110 107 o.setPeriod(null);
111   - o.setStatus(null);
112   - o.setCheckStatus(null);
113 108 o.setReturnTime(null);
114 109 o.setRemindDays(null);
115 110 o.setRemindTime(null);
... ... @@ -120,38 +115,14 @@ public class CrmCrmReceivablePlanServiceImplTest extends BaseDbUnitTest {
120 115 o.setCreateTime(null);
121 116 });
122 117 crmReceivablePlanMapper.insert(dbReceivablePlan);
123   - // 测试 Period 不匹配
124   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setPeriod(null)));
125   - // 测试 status 不匹配
126   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setStatus(null)));
127   - // 测试 checkStatus 不匹配
128   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCheckStatus(null)));
129   - // 测试 returnTime 不匹配
130   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setReturnTime(null)));
131   - // 测试 remindDays 不匹配
132   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setRemindDays(null)));
133   - // 测试 remindTime 不匹配
134   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setRemindTime(null)));
135 118 // 测试 customerId 不匹配
136 119 crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCustomerId(null)));
137 120 // 测试 contractId 不匹配
138 121 crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setContractId(null)));
139   - // 测试 ownerUserId 不匹配
140   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setOwnerUserId(null)));
141   - // 测试 remark 不匹配
142   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setRemark(null)));
143   - // 测试 createTime 不匹配
144   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCreateTime(null)));
145 122 // 准备参数
146 123 CrmReceivablePlanPageReqVO reqVO = new CrmReceivablePlanPageReqVO();
147   - reqVO.setStatus(null);
148   - reqVO.setCheckStatus(null);
149   - reqVO.setReturnTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
150   - reqVO.setRemindTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
151 124 reqVO.setCustomerId(null);
152 125 reqVO.setContractId(null);
153   - reqVO.setOwnerUserId(null);
154   - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
155 126  
156 127 // 调用
157 128 PageResult<CrmReceivablePlanDO> pageResult = receivablePlanService.getReceivablePlanPage(reqVO);
... ... @@ -161,65 +132,4 @@ public class CrmCrmReceivablePlanServiceImplTest extends BaseDbUnitTest {
161 132 assertPojoEquals(dbReceivablePlan, pageResult.getList().get(0));
162 133 }
163 134  
164   - @Test
165   - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
166   - public void testGetReceivablePlanList() {
167   - // mock 数据
168   - CrmReceivablePlanDO dbReceivablePlan = randomPojo(CrmReceivablePlanDO.class, o -> { // 等会查询到
169   - o.setPeriod(null);
170   - o.setStatus(null);
171   - o.setCheckStatus(null);
172   - o.setReturnTime(null);
173   - o.setRemindDays(null);
174   - o.setRemindTime(null);
175   - o.setCustomerId(null);
176   - o.setContractId(null);
177   - o.setOwnerUserId(null);
178   - o.setRemark(null);
179   - o.setCreateTime(null);
180   - });
181   - crmReceivablePlanMapper.insert(dbReceivablePlan);
182   - // 测试 Period 不匹配
183   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setPeriod(null)));
184   - // 测试 status 不匹配
185   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setStatus(null)));
186   - // 测试 checkStatus 不匹配
187   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCheckStatus(null)));
188   - // 测试 returnTime 不匹配
189   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setReturnTime(null)));
190   - // 测试 remindDays 不匹配
191   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setRemindDays(null)));
192   - // 测试 remindTime 不匹配
193   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setRemindTime(null)));
194   - // 测试 customerId 不匹配
195   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCustomerId(null)));
196   - // 测试 contractId 不匹配
197   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setContractId(null)));
198   - // 测试 ownerUserId 不匹配
199   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setOwnerUserId(null)));
200   - // 测试 remark 不匹配
201   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setRemark(null)));
202   - // 测试 createTime 不匹配
203   - crmReceivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCreateTime(null)));
204   - // 准备参数
205   - CrmReceivablePlanExportReqVO reqVO = new CrmReceivablePlanExportReqVO();
206   - reqVO.setPeriod(null);
207   - reqVO.setStatus(null);
208   - reqVO.setCheckStatus(null);
209   - reqVO.setReturnTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
210   - reqVO.setRemindDays(null);
211   - reqVO.setRemindTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
212   - reqVO.setCustomerId(null);
213   - reqVO.setContractId(null);
214   - reqVO.setOwnerUserId(null);
215   - reqVO.setRemark(null);
216   - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
217   -
218   - // 调用
219   - List<CrmReceivablePlanDO> list = receivablePlanService.getReceivablePlanList(reqVO);
220   - // 断言
221   - assertEquals(1, list.size());
222   - assertPojoEquals(dbReceivablePlan, list.get(0));
223   - }
224   -
225 135 }
... ...