Commit f02b9464bdbbd9f13a54dd0d56583a23fce088b3

Authored by YunaiV
1 parent db03b10d

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

Showing 27 changed files with 244 additions and 467 deletions
sql/mysql/crm_data.sql
1 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');
  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 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');
  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 5  
6 6  
7 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');
... ...
sql/mysql/ruoyi-vue-pro.sql
... ... @@ -2405,12 +2405,12 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i
2405 2405 INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2419, '联系人更新', 'crm:contact:update', 3, 3, 2416, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:14:56', '', '2023-10-29 11:14:56', b'0');
2406 2406 INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2420, '联系人删除', 'crm:contact:delete', 3, 4, 2416, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:14:56', '', '2023-10-29 11:14:56', b'0');
2407 2407 INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2421, '联系人导出', 'crm:contact:export', 3, 5, 2416, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:14:56', '', '2023-10-29 11:14:56', b'0');
2408   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2422, '回款管理', '', 2, 0, 2397, 'receivable', 'ep:money', 'crm/receivable/index', 'CrmReceivable', 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '1', '2023-10-29 19:18:52', b'0');
2409   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2423, '回款管理查询', 'crm:receivable:query', 3, 1, 2422, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '', '2023-10-29 11:18:09', b'0');
2410   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2424, '回款管理创建', 'crm:receivable:create', 3, 2, 2422, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '', '2023-10-29 11:18:09', b'0');
2411   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2425, '回款管理更新', 'crm:receivable:update', 3, 3, 2422, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '', '2023-10-29 11:18:09', b'0');
2412   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2426, '回款管理删除', 'crm:receivable:delete', 3, 4, 2422, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '', '2023-10-29 11:18:09', b'0');
2413   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2427, '回款管理导出', 'crm:receivable:export', 3, 5, 2422, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '', '2023-10-29 11:18:09', b'0');
  2408 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2422, '回款', '', 2, 0, 2397, 'receivable', 'ep:money', 'crm/receivable/index', 'CrmReceivable', 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '1', '2023-10-29 19:18:52', b'0');
  2409 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2423, '回款查询', 'crm:receivable:query', 3, 1, 2422, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '', '2023-10-29 11:18:09', b'0');
  2410 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2424, '回款创建', 'crm:receivable:create', 3, 2, 2422, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '', '2023-10-29 11:18:09', b'0');
  2411 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2425, '回款更新', 'crm:receivable:update', 3, 3, 2422, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '', '2023-10-29 11:18:09', b'0');
  2412 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2426, '回款删除', 'crm:receivable:delete', 3, 4, 2422, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '', '2023-10-29 11:18:09', b'0');
  2413 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2427, '回款导出', 'crm:receivable:export', 3, 5, 2422, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '', '2023-10-29 11:18:09', b'0');
