Commit 73f4fc8ceb4adbca1a9b9c75f87f684b7a98aaa6
1 parent
439edcd1
【新增】回款管理 功能
Showing
21 changed files
with
1249 additions
and
4 deletions
sql/mysql/crm.sql
| @@ -60,4 +60,36 @@ CREATE TABLE `crm_clue` ( | @@ -60,4 +60,36 @@ CREATE TABLE `crm_clue` ( | ||
| 60 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 60 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 61 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | 61 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 62 | PRIMARY KEY (`id`) USING BTREE | 62 | PRIMARY KEY (`id`) USING BTREE |
| 63 | -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '线索表' ROW_FORMAT = Dynamic; | ||
| 64 | \ No newline at end of file | 63 | \ No newline at end of file |
| 64 | +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '线索表' ROW_FORMAT = Dynamic; | ||
| 65 | + | ||
| 66 | + | ||
| 67 | +-- ---------------------------- | ||
| 68 | +-- 回款表 | ||
| 69 | +-- ---------------------------- | ||
| 70 | +DROP TABLE IF EXISTS `crm_receivable`; | ||
| 71 | +CREATE TABLE `crm_receivable` ( | ||
| 72 | + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', | ||
| 73 | + `no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '回款编号', | ||
| 74 | + `plan_id` bigint(20) NULL DEFAULT NULL COMMENT '回款计划ID', | ||
| 75 | + `customer_id` bigint(20) NULL DEFAULT NULL COMMENT '客户ID', | ||
| 76 | + `contract_id` bigint(20) NULL DEFAULT NULL COMMENT '合同ID', | ||
| 77 | + `check_status` tinyint(4) NULL DEFAULT NULL COMMENT '审批状态', | ||
| 78 | + `process_instance_id` bigint(20) NULL DEFAULT NULL COMMENT '工作流编号', | ||
| 79 | + `return_time` datetime NULL DEFAULT NULL COMMENT '回款日期', | ||
| 80 | + `return_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '回款方式', | ||
| 81 | + `price` decimal(10, 2) NULL DEFAULT NULL COMMENT '回款金额', | ||
| 82 | + `owner_user_id` bigint(20) NULL DEFAULT NULL COMMENT '负责人的用户编号', | ||
| 83 | + `batch_id` bigint(20) NULL DEFAULT NULL COMMENT '批次', | ||
| 84 | + `sort` int(11) NULL DEFAULT NULL COMMENT '显示顺序', | ||
| 85 | + `data_scope` tinyint(4) NULL DEFAULT 1 COMMENT '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)', | ||
| 86 | + `data_scope_dept_ids` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '数据范围(指定部门数组)', | ||
| 87 | + `status` tinyint(4) NOT NULL COMMENT '状态(0正常 1停用)', | ||
| 88 | + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注', | ||
| 89 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | ||
| 90 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 91 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 92 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 93 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 94 | + `tenant_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 95 | + PRIMARY KEY (`id`) USING BTREE | ||
| 96 | +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '回款管理' ROW_FORMAT = DYNAMIC; |
sql/mysql/crm_data.sql
0 → 100644
| 1 | + | ||
| 2 | +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (184, '回款管理审批状态', 'crm_receivable_check_status', 0, '回款管理审批状态(0 未审核 1 审核通过 2 审核拒绝 3 审核中 4 已撤回)', '1', '2023-10-18 21:44:24', '1', '2023-10-18 21:44:24', b'0', '1970-01-01 00:00:00'); | ||
| 3 | +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (185, '回款管理-回款方式', 'crm_return_type', 0, '回款管理-回款方式', '1', '2023-10-18 21:54:10', '1', '2023-10-18 21:54:10', b'0', '1970-01-01 00:00:00'); | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +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'); | ||
| 7 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1390, 1, '审核通过', '1', 'crm_receivable_check_status', 0, 'default', '', '1 审核通过', '1', '2023-10-18 21:46:18', '1', '2023-10-18 21:47:08', b'0'); | ||
| 8 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1391, 2, '审核拒绝', '2', 'crm_receivable_check_status', 0, 'default', '', ' 2 审核拒绝', '1', '2023-10-18 21:46:58', '1', '2023-10-18 21:47:21', b'0'); | ||
| 9 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1392, 3, '审核中', '3', 'crm_receivable_check_status', 0, 'default', '', ' 3 审核中', '1', '2023-10-18 21:47:35', '1', '2023-10-18 21:47:35', b'0'); | ||
| 10 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1393, 4, '已撤回', '4', 'crm_receivable_check_status', 0, 'default', '', ' 4 已撤回', '1', '2023-10-18 21:47:46', '1', '2023-10-18 21:47:46', b'0'); | ||
| 11 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1394, 1, '支票', '1', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:54:29', '1', '2023-10-18 21:54:29', b'0'); | ||
| 12 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1395, 2, '现金', '2', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:54:41', '1', '2023-10-18 21:54:41', b'0'); | ||
| 13 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1396, 3, '邮政汇款', '3', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:54:53', '1', '2023-10-18 21:54:53', b'0'); | ||
| 14 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1397, 4, '电汇', '4', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:07', '1', '2023-10-18 21:55:07', b'0'); | ||
| 15 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1398, 5, '网上转账', '5', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:24', '1', '2023-10-18 21:55:24', b'0'); | ||
| 16 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1399, 6, '支付宝', '6', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:38', '1', '2023-10-18 21:55:38', b'0'); | ||
| 17 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1400, 7, '微信支付', '7', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:53', '1', '2023-10-18 21:55:53', b'0'); | ||
| 18 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1401, 8, '其他', '8', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:56:06', '1', '2023-10-18 21:56:06', b'0'); | ||
| 19 | + |
sql/mysql/crm_menu.sql
| @@ -8,7 +8,7 @@ INSERT INTO system_menu( | @@ -8,7 +8,7 @@ INSERT INTO system_menu( | ||
| 8 | path, icon, component, status, component_name | 8 | path, icon, component, status, component_name |
| 9 | ) | 9 | ) |
| 10 | VALUES ( | 10 | VALUES ( |
| 11 | - '合同管理', '', 2, 0, 1254, | 11 | + '合同管理', '', 2, 0, 2375, |
| 12 | 'contract', '', 'crm/contract/index', 0, 'Contract' | 12 | 'contract', '', 'crm/contract/index', 0, 'Contract' |
| 13 | ); | 13 | ); |
| 14 | 14 | ||
| @@ -117,3 +117,70 @@ VALUES ( | @@ -117,3 +117,70 @@ VALUES ( | ||
| 117 | '线索导出', 'crm:clue:export', 3, 5, @parentId, | 117 | '线索导出', 'crm:clue:export', 3, 5, @parentId, |
| 118 | '', '', '', 0 | 118 | '', '', '', 0 |
| 119 | ); | 119 | ); |
| 120 | + | ||
| 121 | + | ||
| 122 | +-- ---------------------------- | ||
| 123 | +-- 客户管理菜单 | ||
| 124 | +-- ---------------------------- | ||
| 125 | +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 (2375, '客户管理', '', 1, 0, 0, '/crm', 'ep:avatar', '', '', 0, b'1', b'1', b'1', '1', '2023-10-20 00:36:13', '1', '2023-10-19 16:37:24', b'0'); | ||
| 126 | + | ||
| 127 | + | ||
| 128 | +-- ---------------------------- | ||
| 129 | +-- 回款菜单 | ||
| 130 | +-- ---------------------------- | ||
| 131 | + | ||
| 132 | +-- 菜单 SQL | ||
| 133 | +INSERT INTO system_menu( | ||
| 134 | + name, permission, type, sort, parent_id, | ||
| 135 | + path, icon, component, status, component_name | ||
| 136 | +) | ||
| 137 | +VALUES ( | ||
| 138 | + '回款管理', '', 2, 0, 2375, | ||
| 139 | + 'receivable', '', 'crm/receivable/index', 0, 'Receivable' | ||
| 140 | + ); | ||
| 141 | + | ||
| 142 | +-- 按钮父菜单ID | ||
| 143 | +-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码 | ||
| 144 | +SELECT @parentId := LAST_INSERT_ID(); | ||
| 145 | + | ||
| 146 | +-- 按钮 SQL | ||
| 147 | +INSERT INTO system_menu( | ||
| 148 | + name, permission, type, sort, parent_id, | ||
| 149 | + path, icon, component, status | ||
| 150 | +) | ||
| 151 | +VALUES ( | ||
| 152 | + '回款管理查询', 'crm:receivable:query', 3, 1, @parentId, | ||
| 153 | + '', '', '', 0 | ||
| 154 | + ); | ||
| 155 | +INSERT INTO system_menu( | ||
| 156 | + name, permission, type, sort, parent_id, | ||
| 157 | + path, icon, component, status | ||
| 158 | +) | ||
| 159 | +VALUES ( | ||
| 160 | + '回款管理创建', 'crm:receivable:create', 3, 2, @parentId, | ||
| 161 | + '', '', '', 0 | ||
| 162 | + ); | ||
| 163 | +INSERT INTO system_menu( | ||
| 164 | + name, permission, type, sort, parent_id, | ||
| 165 | + path, icon, component, status | ||
| 166 | +) | ||
| 167 | +VALUES ( | ||
| 168 | + '回款管理更新', 'crm:receivable:update', 3, 3, @parentId, | ||
| 169 | + '', '', '', 0 | ||
| 170 | + ); | ||
| 171 | +INSERT INTO system_menu( | ||
| 172 | + name, permission, type, sort, parent_id, | ||
| 173 | + path, icon, component, status | ||
| 174 | +) | ||
| 175 | +VALUES ( | ||
| 176 | + '回款管理删除', 'crm:receivable:delete', 3, 4, @parentId, | ||
| 177 | + '', '', '', 0 | ||
| 178 | + ); | ||
| 179 | +INSERT INTO system_menu( | ||
| 180 | + name, permission, type, sort, parent_id, | ||
| 181 | + path, icon, component, status | ||
| 182 | +) | ||
| 183 | +VALUES ( | ||
| 184 | + '回款管理导出', 'crm:receivable:export', 3, 5, @parentId, | ||
| 185 | + '', '', '', 0 | ||
| 186 | + ); |
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ErrorCodeConstants.java
| @@ -15,4 +15,6 @@ public interface ErrorCodeConstants { | @@ -15,4 +15,6 @@ public interface ErrorCodeConstants { | ||
| 15 | // TODO @wanwan:要单独一个分段噢 | 15 | // TODO @wanwan:要单独一个分段噢 |
| 16 | ErrorCode CLUE_NOT_EXISTS = new ErrorCode(1_020_000_001, "线索不存在"); | 16 | ErrorCode CLUE_NOT_EXISTS = new ErrorCode(1_020_000_001, "线索不存在"); |
| 17 | 17 | ||
| 18 | + ErrorCode RECEIVABLE_NOT_EXISTS = new ErrorCode(1_030_000_001, "回款管理不存在"); | ||
| 19 | + | ||
| 18 | } | 20 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/ReceivableController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.receivable; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 5 | +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*; | ||
| 7 | +import cn.iocoder.yudao.module.crm.convert.receivable.ReceivableConvert; | ||
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivableDO; | ||
| 9 | +import cn.iocoder.yudao.module.crm.service.receivable.ReceivableService; | ||
| 10 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 11 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 12 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 13 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 14 | +import org.springframework.validation.annotation.Validated; | ||
| 15 | +import org.springframework.web.bind.annotation.*; | ||
| 16 | + | ||
| 17 | +import javax.annotation.Resource; | ||
| 18 | +import javax.servlet.http.HttpServletResponse; | ||
| 19 | +import javax.validation.Valid; | ||
| 20 | +import java.io.IOException; | ||
| 21 | +import java.util.Collection; | ||
| 22 | +import java.util.List; | ||
| 23 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 24 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 25 | +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | ||
| 26 | + | ||
| 27 | +/** | ||
| 28 | + * @author 赤焰 | ||
| 29 | + */ | ||
| 30 | +@Tag(name = "管理后台 - 回款管理") | ||
| 31 | +@RestController | ||
| 32 | +@RequestMapping("/crm/receivable") | ||
| 33 | +@Validated | ||
| 34 | +public class ReceivableController { | ||
| 35 | + | ||
| 36 | + @Resource | ||
| 37 | + private ReceivableService receivableService; | ||
| 38 | + | ||
| 39 | + @PostMapping("/create") | ||
| 40 | + @Operation(summary = "创建回款管理") | ||
| 41 | + @PreAuthorize("@ss.hasPermission('crm:receivable:create')") | ||
| 42 | + public CommonResult<Long> createReceivable(@Valid @RequestBody ReceivableCreateReqVO createReqVO) { | ||
| 43 | + return success(receivableService.createReceivable(createReqVO)); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @PutMapping("/update") | ||
| 47 | + @Operation(summary = "更新回款管理") | ||
| 48 | + @PreAuthorize("@ss.hasPermission('crm:receivable:update')") | ||
| 49 | + public CommonResult<Boolean> updateReceivable(@Valid @RequestBody ReceivableUpdateReqVO updateReqVO) { | ||
| 50 | + receivableService.updateReceivable(updateReqVO); | ||
| 51 | + return success(true); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @DeleteMapping("/delete") | ||
| 55 | + @Operation(summary = "删除回款管理") | ||
| 56 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 57 | + @PreAuthorize("@ss.hasPermission('crm:receivable:delete')") | ||
| 58 | + public CommonResult<Boolean> deleteReceivable(@RequestParam("id") Long id) { | ||
| 59 | + receivableService.deleteReceivable(id); | ||
| 60 | + return success(true); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @GetMapping("/get") | ||
| 64 | + @Operation(summary = "获得回款管理") | ||
| 65 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 66 | + @PreAuthorize("@ss.hasPermission('crm:receivable:query')") | ||
| 67 | + public CommonResult<ReceivableRespVO> getReceivable(@RequestParam("id") Long id) { | ||
| 68 | + ReceivableDO receivable = receivableService.getReceivable(id); | ||
| 69 | + return success(ReceivableConvert.INSTANCE.convert(receivable)); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @GetMapping("/list") | ||
| 73 | + @Operation(summary = "获得回款管理列表") | ||
| 74 | + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") | ||
| 75 | + @PreAuthorize("@ss.hasPermission('crm:receivable:query')") | ||
| 76 | + public CommonResult<List<ReceivableRespVO>> getReceivableList(@RequestParam("ids") Collection<Long> ids) { | ||
| 77 | + List<ReceivableDO> list = receivableService.getReceivableList(ids); | ||
| 78 | + return success(ReceivableConvert.INSTANCE.convertList(list)); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @GetMapping("/page") | ||
| 82 | + @Operation(summary = "获得回款管理分页") | ||
| 83 | + @PreAuthorize("@ss.hasPermission('crm:receivable:query')") | ||
| 84 | + public CommonResult<PageResult<ReceivableRespVO>> getReceivablePage(@Valid ReceivablePageReqVO pageVO) { | ||
| 85 | + PageResult<ReceivableDO> pageResult = receivableService.getReceivablePage(pageVO); | ||
| 86 | + return success(ReceivableConvert.INSTANCE.convertPage(pageResult)); | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + @GetMapping("/export-excel") | ||
| 90 | + @Operation(summary = "导出回款管理 Excel") | ||
| 91 | + @PreAuthorize("@ss.hasPermission('crm:receivable:export')") | ||
| 92 | + @OperateLog(type = EXPORT) | ||
| 93 | + public void exportReceivableExcel(@Valid ReceivableExportReqVO exportReqVO, | ||
| 94 | + HttpServletResponse response) throws IOException { | ||
| 95 | + List<ReceivableDO> list = receivableService.getReceivableList(exportReqVO); | ||
| 96 | + // 导出 Excel | ||
| 97 | + List<ReceivableExcelVO> datas = ReceivableConvert.INSTANCE.convertList02(list); | ||
| 98 | + ExcelUtils.write(response, "回款管理.xls", "数据", ReceivableExcelVO.class, datas); | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/ReceivableBaseVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.*; | ||
| 5 | +import java.util.*; | ||
| 6 | +import java.time.LocalDateTime; | ||
| 7 | +import java.math.BigDecimal; | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | +import java.time.LocalDateTime; | ||
| 10 | +import javax.validation.constraints.*; | ||
| 11 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 12 | + | ||
| 13 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * 回款管理 Base VO,提供给添加、修改、详细的子 VO 使用 | ||
| 17 | + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 18 | + */ | ||
| 19 | +@Data | ||
| 20 | +public class ReceivableBaseVO { | ||
| 21 | + | ||
| 22 | + @Schema(description = "回款编号") | ||
| 23 | + private String no; | ||
| 24 | + | ||
| 25 | + @Schema(description = "回款计划ID", example = "31177") | ||
| 26 | + private Long planId; | ||
| 27 | + | ||
| 28 | + @Schema(description = "客户ID", example = "4963") | ||
| 29 | + private Long customerId; | ||
| 30 | + | ||
| 31 | + @Schema(description = "合同ID", example = "30305") | ||
| 32 | + private Long contractId; | ||
| 33 | + | ||
| 34 | + @Schema(description = "审批状态", example = "1") | ||
| 35 | + private Integer checkStatus; | ||
| 36 | + | ||
| 37 | + @Schema(description = "工作流编号", example = "16568") | ||
| 38 | + private Long processInstanceId; | ||
| 39 | + | ||
| 40 | + @Schema(description = "回款日期") | ||
| 41 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 42 | + private LocalDateTime returnTime; | ||
| 43 | + | ||
| 44 | + @Schema(description = "回款方式", example = "2") | ||
| 45 | + private String returnType; | ||
| 46 | + | ||
| 47 | + @Schema(description = "回款金额", example = "31859") | ||
| 48 | + private BigDecimal price; | ||
| 49 | + | ||
| 50 | + @Schema(description = "负责人", example = "22202") | ||
| 51 | + private Long ownerUserId; | ||
| 52 | + | ||
| 53 | + @Schema(description = "批次", example = "2539") | ||
| 54 | + private Long batchId; | ||
| 55 | + | ||
| 56 | + @Schema(description = "显示顺序") | ||
| 57 | + private Integer sort; | ||
| 58 | + | ||
| 59 | + @Schema(description = "数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)") | ||
| 60 | + private Integer dataScope; | ||
| 61 | + | ||
| 62 | + @Schema(description = "数据范围(指定部门数组)") | ||
| 63 | + private String dataScopeDeptIds; | ||
| 64 | + | ||
| 65 | + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 66 | + @NotNull(message = "状态不能为空") | ||
| 67 | + private Integer status; | ||
| 68 | + | ||
| 69 | + @Schema(description = "备注", example = "随便") | ||
| 70 | + private String remark; | ||
| 71 | + | ||
| 72 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/ReceivableCreateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 6 | +import javax.validation.constraints.*; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - 回款管理创建 Request VO") | ||
| 9 | +@Data | ||
| 10 | +@EqualsAndHashCode(callSuper = true) | ||
| 11 | +@ToString(callSuper = true) | ||
| 12 | +public class ReceivableCreateReqVO extends ReceivableBaseVO { | ||
| 13 | + | ||
| 14 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/ReceivableExcelVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.*; | ||
| 5 | +import java.util.*; | ||
| 6 | +import java.time.LocalDateTime; | ||
| 7 | +import java.math.BigDecimal; | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | +import java.time.LocalDateTime; | ||
| 10 | + | ||
| 11 | +import com.alibaba.excel.annotation.ExcelProperty; | ||
| 12 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 13 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||
| 14 | + | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * 回款管理 Excel VO | ||
| 18 | + * | ||
| 19 | + * @author 赤焰 | ||
| 20 | + */ | ||
| 21 | +@Data | ||
| 22 | +public class ReceivableExcelVO { | ||
| 23 | + | ||
| 24 | + @ExcelProperty("ID") | ||
| 25 | + private Long id; | ||
| 26 | + | ||
| 27 | + @ExcelProperty("回款编号") | ||
| 28 | + private String no; | ||
| 29 | + | ||
| 30 | + @ExcelProperty("回款计划ID") | ||
| 31 | + private Long planId; | ||
| 32 | + | ||
| 33 | + @ExcelProperty("客户ID") | ||
| 34 | + private Long customerId; | ||
| 35 | + | ||
| 36 | + @ExcelProperty("合同ID") | ||
| 37 | + private Long contractId; | ||
| 38 | + | ||
| 39 | + @ExcelProperty(value = "审批状态", converter = DictConvert.class) | ||
| 40 | + @DictFormat("crm_receivable_check_status") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 | ||
| 41 | + private Integer checkStatus; | ||
| 42 | + | ||
| 43 | + @ExcelProperty("工作流编号") | ||
| 44 | + private Long processInstanceId; | ||
| 45 | + | ||
| 46 | + @ExcelProperty("回款日期") | ||
| 47 | + private LocalDateTime returnTime; | ||
| 48 | + | ||
| 49 | + @ExcelProperty("回款方式") | ||
| 50 | + private String returnType; | ||
| 51 | + | ||
| 52 | + @ExcelProperty("回款金额") | ||
| 53 | + private BigDecimal price; | ||
| 54 | + | ||
| 55 | + @ExcelProperty("负责人") | ||
| 56 | + private Long ownerUserId; | ||
| 57 | + | ||
| 58 | + @ExcelProperty("批次") | ||
| 59 | + private Long batchId; | ||
| 60 | + | ||
| 61 | + //@ExcelProperty("显示顺序") | ||
| 62 | + //private Integer sort; | ||
| 63 | + | ||
| 64 | + //@ExcelProperty("数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)") | ||
| 65 | + //private Integer dataScope; | ||
| 66 | + | ||
| 67 | + //@ExcelProperty("数据范围(指定部门数组)") | ||
| 68 | + //private String dataScopeDeptIds; | ||
| 69 | + | ||
| 70 | + @ExcelProperty(value = "状态", converter = DictConvert.class) | ||
| 71 | + @DictFormat("common_status") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 | ||
| 72 | + private Integer status; | ||
| 73 | + | ||
| 74 | + @ExcelProperty("备注") | ||
| 75 | + private String remark; | ||
| 76 | + | ||
| 77 | + @ExcelProperty("创建时间") | ||
| 78 | + private LocalDateTime createTime; | ||
| 79 | + | ||
| 80 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/ReceivableExportReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 6 | + | ||
| 7 | +import java.math.BigDecimal; | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | + | ||
| 10 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * @author 赤焰 | ||
| 14 | + */ | ||
| 15 | +@Schema(description = "管理后台 - 回款管理 Excel 导出 Request VO,参数和 ReceivablePageReqVO 是一致的") | ||
| 16 | +@Data | ||
| 17 | +public class ReceivableExportReqVO { | ||
| 18 | + | ||
| 19 | + @Schema(description = "回款编号") | ||
| 20 | + private String no; | ||
| 21 | + | ||
| 22 | + @Schema(description = "回款计划ID", example = "31177") | ||
| 23 | + private Long planId; | ||
| 24 | + | ||
| 25 | + @Schema(description = "客户ID", example = "4963") | ||
| 26 | + private Long customerId; | ||
| 27 | + | ||
| 28 | + @Schema(description = "合同ID", example = "30305") | ||
| 29 | + private Long contractId; | ||
| 30 | + | ||
| 31 | + @Schema(description = "审批状态", example = "1") | ||
| 32 | + private Integer checkStatus; | ||
| 33 | + | ||
| 34 | + @Schema(description = "工作流编号", example = "16568") | ||
| 35 | + private Long processInstanceId; | ||
| 36 | + | ||
| 37 | + @Schema(description = "回款日期") | ||
| 38 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 39 | + private LocalDateTime[] returnTime; | ||
| 40 | + | ||
| 41 | + @Schema(description = "回款方式", example = "2") | ||
| 42 | + private String returnType; | ||
| 43 | + | ||
| 44 | + @Schema(description = "回款金额", example = "31859") | ||
| 45 | + private BigDecimal price; | ||
| 46 | + | ||
| 47 | + @Schema(description = "负责人", example = "22202") | ||
| 48 | + private Long ownerUserId; | ||
| 49 | + | ||
| 50 | + @Schema(description = "批次", example = "2539") | ||
| 51 | + private Long batchId; | ||
| 52 | + | ||
| 53 | + @Schema(description = "显示顺序") | ||
| 54 | + private Integer sort; | ||
| 55 | + | ||
| 56 | + @Schema(description = "数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)") | ||
| 57 | + private Integer dataScope; | ||
| 58 | + | ||
| 59 | + @Schema(description = "数据范围(指定部门数组)") | ||
| 60 | + private String dataScopeDeptIds; | ||
| 61 | + | ||
| 62 | + @Schema(description = "状态", example = "1") | ||
| 63 | + private Integer status; | ||
| 64 | + | ||
| 65 | + @Schema(description = "备注", example = "随便") | ||
| 66 | + private String remark; | ||
| 67 | + | ||
| 68 | + @Schema(description = "创建时间") | ||
| 69 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 70 | + private LocalDateTime[] createTime; | ||
| 71 | + | ||
| 72 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/ReceivablePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | + | ||
| 5 | +import java.math.BigDecimal; | ||
| 6 | +import java.util.*; | ||
| 7 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 8 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 9 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 10 | +import java.time.LocalDateTime; | ||
| 11 | + | ||
| 12 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 13 | + | ||
| 14 | +@Schema(description = "管理后台 - 回款管理分页 Request VO") | ||
| 15 | +@Data | ||
| 16 | +@EqualsAndHashCode(callSuper = true) | ||
| 17 | +@ToString(callSuper = true) | ||
| 18 | +public class ReceivablePageReqVO extends PageParam { | ||
| 19 | + | ||
| 20 | + @Schema(description = "回款编号") | ||
| 21 | + private String no; | ||
| 22 | + | ||
| 23 | + @Schema(description = "回款计划ID", example = "31177") | ||
| 24 | + private Long planId; | ||
| 25 | + | ||
| 26 | + @Schema(description = "客户ID", example = "4963") | ||
| 27 | + private Long customerId; | ||
| 28 | + | ||
| 29 | + @Schema(description = "合同ID", example = "30305") | ||
| 30 | + private Long contractId; | ||
| 31 | + | ||
| 32 | + @Schema(description = "审批状态", example = "1") | ||
| 33 | + private Integer checkStatus; | ||
| 34 | + | ||
| 35 | + @Schema(description = "工作流编号", example = "16568") | ||
| 36 | + private Long processInstanceId; | ||
| 37 | + | ||
| 38 | + @Schema(description = "回款日期") | ||
| 39 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 40 | + private LocalDateTime[] returnTime; | ||
| 41 | + | ||
| 42 | + @Schema(description = "回款方式", example = "2") | ||
| 43 | + private String returnType; | ||
| 44 | + | ||
| 45 | + @Schema(description = "回款金额", example = "31859") | ||
| 46 | + private BigDecimal price; | ||
| 47 | + | ||
| 48 | + @Schema(description = "负责人", example = "22202") | ||
| 49 | + private Long ownerUserId; | ||
| 50 | + | ||
| 51 | + @Schema(description = "批次", example = "2539") | ||
| 52 | + private Long batchId; | ||
| 53 | + | ||
| 54 | + @Schema(description = "显示顺序") | ||
| 55 | + private Integer sort; | ||
| 56 | + | ||
| 57 | + @Schema(description = "数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)") | ||
| 58 | + private Integer dataScope; | ||
| 59 | + | ||
| 60 | + @Schema(description = "数据范围(指定部门数组)") | ||
| 61 | + private String dataScopeDeptIds; | ||
| 62 | + | ||
| 63 | + @Schema(description = "状态", example = "1") | ||
| 64 | + private Integer status; | ||
| 65 | + | ||
| 66 | + @Schema(description = "备注", example = "随便") | ||
| 67 | + private String remark; | ||
| 68 | + | ||
| 69 | + @Schema(description = "创建时间") | ||
| 70 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 71 | + private LocalDateTime[] createTime; | ||
| 72 | + | ||
| 73 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/ReceivableRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.*; | ||
| 5 | +import java.time.LocalDateTime; | ||
| 6 | + | ||
| 7 | +@Schema(description = "管理后台 - 回款管理 Response VO") | ||
| 8 | +@Data | ||
| 9 | +@EqualsAndHashCode(callSuper = true) | ||
| 10 | +@ToString(callSuper = true) | ||
| 11 | +public class ReceivableRespVO extends ReceivableBaseVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25787") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 17 | + private LocalDateTime createTime; | ||
| 18 | + | ||
| 19 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/ReceivableUpdateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.*; | ||
| 5 | +import java.util.*; | ||
| 6 | +import javax.validation.constraints.*; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - 回款管理更新 Request VO") | ||
| 9 | +@Data | ||
| 10 | +@EqualsAndHashCode(callSuper = true) | ||
| 11 | +@ToString(callSuper = true) | ||
| 12 | +public class ReceivableUpdateReqVO extends ReceivableBaseVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25787") | ||
| 15 | + @NotNull(message = "ID不能为空") | ||
| 16 | + private Long id; | ||
| 17 | + | ||
| 18 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/receivable/ReceivableConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.convert.receivable; | ||
| 2 | + | ||
| 3 | +import java.util.*; | ||
| 4 | + | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | + | ||
| 7 | +import org.mapstruct.Mapper; | ||
| 8 | +import org.mapstruct.factory.Mappers; | ||
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*; | ||
| 10 | +import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivableDO; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * 回款管理 Convert | ||
| 14 | + * | ||
| 15 | + * @author 赤焰 | ||
| 16 | + */ | ||
| 17 | +@Mapper | ||
| 18 | +public interface ReceivableConvert { | ||
| 19 | + | ||
| 20 | + ReceivableConvert INSTANCE = Mappers.getMapper(ReceivableConvert.class); | ||
| 21 | + | ||
| 22 | + ReceivableDO convert(ReceivableCreateReqVO bean); | ||
| 23 | + | ||
| 24 | + ReceivableDO convert(ReceivableUpdateReqVO bean); | ||
| 25 | + | ||
| 26 | + ReceivableRespVO convert(ReceivableDO bean); | ||
| 27 | + | ||
| 28 | + List<ReceivableRespVO> convertList(List<ReceivableDO> list); | ||
| 29 | + | ||
| 30 | + PageResult<ReceivableRespVO> convertPage(PageResult<ReceivableDO> page); | ||
| 31 | + | ||
| 32 | + List<ReceivableExcelVO> convertList02(List<ReceivableDO> list); | ||
| 33 | + | ||
| 34 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/receivable/ReceivableDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.dal.dataobject.receivable; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import java.time.LocalDateTime; | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 10 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * 回款管理 DO | ||
| 14 | + * | ||
| 15 | + * @author 赤焰 | ||
| 16 | + */ | ||
| 17 | +@TableName("crm_receivable") | ||
| 18 | +@KeySequence("crm_receivable_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 19 | +@Data | ||
| 20 | +@EqualsAndHashCode(callSuper = true) | ||
| 21 | +@ToString(callSuper = true) | ||
| 22 | +@Builder | ||
| 23 | +@NoArgsConstructor | ||
| 24 | +@AllArgsConstructor | ||
| 25 | +public class ReceivableDO extends BaseDO { | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * ID | ||
| 29 | + */ | ||
| 30 | + @TableId | ||
| 31 | + private Long id; | ||
| 32 | + /** | ||
| 33 | + * 回款编号 | ||
| 34 | + */ | ||
| 35 | + private String no; | ||
| 36 | + /** | ||
| 37 | + * 回款计划ID | ||
| 38 | + */ | ||
| 39 | + private Long planId; | ||
| 40 | + /** | ||
| 41 | + * 客户ID | ||
| 42 | + */ | ||
| 43 | + private Long customerId; | ||
| 44 | + /** | ||
| 45 | + * 合同ID | ||
| 46 | + */ | ||
| 47 | + private Long contractId; | ||
| 48 | + /** | ||
| 49 | + * 审批状态 | ||
| 50 | + * | ||
| 51 | + * 枚举 {@link TODO crm_receivable_check_status 对应的类} | ||
| 52 | + */ | ||
| 53 | + private Integer checkStatus; | ||
| 54 | + /** | ||
| 55 | + * 工作流编号 | ||
| 56 | + */ | ||
| 57 | + private Long processInstanceId; | ||
| 58 | + /** | ||
| 59 | + * 回款日期 | ||
| 60 | + */ | ||
| 61 | + private LocalDateTime returnTime; | ||
| 62 | + /** | ||
| 63 | + * 回款方式 | ||
| 64 | + */ | ||
| 65 | + private String returnType; | ||
| 66 | + /** | ||
| 67 | + * 回款金额 | ||
| 68 | + */ | ||
| 69 | + private BigDecimal price; | ||
| 70 | + /** | ||
| 71 | + * 负责人 | ||
| 72 | + */ | ||
| 73 | + private Long ownerUserId; | ||
| 74 | + /** | ||
| 75 | + * 批次 | ||
| 76 | + */ | ||
| 77 | + private Long batchId; | ||
| 78 | + /** | ||
| 79 | + * 显示顺序 | ||
| 80 | + */ | ||
| 81 | + private Integer sort; | ||
| 82 | + /** | ||
| 83 | + * 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限) | ||
| 84 | + */ | ||
| 85 | + private Integer dataScope; | ||
| 86 | + /** | ||
| 87 | + * 数据范围(指定部门数组) | ||
| 88 | + */ | ||
| 89 | + private String dataScopeDeptIds; | ||
| 90 | + /** | ||
| 91 | + * 状态 | ||
| 92 | + * | ||
| 93 | + * 枚举 {@link TODO common_status 对应的类} | ||
| 94 | + */ | ||
| 95 | + private Integer status; | ||
| 96 | + /** | ||
| 97 | + * 备注 | ||
| 98 | + */ | ||
| 99 | + private String remark; | ||
| 100 | + | ||
| 101 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/ReceivableMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.dal.mysql.receivable; | ||
| 2 | + | ||
| 3 | +import java.util.*; | ||
| 4 | + | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 7 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivableDO; | ||
| 9 | +import org.apache.ibatis.annotations.Mapper; | ||
| 10 | +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * 回款管理 Mapper | ||
| 14 | + * | ||
| 15 | + * @author 赤焰 | ||
| 16 | + */ | ||
| 17 | +@Mapper | ||
| 18 | +public interface ReceivableMapper extends BaseMapperX<ReceivableDO> { | ||
| 19 | + | ||
| 20 | + default PageResult<ReceivableDO> selectPage(ReceivablePageReqVO reqVO) { | ||
| 21 | + return selectPage(reqVO, new LambdaQueryWrapperX<ReceivableDO>() | ||
| 22 | + .eqIfPresent(ReceivableDO::getNo, reqVO.getNo()) | ||
| 23 | + .eqIfPresent(ReceivableDO::getPlanId, reqVO.getPlanId()) | ||
| 24 | + .eqIfPresent(ReceivableDO::getCustomerId, reqVO.getCustomerId()) | ||
| 25 | + .eqIfPresent(ReceivableDO::getContractId, reqVO.getContractId()) | ||
| 26 | + .eqIfPresent(ReceivableDO::getCheckStatus, reqVO.getCheckStatus()) | ||
| 27 | + .eqIfPresent(ReceivableDO::getProcessInstanceId, reqVO.getProcessInstanceId()) | ||
| 28 | + .betweenIfPresent(ReceivableDO::getReturnTime, reqVO.getReturnTime()) | ||
| 29 | + .eqIfPresent(ReceivableDO::getReturnType, reqVO.getReturnType()) | ||
| 30 | + .eqIfPresent(ReceivableDO::getPrice, reqVO.getPrice()) | ||
| 31 | + .eqIfPresent(ReceivableDO::getOwnerUserId, reqVO.getOwnerUserId()) | ||
| 32 | + .eqIfPresent(ReceivableDO::getBatchId, reqVO.getBatchId()) | ||
| 33 | + .eqIfPresent(ReceivableDO::getSort, reqVO.getSort()) | ||
| 34 | + .eqIfPresent(ReceivableDO::getDataScope, reqVO.getDataScope()) | ||
| 35 | + .eqIfPresent(ReceivableDO::getDataScopeDeptIds, reqVO.getDataScopeDeptIds()) | ||
| 36 | + .eqIfPresent(ReceivableDO::getStatus, reqVO.getStatus()) | ||
| 37 | + .eqIfPresent(ReceivableDO::getRemark, reqVO.getRemark()) | ||
| 38 | + .betweenIfPresent(ReceivableDO::getCreateTime, reqVO.getCreateTime()) | ||
| 39 | + .orderByDesc(ReceivableDO::getId)); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + default List<ReceivableDO> selectList(ReceivableExportReqVO reqVO) { | ||
| 43 | + return selectList(new LambdaQueryWrapperX<ReceivableDO>() | ||
| 44 | + .eqIfPresent(ReceivableDO::getNo, reqVO.getNo()) | ||
| 45 | + .eqIfPresent(ReceivableDO::getPlanId, reqVO.getPlanId()) | ||
| 46 | + .eqIfPresent(ReceivableDO::getCustomerId, reqVO.getCustomerId()) | ||
| 47 | + .eqIfPresent(ReceivableDO::getContractId, reqVO.getContractId()) | ||
| 48 | + .eqIfPresent(ReceivableDO::getCheckStatus, reqVO.getCheckStatus()) | ||
| 49 | + .eqIfPresent(ReceivableDO::getProcessInstanceId, reqVO.getProcessInstanceId()) | ||
| 50 | + .betweenIfPresent(ReceivableDO::getReturnTime, reqVO.getReturnTime()) | ||
| 51 | + .eqIfPresent(ReceivableDO::getReturnType, reqVO.getReturnType()) | ||
| 52 | + .eqIfPresent(ReceivableDO::getPrice, reqVO.getPrice()) | ||
| 53 | + .eqIfPresent(ReceivableDO::getOwnerUserId, reqVO.getOwnerUserId()) | ||
| 54 | + .eqIfPresent(ReceivableDO::getBatchId, reqVO.getBatchId()) | ||
| 55 | + .eqIfPresent(ReceivableDO::getSort, reqVO.getSort()) | ||
| 56 | + .eqIfPresent(ReceivableDO::getDataScope, reqVO.getDataScope()) | ||
| 57 | + .eqIfPresent(ReceivableDO::getDataScopeDeptIds, reqVO.getDataScopeDeptIds()) | ||
| 58 | + .eqIfPresent(ReceivableDO::getStatus, reqVO.getStatus()) | ||
| 59 | + .eqIfPresent(ReceivableDO::getRemark, reqVO.getRemark()) | ||
| 60 | + .betweenIfPresent(ReceivableDO::getCreateTime, reqVO.getCreateTime()) | ||
| 61 | + .orderByDesc(ReceivableDO::getId)); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/ReceivableService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.receivable; | ||
| 2 | + | ||
| 3 | +import java.util.*; | ||
| 4 | +import javax.validation.*; | ||
| 5 | + | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*; | ||
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivableDO; | ||
| 8 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 回款管理 Service 接口 | ||
| 12 | + * | ||
| 13 | + * @author 赤焰 | ||
| 14 | + */ | ||
| 15 | +public interface ReceivableService { | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * 创建回款管理 | ||
| 19 | + * | ||
| 20 | + * @param createReqVO 创建信息 | ||
| 21 | + * @return 编号 | ||
| 22 | + */ | ||
| 23 | + Long createReceivable(@Valid ReceivableCreateReqVO createReqVO); | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 更新回款管理 | ||
| 27 | + * | ||
| 28 | + * @param updateReqVO 更新信息 | ||
| 29 | + */ | ||
| 30 | + void updateReceivable(@Valid ReceivableUpdateReqVO updateReqVO); | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 删除回款管理 | ||
| 34 | + * | ||
| 35 | + * @param id 编号 | ||
| 36 | + */ | ||
| 37 | + void deleteReceivable(Long id); | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 获得回款管理 | ||
| 41 | + * | ||
| 42 | + * @param id 编号 | ||
| 43 | + * @return 回款管理 | ||
| 44 | + */ | ||
| 45 | + ReceivableDO getReceivable(Long id); | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 获得回款管理列表 | ||
| 49 | + * | ||
| 50 | + * @param ids 编号 | ||
| 51 | + * @return 回款管理列表 | ||
| 52 | + */ | ||
| 53 | + List<ReceivableDO> getReceivableList(Collection<Long> ids); | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * 获得回款管理分页 | ||
| 57 | + * | ||
| 58 | + * @param pageReqVO 分页查询 | ||
| 59 | + * @return 回款管理分页 | ||
| 60 | + */ | ||
| 61 | + PageResult<ReceivableDO> getReceivablePage(ReceivablePageReqVO pageReqVO); | ||
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * 获得回款管理列表, 用于 Excel 导出 | ||
| 65 | + * | ||
| 66 | + * @param exportReqVO 查询条件 | ||
| 67 | + * @return 回款管理列表 | ||
| 68 | + */ | ||
| 69 | + List<ReceivableDO> getReceivableList(ReceivableExportReqVO exportReqVO); | ||
| 70 | + | ||
| 71 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/ReceivableServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.receivable; | ||
| 2 | + | ||
| 3 | +import org.springframework.stereotype.Service; | ||
| 4 | +import javax.annotation.Resource; | ||
| 5 | +import org.springframework.validation.annotation.Validated; | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 7 | +import java.util.*; | ||
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*; | ||
| 9 | +import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivableDO; | ||
| 10 | + | ||
| 11 | +import cn.iocoder.yudao.module.crm.convert.receivable.ReceivableConvert; | ||
| 12 | +import cn.iocoder.yudao.module.crm.dal.mysql.receivable.ReceivableMapper; | ||
| 13 | + | ||
| 14 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 15 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; | ||
| 16 | + | ||
| 17 | +import cn.hutool.core.collection.CollUtil; | ||
| 18 | +import cn.hutool.core.collection.ListUtil; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * 回款管理 Service 实现类 | ||
| 22 | + * | ||
| 23 | + * @author 赤焰 | ||
| 24 | + */ | ||
| 25 | +@Service | ||
| 26 | +@Validated | ||
| 27 | +public class ReceivableServiceImpl implements ReceivableService { | ||
| 28 | + | ||
| 29 | + @Resource | ||
| 30 | + private ReceivableMapper receivableMapper; | ||
| 31 | + | ||
| 32 | + @Override | ||
| 33 | + public Long createReceivable(ReceivableCreateReqVO createReqVO) { | ||
| 34 | + // 插入 | ||
| 35 | + ReceivableDO receivable = ReceivableConvert.INSTANCE.convert(createReqVO); | ||
| 36 | + receivableMapper.insert(receivable); | ||
| 37 | + // 返回 | ||
| 38 | + return receivable.getId(); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + @Override | ||
| 42 | + public void updateReceivable(ReceivableUpdateReqVO updateReqVO) { | ||
| 43 | + // 校验存在 | ||
| 44 | + validateReceivableExists(updateReqVO.getId()); | ||
| 45 | + // 更新 | ||
| 46 | + ReceivableDO updateObj = ReceivableConvert.INSTANCE.convert(updateReqVO); | ||
| 47 | + receivableMapper.updateById(updateObj); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + @Override | ||
| 51 | + public void deleteReceivable(Long id) { | ||
| 52 | + // 校验存在 | ||
| 53 | + validateReceivableExists(id); | ||
| 54 | + // 删除 | ||
| 55 | + receivableMapper.deleteById(id); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + private void validateReceivableExists(Long id) { | ||
| 59 | + if (receivableMapper.selectById(id) == null) { | ||
| 60 | + throw exception(RECEIVABLE_NOT_EXISTS); | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @Override | ||
| 65 | + public ReceivableDO getReceivable(Long id) { | ||
| 66 | + return receivableMapper.selectById(id); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + @Override | ||
| 70 | + public List<ReceivableDO> getReceivableList(Collection<Long> ids) { | ||
| 71 | + if (CollUtil.isEmpty(ids)) { | ||
| 72 | + return ListUtil.empty(); | ||
| 73 | + } | ||
| 74 | + return receivableMapper.selectBatchIds(ids); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @Override | ||
| 78 | + public PageResult<ReceivableDO> getReceivablePage(ReceivablePageReqVO pageReqVO) { | ||
| 79 | + return receivableMapper.selectPage(pageReqVO); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + @Override | ||
| 83 | + public List<ReceivableDO> getReceivableList(ReceivableExportReqVO exportReqVO) { | ||
| 84 | + return receivableMapper.selectList(exportReqVO); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/receivable/ReceivableMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 3 | +<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.receivable.ReceivableMapper"> | ||
| 4 | + | ||
| 5 | + <!-- | ||
| 6 | + 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | ||
| 7 | + 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | ||
| 8 | + 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | ||
| 9 | + 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | ||
| 10 | + --> | ||
| 11 | + | ||
| 12 | +</mapper> |
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/receivable/ReceivableServiceImplTest.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.receivable; | ||
| 2 | + | ||
| 3 | +import org.junit.jupiter.api.Disabled; | ||
| 4 | +import org.junit.jupiter.api.Test; | ||
| 5 | +import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 6 | + | ||
| 7 | +import javax.annotation.Resource; | ||
| 8 | + | ||
| 9 | +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | ||
| 10 | + | ||
| 11 | +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*; | ||
| 12 | +import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivableDO; | ||
| 13 | +import cn.iocoder.yudao.module.crm.dal.mysql.receivable.ReceivableMapper; | ||
| 14 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 15 | + | ||
| 16 | +import javax.annotation.Resource; | ||
| 17 | +import org.springframework.context.annotation.Import; | ||
| 18 | +import java.util.*; | ||
| 19 | +import java.time.LocalDateTime; | ||
| 20 | + | ||
| 21 | +import static cn.hutool.core.util.RandomUtil.*; | ||
| 22 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; | ||
| 23 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*; | ||
| 24 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; | ||
| 25 | +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*; | ||
| 26 | +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*; | ||
| 27 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*; | ||
| 28 | +import static org.junit.jupiter.api.Assertions.*; | ||
| 29 | +import static org.mockito.Mockito.*; | ||
| 30 | + | ||
| 31 | +/** | ||
| 32 | + * {@link ReceivableServiceImpl} 的单元测试类 | ||
| 33 | + * | ||
| 34 | + * @author 赤焰 | ||
| 35 | + */ | ||
| 36 | +@Import(ReceivableServiceImpl.class) | ||
| 37 | +public class ReceivableServiceImplTest extends BaseDbUnitTest { | ||
| 38 | + | ||
| 39 | + @Resource | ||
| 40 | + private ReceivableServiceImpl receivableService; | ||
| 41 | + | ||
| 42 | + @Resource | ||
| 43 | + private ReceivableMapper receivableMapper; | ||
| 44 | + | ||
| 45 | + @Test | ||
| 46 | + public void testCreateReceivable_success() { | ||
| 47 | + // 准备参数 | ||
| 48 | + ReceivableCreateReqVO reqVO = randomPojo(ReceivableCreateReqVO.class); | ||
| 49 | + | ||
| 50 | + // 调用 | ||
| 51 | + Long receivableId = receivableService.createReceivable(reqVO); | ||
| 52 | + // 断言 | ||
| 53 | + assertNotNull(receivableId); | ||
| 54 | + // 校验记录的属性是否正确 | ||
| 55 | + ReceivableDO receivable = receivableMapper.selectById(receivableId); | ||
| 56 | + assertPojoEquals(reqVO, receivable); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @Test | ||
| 60 | + public void testUpdateReceivable_success() { | ||
| 61 | + // mock 数据 | ||
| 62 | + ReceivableDO dbReceivable = randomPojo(ReceivableDO.class); | ||
| 63 | + receivableMapper.insert(dbReceivable);// @Sql: 先插入出一条存在的数据 | ||
| 64 | + // 准备参数 | ||
| 65 | + ReceivableUpdateReqVO reqVO = randomPojo(ReceivableUpdateReqVO.class, o -> { | ||
| 66 | + o.setId(dbReceivable.getId()); // 设置更新的 ID | ||
| 67 | + }); | ||
| 68 | + | ||
| 69 | + // 调用 | ||
| 70 | + receivableService.updateReceivable(reqVO); | ||
| 71 | + // 校验是否更新正确 | ||
| 72 | + ReceivableDO receivable = receivableMapper.selectById(reqVO.getId()); // 获取最新的 | ||
| 73 | + assertPojoEquals(reqVO, receivable); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + @Test | ||
| 77 | + public void testUpdateReceivable_notExists() { | ||
| 78 | + // 准备参数 | ||
| 79 | + ReceivableUpdateReqVO reqVO = randomPojo(ReceivableUpdateReqVO.class); | ||
| 80 | + | ||
| 81 | + // 调用, 并断言异常 | ||
| 82 | + assertServiceException(() -> receivableService.updateReceivable(reqVO), RECEIVABLE_NOT_EXISTS); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + @Test | ||
| 86 | + public void testDeleteReceivable_success() { | ||
| 87 | + // mock 数据 | ||
| 88 | + ReceivableDO dbReceivable = randomPojo(ReceivableDO.class); | ||
| 89 | + receivableMapper.insert(dbReceivable);// @Sql: 先插入出一条存在的数据 | ||
| 90 | + // 准备参数 | ||
| 91 | + Long id = dbReceivable.getId(); | ||
| 92 | + | ||
| 93 | + // 调用 | ||
| 94 | + receivableService.deleteReceivable(id); | ||
| 95 | + // 校验数据不存在了 | ||
| 96 | + assertNull(receivableMapper.selectById(id)); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + @Test | ||
| 100 | + public void testDeleteReceivable_notExists() { | ||
| 101 | + // 准备参数 | ||
| 102 | + Long id = randomLongId(); | ||
| 103 | + | ||
| 104 | + // 调用, 并断言异常 | ||
| 105 | + assertServiceException(() -> receivableService.deleteReceivable(id), RECEIVABLE_NOT_EXISTS); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + @Test | ||
| 109 | + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | ||
| 110 | + public void testGetReceivablePage() { | ||
| 111 | + // mock 数据 | ||
| 112 | + ReceivableDO dbReceivable = randomPojo(ReceivableDO.class, o -> { // 等会查询到 | ||
| 113 | + o.setNo(null); | ||
| 114 | + o.setPlanId(null); | ||
| 115 | + o.setCustomerId(null); | ||
| 116 | + o.setContractId(null); | ||
| 117 | + o.setCheckStatus(null); | ||
| 118 | + o.setProcessInstanceId(null); | ||
| 119 | + o.setReturnTime(null); | ||
| 120 | + o.setReturnType(null); | ||
| 121 | + o.setPrice(null); | ||
| 122 | + o.setOwnerUserId(null); | ||
| 123 | + o.setBatchId(null); | ||
| 124 | + o.setSort(null); | ||
| 125 | + o.setDataScope(null); | ||
| 126 | + o.setDataScopeDeptIds(null); | ||
| 127 | + o.setStatus(null); | ||
| 128 | + o.setRemark(null); | ||
| 129 | + o.setCreateTime(null); | ||
| 130 | + }); | ||
| 131 | + receivableMapper.insert(dbReceivable); | ||
| 132 | + // 测试 no 不匹配 | ||
| 133 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setNo(null))); | ||
| 134 | + // 测试 planId 不匹配 | ||
| 135 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setPlanId(null))); | ||
| 136 | + // 测试 customerId 不匹配 | ||
| 137 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCustomerId(null))); | ||
| 138 | + // 测试 contractId 不匹配 | ||
| 139 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setContractId(null))); | ||
| 140 | + // 测试 checkStatus 不匹配 | ||
| 141 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCheckStatus(null))); | ||
| 142 | + // 测试 processInstanceId 不匹配 | ||
| 143 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setProcessInstanceId(null))); | ||
| 144 | + // 测试 returnTime 不匹配 | ||
| 145 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setReturnTime(null))); | ||
| 146 | + // 测试 returnType 不匹配 | ||
| 147 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setReturnType(null))); | ||
| 148 | + // 测试 price 不匹配 | ||
| 149 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setPrice(null))); | ||
| 150 | + // 测试 ownerUserId 不匹配 | ||
| 151 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setOwnerUserId(null))); | ||
| 152 | + // 测试 batchId 不匹配 | ||
| 153 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setBatchId(null))); | ||
| 154 | + // 测试 sort 不匹配 | ||
| 155 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setSort(null))); | ||
| 156 | + // 测试 dataScope 不匹配 | ||
| 157 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setDataScope(null))); | ||
| 158 | + // 测试 dataScopeDeptIds 不匹配 | ||
| 159 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setDataScopeDeptIds(null))); | ||
| 160 | + // 测试 status 不匹配 | ||
| 161 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setStatus(null))); | ||
| 162 | + // 测试 remark 不匹配 | ||
| 163 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setRemark(null))); | ||
| 164 | + // 测试 createTime 不匹配 | ||
| 165 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCreateTime(null))); | ||
| 166 | + // 准备参数 | ||
| 167 | + ReceivablePageReqVO reqVO = new ReceivablePageReqVO(); | ||
| 168 | + reqVO.setNo(null); | ||
| 169 | + reqVO.setPlanId(null); | ||
| 170 | + reqVO.setCustomerId(null); | ||
| 171 | + reqVO.setContractId(null); | ||
| 172 | + reqVO.setCheckStatus(null); | ||
| 173 | + reqVO.setProcessInstanceId(null); | ||
| 174 | + reqVO.setReturnTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); | ||
| 175 | + reqVO.setReturnType(null); | ||
| 176 | + reqVO.setPrice(null); | ||
| 177 | + reqVO.setOwnerUserId(null); | ||
| 178 | + reqVO.setBatchId(null); | ||
| 179 | + reqVO.setSort(null); | ||
| 180 | + reqVO.setDataScope(null); | ||
| 181 | + reqVO.setDataScopeDeptIds(null); | ||
| 182 | + reqVO.setStatus(null); | ||
| 183 | + reqVO.setRemark(null); | ||
| 184 | + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); | ||
| 185 | + | ||
| 186 | + // 调用 | ||
| 187 | + PageResult<ReceivableDO> pageResult = receivableService.getReceivablePage(reqVO); | ||
| 188 | + // 断言 | ||
| 189 | + assertEquals(1, pageResult.getTotal()); | ||
| 190 | + assertEquals(1, pageResult.getList().size()); | ||
| 191 | + assertPojoEquals(dbReceivable, pageResult.getList().get(0)); | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + @Test | ||
| 195 | + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | ||
| 196 | + public void testGetReceivableList() { | ||
| 197 | + // mock 数据 | ||
| 198 | + ReceivableDO dbReceivable = randomPojo(ReceivableDO.class, o -> { // 等会查询到 | ||
| 199 | + o.setNo(null); | ||
| 200 | + o.setPlanId(null); | ||
| 201 | + o.setCustomerId(null); | ||
| 202 | + o.setContractId(null); | ||
| 203 | + o.setCheckStatus(null); | ||
| 204 | + o.setProcessInstanceId(null); | ||
| 205 | + o.setReturnTime(null); | ||
| 206 | + o.setReturnType(null); | ||
| 207 | + o.setPrice(null); | ||
| 208 | + o.setOwnerUserId(null); | ||
| 209 | + o.setBatchId(null); | ||
| 210 | + o.setSort(null); | ||
| 211 | + o.setDataScope(null); | ||
| 212 | + o.setDataScopeDeptIds(null); | ||
| 213 | + o.setStatus(null); | ||
| 214 | + o.setRemark(null); | ||
| 215 | + o.setCreateTime(null); | ||
| 216 | + }); | ||
| 217 | + receivableMapper.insert(dbReceivable); | ||
| 218 | + // 测试 no 不匹配 | ||
| 219 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setNo(null))); | ||
| 220 | + // 测试 planId 不匹配 | ||
| 221 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setPlanId(null))); | ||
| 222 | + // 测试 customerId 不匹配 | ||
| 223 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCustomerId(null))); | ||
| 224 | + // 测试 contractId 不匹配 | ||
| 225 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setContractId(null))); | ||
| 226 | + // 测试 checkStatus 不匹配 | ||
| 227 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCheckStatus(null))); | ||
| 228 | + // 测试 processInstanceId 不匹配 | ||
| 229 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setProcessInstanceId(null))); | ||
| 230 | + // 测试 returnTime 不匹配 | ||
| 231 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setReturnTime(null))); | ||
| 232 | + // 测试 returnType 不匹配 | ||
| 233 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setReturnType(null))); | ||
| 234 | + // 测试 price 不匹配 | ||
| 235 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setPrice(null))); | ||
| 236 | + // 测试 ownerUserId 不匹配 | ||
| 237 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setOwnerUserId(null))); | ||
| 238 | + // 测试 batchId 不匹配 | ||
| 239 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setBatchId(null))); | ||
| 240 | + // 测试 sort 不匹配 | ||
| 241 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setSort(null))); | ||
| 242 | + // 测试 dataScope 不匹配 | ||
| 243 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setDataScope(null))); | ||
| 244 | + // 测试 dataScopeDeptIds 不匹配 | ||
| 245 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setDataScopeDeptIds(null))); | ||
| 246 | + // 测试 status 不匹配 | ||
| 247 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setStatus(null))); | ||
| 248 | + // 测试 remark 不匹配 | ||
| 249 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setRemark(null))); | ||
| 250 | + // 测试 createTime 不匹配 | ||
| 251 | + receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCreateTime(null))); | ||
| 252 | + // 准备参数 | ||
| 253 | + ReceivableExportReqVO reqVO = new ReceivableExportReqVO(); | ||
| 254 | + reqVO.setNo(null); | ||
| 255 | + reqVO.setPlanId(null); | ||
| 256 | + reqVO.setCustomerId(null); | ||
| 257 | + reqVO.setContractId(null); | ||
| 258 | + reqVO.setCheckStatus(null); | ||
| 259 | + reqVO.setProcessInstanceId(null); | ||
| 260 | + reqVO.setReturnTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); | ||
| 261 | + reqVO.setReturnType(null); | ||
| 262 | + reqVO.setPrice(null); | ||
| 263 | + reqVO.setOwnerUserId(null); | ||
| 264 | + reqVO.setBatchId(null); | ||
| 265 | + reqVO.setSort(null); | ||
| 266 | + reqVO.setDataScope(null); | ||
| 267 | + reqVO.setDataScopeDeptIds(null); | ||
| 268 | + reqVO.setStatus(null); | ||
| 269 | + reqVO.setRemark(null); | ||
| 270 | + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); | ||
| 271 | + | ||
| 272 | + // 调用 | ||
| 273 | + List<ReceivableDO> list = receivableService.getReceivableList(reqVO); | ||
| 274 | + // 断言 | ||
| 275 | + assertEquals(1, list.size()); | ||
| 276 | + assertPojoEquals(dbReceivable, list.get(0)); | ||
| 277 | + } | ||
| 278 | + | ||
| 279 | +} |
yudao-module-crm/yudao-module-crm-biz/src/test/resources/sql/clean.sql
yudao-module-crm/yudao-module-crm-biz/src/test/resources/sql/create_tables.sql
| @@ -46,4 +46,30 @@ CREATE TABLE IF NOT EXISTS "crm_clue" ( | @@ -46,4 +46,30 @@ CREATE TABLE IF NOT EXISTS "crm_clue" ( | ||
| 46 | "deleted" bit NOT NULL DEFAULT FALSE, | 46 | "deleted" bit NOT NULL DEFAULT FALSE, |
| 47 | "tenant_id" bigint NOT NULL, | 47 | "tenant_id" bigint NOT NULL, |
| 48 | PRIMARY KEY ("id") | 48 | PRIMARY KEY ("id") |
| 49 | -) COMMENT '线索表'; | ||
| 50 | \ No newline at end of file | 49 | \ No newline at end of file |
| 50 | +) COMMENT '线索表'; | ||
| 51 | + | ||
| 52 | +CREATE TABLE IF NOT EXISTS "crm_receivable" ( | ||
| 53 | + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, | ||
| 54 | + "no" varchar, | ||
| 55 | + "plan_id" bigint, | ||
| 56 | + "customer_id" bigint, | ||
| 57 | + "contract_id" bigint, | ||
| 58 | + "check_status" int, | ||
| 59 | + "process_instance_id" bigint, | ||
| 60 | + "return_time" varchar, | ||
| 61 | + "return_type" varchar, | ||
| 62 | + "price" varchar, | ||
| 63 | + "owner_user_id" bigint, | ||
| 64 | + "batch_id" bigint, | ||
| 65 | + "sort" int, | ||
| 66 | + "data_scope" int, | ||
| 67 | + "data_scope_dept_ids" varchar, | ||
| 68 | + "status" int NOT NULL, | ||
| 69 | + "remark" varchar, | ||
| 70 | + "creator" varchar DEFAULT '', | ||
| 71 | + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 72 | + "updater" varchar DEFAULT '', | ||
| 73 | + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
| 74 | + "deleted" bit NOT NULL DEFAULT FALSE, | ||
| 75 | + PRIMARY KEY ("id") | ||
| 76 | +) COMMENT '回款管理'; |