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

This commit is contained in:
YunaiV 2023-12-01 19:37:44 +08:00
parent db03b10d24
commit f02b9464bd
28 changed files with 261 additions and 484 deletions

View File

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

View File

@ -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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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'); 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');

View File

@ -24,8 +24,8 @@ public interface ErrorCodeConstants {
// ========== 联系人管理 1-020-003-000 ========== // ========== 联系人管理 1-020-003-000 ==========
ErrorCode CONTACT_NOT_EXISTS = new ErrorCode(1_020_003_000, "联系人不存在"); ErrorCode CONTACT_NOT_EXISTS = new ErrorCode(1_020_003_000, "联系人不存在");
// ========== 回款管理 1-020-004-000 ========== // ========== 回款 1-020-004-000 ==========
ErrorCode RECEIVABLE_NOT_EXISTS = new ErrorCode(1_020_004_000, "回款管理不存在"); ErrorCode RECEIVABLE_NOT_EXISTS = new ErrorCode(1_020_004_000, "回款不存在");
// ========== 合同管理 1-020-005-000 ========== // ========== 合同管理 1-020-005-000 ==========
ErrorCode RECEIVABLE_PLAN_NOT_EXISTS = new ErrorCode(1_020_005_000, "回款计划不存在"); ErrorCode RECEIVABLE_PLAN_NOT_EXISTS = new ErrorCode(1_020_005_000, "回款计划不存在");

View File

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

View File

@ -1,13 +1,25 @@
package cn.iocoder.yudao.module.crm.controller.admin.receivable; 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.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; 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.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; 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.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.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.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.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
@ -20,71 +32,113 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.util.List; 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.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; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - CRM 回款管理") @Tag(name = "管理后台 - CRM 回款")
@RestController @RestController
@RequestMapping("/crm/receivable") @RequestMapping("/crm/receivable")
@Validated @Validated
public class CrmReceivableController { public class CrmReceivableController {
// TODO @liuhongfengcrmReceivableService 可以使用 receivableService 在自己模块里相对简洁一点
@Resource @Resource
private CrmReceivableService crmReceivableService; private CrmReceivableService receivableService;
@Resource
private CrmContractService contractService;
@Resource
private CrmCustomerService customerService;
@Resource
private AdminUserApi adminUserApi;
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建回款管理") @Operation(summary = "创建回款")
@PreAuthorize("@ss.hasPermission('crm:receivable:create')") @PreAuthorize("@ss.hasPermission('crm:receivable:create')")
public CommonResult<Long> createReceivable(@Valid @RequestBody CrmReceivableCreateReqVO createReqVO) { public CommonResult<Long> createReceivable(@Valid @RequestBody CrmReceivableCreateReqVO createReqVO) {
return success(crmReceivableService.createReceivable(createReqVO)); return success(receivableService.createReceivable(createReqVO));
} }
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新回款管理") @Operation(summary = "更新回款")
@PreAuthorize("@ss.hasPermission('crm:receivable:update')") @PreAuthorize("@ss.hasPermission('crm:receivable:update')")
public CommonResult<Boolean> updateReceivable(@Valid @RequestBody CrmReceivableUpdateReqVO updateReqVO) { public CommonResult<Boolean> updateReceivable(@Valid @RequestBody CrmReceivableUpdateReqVO updateReqVO) {
crmReceivableService.updateReceivable(updateReqVO); receivableService.updateReceivable(updateReqVO);
return success(true); return success(true);
} }
@DeleteMapping("/delete") @DeleteMapping("/delete")
@Operation(summary = "删除回款管理") @Operation(summary = "删除回款")
@Parameter(name = "id", description = "编号", required = true) @Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('crm:receivable:delete')") @PreAuthorize("@ss.hasPermission('crm:receivable:delete')")
public CommonResult<Boolean> deleteReceivable(@RequestParam("id") Long id) { public CommonResult<Boolean> deleteReceivable(@RequestParam("id") Long id) {
crmReceivableService.deleteReceivable(id); receivableService.deleteReceivable(id);
return success(true); return success(true);
} }
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得回款管理") @Operation(summary = "获得回款")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('crm:receivable:query')") @PreAuthorize("@ss.hasPermission('crm:receivable:query')")
public CommonResult<CrmReceivableRespVO> getReceivable(@RequestParam("id") Long id) { public CommonResult<CrmReceivableRespVO> getReceivable(@RequestParam("id") Long id) {
CrmReceivableDO receivable = crmReceivableService.getReceivable(id); CrmReceivableDO receivable = receivableService.getReceivable(id);
return success(CrmReceivableConvert.INSTANCE.convert(receivable)); return success(CrmReceivableConvert.INSTANCE.convert(receivable));
} }
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得回款管理分页") @Operation(summary = "获得回款分页")
@PreAuthorize("@ss.hasPermission('crm:receivable:query')") @PreAuthorize("@ss.hasPermission('crm:receivable:query')")
public CommonResult<PageResult<CrmReceivableRespVO>> getReceivablePage(@Valid CrmReceivablePageReqVO pageVO) { public CommonResult<PageResult<CrmReceivableRespVO>> getReceivablePage(@Valid CrmReceivablePageReqVO pageReqVO) {
PageResult<CrmReceivableDO> pageResult = crmReceivableService.getReceivablePage(pageVO); PageResult<CrmReceivableDO> pageResult = receivableService.getReceivablePage(pageReqVO);
return success(CrmReceivableConvert.INSTANCE.convertPage(pageResult)); 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") @GetMapping("/export-excel")
@Operation(summary = "导出回款管理 Excel") @Operation(summary = "导出回款 Excel")
@PreAuthorize("@ss.hasPermission('crm:receivable:export')") @PreAuthorize("@ss.hasPermission('crm:receivable:export')")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public void exportReceivableExcel(@Valid CrmReceivableExportReqVO exportReqVO, public void exportReceivableExcel(@Valid CrmReceivablePageReqVO exportReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
List<CrmReceivableDO> list = crmReceivableService.getReceivableList(exportReqVO); PageResult<CrmReceivableDO> pageResult = receivableService.getReceivablePage(exportReqVO);
// 导出 Excel // 导出 Excel
List<CrmReceivableExcelVO> datas = CrmReceivableConvert.INSTANCE.convertList02(list); ExcelUtils.write(response, "回款.xls", "数据", CrmReceivableRespVO.class,
ExcelUtils.write(response, "回款管理.xls", "数据", CrmReceivableExcelVO.class, datas); 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);
} }
} }

View File

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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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可以根据需求去除掉一些不要的过滤条件另外planIdcustomerIdcontractIdownerUserId 注释不正确应该都是对应的编号
@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;
}

View File

@ -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;
}