2414 2414 INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2428, '回款计划管理', '', 2, 0, 2397, 'receivable-plan', 'fa:money', 'crm/receivablePlan/index', 'CrmReceivablePlan', 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '1', '2023-10-29 19:19:08', b'0');
2415 2415 INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2429, '回款计划查询', 'crm:receivable-plan:query', 3, 1, 2428, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '', '2023-10-29 11:18:09', b'0');
2416 2416 INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2430, '回款计划创建', 'crm:receivable-plan:create', 3, 2, 2428, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '', '2023-10-29 11:18:09', b'0');
... ...
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ErrorCodeConstants.java
... ... @@ -24,8 +24,8 @@ public interface ErrorCodeConstants {
24 24 // ========== 联系人管理 1-020-003-000 ==========
25 25 ErrorCode CONTACT_NOT_EXISTS = new ErrorCode(1_020_003_000, "联系人不存在");
26 26  
27   - // ========== 回款管理 1-020-004-000 ==========
28   - ErrorCode RECEIVABLE_NOT_EXISTS = new ErrorCode(1_020_004_000, "回款管理不存在");
  27 + // ========== 回款 1-020-004-000 ==========
  28 + ErrorCode RECEIVABLE_NOT_EXISTS = new ErrorCode(1_020_004_000, "回款不存在");
29 29  
30 30 // ========== 合同管理 1-020-005-000 ==========
31 31 ErrorCode RECEIVABLE_PLAN_NOT_EXISTS = new ErrorCode(1_020_005_000, "回款计划不存在");
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java
... ... @@ -112,10 +112,10 @@ public class CrmContractController {
112 112 }
113 113  
114 114 /**
115   - * 转换成详细的联系人分页,即读取关联信息
  115 + * 转换成详细的合同分页,即读取关联信息
116 116 *
117   - * @param pageResult 联系人分页
118   - * @return 详细的联系人分页
  117 + * @param pageResult 合同分页
  118 + * @return 详细的合同分页
119 119 */
120 120 private PageResult<ContractRespVO> convertDetailContractPage(PageResult<CrmContractDO> pageResult) {
121 121 List<CrmContractDO> contactList = pageResult.getList();
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivableController.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.receivable.CrmReceivableCreateReqVO;
  11 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO;
  12 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableRespVO;
  13 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableUpdateReqVO;
8 14 import cn.iocoder.yudao.module.crm.convert.receivable.CrmReceivableConvert;
  15 +import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
  16 +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
9 17 import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
  18 +import cn.iocoder.yudao.module.crm.service.contract.CrmContractService;
  19 +import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
10 20 import cn.iocoder.yudao.module.crm.service.receivable.CrmReceivableService;
  21 +import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
  22 +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
11 23 import io.swagger.v3.oas.annotations.Operation;
12 24 import io.swagger.v3.oas.annotations.Parameter;
13 25 import io.swagger.v3.oas.annotations.tags.Tag;
... ... @@ -20,71 +32,113 @@ import javax.servlet.http.HttpServletResponse;
20 32 import javax.validation.Valid;
21 33 import java.io.IOException;
22 34 import java.util.List;
  35 +import java.util.Map;
  36 +import java.util.stream.Stream;
23 37  
24 38 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  39 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertListByFlatMap;
  40 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
25 41 import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
26 42  
27   -@Tag(name = "管理后台 - CRM 回款管理")
  43 +@Tag(name = "管理后台 - CRM 回款")
28 44 @RestController
29 45 @RequestMapping("/crm/receivable")
30 46 @Validated
31 47 public class CrmReceivableController {
32 48  
33   - // TODO @liuhongfeng:crmReceivableService 可以使用 receivableService ;在自己模块里,相对简洁一点;
34 49 @Resource
35   - private CrmReceivableService crmReceivableService;
  50 + private CrmReceivableService receivableService;
  51 + @Resource
  52 + private CrmContractService contractService;
  53 + @Resource
  54 + private CrmCustomerService customerService;
  55 +
  56 + @Resource
  57 + private AdminUserApi adminUserApi;
36 58  
37 59 @PostMapping("/create")
38   - @Operation(summary = "创建回款管理")
  60 + @Operation(summary = "创建回款")
39 61 @PreAuthorize("@ss.hasPermission('crm:receivable:create')")
40 62 public CommonResult<Long> createReceivable(@Valid @RequestBody CrmReceivableCreateReqVO createReqVO) {
41   - return success(crmReceivableService.createReceivable(createReqVO));
  63 + return success(receivableService.createReceivable(createReqVO));
42 64 }
43 65  
44 66 @PutMapping("/update")
45   - @Operation(summary = "更新回款管理")
  67 + @Operation(summary = "更新回款")
46 68 @PreAuthorize("@ss.hasPermission('crm:receivable:update')")
47 69 public CommonResult<Boolean> updateReceivable(@Valid @RequestBody CrmReceivableUpdateReqVO updateReqVO) {
48   - crmReceivableService.updateReceivable(updateReqVO);
  70 + receivableService.updateReceivable(updateReqVO);
49 71 return success(true);
50 72 }
51 73  
52 74 @DeleteMapping("/delete")
53   - @Operation(summary = "删除回款管理")
  75 + @Operation(summary = "删除回款")
54 76 @Parameter(name = "id", description = "编号", required = true)
55 77 @PreAuthorize("@ss.hasPermission('crm:receivable:delete')")
56 78 public CommonResult<Boolean> deleteReceivable(@RequestParam("id") Long id) {
57   - crmReceivableService.deleteReceivable(id);
  79 + receivableService.deleteReceivable(id);
58 80 return success(true);
59 81 }
60 82  
61 83 @GetMapping("/get")
62   - @Operation(summary = "获得回款管理")
  84 + @Operation(summary = "获得回款")
63 85 @Parameter(name = "id", description = "编号", required = true, example = "1024")
64 86 @PreAuthorize("@ss.hasPermission('crm:receivable:query')")
65 87 public CommonResult<CrmReceivableRespVO> getReceivable(@RequestParam("id") Long id) {
66   - CrmReceivableDO receivable = crmReceivableService.getReceivable(id);
  88 + CrmReceivableDO receivable = receivableService.getReceivable(id);
67 89 return success(CrmReceivableConvert.INSTANCE.convert(receivable));
68 90 }
69 91  
70 92 @GetMapping("/page")
71   - @Operation(summary = "获得回款管理分页")
  93 + @Operation(summary = "获得回款分页")
72 94 @PreAuthorize("@ss.hasPermission('crm:receivable:query')")
73   - public CommonResult<PageResult<CrmReceivableRespVO>> getReceivablePage(@Valid CrmReceivablePageReqVO pageVO) {
74   - PageResult<CrmReceivableDO> pageResult = crmReceivableService.getReceivablePage(pageVO);
75   - return success(CrmReceivableConvert.INSTANCE.convertPage(pageResult));
  95 + public CommonResult<PageResult<CrmReceivableRespVO>> getReceivablePage(@Valid CrmReceivablePageReqVO pageReqVO) {
  96 + PageResult<CrmReceivableDO> pageResult = receivableService.getReceivablePage(pageReqVO);
  97 + return success(convertDetailReceivablePage(pageResult));
76 98 }
77 99  
  100 + @GetMapping("/page-by-customer")
  101 + @Operation(summary = "获得回款分页,基于指定客户")
  102 + public CommonResult<PageResult<CrmReceivableRespVO>> getContractPageByCustomer(@Valid CrmReceivablePageReqVO pageReqVO) {
  103 + Assert.notNull(pageReqVO.getCustomerId(), "客户编号不能为空");
  104 + PageResult<CrmReceivableDO> pageResult = receivableService.getReceivablePageByCustomer(pageReqVO);
  105 + return success(convertDetailReceivablePage(pageResult));
  106 + }
  107 +
  108 + // TODO 芋艿:后面在优化导出
78 109 @GetMapping("/export-excel")
79   - @Operation(summary = "导出回款管理 Excel")
  110 + @Operation(summary = "导出回款 Excel")
80 111 @PreAuthorize("@ss.hasPermission('crm:receivable:export')")
81 112 @OperateLog(type = EXPORT)
82   - public void exportReceivableExcel(@Valid CrmReceivableExportReqVO exportReqVO,
  113 + public void exportReceivableExcel(@Valid CrmReceivablePageReqVO exportReqVO,
83 114 HttpServletResponse response) throws IOException {
84   - List<CrmReceivableDO> list = crmReceivableService.getReceivableList(exportReqVO);
  115 + PageResult<CrmReceivableDO> pageResult = receivableService.getReceivablePage(exportReqVO);
85 116 // 导出 Excel
86   - List<CrmReceivableExcelVO> datas = CrmReceivableConvert.INSTANCE.convertList02(list);
87   - ExcelUtils.write(response, "回款管理.xls", "数据", CrmReceivableExcelVO.class, datas);
  117 + ExcelUtils.write(response, "回款.xls", "数据", CrmReceivableRespVO.class,
  118 + convertDetailReceivablePage(pageResult).getList());
  119 + }
  120 +
  121 + /**
  122 + * 转换成详细的回款分页,即读取关联信息
  123 + *
  124 + * @param pageResult 回款分页
  125 + * @return 详细的回款分页
  126 + */
  127 + private PageResult<CrmReceivableRespVO> convertDetailReceivablePage(PageResult<CrmReceivableDO> pageResult) {
  128 + List<CrmReceivableDO> contactList = pageResult.getList();
  129 + if (CollUtil.isEmpty(contactList)) {
  130 + return PageResult.empty(pageResult.getTotal());
  131 + }
  132 + // 1. 获取客户列表
  133 + List<CrmCustomerDO> customerList = customerService.getCustomerList(
  134 + convertSet(contactList, CrmReceivableDO::getCustomerId));
  135 + // 2. 获取创建人、负责人列表
  136 + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(contactList,
  137 + contact -> Stream.of(NumberUtils.parseLong(contact.getCreator()), contact.getOwnerUserId())));
  138 + // 3. 获得合同列表
  139 + List<CrmContractDO> contractList = contractService.getContractList(
  140 + convertSet(contactList, CrmReceivableDO::getContractId));
  141 + return CrmReceivableConvert.INSTANCE.convertPage(pageResult, userMap, customerList, contractList);
88 142 }
89 143  
90 144 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/package-info.java deleted
1   -/**
2   - * 回款
3   - */
4   -package cn.iocoder.yudao.module.crm.controller.admin.receivable;
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableExcelVO.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   -@Data
13   -public class CrmReceivableExcelVO {
14   -
15   - @ExcelProperty("ID")
16   - private Long id;
17   -
18   - @ExcelProperty("回款编号")
19   - private String no;
20   -
21   - @ExcelProperty("回款计划ID")
22   - private Long planId;
23   -
24   - @ExcelProperty("客户名称")
25   - private Long customerId;
26   -
27   - @ExcelProperty("合同名称")
28   - private Long contractId;
29   -
30   - @ExcelProperty(value = "审批状态", converter = DictConvert.class)
31   - @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_AUDIT_STATUS)
32   - private Integer checkStatus;
33   -
34   - @ExcelProperty("工作流编号")
35   - private Long processInstanceId;
36   -
37   - @ExcelProperty("回款日期")
38   - private LocalDateTime returnTime;
39   -
40   - @ExcelProperty("回款方式")
41   - private String returnType;
42   -
43   - @ExcelProperty("回款金额")
44   - private Integer price;
45   -
46   - @ExcelProperty("负责人")
47   - private Long ownerUserId;
48   -
49   - @ExcelProperty("批次")
50   - private Long batchId;
51   -
52   - @ExcelProperty(value = "状态", converter = DictConvert.class)
53   - @DictFormat(DictTypeConstants.COMMON_STATUS)
54   - private Integer status;
55   -
56   - @ExcelProperty("备注")
57   - private String remark;
58   -
59   - @ExcelProperty("创建时间")
60   - private LocalDateTime createTime;
61   -
62   -}
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableExportReqVO.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,参数和 CrmReceivablePageReqVO 是一致的")
13   -@Data
14   -public class CrmReceivableExportReqVO {
15   -
16   - @Schema(description = "回款编号")
17   - private String no;
18   -
19   - @Schema(description = "回款计划", example = "31177")
20   - private Long planId;
21   -
22   - @Schema(description = "客户名称", example = "4963")
23   - private Long customerId;
24   -
25   - @Schema(description = "合同名称", example = "30305")
26   - private Long contractId;
27   -
28   - @Schema(description = "审批状态", example = "1")
29   - private Integer checkStatus;
30   -
31   - @Schema(description = "回款日期")
32   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
33   - private LocalDateTime[] returnTime;
34   -
35   - @Schema(description = "回款方式", example = "2")
36   - private String returnType;
37   -
38   - @Schema(description = "回款金额", example = "31859")
39   - private Integer price;
40   -
41   - @Schema(description = "负责人", example = "22202")
42   - private Long ownerUserId;
43   -
44   - @Schema(description = "批次", example = "2539")
45   - private Long batchId;
46   -
47   - @Schema(description = "状态", example = "1")
48   - private Integer status;
49   -
50   - @Schema(description = "备注", example = "随便")
51   - private String remark;
52   -
53   - @Schema(description = "创建时间")
54   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
55   - private LocalDateTime[] createTime;
56   -
57   -}
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivablePageReqVO.java deleted
1   -package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
2   -
3   -import cn.iocoder.yudao.framework.common.pojo.PageParam;
4   -import io.swagger.v3.oas.annotations.media.Schema;
5   -import lombok.Data;
6   -import lombok.EqualsAndHashCode;
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   -
14   -@Schema(description = "管理后台 - CRM 回款分页 Request VO")
15   -@Data
16   -@EqualsAndHashCode(callSuper = true)
17   -@ToString(callSuper = true)
18   -public class CrmReceivablePageReqVO extends PageParam {
19   -
20   - // TODO @liuhongfeng:可以根据需求,去除掉一些不要的过滤条件;另外,planId、customerId、contractId、ownerUserId 注释不正确,应该都是对应的编号
21   -
22   - @Schema(description = "回款编号")
23   - private String no;
24   -
25   - @Schema(description = "回款计划ID", example = "31177")
26   - private Long planId;
27   -
28   - @Schema(description = "客户名称", example = "4963")
29   - private Long customerId;
30   -
31   - @Schema(description = "合同名称", example = "30305")
32   - private Long contractId;
33   -
34   - @Schema(description = "审批状态", example = "1")
35   - private Integer checkStatus;
36   -
37   - @Schema(description = "回款日期")
38   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
39   - private LocalDateTime[] returnTime;
40   -
41   - @Schema(description = "回款方式", example = "2")
42   - private String returnType;
43   -
44   - @Schema(description = "回款金额", example = "31859")
45   - private Integer price;
46   -
47   - @Schema(description = "负责人", example = "22202")
48   - private Long ownerUserId;
49   -
50   -
51   - @Schema(description = "状态", example = "1")
52   - private Integer status;
53   -
54   - @Schema(description = "创建时间")
55   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
56   - private LocalDateTime[] createTime;
57   -
58   -}
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableBaseVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableBaseVO.java
1   -package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
  1 +package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable;
2 2  
3 3 import cn.iocoder.yudao.framework.common.validation.InEnum;
4 4 import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum;
... ... @@ -11,7 +11,7 @@ import java.time.LocalDateTime;
11 11 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
12 12  
13 13 /**
14   - * 回款管理 Base VO,提供给添加、修改、详细的子 VO 使用
  14 + * 回款 Base VO,提供给添加、修改、详细的子 VO 使用
15 15 * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
16 16 */
17 17 @Data
... ... @@ -60,8 +60,5 @@ public class CrmReceivableBaseVO {
60 60 @Schema(description = "备注", example = "备注")
61 61 private String remark;
62 62  
63   - // TODO @liuhongfeng:这个字段,这个字段,应该不是前端传递的噢,而是后端自己生成的,所以不适合放在 base 里面;
64   - @Schema(description = "完成状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
65   - private Integer status;
66 63  
67 64 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableCreateReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableCreateReqVO.java
1   -package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
  1 +package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable;
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/receivable/CrmReceivablePageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  4 +import io.swagger.v3.oas.annotations.media.Schema;
  5 +import lombok.Data;
  6 +import lombok.EqualsAndHashCode;
  7 +import lombok.ToString;
  8 +
  9 +@Schema(description = "管理后台 - CRM 回款分页 Request VO")
  10 +@Data
  11 +@EqualsAndHashCode(callSuper = true)
  12 +@ToString(callSuper = true)
  13 +public class CrmReceivablePageReqVO extends PageParam {
  14 +
  15 + @Schema(description = "回款编号")
  16 + private String no;
  17 +
  18 + @Schema(description = "回款计划编号", example = "31177")
  19 + private Long planId;
  20 +
  21 + @Schema(description = "客户编号", example = "4963")
  22 + private Long customerId;
  23 +
  24 +}
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableRespVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableRespVO.java
1   -package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
  1 +package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable;
2 2  
3 3 import io.swagger.v3.oas.annotations.media.Schema;
4 4 import lombok.*;
5 5 import java.time.LocalDateTime;
6 6  
  7 +// TODO 芋艿:导出的 VO,可以考虑使用 @Excel 注解,实现导出功能
7 8 @Schema(description = "管理后台 - CRM 回款 Response VO")
8 9 @Data
9 10 @EqualsAndHashCode(callSuper = true)
... ... @@ -16,4 +17,22 @@ public class CrmReceivableRespVO extends CrmReceivableBaseVO {
16 17 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
17 18 private LocalDateTime createTime;
18 19  
  20 + @Schema(description = "客户名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "test")
  21 + private String customerName;
  22 +
  23 + @Schema(description = "审批状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
  24 + private Integer auditStatus;
  25 +
  26 + @Schema(description = "合同编号", example = "Q110")
  27 + private String contractNo;
  28 +
  29 + @Schema(description = "负责人", example = "test")
  30 + private String ownerUserName;
  31 +
  32 + @Schema(description = "创建人", example = "25682")
  33 + private String creator;
  34 +
  35 + @Schema(description = "创建人名字", example = "test")
  36 + private String creatorName;
  37 +
19 38 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableUpdateReqVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableUpdateReqVO.java
1   -package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
  1 +package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable;
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/convert/receivable/CrmReceivableConvert.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.receivable.CrmReceivableCreateReqVO;
  5 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableRespVO;
  6 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableUpdateReqVO;
  7 +import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
  8 +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
7 9 import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
  10 +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
8 11 import org.mapstruct.Mapper;
9 12 import org.mapstruct.factory.Mappers;
10   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
  13 +
  14 +import java.util.List;
  15 +import java.util.Map;
  16 +
  17 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
  18 +import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen;
11 19  
12 20 /**
13   - * 回款管理 Convert
  21 + * 回款 Convert
14 22 *
15 23 * @author 赤焰
16 24 */
... ... @@ -27,8 +35,27 @@ public interface CrmReceivableConvert {
27 35  
28 36 List<CrmReceivableRespVO> convertList(List<CrmReceivableDO> list);
29 37  
30   - PageResult<CrmReceivableRespVO> convertPage(PageResult<CrmReceivableDO> page);
31   -
32   - List<CrmReceivableExcelVO> convertList02(List<CrmReceivableDO> list);
  38 + default PageResult<CrmReceivableRespVO> convertPage(PageResult<CrmReceivableDO> pageResult, Map<Long, AdminUserRespDTO> userMap,
  39 + List<CrmCustomerDO> customerList, List<CrmContractDO> contractList) {
  40 + return new PageResult<>(converList(pageResult.getList(), userMap, customerList, contractList), pageResult.getTotal());
  41 + }
  42 +
  43 + default List<CrmReceivableRespVO> converList(List<CrmReceivableDO> receivableList, Map<Long, AdminUserRespDTO> userMap,
  44 + List<CrmCustomerDO> customerList, List<CrmContractDO> contractList) {
  45 + List<CrmReceivableRespVO> result = convertList(receivableList);
  46 + Map<Long, CrmCustomerDO> customerMap = convertMap(customerList, CrmCustomerDO::getId);
  47 + Map<Long, CrmContractDO> contractMap = convertMap(contractList, CrmContractDO::getId);
  48 + result.forEach(item -> {
  49 + setUserInfo(item, userMap);
  50 + findAndThen(customerMap, item.getCustomerId(), customer -> item.setCustomerName(customer.getName()));
  51 + findAndThen(contractMap, item.getContractId(), contract -> item.setContractNo(contract.getNo()));
  52 + });
  53 + return result;
  54 + }
  55 +
  56 + static void setUserInfo(CrmReceivableRespVO receivable, Map<Long, AdminUserRespDTO> userMap) {
  57 + findAndThen(userMap, receivable.getOwnerUserId(), user -> receivable.setOwnerUserName(user.getNickname()));
  58 + findAndThen(userMap, Long.parseLong(receivable.getCreator()), user -> receivable.setCreatorName(user.getNickname()));
  59 + }
33 60  
34 61 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/receivable/CrmReceivableDO.java
... ... @@ -10,7 +10,7 @@ import lombok.*;
10 10 import java.time.LocalDateTime;
11 11  
12 12 /**
13   - * 回款管理 DO
  13 + * 回款 DO
14 14 *
15 15 * @author 赤焰
16 16 */
... ... @@ -54,12 +54,6 @@ public class CrmReceivableDO extends BaseDO {
54 54 * 对应实体 {@link CrmContractDO}
55 55 */
56 56 private Long contractId;
57   - // TODO @liuhongfeng:“对应字典”,参考别的模块,枚举 {@link XXXX};另外,这个字段就叫 status,整体状态,不只审批
58   - /**
59   - * 审批状态
60   - * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_AUDIT_STATUS}
61   - */
62   - private Integer checkStatus;
63 57 /**
64 58 * 工作流编号
65 59 *
... ... @@ -84,31 +78,16 @@ public class CrmReceivableDO extends BaseDO {
84 78 * 负责人
85 79 */
86 80 private Long ownerUserId;
87   - // TODO @liuhongfeng:应该不需要 batchId 字段
88   - /**
89   - * 批次
90   - */
91   - private Long batchId;
92 81 /**
93 82 * 显示顺序
94 83 */
95 84 private Integer sort;
96   - // TODO 芋艿:dataScope、dataScopeDeptIds 在想下;
97 85 /**
98   - * 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)
99   - */
100   - private Integer dataScope;
101   - /**
102   - * 数据范围(指定部门数组)
103   - */
104   - private String dataScopeDeptIds;
105   - /**
106   - * 状态
107   - *
108   - * 枚举 {@link cn.iocoder.yudao.framework.common.enums.CommonStatusEnum}
  86 + * 审核状态
109 87 *
  88 + * 枚举 {@link cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum}
110 89 */
111   - private Integer status;
  90 + private Integer auditStatus;
112 91 /**
113 92 * 备注
114 93 */
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/package-info.java deleted
1   -/**
2   - * 合同
3   - */
4   -package cn.iocoder.yudao.module.crm.dal.mysql.contract;
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customerlimitconfig/CrmCustomerLimitConfigMapper.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerLimitConfigMapper.java
1   -package cn.iocoder.yudao.module.crm.dal.mysql.customerlimitconfig;
  1 +package cn.iocoder.yudao.module.crm.dal.mysql.customer;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/package-info.java deleted
1   -/**
2   - * 客户
3   - */
4   -package cn.iocoder.yudao.module.crm.dal.mysql.customer;
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivableMapper.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.receivable.CrmReceivablePageReqVO;
8 7 import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
9 8 import org.apache.ibatis.annotations.Mapper;
10   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
11 9  
12 10 /**
13   - * 回款管理 Mapper
  11 + * 回款 Mapper
14 12 *
15 13 * @author 赤焰
16 14 */
... ... @@ -22,32 +20,14 @@ public interface CrmReceivableMapper extends BaseMapperX&lt;CrmReceivableDO&gt; {
22 20 .eqIfPresent(CrmReceivableDO::getNo, reqVO.getNo())
23 21 .eqIfPresent(CrmReceivableDO::getPlanId, reqVO.getPlanId())
24 22 .eqIfPresent(CrmReceivableDO::getCustomerId, reqVO.getCustomerId())
25   - .eqIfPresent(CrmReceivableDO::getContractId, reqVO.getContractId())
26   - .eqIfPresent(CrmReceivableDO::getCheckStatus, reqVO.getCheckStatus())
27   - .betweenIfPresent(CrmReceivableDO::getReturnTime, reqVO.getReturnTime())
28   - .eqIfPresent(CrmReceivableDO::getReturnType, reqVO.getReturnType())
29   - .eqIfPresent(CrmReceivableDO::getPrice, reqVO.getPrice())
30   - .eqIfPresent(CrmReceivableDO::getOwnerUserId, reqVO.getOwnerUserId())
31   - .eqIfPresent(CrmReceivableDO::getStatus, reqVO.getStatus())
32   - .betweenIfPresent(CrmReceivableDO::getCreateTime, reqVO.getCreateTime())
33 23 .orderByDesc(CrmReceivableDO::getId));
34 24 }
35 25  
36   - default List<CrmReceivableDO> selectList(CrmReceivableExportReqVO reqVO) {
37   - return selectList(new LambdaQueryWrapperX<CrmReceivableDO>()
  26 + default PageResult<CrmReceivableDO> selectPageByCustomer(CrmReceivablePageReqVO reqVO) {
  27 + return selectPage(reqVO, new LambdaQueryWrapperX<CrmReceivableDO>()
  28 + .eq(CrmReceivableDO::getCustomerId, reqVO.getCustomerId()) // 必须传递
38 29 .eqIfPresent(CrmReceivableDO::getNo, reqVO.getNo())
39 30 .eqIfPresent(CrmReceivableDO::getPlanId, reqVO.getPlanId())
40   - .eqIfPresent(CrmReceivableDO::getCustomerId, reqVO.getCustomerId())
41   - .eqIfPresent(CrmReceivableDO::getContractId, reqVO.getContractId())
42   - .eqIfPresent(CrmReceivableDO::getCheckStatus, reqVO.getCheckStatus())
43   - .betweenIfPresent(CrmReceivableDO::getReturnTime, reqVO.getReturnTime())
44   - .eqIfPresent(CrmReceivableDO::getReturnType, reqVO.getReturnType())
45   - .eqIfPresent(CrmReceivableDO::getPrice, reqVO.getPrice())
46   - .eqIfPresent(CrmReceivableDO::getOwnerUserId, reqVO.getOwnerUserId())
47   - .eqIfPresent(CrmReceivableDO::getBatchId, reqVO.getBatchId())
48   - .eqIfPresent(CrmReceivableDO::getStatus, reqVO.getStatus())
49   - .eqIfPresent(CrmReceivableDO::getRemark, reqVO.getRemark())
50   - .betweenIfPresent(CrmReceivableDO::getCreateTime, reqVO.getCreateTime())
51 31 .orderByDesc(CrmReceivableDO::getId));
52 32 }
53 33  
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/package-info.java deleted
1   -/**
2   - * 回款
3   - */
4   -package cn.iocoder.yudao.module.crm.dal.mysql.receivable;
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerLimitConfigServiceImpl.java
... ... @@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmC
6 6 import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigUpdateReqVO;
7 7 import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerLimitConfigConvert;
8 8 import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerLimitConfigDO;
9   -import cn.iocoder.yudao.module.crm.dal.mysql.customerlimitconfig.CrmCustomerLimitConfigMapper;
  9 +import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerLimitConfigMapper;
10 10 import cn.iocoder.yudao.module.system.api.dept.DeptApi;
11 11 import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
12 12 import org.springframework.stereotype.Service;
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableService.java
1 1 package cn.iocoder.yudao.module.crm.service.receivable;
2 2  
3   -import java.util.*;
4   -import javax.validation.*;
5   -
6   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
7   -import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
8 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableCreateReqVO;
  5 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO;
  6 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableUpdateReqVO;
  7 +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
  8 +import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
  9 +
  10 +import javax.validation.Valid;
  11 +import java.util.Collection;
  12 +import java.util.List;
9 13  
10 14 /**
11   - * 回款管理 Service 接口
  15 + * CRM 回款 Service 接口
12 16 *
13 17 * @author 赤焰
14 18 */
15 19 public interface CrmReceivableService {
16 20  
17 21 /**
18   - * 创建回款管理
  22 + * 创建回款
19 23 *
20 24 * @param createReqVO 创建信息
21 25 * @return 编号
... ... @@ -23,49 +27,53 @@ public interface CrmReceivableService {
23 27 Long createReceivable(@Valid CrmReceivableCreateReqVO createReqVO);
24 28  
25 29 /**
26   - * 更新回款管理
  30 + * 更新回款
27 31 *
28 32 * @param updateReqVO 更新信息
29 33 */
30 34 void updateReceivable(@Valid CrmReceivableUpdateReqVO updateReqVO);
31 35  
32 36 /**
33   - * 删除回款管理
  37 + * 删除回款
34 38 *
35 39 * @param id 编号
36 40 */
37 41 void deleteReceivable(Long id);
38 42  
39 43 /**
40   - * 获得回款管理
  44 + * 获得回款
41 45 *
42 46 * @param id 编号
43   - * @return 回款管理
  47 + * @return 回款
44 48 */
45 49 CrmReceivableDO getReceivable(Long id);
46 50  
47 51 /**
48   - * 获得回款管理列表
  52 + * 获得回款列表
49 53 *
50 54 * @param ids 编号
51   - * @return 回款管理列表
  55 + * @return 回款列表
52 56 */
53 57 List<CrmReceivableDO> getReceivableList(Collection<Long> ids);
54 58  
55 59 /**
56   - * 获得回款管理分页
  60 + * 获得回款分页
  61 + *
  62 + * 数据权限:基于 {@link CrmReceivableDO} 读取
57 63 *
58 64 * @param pageReqVO 分页查询
59   - * @return 回款管理分页
  65 + * @return 回款分页
60 66 */
61 67 PageResult<CrmReceivableDO> getReceivablePage(CrmReceivablePageReqVO pageReqVO);
62 68  
63 69 /**
64   - * 获得回款管理列表, 用于 Excel 导出
  70 + * 获得回款分页,基于指定客户
  71 + *
  72 + * 数据权限:基于 {@link CrmCustomerDO} 读取
65 73 *
66   - * @param exportReqVO 查询条件
67   - * @return 回款管理列表
  74 + * @param pageReqVO 分页查询
  75 + * @return 回款分页
68 76 */
69   - List<CrmReceivableDO> getReceivableList(CrmReceivableExportReqVO exportReqVO);
  77 + PageResult<CrmReceivableDO> getReceivablePageByCustomer(CrmReceivablePageReqVO pageReqVO);
70 78  
71 79 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableServiceImpl.java
... ... @@ -5,10 +5,9 @@ import cn.hutool.core.collection.ListUtil;
5 5 import cn.hutool.core.util.ObjectUtil;
6 6 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
7 7 import cn.iocoder.yudao.framework.common.pojo.PageResult;
8   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivableCreateReqVO;
9   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivableExportReqVO;
10   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePageReqVO;
11   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivableUpdateReqVO;
  8 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableCreateReqVO;
  9 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO;
  10 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableUpdateReqVO;
12 11 import cn.iocoder.yudao.module.crm.convert.receivable.CrmReceivableConvert;
13 12 import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
14 13 import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
... ... @@ -16,6 +15,9 @@ import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
16 15 import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO;
17 16 import cn.iocoder.yudao.module.crm.dal.mysql.receivable.CrmReceivableMapper;
18 17 import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum;
  18 +import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum;
  19 +import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum;
  20 +import cn.iocoder.yudao.module.crm.framework.core.annotations.CrmPermission;
19 21 import cn.iocoder.yudao.module.crm.service.contract.CrmContractService;
20 22 import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
21 23 import org.springframework.stereotype.Service;
... ... @@ -29,7 +31,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
29 31 import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
30 32  
31 33 /**
32   - * 回款管理 Service 实现类
  34 + * CRM 回款 Service 实现类
33 35 *
34 36 * @author 赤焰
35 37 */
... ... @@ -37,34 +39,31 @@ import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
37 39 @Validated
38 40 public class CrmReceivableServiceImpl implements CrmReceivableService {
39 41  
40   - // TODO @liuhongfeng:crm 前缀,变量可以不带哈;
41 42 @Resource
42   - private CrmReceivableMapper crmReceivableMapper;
  43 + private CrmReceivableMapper receivableMapper;
  44 +
43 45 @Resource
44 46 private CrmContractService contractService;
45 47 @Resource
46   - private CrmCustomerService crmCustomerService;
  48 + private CrmCustomerService customerService;
47 49 @Resource
48   - private CrmReceivablePlanService crmReceivablePlanService;
  50 + private CrmReceivablePlanService receivablePlanService;
49 51  
50 52 // TODO @liuhongfeng:创建还款后,是不是什么时候,要更新 plan?
51 53 @Override
52 54 public Long createReceivable(CrmReceivableCreateReqVO createReqVO) {
53 55 // 插入
54 56 CrmReceivableDO receivable = CrmReceivableConvert.INSTANCE.convert(createReqVO);
55   - // TODO @liuhongfeng:这里的括号要注意排版;
56   - if (ObjectUtil.isNull(receivable.getStatus())){
57   - receivable.setStatus(CommonStatusEnum.ENABLE.getStatus());
58   - }
59   - if (ObjectUtil.isNull(receivable.getCheckStatus())){
60   - receivable.setCheckStatus(CrmAuditStatusEnum.DRAFT.getStatus());
  57 + if (ObjectUtil.isNull(receivable.getAuditStatus())) {
  58 + receivable.setAuditStatus(CommonStatusEnum.ENABLE.getStatus());
61 59 }
  60 + receivable.setAuditStatus(CrmAuditStatusEnum.DRAFT.getStatus());
62 61  
63 62 // TODO @liuhongfeng:一般来说,逻辑的写法,是要先检查,后操作 db;所以,你这个 check 应该放到 CrmReceivableDO receivable 之前;
64 63 // 校验
65 64 checkReceivable(receivable);
66 65  
67   - crmReceivableMapper.insert(receivable);
  66 + receivableMapper.insert(receivable);
68 67 return receivable.getId();
69 68 }
70 69  
... ... @@ -80,12 +79,12 @@ public class CrmReceivableServiceImpl implements CrmReceivableService {
80 79 throw exception(CONTRACT_NOT_EXISTS);
81 80 }
82 81  
83   - CrmCustomerDO customer = crmCustomerService.getCustomer(receivable.getCustomerId());
  82 + CrmCustomerDO customer = customerService.getCustomer(receivable.getCustomerId());
84 83 if(ObjectUtil.isNull(customer)){
85 84 throw exception(CUSTOMER_NOT_EXISTS);
86 85 }
87 86  
88   - CrmReceivablePlanDO receivablePlan = crmReceivablePlanService.getReceivablePlan(receivable.getPlanId());
  87 + CrmReceivablePlanDO receivablePlan = receivablePlanService.getReceivablePlan(receivable.getPlanId());
89 88 if(ObjectUtil.isNull(receivablePlan)){
90 89 throw exception(RECEIVABLE_PLAN_NOT_EXISTS);
91 90 }
... ... @@ -99,7 +98,7 @@ public class CrmReceivableServiceImpl implements CrmReceivableService {
99 98  
100 99 // 更新
101 100 CrmReceivableDO updateObj = CrmReceivableConvert.INSTANCE.convert(updateReqVO);
102   - crmReceivableMapper.updateById(updateObj);
  101 + receivableMapper.updateById(updateObj);
103 102 }
104 103  
105 104 @Override
... ... @@ -107,18 +106,19 @@ public class CrmReceivableServiceImpl implements CrmReceivableService {
107 106 // 校验存在
108 107 validateReceivableExists(id);
109 108 // 删除
110   - crmReceivableMapper.deleteById(id);
  109 + receivableMapper.deleteById(id);
111 110 }
112 111  
113 112 private void validateReceivableExists(Long id) {
114   - if (crmReceivableMapper.selectById(id) == null) {
  113 + if (receivableMapper.selectById(id) == null) {
115 114 throw exception(RECEIVABLE_NOT_EXISTS);
116 115 }
117 116 }
118 117  
  118 + // TODO @芋艿:数据权限
119 119 @Override
120 120 public CrmReceivableDO getReceivable(Long id) {
121   - return crmReceivableMapper.selectById(id);
  121 + return receivableMapper.selectById(id);
122 122 }
123 123  
124 124 @Override
... ... @@ -126,17 +126,19 @@ public class CrmReceivableServiceImpl implements CrmReceivableService {
126 126 if (CollUtil.isEmpty(ids)) {
127 127 return ListUtil.empty();
128 128 }
129   - return crmReceivableMapper.selectBatchIds(ids);
  129 + return receivableMapper.selectBatchIds(ids);
130 130 }
131 131  
  132 + // TODO @芋艿:数据权限
132 133 @Override
133 134 public PageResult<CrmReceivableDO> getReceivablePage(CrmReceivablePageReqVO pageReqVO) {
134   - return crmReceivableMapper.selectPage(pageReqVO);
  135 + return receivableMapper.selectPage(pageReqVO);
135 136 }
136 137  
137 138 @Override
138   - public List<CrmReceivableDO> getReceivableList(CrmReceivableExportReqVO exportReqVO) {
139   - return crmReceivableMapper.selectList(exportReqVO);
  139 + @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#pageReqVO.customerId", level = CrmPermissionLevelEnum.READ)
  140 + public PageResult<CrmReceivableDO> getReceivablePageByCustomer(CrmReceivablePageReqVO pageReqVO) {
  141 + return receivableMapper.selectPageByCustomer(pageReqVO);
140 142 }
141 143  
142 144 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/customerlimitconfig/CrmCustomerLimitConfigServiceImplTest.java
... ... @@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmC
6 6 import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigPageReqVO;
7 7 import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigUpdateReqVO;
8 8 import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerLimitConfigDO;
9   -import cn.iocoder.yudao.module.crm.dal.mysql.customerlimitconfig.CrmCustomerLimitConfigMapper;
  9 +import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerLimitConfigMapper;
10 10 import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerLimitConfigServiceImpl;
11 11 import org.junit.jupiter.api.Disabled;
12 12 import org.junit.jupiter.api.Test;
... ...
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/receivable/CrmCrmReceivableServiceImplTest.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.CrmReceivableCreateReqVO;
6   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivableExportReqVO;
7   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePageReqVO;
8   -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivableUpdateReqVO;
  5 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableCreateReqVO;
  6 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO;
  7 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableUpdateReqVO;
9 8 import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
10 9 import cn.iocoder.yudao.module.crm.dal.mysql.receivable.CrmReceivableMapper;
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;
... ... @@ -121,7 +118,7 @@ public class CrmCrmReceivableServiceImplTest extends BaseDbUnitTest {
121 118 o.setSort(null);
122 119 o.setDataScope(null);
123 120 o.setDataScopeDeptIds(null);
124   - o.setStatus(null);
  121 + o.setAuditStatus(null);
125 122 o.setRemark(null);
126 123 o.setCreateTime(null);
127 124 });
... ... @@ -132,47 +129,11 @@ public class CrmCrmReceivableServiceImplTest extends BaseDbUnitTest {
132 129 crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setPlanId(null)));
133 130 // 测试 customerId 不匹配
134 131 crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCustomerId(null)));
135   - // 测试 contractId 不匹配
136   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setContractId(null)));
137   - // 测试 checkStatus 不匹配
138   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCheckStatus(null)));
139   - // 测试 processInstanceId 不匹配
140   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setProcessInstanceId(null)));
141   - // 测试 returnTime 不匹配
142   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setReturnTime(null)));
143   - // 测试 returnType 不匹配
144   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setReturnType(null)));
145   - // 测试 price 不匹配
146   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setPrice(null)));
147   - // 测试 ownerUserId 不匹配
148   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setOwnerUserId(null)));
149   - // 测试 batchId 不匹配
150   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setBatchId(null)));
151   - // 测试 sort 不匹配
152   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setSort(null)));
153   - // 测试 dataScope 不匹配
154   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setDataScope(null)));
155   - // 测试 dataScopeDeptIds 不匹配
156   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setDataScopeDeptIds(null)));
157   - // 测试 status 不匹配
158   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setStatus(null)));
159   - // 测试 remark 不匹配
160   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setRemark(null)));
161   - // 测试 createTime 不匹配
162   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCreateTime(null)));
163 132 // 准备参数
164 133 CrmReceivablePageReqVO reqVO = new CrmReceivablePageReqVO();
165 134 reqVO.setNo(null);
166 135 reqVO.setPlanId(null);
167 136 reqVO.setCustomerId(null);
168   - reqVO.setContractId(null);
169   - reqVO.setCheckStatus(null);
170   - reqVO.setReturnTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
171   - reqVO.setReturnType(null);
172   - reqVO.setPrice(null);
173   - reqVO.setOwnerUserId(null);
174   - reqVO.setStatus(null);
175   - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
176 137  
177 138 // 调用
178 139 PageResult<CrmReceivableDO> pageResult = receivableService.getReceivablePage(reqVO);
... ... @@ -182,85 +143,4 @@ public class CrmCrmReceivableServiceImplTest extends BaseDbUnitTest {
182 143 assertPojoEquals(dbReceivable, pageResult.getList().get(0));
183 144 }
184 145  
185   - @Test
186   - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
187   - public void testGetReceivableList() {
188   - // mock 数据
189   - CrmReceivableDO dbReceivable = randomPojo(CrmReceivableDO.class, o -> { // 等会查询到
190   - o.setNo(null);
191   - o.setPlanId(null);
192   - o.setCustomerId(null);
193   - o.setContractId(null);
194   - o.setCheckStatus(null);
195   - o.setProcessInstanceId(null);
196   - o.setReturnTime(null);
197   - o.setReturnType(null);
198   - o.setPrice(null);
199   - o.setOwnerUserId(null);
200   - o.setBatchId(null);
201   - o.setSort(null);
202   - o.setDataScope(null);
203   - o.setDataScopeDeptIds(null);
204   - o.setStatus(null);
205   - o.setRemark(null);
206   - o.setCreateTime(null);
207   - });
208   - crmReceivableMapper.insert(dbReceivable);
209   - // 测试 no 不匹配
210   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setNo(null)));
211   - // 测试 planId 不匹配
212   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setPlanId(null)));
213   - // 测试 customerId 不匹配
214   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCustomerId(null)));
215   - // 测试 contractId 不匹配
216   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setContractId(null)));
217   - // 测试 checkStatus 不匹配
218   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCheckStatus(null)));
219   - // 测试 processInstanceId 不匹配
220   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setProcessInstanceId(null)));
221   - // 测试 returnTime 不匹配
222   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setReturnTime(null)));
223   - // 测试 returnType 不匹配
224   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setReturnType(null)));
225   - // 测试 price 不匹配
226   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setPrice(null)));
227   - // 测试 ownerUserId 不匹配
228   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setOwnerUserId(null)));
229   - // 测试 batchId 不匹配
230   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setBatchId(null)));
231   - // 测试 sort 不匹配
232   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setSort(null)));
233   - // 测试 dataScope 不匹配
234   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setDataScope(null)));
235   - // 测试 dataScopeDeptIds 不匹配
236   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setDataScopeDeptIds(null)));
237   - // 测试 status 不匹配
238   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setStatus(null)));
239   - // 测试 remark 不匹配
240   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setRemark(null)));
241   - // 测试 createTime 不匹配
242   - crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCreateTime(null)));
243   - // 准备参数
244   - CrmReceivableExportReqVO reqVO = new CrmReceivableExportReqVO();
245   - reqVO.setNo(null);
246   - reqVO.setPlanId(null);
247   - reqVO.setCustomerId(null);
248   - reqVO.setContractId(null);
249   - reqVO.setCheckStatus(null);
250   - reqVO.setReturnTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
251   - reqVO.setReturnType(null);
252   - reqVO.setPrice(null);
253   - reqVO.setOwnerUserId(null);
254   - reqVO.setBatchId(null);
255   - reqVO.setStatus(null);
256   - reqVO.setRemark(null);
257   - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
258   -
259   - // 调用
260   - List<CrmReceivableDO> list = receivableService.getReceivableList(reqVO);
261   - // 断言
262   - assertEquals(1, list.size());
263   - assertPojoEquals(dbReceivable, list.get(0));
264   - }
265   -
266 146 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/test/resources/sql/create_tables.sql
... ... @@ -72,7 +72,7 @@ CREATE TABLE IF NOT EXISTS &quot;crm_receivable&quot; (
72 72 "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
73 73 "deleted" bit NOT NULL DEFAULT FALSE,
74 74 PRIMARY KEY ("id")
75   -) COMMENT '回款管理';
  75 +) COMMENT '回款';
76 76  
77 77 CREATE TABLE IF NOT EXISTS "crm_receivable_plan" (
78 78 "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
... ...