Parcourir la source

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

YunaiV il y a 1 an
Parent
commit
f02b9464bd
28 fichiers modifiés avec 262 ajouts et 485 suppressions
  1. 2 2
      sql/mysql/crm_data.sql
  2. 6 6
      sql/mysql/ruoyi-vue-pro.sql
  3. 2 2
      yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ErrorCodeConstants.java
  4. 3 3
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java
  5. 75 21
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivableController.java
  6. 0 4
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/package-info.java
  7. 0 62
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableExcelVO.java
  8. 0 57
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableExportReqVO.java
  9. 0 58
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivablePageReqVO.java
  10. 0 19
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableRespVO.java
  11. 2 5
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableBaseVO.java
  12. 1 1
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableCreateReqVO.java
  13. 24 0
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivablePageReqVO.java
  14. 38 0
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableRespVO.java
  15. 1 1
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableUpdateReqVO.java
  16. 35 8
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/receivable/CrmReceivableConvert.java
  17. 4 25
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/receivable/CrmReceivableDO.java
  18. 0 4
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/package-info.java
  19. 1 1
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customerlimitconfig/CrmCustomerLimitConfigMapper.java
  20. 0 4
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/package-info.java
  21. 6 26
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivableMapper.java
  22. 0 4
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/package-info.java
  23. 1 1
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerLimitConfigServiceImpl.java
  24. 27 19
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableService.java
  25. 28 26
      yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableServiceImpl.java
  26. 1 1
      yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/customerlimitconfig/CrmCustomerLimitConfigServiceImplTest.java
  27. 4 124
      yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/receivable/CrmCrmReceivableServiceImplTest.java
  28. 1 1
      yudao-module-crm/yudao-module-crm-biz/src/test/resources/sql/create_tables.sql

+ 2 - 2
sql/mysql/crm_data.sql

@@ -1,7 +1,7 @@
 
-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');
+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');
 
-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');
+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');
 
 
 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');

+ 6 - 6
sql/mysql/ruoyi-vue-pro.sql

@@ -2405,12 +2405,12 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i
 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');
 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');
 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');
-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');
-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');
-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');
-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');
-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');
-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');
+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');
+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');
+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');
+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');
+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');
+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');
 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');
 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');
 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');