View File

@ -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.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; 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; 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 文档生成 * 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/ */
@Data @Data
@ -60,8 +60,5 @@ public class CrmReceivableBaseVO {
@Schema(description = "备注", example = "备注") @Schema(description = "备注", example = "备注")
private String remark; private String remark;
// TODO @liuhongfeng这个字段这个字段应该不是前端传递的噢而是后端自己生成的所以不适合放在 base 里面
@Schema(description = "完成状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Integer status;
} }

View File

@ -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 lombok.*;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;

View File

@ -1,16 +1,24 @@
package cn.iocoder.yudao.module.crm.convert.receivable; package cn.iocoder.yudao.module.crm.convert.receivable;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult; 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.crm.dal.dataobject.receivable.CrmReceivableDO;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers; 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 赤焰 * @author 赤焰
*/ */
@ -27,8 +35,27 @@ public interface CrmReceivableConvert {
List<CrmReceivableRespVO> convertList(List<CrmReceivableDO> list); List<CrmReceivableRespVO> convertList(List<CrmReceivableDO> list);
PageResult<CrmReceivableRespVO> convertPage(PageResult<CrmReceivableDO> page); 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());
}
List<CrmReceivableExcelVO> convertList02(List<CrmReceivableDO> list); 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()));
}
} }

View File

@ -10,7 +10,7 @@ import lombok.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
/** /**
* 回款管理 DO * 回款 DO
* *
* @author 赤焰 * @author 赤焰
*/ */
@ -54,12 +54,6 @@ public class CrmReceivableDO extends BaseDO {
* 对应实体 {@link CrmContractDO} * 对应实体 {@link CrmContractDO}
*/ */
private Long contractId; 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; private Long ownerUserId;
// TODO @liuhongfeng应该不需要 batchId 字段
/**
* 批次
*/
private Long batchId;
/** /**
* 显示顺序 * 显示顺序
*/ */
private Integer sort; private Integer sort;
// TODO 芋艿dataScopedataScopeDeptIds 在想下
/** /**
* 数据范围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;
/** /**
* 备注 * 备注
*/ */

View File

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

View File

@ -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.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;

View File

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

View File

@ -1,16 +1,14 @@
package cn.iocoder.yudao.module.crm.dal.mysql.receivable; 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.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.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 cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
/** /**
* 回款管理 Mapper * 回款 Mapper
* *
* @author 赤焰 * @author 赤焰
*/ */
@ -22,32 +20,14 @@ public interface CrmReceivableMapper extends BaseMapperX<CrmReceivableDO> {
.eqIfPresent(CrmReceivableDO::getNo, reqVO.getNo()) .eqIfPresent(CrmReceivableDO::getNo, reqVO.getNo())
.eqIfPresent(CrmReceivableDO::getPlanId, reqVO.getPlanId()) .eqIfPresent(CrmReceivableDO::getPlanId, reqVO.getPlanId())
.eqIfPresent(CrmReceivableDO::getCustomerId, reqVO.getCustomerId()) .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)); .orderByDesc(CrmReceivableDO::getId));
} }
default List<CrmReceivableDO> selectList(CrmReceivableExportReqVO reqVO) { default PageResult<CrmReceivableDO> selectPageByCustomer(CrmReceivablePageReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<CrmReceivableDO>() return selectPage(reqVO, new LambdaQueryWrapperX<CrmReceivableDO>()
.eq(CrmReceivableDO::getCustomerId, reqVO.getCustomerId()) // 必须传递
.eqIfPresent(CrmReceivableDO::getNo, reqVO.getNo()) .eqIfPresent(CrmReceivableDO::getNo, reqVO.getNo())
.eqIfPresent(CrmReceivableDO::getPlanId, reqVO.getPlanId()) .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)); .orderByDesc(CrmReceivableDO::getId));
} }

View File

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

View File

@ -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.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigUpdateReqVO;
import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerLimitConfigConvert; 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.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.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

View File

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

View File

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

View File

@ -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.CrmCustomerLimitConfigPageReqVO;
import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigUpdateReqVO; 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.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 cn.iocoder.yudao.module.crm.service.customer.CrmCustomerLimitConfigServiceImpl;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View File

@ -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.common.pojo.PageResult;
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; 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.receivable.CrmReceivableCreateReqVO;
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivableExportReqVO; import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO;
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivablePageReqVO; import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableUpdateReqVO;
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.CrmReceivableUpdateReqVO;
import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO; import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
import cn.iocoder.yudao.module.crm.dal.mysql.receivable.CrmReceivableMapper; import cn.iocoder.yudao.module.crm.dal.mysql.receivable.CrmReceivableMapper;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
@ -13,9 +12,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import javax.annotation.Resource; 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.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.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
@ -121,7 +118,7 @@ public class CrmCrmReceivableServiceImplTest extends BaseDbUnitTest {
o.setSort(null); o.setSort(null);
o.setDataScope(null); o.setDataScope(null);
o.setDataScopeDeptIds(null); o.setDataScopeDeptIds(null);
o.setStatus(null); o.setAuditStatus(null);
o.setRemark(null); o.setRemark(null);
o.setCreateTime(null); o.setCreateTime(null);
}); });
@ -132,47 +129,11 @@ public class CrmCrmReceivableServiceImplTest extends BaseDbUnitTest {
crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setPlanId(null))); crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setPlanId(null)));
// 测试 customerId 不匹配 // 测试 customerId 不匹配
crmReceivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCustomerId(null))); 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(); CrmReceivablePageReqVO reqVO = new CrmReceivablePageReqVO();
reqVO.setNo(null); reqVO.setNo(null);
reqVO.setPlanId(null); reqVO.setPlanId(null);
reqVO.setCustomerId(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); PageResult<CrmReceivableDO> pageResult = receivableService.getReceivablePage(reqVO);
@ -182,85 +143,4 @@ public class CrmCrmReceivableServiceImplTest extends BaseDbUnitTest {
assertPojoEquals(dbReceivable, pageResult.getList().get(0)); 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));
}
} }

View File

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