+ 2 - 2
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 {
     // ========== 联系人管理 1-020-003-000 ==========
     ErrorCode CONTACT_NOT_EXISTS = new ErrorCode(1_020_003_000, "联系人不存在");
 
-    // ========== 回款管理 1-020-004-000 ==========
-    ErrorCode RECEIVABLE_NOT_EXISTS = new ErrorCode(1_020_004_000, "回款管理不存在");
+    // ========== 回款 1-020-004-000 ==========
+    ErrorCode RECEIVABLE_NOT_EXISTS = new ErrorCode(1_020_004_000, "回款不存在");
 
     // ========== 合同管理 1-020-005-000 ==========
     ErrorCode RECEIVABLE_PLAN_NOT_EXISTS = new ErrorCode(1_020_005_000, "回款计划不存在");

+ 3 - 3
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 {
     }
 
     /**
-     * 转换成详细的联系人分页,即读取关联信息
+     * 转换成详细的合同分页,即读取关联信息
      *
-     * @param pageResult 联系人分页
-     * @return 详细的联系人分页
+     * @param pageResult 合同分页
+     * @return 详细的合同分页
      */
     private PageResult<ContractRespVO> convertDetailContractPage(PageResult<CrmContractDO> pageResult) {
         List<CrmContractDO> contactList = pageResult.getList();

+ 75 - 21
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivableController.java

@@ -1,13 +1,25 @@
 package cn.iocoder.yudao.module.crm.controller.admin.receivable;
 
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.lang.Assert;
 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
-import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
+import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableCreateReqVO;
+import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO;
+import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableRespVO;
+import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableUpdateReqVO;
 import cn.iocoder.yudao.module.crm.convert.receivable.CrmReceivableConvert;
+import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
+import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
 import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
+import cn.iocoder.yudao.module.crm.service.contract.CrmContractService;
+import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
 import cn.iocoder.yudao.module.crm.service.receivable.CrmReceivableService;
+import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
+import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -20,71 +32,113 @@ import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 import java.io.IOException;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Stream;
 
 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertListByFlatMap;
+import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
 import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
 
-@Tag(name = "管理后台 - CRM 回款管理")
+@Tag(name = "管理后台 - CRM 回款")
 @RestController
 @RequestMapping("/crm/receivable")
 @Validated
 public class CrmReceivableController {
 
-    // TODO @liuhongfeng:crmReceivableService 可以使用 receivableService ;在自己模块里,相对简洁一点;
     @Resource
-    private CrmReceivableService crmReceivableService;
+    private CrmReceivableService receivableService;
+    @Resource
+    private CrmContractService contractService;
+    @Resource
+    private CrmCustomerService customerService;
+
+    @Resource
+    private AdminUserApi adminUserApi;
 
     @PostMapping("/create")
-    @Operation(summary = "创建回款管理")
+    @Operation(summary = "创建回款")
     @PreAuthorize("@ss.hasPermission('crm:receivable:create')")
     public CommonResult<Long> createReceivable(@Valid @RequestBody CrmReceivableCreateReqVO createReqVO) {
-        return success(crmReceivableService.createReceivable(createReqVO));
+        return success(receivableService.createReceivable(createReqVO));
     }
 
     @PutMapping("/update")
-    @Operation(summary = "更新回款管理")
+    @Operation(summary = "更新回款")
     @PreAuthorize("@ss.hasPermission('crm:receivable:update')")
     public CommonResult<Boolean> updateReceivable(@Valid @RequestBody CrmReceivableUpdateReqVO updateReqVO) {
-        crmReceivableService.updateReceivable(updateReqVO);
+        receivableService.updateReceivable(updateReqVO);
         return success(true);
     }
 
     @DeleteMapping("/delete")
-    @Operation(summary = "删除回款管理")
+    @Operation(summary = "删除回款")
     @Parameter(name = "id", description = "编号", required = true)
     @PreAuthorize("@ss.hasPermission('crm:receivable:delete')")
     public CommonResult<Boolean> deleteReceivable(@RequestParam("id") Long id) {
-        crmReceivableService.deleteReceivable(id);
+        receivableService.deleteReceivable(id);
         return success(true);
     }
 
     @GetMapping("/get")
-    @Operation(summary = "获得回款管理")
+    @Operation(summary = "获得回款")
     @Parameter(name = "id", description = "编号", required = true, example = "1024")
     @PreAuthorize("@ss.hasPermission('crm:receivable:query')")
     public CommonResult<CrmReceivableRespVO> getReceivable(@RequestParam("id") Long id) {
-        CrmReceivableDO receivable = crmReceivableService.getReceivable(id);
+        CrmReceivableDO receivable = receivableService.getReceivable(id);
         return success(CrmReceivableConvert.INSTANCE.convert(receivable));
     }
 
     @GetMapping("/page")
-    @Operation(summary = "获得回款管理分页")
+    @Operation(summary = "获得回款分页")
     @PreAuthorize("@ss.hasPermission('crm:receivable:query')")
-    public CommonResult<PageResult<CrmReceivableRespVO>> getReceivablePage(@Valid CrmReceivablePageReqVO pageVO) {
-        PageResult<CrmReceivableDO> pageResult = crmReceivableService.getReceivablePage(pageVO);
-        return success(CrmReceivableConvert.INSTANCE.convertPage(pageResult));
+    public CommonResult<PageResult<CrmReceivableRespVO>> getReceivablePage(@Valid CrmReceivablePageReqVO pageReqVO) {
+        PageResult<CrmReceivableDO> pageResult = receivableService.getReceivablePage(pageReqVO);
+        return success(convertDetailReceivablePage(pageResult));
     }
 
+    @GetMapping("/page-by-customer")
+    @Operation(summary = "获得回款分页,基于指定客户")
+    public CommonResult<PageResult<CrmReceivableRespVO>> getContractPageByCustomer(@Valid CrmReceivablePageReqVO pageReqVO) {
+        Assert.notNull(pageReqVO.getCustomerId(), "客户编号不能为空");
+        PageResult<CrmReceivableDO> pageResult = receivableService.getReceivablePageByCustomer(pageReqVO);
+        return success(convertDetailReceivablePage(pageResult));
+    }
+
+    // TODO 芋艿:后面在优化导出
     @GetMapping("/export-excel")
-    @Operation(summary = "导出回款管理 Excel")
+    @Operation(summary = "导出回款 Excel")
     @PreAuthorize("@ss.hasPermission('crm:receivable:export')")
     @OperateLog(type = EXPORT)
-    public void exportReceivableExcel(@Valid CrmReceivableExportReqVO exportReqVO,
+    public void exportReceivableExcel(@Valid CrmReceivablePageReqVO exportReqVO,
               HttpServletResponse response) throws IOException {
-        List<CrmReceivableDO> list = crmReceivableService.getReceivableList(exportReqVO);
+        PageResult<CrmReceivableDO> pageResult = receivableService.getReceivablePage(exportReqVO);
         // 导出 Excel
-        List<CrmReceivableExcelVO> datas = CrmReceivableConvert.INSTANCE.convertList02(list);
-        ExcelUtils.write(response, "回款管理.xls", "数据", CrmReceivableExcelVO.class, datas);
+        ExcelUtils.write(response, "回款.xls", "数据", CrmReceivableRespVO.class,
+                convertDetailReceivablePage(pageResult).getList());
+    }
+
+    /**
+     * 转换成详细的回款分页,即读取关联信息
+     *
+     * @param pageResult 回款分页
+     * @return 详细的回款分页
+     */
+    private PageResult<CrmReceivableRespVO> convertDetailReceivablePage(PageResult<CrmReceivableDO> pageResult) {
+        List<CrmReceivableDO> contactList = pageResult.getList();
+        if (CollUtil.isEmpty(contactList)) {
+            return PageResult.empty(pageResult.getTotal());
+        }
+        // 1. 获取客户列表
+        List<CrmCustomerDO> customerList = customerService.getCustomerList(
+                convertSet(contactList, CrmReceivableDO::getCustomerId));
+        // 2. 获取创建人、负责人列表
+        Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(contactList,
+                contact -> Stream.of(NumberUtils.parseLong(contact.getCreator()), contact.getOwnerUserId())));
+        // 3. 获得合同列表
+        List<CrmContractDO> contractList = contractService.getContractList(
+                convertSet(contactList, CrmReceivableDO::getContractId));
+        return CrmReceivableConvert.INSTANCE.convertPage(pageResult, userMap, customerList, contractList);
     }
 
 }

+ 0 - 4
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/package-info.java

@@ -1,4 +0,0 @@
-/**
- * 回款
- */
-package cn.iocoder.yudao.module.crm.controller.admin.receivable;

+ 0 - 62
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableExcelVO.java

@@ -1,62 +0,0 @@
-package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
-
-import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
-import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
-import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
-import com.alibaba.excel.annotation.ExcelProperty;
-import lombok.Data;
-
-import java.time.LocalDateTime;
-
-// TODO liuhongfeng:导出可以等其它功能做完,统一在搞;
-@Data
-public class CrmReceivableExcelVO {
-
-    @ExcelProperty("ID")
-    private Long id;
-
-    @ExcelProperty("回款编号")
-    private String no;
-
-    @ExcelProperty("回款计划ID")
-    private Long planId;
-
-    @ExcelProperty("客户名称")
-    private Long customerId;
-
-    @ExcelProperty("合同名称")
-    private Long contractId;
-
-    @ExcelProperty(value = "审批状态", converter = DictConvert.class)
-    @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_AUDIT_STATUS)
-    private Integer checkStatus;
-
-    @ExcelProperty("工作流编号")
-    private Long processInstanceId;
-
-    @ExcelProperty("回款日期")
-    private LocalDateTime returnTime;
-
-    @ExcelProperty("回款方式")
-    private String returnType;
-
-    @ExcelProperty("回款金额")
-    private Integer price;
-
-    @ExcelProperty("负责人")
-    private Long ownerUserId;
-
-    @ExcelProperty("批次")
-    private Long batchId;
-
-    @ExcelProperty(value = "状态", converter = DictConvert.class)
-    @DictFormat(DictTypeConstants.COMMON_STATUS)
-    private Integer status;
-
-    @ExcelProperty("备注")
-    private String remark;
-
-    @ExcelProperty("创建时间")
-    private LocalDateTime createTime;
-
-}

+ 0 - 57
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableExportReqVO.java

@@ -1,57 +0,0 @@
-package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.time.LocalDateTime;
-
-import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
-
-// TODO liuhongfeng:导出可以等其它功能做完,统一在搞;
-@Schema(description = "管理后台 - CRM 回款 Excel 导出 Request VO,参数和 CrmReceivablePageReqVO 是一致的")
-@Data
-public class CrmReceivableExportReqVO {
-
-    @Schema(description = "回款编号")
-    private String no;
-
-    @Schema(description = "回款计划", example = "31177")
-    private Long planId;
-
-    @Schema(description = "客户名称", example = "4963")
-    private Long customerId;
-
-    @Schema(description = "合同名称", example = "30305")
-    private Long contractId;
-
-    @Schema(description = "审批状态", example = "1")
-    private Integer checkStatus;
-
-    @Schema(description = "回款日期")
-    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
-    private LocalDateTime[] returnTime;
-
-    @Schema(description = "回款方式", example = "2")
-    private String returnType;
-
-    @Schema(description = "回款金额", example = "31859")
-    private Integer price;
-
-    @Schema(description = "负责人", example = "22202")
-    private Long ownerUserId;
-
-    @Schema(description = "批次", example = "2539")
-    private Long batchId;
-
-    @Schema(description = "状态", example = "1")
-    private Integer status;
-
-    @Schema(description = "备注", example = "随便")
-    private String remark;
-
-    @Schema(description = "创建时间")
-    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
-    private LocalDateTime[] createTime;
-
-}

+ 0 - 58
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivablePageReqVO.java

@@ -1,58 +0,0 @@
-package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
-
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.time.LocalDateTime;
-
-import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
-
-@Schema(description = "管理后台 - CRM 回款分页 Request VO")
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
-public class CrmReceivablePageReqVO extends PageParam {
-
-    // TODO @liuhongfeng:可以根据需求,去除掉一些不要的过滤条件;另外,planId、customerId、contractId、ownerUserId 注释不正确,应该都是对应的编号
-
-    @Schema(description = "回款编号")
-    private String no;
-
-    @Schema(description = "回款计划ID", example = "31177")
-    private Long planId;
-
-    @Schema(description = "客户名称", example = "4963")
-    private Long customerId;
-
-    @Schema(description = "合同名称", example = "30305")
-    private Long contractId;
-
-    @Schema(description = "审批状态", example = "1")
-    private Integer checkStatus;
-
-    @Schema(description = "回款日期")
-    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
-    private LocalDateTime[] returnTime;
-
-    @Schema(description = "回款方式", example = "2")
-    private String returnType;
-
-    @Schema(description = "回款金额", example = "31859")
-    private Integer price;
-
-    @Schema(description = "负责人", example = "22202")
-    private Long ownerUserId;
-
-
-    @Schema(description = "状态", example = "1")
-    private Integer status;
-
-    @Schema(description = "创建时间")
-    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
-    private LocalDateTime[] createTime;
-
-}

+ 0 - 19
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableRespVO.java

@@ -1,19 +0,0 @@
-package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.*;
-import java.time.LocalDateTime;
-
-@Schema(description = "管理后台 - CRM 回款 Response VO")
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
-public class CrmReceivableRespVO extends CrmReceivableBaseVO {
-
-    @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25787")
-    private Long id;
-
-    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
-    private LocalDateTime createTime;
-
-}

+ 2 - 5
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableBaseVO.java

@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
+package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable;
 
 import cn.iocoder.yudao.framework.common.validation.InEnum;
 import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum;
@@ -11,7 +11,7 @@ import java.time.LocalDateTime;
 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
 
 /**
- * 回款管理 Base VO,提供给添加、修改、详细的子 VO 使用
+ * 回款 Base VO,提供给添加、修改、详细的子 VO 使用
  * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
  */
 @Data
@@ -60,8 +60,5 @@ public class CrmReceivableBaseVO {
     @Schema(description = "备注", example = "备注")
     private String remark;
 
-    // TODO @liuhongfeng:这个字段,这个字段,应该不是前端传递的噢,而是后端自己生成的,所以不适合放在 base 里面;
-    @Schema(description = "完成状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
-    private Integer status;
 
 }

+ 1 - 1
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableCreateReqVO.java

@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
+package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable;
 
 import lombok.*;
 import io.swagger.v3.oas.annotations.media.Schema;

+ 24 - 0
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivablePageReqVO.java

@@ -0,0 +1,24 @@
+package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable;
+
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+@Schema(description = "管理后台 - CRM 回款分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class CrmReceivablePageReqVO extends PageParam {
+
+    @Schema(description = "回款编号")
+    private String no;
+
+    @Schema(description = "回款计划编号", example = "31177")
+    private Long planId;
+
+    @Schema(description = "客户编号", example = "4963")
+    private Long customerId;
+
+}

+ 38 - 0
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableRespVO.java

@@ -0,0 +1,38 @@
+package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.time.LocalDateTime;
+
+// TODO 芋艿:导出的 VO,可以考虑使用 @Excel 注解,实现导出功能
+@Schema(description = "管理后台 - CRM 回款 Response VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class CrmReceivableRespVO extends CrmReceivableBaseVO {
+
+    @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25787")
+    private Long id;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    private LocalDateTime createTime;
+
+    @Schema(description = "客户名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "test")
+    private String customerName;
+
+    @Schema(description = "审批状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
+    private Integer auditStatus;
+
+    @Schema(description = "合同编号", example = "Q110")
+    private String contractNo;
+
+    @Schema(description = "负责人", example = "test")
+    private String ownerUserName;
+
+    @Schema(description = "创建人", example = "25682")
+    private String creator;
+
+    @Schema(description = "创建人名字", example = "test")
+    private String creatorName;
+
+}

+ 1 - 1
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableUpdateReqVO.java

@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
+package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable;
 
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.*;

+ 35 - 8
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/receivable/CrmReceivableConvert.java

@@ -1,16 +1,24 @@
 package cn.iocoder.yudao.module.crm.convert.receivable;
 
-import java.util.*;
-
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
-
+import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableCreateReqVO;
+import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableRespVO;
+import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableUpdateReqVO;
+import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
+import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
 import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
+import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
 import org.mapstruct.Mapper;
 import org.mapstruct.factory.Mappers;
-import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
+
+import java.util.List;
+import java.util.Map;
+
+import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
+import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen;
 
 /**
- * 回款管理 Convert
+ * 回款 Convert
  *
  * @author 赤焰
  */
@@ -27,8 +35,27 @@ public interface CrmReceivableConvert {
 
     List<CrmReceivableRespVO> convertList(List<CrmReceivableDO> list);
 
-    PageResult<CrmReceivableRespVO> convertPage(PageResult<CrmReceivableDO> page);
-
-    List<CrmReceivableExcelVO> convertList02(List<CrmReceivableDO> list);
+    default PageResult<CrmReceivableRespVO> convertPage(PageResult<CrmReceivableDO> pageResult, Map<Long, AdminUserRespDTO> userMap,
+                                                        List<CrmCustomerDO> customerList, List<CrmContractDO> contractList) {
+        return new PageResult<>(converList(pageResult.getList(), userMap, customerList, contractList), pageResult.getTotal());
+    }
+
+    default List<CrmReceivableRespVO> converList(List<CrmReceivableDO> receivableList, Map<Long, AdminUserRespDTO> userMap,
+                                                 List<CrmCustomerDO> customerList, List<CrmContractDO> contractList) {
+        List<CrmReceivableRespVO> result = convertList(receivableList);
+        Map<Long, CrmCustomerDO> customerMap = convertMap(customerList, CrmCustomerDO::getId);
+        Map<Long, CrmContractDO> contractMap = convertMap(contractList, CrmContractDO::getId);
+        result.forEach(item -> {
+            setUserInfo(item, userMap);
+            findAndThen(customerMap, item.getCustomerId(), customer -> item.setCustomerName(customer.getName()));
+            findAndThen(contractMap, item.getContractId(), contract -> item.setContractNo(contract.getNo()));
+        });
+        return result;
+    }
+
+    static void setUserInfo(CrmReceivableRespVO receivable, Map<Long, AdminUserRespDTO> userMap) {
+        findAndThen(userMap, receivable.getOwnerUserId(), user -> receivable.setOwnerUserName(user.getNickname()));
+        findAndThen(userMap, Long.parseLong(receivable.getCreator()), user -> receivable.setCreatorName(user.getNickname()));
+    }
 
 }

+ 4 - 25
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.*;
 import java.time.LocalDateTime;
 
 /**
- * 回款管理 DO
+ * 回款 DO
  *
  * @author 赤焰
  */
@@ -54,12 +54,6 @@ public class CrmReceivableDO extends BaseDO {
      * 对应实体 {@link CrmContractDO}
      */
     private Long contractId;
-    // TODO @liuhongfeng:“对应字典”,参考别的模块,枚举 {@link XXXX};另外,这个字段就叫 status,整体状态,不只审批
-    /**
-     * 审批状态
-     * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_AUDIT_STATUS}
-     */
-    private Integer checkStatus;
     /**
      * 工作流编号
      *
@@ -84,31 +78,16 @@ public class CrmReceivableDO extends BaseDO {
      * 负责人
      */
     private Long ownerUserId;
-    // TODO @liuhongfeng:应该不需要 batchId 字段
-    /**
-     * 批次
-     */
-    private Long batchId;
     /**
      * 显示顺序
      */
     private Integer sort;
-    // TODO 芋艿:dataScope、dataScopeDeptIds 在想下;
     /**
-     * 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)
-     */
-    private Integer dataScope;
-    /**
-     * 数据范围(指定部门数组)
-     */
-    private String dataScopeDeptIds;
-    /**
-     * 状态
-     *
-     * 枚举 {@link cn.iocoder.yudao.framework.common.enums.CommonStatusEnum}
+     * 审核状态
      *
+     * 枚举 {@link cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum}
      */
-    private Integer status;
+    private Integer auditStatus;
     /**
      * 备注
      */

+ 0 - 4
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/package-info.java

@@ -1,4 +0,0 @@
-/**
- * 合同
- */
-package cn.iocoder.yudao.module.crm.dal.mysql.contract;

+ 1 - 1
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customerlimitconfig/CrmCustomerLimitConfigMapper.java

@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.module.crm.dal.mysql.customerlimitconfig;
+package cn.iocoder.yudao.module.crm.dal.mysql.customer;
 
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;

+ 0 - 4
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/package-info.java

@@ -1,4 +0,0 @@
-/**
- * 客户
- */
-package cn.iocoder.yudao.module.crm.dal.mysql.customer;

+ 6 - 26
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivableMapper.java

@@ -1,16 +1,14 @@
 package cn.iocoder.yudao.module.crm.dal.mysql.receivable;
 
-import java.util.*;
-
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO;
 import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
 import org.apache.ibatis.annotations.Mapper;
-import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
 
 /**
- * 回款管理 Mapper
+ * 回款 Mapper
  *
  * @author 赤焰
  */
@@ -22,32 +20,14 @@ public interface CrmReceivableMapper extends BaseMapperX<CrmReceivableDO> {
                 .eqIfPresent(CrmReceivableDO::getNo, reqVO.getNo())
                 .eqIfPresent(CrmReceivableDO::getPlanId, reqVO.getPlanId())
                 .eqIfPresent(CrmReceivableDO::getCustomerId, reqVO.getCustomerId())
-                .eqIfPresent(CrmReceivableDO::getContractId, reqVO.getContractId())
-                .eqIfPresent(CrmReceivableDO::getCheckStatus, reqVO.getCheckStatus())
-                .betweenIfPresent(CrmReceivableDO::getReturnTime, reqVO.getReturnTime())
-                .eqIfPresent(CrmReceivableDO::getReturnType, reqVO.getReturnType())
-                .eqIfPresent(CrmReceivableDO::getPrice, reqVO.getPrice())
-                .eqIfPresent(CrmReceivableDO::getOwnerUserId, reqVO.getOwnerUserId())
-                .eqIfPresent(CrmReceivableDO::getStatus, reqVO.getStatus())
-                .betweenIfPresent(CrmReceivableDO::getCreateTime, reqVO.getCreateTime())
                 .orderByDesc(CrmReceivableDO::getId));
     }
 
-    default List<CrmReceivableDO> selectList(CrmReceivableExportReqVO reqVO) {
-        return selectList(new LambdaQueryWrapperX<CrmReceivableDO>()
+    default PageResult<CrmReceivableDO> selectPageByCustomer(CrmReceivablePageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<CrmReceivableDO>()
+                .eq(CrmReceivableDO::getCustomerId, reqVO.getCustomerId()) // 必须传递
                 .eqIfPresent(CrmReceivableDO::getNo, reqVO.getNo())
                 .eqIfPresent(CrmReceivableDO::getPlanId, reqVO.getPlanId())
-                .eqIfPresent(CrmReceivableDO::getCustomerId, reqVO.getCustomerId())
-                .eqIfPresent(CrmReceivableDO::getContractId, reqVO.getContractId())
-                .eqIfPresent(CrmReceivableDO::getCheckStatus, reqVO.getCheckStatus())
-                .betweenIfPresent(CrmReceivableDO::getReturnTime, reqVO.getReturnTime())
-                .eqIfPresent(CrmReceivableDO::getReturnType, reqVO.getReturnType())
-                .eqIfPresent(CrmReceivableDO::getPrice, reqVO.getPrice())
-                .eqIfPresent(CrmReceivableDO::getOwnerUserId, reqVO.getOwnerUserId())
-                .eqIfPresent(CrmReceivableDO::getBatchId, reqVO.getBatchId())
-                .eqIfPresent(CrmReceivableDO::getStatus, reqVO.getStatus())
-                .eqIfPresent(CrmReceivableDO::getRemark, reqVO.getRemark())
-                .betweenIfPresent(CrmReceivableDO::getCreateTime, reqVO.getCreateTime())
                 .orderByDesc(CrmReceivableDO::getId));
     }
 

+ 0 - 4
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/package-info.java

@@ -1,4 +0,0 @@
-/**
- * 回款
- */
-package cn.iocoder.yudao.module.crm.dal.mysql.receivable;

+ 1 - 1
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
 import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigUpdateReqVO;
 import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerLimitConfigConvert;
 import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerLimitConfigDO;
-import cn.iocoder.yudao.module.crm.dal.mysql.customerlimitconfig.CrmCustomerLimitConfigMapper;
+import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerLimitConfigMapper;
 import cn.iocoder.yudao.module.system.api.dept.DeptApi;
 import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
 import org.springframework.stereotype.Service;

+ 27 - 19
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableService.java

@@ -1,21 +1,25 @@
 package cn.iocoder.yudao.module.crm.service.receivable;
 
-import java.util.*;
-import javax.validation.*;
-
-import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
-import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableCreateReqVO;
+import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO;
+import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableUpdateReqVO;
+import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
+import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
+
+import javax.validation.Valid;
+import java.util.Collection;
+import java.util.List;
 
 /**
- * 回款管理 Service 接口
+ * CRM 回款 Service 接口
  *
  * @author 赤焰
  */
 public interface CrmReceivableService {
 
     /**
-     * 创建回款管理
+     * 创建回款
      *
      * @param createReqVO 创建信息
      * @return 编号
@@ -23,49 +27,53 @@ public interface CrmReceivableService {
     Long createReceivable(@Valid CrmReceivableCreateReqVO createReqVO);
 
     /**
-     * 更新回款管理
+     * 更新回款
      *
      * @param updateReqVO 更新信息
      */
     void updateReceivable(@Valid CrmReceivableUpdateReqVO updateReqVO);
 
     /**
-     * 删除回款管理
+     * 删除回款
      *
      * @param id 编号
      */
     void deleteReceivable(Long id);
 
     /**
-     * 获得回款管理
+     * 获得回款
      *
      * @param id 编号
-     * @return 回款管理
+     * @return 回款
      */
     CrmReceivableDO getReceivable(Long id);
 
     /**
-     * 获得回款管理列表
+     * 获得回款列表
      *
      * @param ids 编号
-     * @return 回款管理列表
+     * @return 回款列表
      */
     List<CrmReceivableDO> getReceivableList(Collection<Long> ids);
 
     /**
-     * 获得回款管理分页
+     * 获得回款分页
+     *
+     * 数据权限:基于 {@link CrmReceivableDO} 读取
      *
      * @param pageReqVO 分页查询
-     * @return 回款管理分页
+     * @return 回款分页
      */
     PageResult<CrmReceivableDO> getReceivablePage(CrmReceivablePageReqVO pageReqVO);
 
     /**
-     * 获得回款管理列表, 用于 Excel 导出
+     * 获得回款分页,基于指定客户
+     *
+     * 数据权限:基于 {@link CrmCustomerDO} 读取
      *
-     * @param exportReqVO 查询条件
-     * @return 回款管理列表
+     * @param pageReqVO 分页查询
+     * @return 回款分页
      */
-    List<CrmReceivableDO> getReceivableList(CrmReceivableExportReqVO exportReqVO);
+    PageResult<CrmReceivableDO> getReceivablePageByCustomer(CrmReceivablePageReqVO pageReqVO);
 
 }

+ 28 - 26
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;
 import cn.hutool.core.util.ObjectUtil;
 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivableCreateReqVO;
-import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivableExportReqVO;
-import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePageReqVO;
-import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivableUpdateReqVO;
+import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableCreateReqVO;
+import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO;
+import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableUpdateReqVO;
 import cn.iocoder.yudao.module.crm.convert.receivable.CrmReceivableConvert;
 import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
 import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
@@ -16,6 +15,9 @@ import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
 import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO;
 import cn.iocoder.yudao.module.crm.dal.mysql.receivable.CrmReceivableMapper;
 import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum;
+import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum;
+import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum;
+import cn.iocoder.yudao.module.crm.framework.core.annotations.CrmPermission;
 import cn.iocoder.yudao.module.crm.service.contract.CrmContractService;
 import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
 import org.springframework.stereotype.Service;
@@ -29,7 +31,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
 import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
 
 /**
- * 回款管理 Service 实现类
+ * CRM 回款 Service 实现类
  *
  * @author 赤焰
  */
@@ -37,34 +39,31 @@ import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
 @Validated
 public class CrmReceivableServiceImpl implements CrmReceivableService {
 
-    // TODO @liuhongfeng:crm 前缀,变量可以不带哈;
     @Resource
-    private CrmReceivableMapper crmReceivableMapper;
+    private CrmReceivableMapper receivableMapper;
+
     @Resource
     private CrmContractService contractService;
     @Resource
-    private CrmCustomerService crmCustomerService;
+    private CrmCustomerService customerService;
     @Resource
-    private CrmReceivablePlanService crmReceivablePlanService;
+    private CrmReceivablePlanService receivablePlanService;
 
     // TODO @liuhongfeng:创建还款后,是不是什么时候,要更新 plan?
     @Override
     public Long createReceivable(CrmReceivableCreateReqVO createReqVO) {
         // 插入
         CrmReceivableDO receivable = CrmReceivableConvert.INSTANCE.convert(createReqVO);
-        // TODO @liuhongfeng:这里的括号要注意排版;
-        if (ObjectUtil.isNull(receivable.getStatus())){
-            receivable.setStatus(CommonStatusEnum.ENABLE.getStatus());
-        }
-        if (ObjectUtil.isNull(receivable.getCheckStatus())){
-            receivable.setCheckStatus(CrmAuditStatusEnum.DRAFT.getStatus());
+        if (ObjectUtil.isNull(receivable.getAuditStatus())) {
+            receivable.setAuditStatus(CommonStatusEnum.ENABLE.getStatus());
         }
+        receivable.setAuditStatus(CrmAuditStatusEnum.DRAFT.getStatus());
 
         // TODO @liuhongfeng:一般来说,逻辑的写法,是要先检查,后操作 db;所以,你这个 check 应该放到  CrmReceivableDO receivable 之前;
         // 校验
         checkReceivable(receivable);
 
-        crmReceivableMapper.insert(receivable);
+        receivableMapper.insert(receivable);
         return receivable.getId();
     }
 
@@ -80,12 +79,12 @@ public class CrmReceivableServiceImpl implements CrmReceivableService {
             throw exception(CONTRACT_NOT_EXISTS);
         }
 
-        CrmCustomerDO customer = crmCustomerService.getCustomer(receivable.getCustomerId());
+        CrmCustomerDO customer = customerService.getCustomer(receivable.getCustomerId());
         if(ObjectUtil.isNull(customer)){
             throw exception(CUSTOMER_NOT_EXISTS);
         }
 
-        CrmReceivablePlanDO receivablePlan = crmReceivablePlanService.getReceivablePlan(receivable.getPlanId());
+        CrmReceivablePlanDO receivablePlan = receivablePlanService.getReceivablePlan(receivable.getPlanId());
         if(ObjectUtil.isNull(receivablePlan)){
             throw exception(RECEIVABLE_PLAN_NOT_EXISTS);
         }
@@ -99,7 +98,7 @@ public class CrmReceivableServiceImpl implements CrmReceivableService {
 
         // 更新
         CrmReceivableDO updateObj = CrmReceivableConvert.INSTANCE.convert(updateReqVO);
-        crmReceivableMapper.updateById(updateObj);
+        receivableMapper.updateById(updateObj);
     }
 
     @Override
@@ -107,18 +106,19 @@ public class CrmReceivableServiceImpl implements CrmReceivableService {
         // 校验存在
         validateReceivableExists(id);
         // 删除
-        crmReceivableMapper.deleteById(id);
+        receivableMapper.deleteById(id);
     }
 
     private void validateReceivableExists(Long id) {
-        if (crmReceivableMapper.selectById(id) == null) {
+        if (receivableMapper.selectById(id) == null) {
             throw exception(RECEIVABLE_NOT_EXISTS);
         }
     }
 
+    // TODO @芋艿:数据权限
     @Override
     public CrmReceivableDO getReceivable(Long id) {
-        return crmReceivableMapper.selectById(id);
+        return receivableMapper.selectById(id);
     }
 
     @Override
@@ -126,17 +126,19 @@ public class CrmReceivableServiceImpl implements CrmReceivableService {
         if (CollUtil.isEmpty(ids)) {
             return ListUtil.empty();
         }
-        return crmReceivableMapper.selectBatchIds(ids);
+        return receivableMapper.selectBatchIds(ids);
     }
 
+    // TODO @芋艿:数据权限
     @Override
     public PageResult<CrmReceivableDO> getReceivablePage(CrmReceivablePageReqVO pageReqVO) {
-        return crmReceivableMapper.selectPage(pageReqVO);
+        return receivableMapper.selectPage(pageReqVO);
     }
 
     @Override
-    public List<CrmReceivableDO> getReceivableList(CrmReceivableExportReqVO exportReqVO) {
-        return crmReceivableMapper.selectList(exportReqVO);
+    @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#pageReqVO.customerId", level = CrmPermissionLevelEnum.READ)
+    public PageResult<CrmReceivableDO> getReceivablePageByCustomer(CrmReceivablePageReqVO pageReqVO) {
+        return receivableMapper.selectPageByCustomer(pageReqVO);
     }
 
 }

+ 1 - 1
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
 import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigPageReqVO;
 import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigUpdateReqVO;
 import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerLimitConfigDO;
-import cn.iocoder.yudao.module.crm.dal.mysql.customerlimitconfig.CrmCustomerLimitConfigMapper;
+import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerLimitConfigMapper;
 import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerLimitConfigServiceImpl;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;

+ 4 - 124
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;
 
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
-import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivableCreateReqVO;
-import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivableExportReqVO;
-import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePageReqVO;
-import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivableUpdateReqVO;
+import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableCreateReqVO;
+import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO;
+import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableUpdateReqVO;
 import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
 import cn.iocoder.yudao.module.crm.dal.mysql.receivable.CrmReceivableMapper;
 import org.junit.jupiter.api.Disabled;
@@ -13,9 +12,7 @@ import org.junit.jupiter.api.Test;
 import org.springframework.context.annotation.Import;
 
 import javax.annotation.Resource;
-import java.util.List;
 
-import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
 import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
@@ -121,7 +118,7 @@ public class CrmCrmReceivableServiceImplTest extends BaseDbUnitTest {
            o.setSort(null);
            o.setDataScope(null);
            o.setDataScopeDeptIds(null);
-           o.setStatus(null);
+           o.setAuditStatus(null);
            o.setRemark(null);
            o.setCreateTime(null);
        });
@@ -132,47 +129,11 @@ public class CrmCrmReceivableServiceImplTest extends BaseDbUnitTest {
        crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setPlanId(null)));
        // 测试 customerId 不匹配
        crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCustomerId(null)));
-       // 测试 contractId 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setContractId(null)));
-       // 测试 checkStatus 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCheckStatus(null)));
-       // 测试 processInstanceId 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setProcessInstanceId(null)));
-       // 测试 returnTime 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setReturnTime(null)));
-       // 测试 returnType 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setReturnType(null)));
-       // 测试 price 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setPrice(null)));
-       // 测试 ownerUserId 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setOwnerUserId(null)));
-       // 测试 batchId 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setBatchId(null)));
-       // 测试 sort 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setSort(null)));
-       // 测试 dataScope 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setDataScope(null)));
-       // 测试 dataScopeDeptIds 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setDataScopeDeptIds(null)));
-       // 测试 status 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setStatus(null)));
-       // 测试 remark 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setRemark(null)));
-       // 测试 createTime 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCreateTime(null)));
        // 准备参数
        CrmReceivablePageReqVO reqVO = new CrmReceivablePageReqVO();
        reqVO.setNo(null);
        reqVO.setPlanId(null);
        reqVO.setCustomerId(null);
-       reqVO.setContractId(null);
-       reqVO.setCheckStatus(null);
-       reqVO.setReturnTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
-       reqVO.setReturnType(null);
-       reqVO.setPrice(null);
-       reqVO.setOwnerUserId(null);
-       reqVO.setStatus(null);
-       reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
 
        // 调用
        PageResult<CrmReceivableDO> pageResult = receivableService.getReceivablePage(reqVO);
@@ -182,85 +143,4 @@ public class CrmCrmReceivableServiceImplTest extends BaseDbUnitTest {
        assertPojoEquals(dbReceivable, pageResult.getList().get(0));
     }
 
-    @Test
-    @Disabled  // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
-    public void testGetReceivableList() {
-       // mock 数据
-       CrmReceivableDO dbReceivable = randomPojo(CrmReceivableDO.class, o -> { // 等会查询到
-           o.setNo(null);
-           o.setPlanId(null);
-           o.setCustomerId(null);
-           o.setContractId(null);
-           o.setCheckStatus(null);
-           o.setProcessInstanceId(null);
-           o.setReturnTime(null);
-           o.setReturnType(null);
-           o.setPrice(null);
-           o.setOwnerUserId(null);
-           o.setBatchId(null);
-           o.setSort(null);
-           o.setDataScope(null);
-           o.setDataScopeDeptIds(null);
-           o.setStatus(null);
-           o.setRemark(null);
-           o.setCreateTime(null);
-       });
-       crmReceivableMapper.insert(dbReceivable);
-       // 测试 no 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setNo(null)));
-       // 测试 planId 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setPlanId(null)));
-       // 测试 customerId 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCustomerId(null)));
-       // 测试 contractId 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setContractId(null)));
-       // 测试 checkStatus 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCheckStatus(null)));
-       // 测试 processInstanceId 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setProcessInstanceId(null)));
-       // 测试 returnTime 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setReturnTime(null)));
-       // 测试 returnType 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setReturnType(null)));
-       // 测试 price 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setPrice(null)));
-       // 测试 ownerUserId 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setOwnerUserId(null)));
-       // 测试 batchId 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setBatchId(null)));
-       // 测试 sort 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setSort(null)));
-       // 测试 dataScope 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setDataScope(null)));
-       // 测试 dataScopeDeptIds 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setDataScopeDeptIds(null)));
-       // 测试 status 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setStatus(null)));
-       // 测试 remark 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setRemark(null)));
-       // 测试 createTime 不匹配
-       crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCreateTime(null)));
-       // 准备参数
-       CrmReceivableExportReqVO reqVO = new CrmReceivableExportReqVO();
-       reqVO.setNo(null);
-       reqVO.setPlanId(null);
-       reqVO.setCustomerId(null);
-       reqVO.setContractId(null);
-       reqVO.setCheckStatus(null);
-       reqVO.setReturnTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
-       reqVO.setReturnType(null);
-       reqVO.setPrice(null);
-       reqVO.setOwnerUserId(null);
-       reqVO.setBatchId(null);
-       reqVO.setStatus(null);
-       reqVO.setRemark(null);
-       reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
-
-       // 调用
-       List<CrmReceivableDO> list = receivableService.getReceivableList(reqVO);
-       // 断言
-       assertEquals(1, list.size());
-       assertPojoEquals(dbReceivable, list.get(0));
-    }
-
 }

+ 1 - 1
yudao-module-crm/yudao-module-crm-biz/src/test/resources/sql/create_tables.sql

@@ -72,7 +72,7 @@ CREATE TABLE IF NOT EXISTS "crm_receivable" (
     "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
     "deleted" bit NOT NULL DEFAULT FALSE,
     PRIMARY KEY ("id")
-) COMMENT '回款管理';
+) COMMENT '回款';
 
 CREATE TABLE IF NOT EXISTS "crm_receivable_plan" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,