Commit 56b59cf383f618e88d98a6935cde62dab6f3d0fd

Authored by YunaiV
2 parents 6f8fd383 34a57857

Merge branch 'feature/crm' of https://gitee.com/souvc/ruoyi-vue-pro into feature/crm

# Conflicts:
#	sql/mysql/crm.sql
#	sql/mysql/crm_menu.sql
#	yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ErrorCodeConstants.java
Showing 36 changed files with 2366 additions and 3 deletions
sql/mysql/crm.sql
... ... @@ -90,3 +90,71 @@ CREATE TABLE `crm_business` (
90 90 `tenant_id` bigint DEFAULT '0' COMMENT '租户ID',
91 91 PRIMARY KEY (`id`)
92 92 ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='商机表';
  93 +
  94 +
  95 +
  96 +-- ----------------------------
  97 +-- 回款表
  98 +-- ----------------------------
  99 +DROP TABLE IF EXISTS `crm_receivable`;
  100 +CREATE TABLE `crm_receivable` (
  101 + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  102 + `no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '回款编号',
  103 + `plan_id` bigint(20) NULL DEFAULT NULL COMMENT '回款计划ID',
  104 + `customer_id` bigint(20) NULL DEFAULT NULL COMMENT '客户ID',
  105 + `contract_id` bigint(20) NULL DEFAULT NULL COMMENT '合同ID',
  106 + `check_status` tinyint(4) NULL DEFAULT NULL COMMENT '审批状态',
  107 + `process_instance_id` bigint(20) NULL DEFAULT NULL COMMENT '工作流编号',
  108 + `return_time` datetime NULL DEFAULT NULL COMMENT '回款日期',
  109 + `return_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '回款方式',
  110 + `price` decimal(10, 2) NULL DEFAULT NULL COMMENT '回款金额',
  111 + `owner_user_id` bigint(20) NULL DEFAULT NULL COMMENT '负责人的用户编号',
  112 + `batch_id` bigint(20) NULL DEFAULT NULL COMMENT '批次',
  113 + `sort` int(11) NULL DEFAULT NULL COMMENT '显示顺序',
  114 + `data_scope` tinyint(4) NULL DEFAULT 1 COMMENT '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)',
  115 + `data_scope_dept_ids` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '数据范围(指定部门数组)',
  116 + `status` tinyint(4) NOT NULL COMMENT '状态(0正常 1停用)',
  117 + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注',
  118 + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
  119 + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  120 + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
  121 + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  122 + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  123 + `tenant_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号',
  124 + PRIMARY KEY (`id`) USING BTREE
  125 +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '回款管理' ROW_FORMAT = DYNAMIC;
  126 +
  127 +
  128 +-- ----------------------------
  129 +-- 回款计划表
  130 +-- ----------------------------
  131 +DROP TABLE IF EXISTS `crm_receivable_plan`;
  132 +CREATE TABLE `crm_receivable_plan` (
  133 + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  134 + `index_no` bigint(20) NULL DEFAULT NULL COMMENT '期数',
  135 + `receivable_id` bigint(20) NULL DEFAULT NULL COMMENT '回款ID',
  136 + `status` tinyint(4) NOT NULL COMMENT '完成状态',
  137 + `check_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '审批状态',
  138 + `process_instance_id` bigint(20) NULL DEFAULT NULL COMMENT '工作流编号',
  139 + `price` decimal(10, 2) NULL DEFAULT NULL COMMENT '计划回款金额',
  140 + `return_time` datetime NULL DEFAULT NULL COMMENT '计划回款日期',
  141 + `remind_days` bigint(20) NULL DEFAULT NULL COMMENT '提前几天提醒',
  142 + `remind_time` datetime NULL DEFAULT NULL COMMENT '提醒日期',
  143 + `customer_id` bigint(20) NULL DEFAULT NULL COMMENT '客户ID',
  144 + `contract_id` bigint(20) NULL DEFAULT NULL COMMENT '合同ID',
  145 + `owner_user_id` bigint(20) NULL DEFAULT NULL COMMENT '负责人',
  146 + `sort` int(11) NULL DEFAULT NULL COMMENT '显示顺序',
  147 + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注',
  148 + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
  149 + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  150 + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
  151 + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  152 + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  153 + `tenant_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号',
  154 + PRIMARY KEY (`id`) USING BTREE
  155 +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '回款计划' ROW_FORMAT = DYNAMIC;
  156 +
  157 +
  158 +
  159 +
  160 +
... ...
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 8 path, icon, component, status, component_name
9 9 )
10 10 VALUES (
11   - '合同管理', '', 2, 0, 1254,
  11 + '合同管理', '', 2, 0, 2375,
12 12 'contract', '', 'crm/contract/index', 0, 'Contract'
13 13 );
14 14  
... ... @@ -177,3 +177,131 @@ VALUES (
177 177 '商机导出', 'crm:business:export', 3, 5, @parentId,
178 178 '', '', '', 0
179 179 );
  180 +
  181 +
  182 +-- ----------------------------
  183 +-- 客户管理菜单
  184 +-- ----------------------------
  185 +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');
  186 +
  187 +
  188 +-- ----------------------------
  189 +-- 回款菜单
  190 +-- ----------------------------
  191 +
  192 +-- 菜单 SQL
  193 +INSERT INTO system_menu(
  194 + name, permission, type, sort, parent_id,
  195 + path, icon, component, status, component_name
  196 +)
  197 +VALUES (
  198 + '回款管理', '', 2, 0, 2375,
  199 + 'receivable', '', 'crm/receivable/index', 0, 'Receivable'
  200 + );
  201 +
  202 +-- 按钮父菜单ID
  203 +-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
  204 +SELECT @parentId := LAST_INSERT_ID();
  205 +
  206 +-- 按钮 SQL
  207 +INSERT INTO system_menu(
  208 + name, permission, type, sort, parent_id,
  209 + path, icon, component, status
  210 +)
  211 +VALUES (
  212 + '回款管理查询', 'crm:receivable:query', 3, 1, @parentId,
  213 + '', '', '', 0
  214 + );
  215 +INSERT INTO system_menu(
  216 + name, permission, type, sort, parent_id,
  217 + path, icon, component, status
  218 +)
  219 +VALUES (
  220 + '回款管理创建', 'crm:receivable:create', 3, 2, @parentId,
  221 + '', '', '', 0
  222 + );
  223 +INSERT INTO system_menu(
  224 + name, permission, type, sort, parent_id,
  225 + path, icon, component, status
  226 +)
  227 +VALUES (
  228 + '回款管理更新', 'crm:receivable:update', 3, 3, @parentId,
  229 + '', '', '', 0
  230 + );
  231 +INSERT INTO system_menu(
  232 + name, permission, type, sort, parent_id,
  233 + path, icon, component, status
  234 +)
  235 +VALUES (
  236 + '回款管理删除', 'crm:receivable:delete', 3, 4, @parentId,
  237 + '', '', '', 0
  238 + );
  239 +INSERT INTO system_menu(
  240 + name, permission, type, sort, parent_id,
  241 + path, icon, component, status
  242 +)
  243 +VALUES (
  244 + '回款管理导出', 'crm:receivable:export', 3, 5, @parentId,
  245 + '', '', '', 0
  246 + );
  247 +
  248 +
  249 +-- ----------------------------
  250 +-- 回款计划菜单
  251 +-- ----------------------------
  252 +
  253 +-- 菜单 SQL
  254 +INSERT INTO system_menu(
  255 + name, permission, type, sort, parent_id,
  256 + path, icon, component, status, component_name
  257 +)
  258 +VALUES (
  259 + '回款计划管理', '', 2, 0, 2375,
  260 + 'receivable-plan', '', 'crm/receivablePlan/index', 0, 'ReceivablePlan'
  261 + );
  262 +
  263 +-- 按钮父菜单ID
  264 +-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
  265 +SELECT @parentId := LAST_INSERT_ID();
  266 +
  267 +-- 按钮 SQL
  268 +INSERT INTO system_menu(
  269 + name, permission, type, sort, parent_id,
  270 + path, icon, component, status
  271 +)
  272 +VALUES (
  273 + '回款计划查询', 'crm:receivable-plan:query', 3, 1, @parentId,
  274 + '', '', '', 0
  275 + );
  276 +INSERT INTO system_menu(
  277 + name, permission, type, sort, parent_id,
  278 + path, icon, component, status
  279 +)
  280 +VALUES (
  281 + '回款计划创建', 'crm:receivable-plan:create', 3, 2, @parentId,
  282 + '', '', '', 0
  283 + );
  284 +INSERT INTO system_menu(
  285 + name, permission, type, sort, parent_id,
  286 + path, icon, component, status
  287 +)
  288 +VALUES (
  289 + '回款计划更新', 'crm:receivable-plan:update', 3, 3, @parentId,
  290 + '', '', '', 0
  291 + );
  292 +INSERT INTO system_menu(
  293 + name, permission, type, sort, parent_id,
  294 + path, icon, component, status
  295 +)
  296 +VALUES (
  297 + '回款计划删除', 'crm:receivable-plan:delete', 3, 4, @parentId,
  298 + '', '', '', 0
  299 + );
  300 +INSERT INTO system_menu(
  301 + name, permission, type, sort, parent_id,
  302 + path, icon, component, status
  303 +)
  304 +VALUES (
  305 + '回款计划导出', 'crm:receivable-plan:export', 3, 5, @parentId,
  306 + '', '', '', 0
  307 + );
... ...
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ErrorCodeConstants.java
... ... @@ -18,4 +18,9 @@ public interface ErrorCodeConstants {
18 18 // ========== 商机管理 1-020-001-000 ==========
19 19 ErrorCode BUSINESS_NOT_EXISTS = new ErrorCode(1_020_001_000, "商机不存在");
20 20  
  21 + // TODO @liuhongfeng:错误码分段;
  22 + ErrorCode RECEIVABLE_NOT_EXISTS = new ErrorCode(1_030_000_001, "回款管理不存在");
  23 +
  24 + ErrorCode RECEIVABLE_PLAN_NOT_EXISTS = new ErrorCode(1_040_000_001, "回款计划不存在");
  25 +
21 26 }
... ...
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/ReceivablePlanController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.crm.controller.admin.receivable;
  2 +
  3 +import org.springframework.web.bind.annotation.*;
  4 +import javax.annotation.Resource;
  5 +import org.springframework.validation.annotation.Validated;
  6 +import org.springframework.security.access.prepost.PreAuthorize;
  7 +import io.swagger.v3.oas.annotations.tags.Tag;
  8 +import io.swagger.v3.oas.annotations.Parameter;
  9 +import io.swagger.v3.oas.annotations.Operation;
  10 +
  11 +import javax.validation.constraints.*;
  12 +import javax.validation.*;
  13 +import javax.servlet.http.*;
  14 +import java.util.*;
  15 +import java.io.IOException;
  16 +
  17 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  18 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  19 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  20 +
  21 +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
  22 +
  23 +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
  24 +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
  25 +
  26 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
  27 +import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivablePlanDO;
  28 +import cn.iocoder.yudao.module.crm.convert.receivable.ReceivablePlanConvert;
  29 +import cn.iocoder.yudao.module.crm.service.receivable.ReceivablePlanService;
  30 +
  31 +/**
  32 + * @author 赤焰
  33 + */
  34 +@Tag(name = "管理后台 - 回款计划")
  35 +@RestController
  36 +@RequestMapping("/crm/receivable-plan")
  37 +@Validated
  38 +public class ReceivablePlanController {
  39 +
  40 + @Resource
  41 + private ReceivablePlanService receivablePlanService;
  42 +
  43 + @PostMapping("/create")
  44 + @Operation(summary = "创建回款计划")
  45 + @PreAuthorize("@ss.hasPermission('crm:receivable-plan:create')")
  46 + public CommonResult<Long> createReceivablePlan(@Valid @RequestBody ReceivablePlanCreateReqVO createReqVO) {
  47 + return success(receivablePlanService.createReceivablePlan(createReqVO));
  48 + }
  49 +
  50 + @PutMapping("/update")
  51 + @Operation(summary = "更新回款计划")
  52 + @PreAuthorize("@ss.hasPermission('crm:receivable-plan:update')")
  53 + public CommonResult<Boolean> updateReceivablePlan(@Valid @RequestBody ReceivablePlanUpdateReqVO updateReqVO) {
  54 + receivablePlanService.updateReceivablePlan(updateReqVO);
  55 + return success(true);
  56 + }
  57 +
  58 + @DeleteMapping("/delete")
  59 + @Operation(summary = "删除回款计划")
  60 + @Parameter(name = "id", description = "编号", required = true)
  61 + @PreAuthorize("@ss.hasPermission('crm:receivable-plan:delete')")
  62 + public CommonResult<Boolean> deleteReceivablePlan(@RequestParam("id") Long id) {
  63 + receivablePlanService.deleteReceivablePlan(id);
  64 + return success(true);
  65 + }
  66 +
  67 + @GetMapping("/get")
  68 + @Operation(summary = "获得回款计划")
  69 + @Parameter(name = "id", description = "编号", required = true, example = "1024")
  70 + @PreAuthorize("@ss.hasPermission('crm:receivable-plan:query')")
  71 + public CommonResult<ReceivablePlanRespVO> getReceivablePlan(@RequestParam("id") Long id) {
  72 + ReceivablePlanDO receivablePlan = receivablePlanService.getReceivablePlan(id);
  73 + return success(ReceivablePlanConvert.INSTANCE.convert(receivablePlan));
  74 + }
  75 +
  76 + @GetMapping("/list")
  77 + @Operation(summary = "获得回款计划列表")
  78 + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
  79 + @PreAuthorize("@ss.hasPermission('crm:receivable-plan:query')")
  80 + public CommonResult<List<ReceivablePlanRespVO>> getReceivablePlanList(@RequestParam("ids") Collection<Long> ids) {
  81 + List<ReceivablePlanDO> list = receivablePlanService.getReceivablePlanList(ids);
  82 + return success(ReceivablePlanConvert.INSTANCE.convertList(list));
  83 + }
  84 +
  85 + @GetMapping("/page")
  86 + @Operation(summary = "获得回款计划分页")
  87 + @PreAuthorize("@ss.hasPermission('crm:receivable-plan:query')")
  88 + public CommonResult<PageResult<ReceivablePlanRespVO>> getReceivablePlanPage(@Valid ReceivablePlanPageReqVO pageVO) {
  89 + PageResult<ReceivablePlanDO> pageResult = receivablePlanService.getReceivablePlanPage(pageVO);
  90 + return success(ReceivablePlanConvert.INSTANCE.convertPage(pageResult));
  91 + }
  92 +
  93 + @GetMapping("/export-excel")
  94 + @Operation(summary = "导出回款计划 Excel")
  95 + @PreAuthorize("@ss.hasPermission('crm:receivable-plan:export')")
  96 + @OperateLog(type = EXPORT)
  97 + public void exportReceivablePlanExcel(@Valid ReceivablePlanExportReqVO exportReqVO,
  98 + HttpServletResponse response) throws IOException {
  99 + List<ReceivablePlanDO> list = receivablePlanService.getReceivablePlanList(exportReqVO);
  100 + // 导出 Excel
  101 + List<ReceivablePlanExcelVO> datas = ReceivablePlanConvert.INSTANCE.convertList02(list);
  102 + ExcelUtils.write(response, "回款计划.xls", "数据", ReceivablePlanExcelVO.class, datas);
  103 + }
  104 +
  105 +}
... ...
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/ReceivablePlanBaseVO.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.math.BigDecimal;
  7 +import java.time.LocalDateTime;
  8 +import java.time.LocalDateTime;
  9 +import java.time.LocalDateTime;
  10 +import java.time.LocalDateTime;
  11 +import javax.validation.constraints.*;
  12 +import org.springframework.format.annotation.DateTimeFormat;
  13 +
  14 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  15 +
  16 +/**
  17 + * 回款计划 Base VO,提供给添加、修改、详细的子 VO 使用
  18 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
  19 + */
  20 +@Data
  21 +public class ReceivablePlanBaseVO {
  22 +
  23 + @Schema(description = "期数")
  24 + private Long indexNo;
  25 +
  26 + @Schema(description = "回款ID", example = "19852")
  27 + private Long receivableId;
  28 +
  29 + @Schema(description = "完成状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
  30 + //@NotNull(message = "完成状态不能为空")
  31 + private Integer status;
  32 +
  33 + @Schema(description = "审批状态", example = "1")
  34 + private String checkStatus;
  35 +
  36 + @Schema(description = "工作流编号", example = "8909")
  37 + private Long processInstanceId;
  38 +
  39 + @Schema(description = "计划回款金额", example = "29675")
  40 + private BigDecimal price;
  41 +
  42 + @Schema(description = "计划回款日期")
  43 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  44 + private LocalDateTime returnTime;
  45 +
  46 + @Schema(description = "提前几天提醒")
  47 + private Long remindDays;
  48 +
  49 + @Schema(description = "提醒日期")
  50 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  51 + private LocalDateTime remindTime;
  52 +
  53 + @Schema(description = "客户ID", example = "18026")
  54 + private Long customerId;
  55 +
  56 + @Schema(description = "合同ID", example = "3473")
  57 + private Long contractId;
  58 +
  59 + @Schema(description = "负责人", example = "17828")
  60 + private Long ownerUserId;
  61 +
  62 + @Schema(description = "显示顺序")
  63 + private Integer sort;
  64 +
  65 + @Schema(description = "备注", example = "随便")
  66 + private String remark;
  67 +
  68 +}
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/ReceivablePlanCreateReqVO.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 ReceivablePlanCreateReqVO extends ReceivablePlanBaseVO {
  13 +
  14 +}
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/ReceivablePlanExcelVO.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.math.BigDecimal;
  7 +import java.time.LocalDateTime;
  8 +import java.time.LocalDateTime;
  9 +import java.time.LocalDateTime;
  10 +import java.time.LocalDateTime;
  11 +
  12 +import com.alibaba.excel.annotation.ExcelProperty;
  13 +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
  14 +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
  15 +
  16 +
  17 +/**
  18 + * 回款计划 Excel VO
  19 + *
  20 + * @author 芋道源码
  21 + */
  22 +@Data
  23 +public class ReceivablePlanExcelVO {
  24 +
  25 + @ExcelProperty("ID")
  26 + private Long id;
  27 +
  28 + @ExcelProperty("期数")
  29 + private Long indexNo;
  30 +
  31 + @ExcelProperty("回款ID")
  32 + private Long receivableId;
  33 +
  34 + @ExcelProperty(value = "完成状态", converter = DictConvert.class)
  35 + @DictFormat("common_status") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
  36 + private Integer status;
  37 +
  38 + @ExcelProperty(value = "审批状态", converter = DictConvert.class)
  39 + @DictFormat("crm_receivable_check_status") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
  40 + private String checkStatus;
  41 +
  42 + //@ExcelProperty("工作流编号")
  43 + //private Long processInstanceId;
  44 +
  45 + @ExcelProperty("计划回款金额")
  46 + private BigDecimal price;
  47 +
  48 + @ExcelProperty("计划回款日期")
  49 + private LocalDateTime returnTime;
  50 +
  51 + @ExcelProperty("提前几天提醒")
  52 + private Long remindDays;
  53 +
  54 + @ExcelProperty("提醒日期")
  55 + private LocalDateTime remindTime;
  56 +
  57 + @ExcelProperty("客户ID")
  58 + private Long customerId;
  59 +
  60 + @ExcelProperty("合同ID")
  61 + private Long contractId;
  62 +
  63 + @ExcelProperty("负责人")
  64 + private Long ownerUserId;
  65 +
  66 + //@ExcelProperty("显示顺序")
  67 + //private Integer sort;
  68 +
  69 + @ExcelProperty("备注")
  70 + private String remark;
  71 +
  72 + @ExcelProperty("创建时间")
  73 + private LocalDateTime createTime;
  74 +
  75 +}
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/ReceivablePlanExportReqVO.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 cn.iocoder.yudao.framework.common.pojo.PageParam;
  7 +import java.time.LocalDateTime;
  8 +import org.springframework.format.annotation.DateTimeFormat;
  9 +
  10 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  11 +
  12 +@Schema(description = "管理后台 - 回款计划 Excel 导出 Request VO,参数和 ReceivablePlanPageReqVO 是一致的")
  13 +@Data
  14 +public class ReceivablePlanExportReqVO {
  15 +
  16 + @Schema(description = "期数")
  17 + private Long indexNo;
  18 +
  19 + @Schema(description = "完成状态", example = "2")
  20 + private Integer status;
  21 +
  22 + @Schema(description = "审批状态", example = "1")
  23 + private String checkStatus;
  24 +
  25 + @Schema(description = "计划回款日期")
  26 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  27 + private LocalDateTime[] returnTime;
  28 +
  29 + @Schema(description = "提前几天提醒")
  30 + private Long remindDays;
  31 +
  32 + @Schema(description = "提醒日期")
  33 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  34 + private LocalDateTime[] remindTime;
  35 +
  36 + @Schema(description = "客户ID", example = "18026")
  37 + private Long customerId;
  38 +
  39 + @Schema(description = "合同ID", example = "3473")
  40 + private Long contractId;
  41 +
  42 + @Schema(description = "负责人", example = "17828")
  43 + private Long ownerUserId;
  44 +
  45 + @Schema(description = "备注", example = "随便")
  46 + private String remark;
  47 +
  48 + @Schema(description = "创建时间")
  49 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  50 + private LocalDateTime[] createTime;
  51 +
  52 +}
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/ReceivablePlanPageReqVO.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 cn.iocoder.yudao.framework.common.pojo.PageParam;
  7 +import org.springframework.format.annotation.DateTimeFormat;
  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 +@Schema(description = "管理后台 - 回款计划分页 Request VO")
  13 +@Data
  14 +@EqualsAndHashCode(callSuper = true)
  15 +@ToString(callSuper = true)
  16 +public class ReceivablePlanPageReqVO extends PageParam {
  17 +
  18 + @Schema(description = "期数")
  19 + private Long indexNo;
  20 +
  21 + @Schema(description = "完成状态", example = "2")
  22 + private Integer status;
  23 +
  24 + @Schema(description = "审批状态", example = "1")
  25 + private String checkStatus;
  26 +
  27 + @Schema(description = "计划回款日期")
  28 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  29 + private LocalDateTime[] returnTime;
  30 +
  31 + @Schema(description = "提前几天提醒")
  32 + private Long remindDays;
  33 +
  34 + @Schema(description = "提醒日期")
  35 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  36 + private LocalDateTime[] remindTime;
  37 +
  38 + @Schema(description = "客户ID", example = "18026")
  39 + private Long customerId;
  40 +
  41 + @Schema(description = "合同ID", example = "3473")
  42 + private Long contractId;
  43 +
  44 + @Schema(description = "负责人", example = "17828")
  45 + private Long ownerUserId;
  46 +
  47 + @Schema(description = "备注", example = "随便")
  48 + private String remark;
  49 +
  50 + @Schema(description = "创建时间")
  51 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  52 + private LocalDateTime[] createTime;
  53 +
  54 +}
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/ReceivablePlanRespVO.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 ReceivablePlanRespVO extends ReceivablePlanBaseVO {
  12 +
  13 + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25153")
  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/ReceivablePlanUpdateReqVO.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 ReceivablePlanUpdateReqVO extends ReceivablePlanBaseVO {
  13 +
  14 + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25153")
  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/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/convert/receivable/ReceivablePlanConvert.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.ReceivablePlanDO;
  11 +
  12 +/**
  13 + * 回款计划 Convert
  14 + *
  15 + * @author 芋道源码
  16 + */
  17 +@Mapper
  18 +public interface ReceivablePlanConvert {
  19 +
  20 + ReceivablePlanConvert INSTANCE = Mappers.getMapper(ReceivablePlanConvert.class);
  21 +
  22 + ReceivablePlanDO convert(ReceivablePlanCreateReqVO bean);
  23 +
  24 + ReceivablePlanDO convert(ReceivablePlanUpdateReqVO bean);
  25 +
  26 + ReceivablePlanRespVO convert(ReceivablePlanDO bean);
  27 +
  28 + List<ReceivablePlanRespVO> convertList(List<ReceivablePlanDO> list);
  29 +
  30 + PageResult<ReceivablePlanRespVO> convertPage(PageResult<ReceivablePlanDO> page);
  31 +
  32 + List<ReceivablePlanExcelVO> convertList02(List<ReceivablePlanDO> 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/dataobject/receivable/ReceivablePlanDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.crm.dal.dataobject.receivable;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import java.math.BigDecimal;
  6 +import java.time.LocalDateTime;
  7 +import java.time.LocalDateTime;
  8 +import java.time.LocalDateTime;
  9 +import java.time.LocalDateTime;
  10 +import com.baomidou.mybatisplus.annotation.*;
  11 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  12 +
  13 +/**
  14 + * 回款计划 DO
  15 + *
  16 + * @author 芋道源码
  17 + */
  18 +@TableName("crm_receivable_plan")
  19 +@KeySequence("crm_receivable_plan_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  20 +@Data
  21 +@EqualsAndHashCode(callSuper = true)
  22 +@ToString(callSuper = true)
  23 +@Builder
  24 +@NoArgsConstructor
  25 +@AllArgsConstructor
  26 +public class ReceivablePlanDO extends BaseDO {
  27 +
  28 + /**
  29 + * ID
  30 + */
  31 + @TableId
  32 + private Long id;
  33 + /**
  34 + * 期数
  35 + */
  36 + private Long indexNo;
  37 + /**
  38 + * 回款ID
  39 + */
  40 + private Long receivableId;
  41 + /**
  42 + * 完成状态
  43 + *
  44 + * 枚举 {@link TODO common_status 对应的类}
  45 + */
  46 + private Integer status;
  47 + /**
  48 + * 审批状态
  49 + *
  50 + * 枚举 {@link TODO crm_receivable_check_status 对应的类}
  51 + */
  52 + private String checkStatus;
  53 + /**
  54 + * 工作流编号
  55 + */
  56 + private Long processInstanceId;
  57 + /**
  58 + * 计划回款金额
  59 + */
  60 + private BigDecimal price;
  61 + /**
  62 + * 计划回款日期
  63 + */
  64 + private LocalDateTime returnTime;
  65 + /**
  66 + * 提前几天提醒
  67 + */
  68 + private Long remindDays;
  69 + /**
  70 + * 提醒日期
  71 + */
  72 + private LocalDateTime remindTime;
  73 + /**
  74 + * 客户ID
  75 + */
  76 + private Long customerId;
  77 + /**
  78 + * 合同ID
  79 + */
  80 + private Long contractId;
  81 + /**
  82 + * 负责人
  83 + */
  84 + private Long ownerUserId;
  85 + /**
  86 + * 显示顺序
  87 + */
  88 + private Integer sort;
  89 + /**
  90 + * 备注
  91 + */
  92 + private String remark;
  93 +
  94 +}
... ...
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/dal/mysql/receivable/ReceivablePlanMapper.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.ReceivablePlanDO;
  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 ReceivablePlanMapper extends BaseMapperX<ReceivablePlanDO> {
  19 +
  20 + default PageResult<ReceivablePlanDO> selectPage(ReceivablePlanPageReqVO reqVO) {
  21 + return selectPage(reqVO, new LambdaQueryWrapperX<ReceivablePlanDO>()
  22 + .eqIfPresent(ReceivablePlanDO::getIndexNo, reqVO.getIndexNo())
  23 + .eqIfPresent(ReceivablePlanDO::getStatus, reqVO.getStatus())
  24 + .eqIfPresent(ReceivablePlanDO::getCheckStatus, reqVO.getCheckStatus())
  25 + .betweenIfPresent(ReceivablePlanDO::getReturnTime, reqVO.getReturnTime())
  26 + .eqIfPresent(ReceivablePlanDO::getRemindDays, reqVO.getRemindDays())
  27 + .betweenIfPresent(ReceivablePlanDO::getRemindTime, reqVO.getRemindTime())
  28 + .eqIfPresent(ReceivablePlanDO::getCustomerId, reqVO.getCustomerId())
  29 + .eqIfPresent(ReceivablePlanDO::getContractId, reqVO.getContractId())
  30 + .eqIfPresent(ReceivablePlanDO::getOwnerUserId, reqVO.getOwnerUserId())
  31 + .eqIfPresent(ReceivablePlanDO::getRemark, reqVO.getRemark())
  32 + .betweenIfPresent(ReceivablePlanDO::getCreateTime, reqVO.getCreateTime())
  33 + .orderByDesc(ReceivablePlanDO::getId));
  34 + }
  35 +
  36 + default List<ReceivablePlanDO> selectList(ReceivablePlanExportReqVO reqVO) {
  37 + return selectList(new LambdaQueryWrapperX<ReceivablePlanDO>()
  38 + .eqIfPresent(ReceivablePlanDO::getIndexNo, reqVO.getIndexNo())
  39 + .eqIfPresent(ReceivablePlanDO::getStatus, reqVO.getStatus())
  40 + .eqIfPresent(ReceivablePlanDO::getCheckStatus, reqVO.getCheckStatus())
  41 + .betweenIfPresent(ReceivablePlanDO::getReturnTime, reqVO.getReturnTime())
  42 + .eqIfPresent(ReceivablePlanDO::getRemindDays, reqVO.getRemindDays())
  43 + .betweenIfPresent(ReceivablePlanDO::getRemindTime, reqVO.getRemindTime())
  44 + .eqIfPresent(ReceivablePlanDO::getCustomerId, reqVO.getCustomerId())
  45 + .eqIfPresent(ReceivablePlanDO::getContractId, reqVO.getContractId())
  46 + .eqIfPresent(ReceivablePlanDO::getOwnerUserId, reqVO.getOwnerUserId())
  47 + .eqIfPresent(ReceivablePlanDO::getRemark, reqVO.getRemark())
  48 + .betweenIfPresent(ReceivablePlanDO::getCreateTime, reqVO.getCreateTime())
  49 + .orderByDesc(ReceivablePlanDO::getId));
  50 + }
  51 +
  52 +}
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/ReceivablePlanService.java 0 → 100644
  1 +package cn.iocoder.yudao.module.crm.service.receivable;
  2 +
  3 +import java.util.*;
  4 +import javax.validation.*;
  5 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
  6 +import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivablePlanDO;
  7 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  8 +
  9 +/**
  10 + * 回款计划 Service 接口
  11 + *
  12 + * @author 芋道源码
  13 + */
  14 +public interface ReceivablePlanService {
  15 +
  16 + /**
  17 + * 创建回款计划
  18 + *
  19 + * @param createReqVO 创建信息
  20 + * @return 编号
  21 + */
  22 + Long createReceivablePlan(@Valid ReceivablePlanCreateReqVO createReqVO);
  23 +
  24 + /**
  25 + * 更新回款计划
  26 + *
  27 + * @param updateReqVO 更新信息
  28 + */
  29 + void updateReceivablePlan(@Valid ReceivablePlanUpdateReqVO updateReqVO);
  30 +
  31 + /**
  32 + * 删除回款计划
  33 + *
  34 + * @param id 编号
  35 + */
  36 + void deleteReceivablePlan(Long id);
  37 +
  38 + /**
  39 + * 获得回款计划
  40 + *
  41 + * @param id 编号
  42 + * @return 回款计划
  43 + */
  44 + ReceivablePlanDO getReceivablePlan(Long id);
  45 +
  46 + /**
  47 + * 获得回款计划列表
  48 + *
  49 + * @param ids 编号
  50 + * @return 回款计划列表
  51 + */
  52 + List<ReceivablePlanDO> getReceivablePlanList(Collection<Long> ids);
  53 +
  54 + /**
  55 + * 获得回款计划分页
  56 + *
  57 + * @param pageReqVO 分页查询
  58 + * @return 回款计划分页
  59 + */
  60 + PageResult<ReceivablePlanDO> getReceivablePlanPage(ReceivablePlanPageReqVO pageReqVO);
  61 +
  62 + /**
  63 + * 获得回款计划列表, 用于 Excel 导出
  64 + *
  65 + * @param exportReqVO 查询条件
  66 + * @return 回款计划列表
  67 + */
  68 + List<ReceivablePlanDO> getReceivablePlanList(ReceivablePlanExportReqVO exportReqVO);
  69 +
  70 +}
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/ReceivablePlanServiceImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.module.crm.service.receivable;
  2 +
  3 +import cn.hutool.core.util.ObjectUtil;
  4 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
  5 +import org.springframework.stereotype.Service;
  6 +import javax.annotation.Resource;
  7 +import org.springframework.validation.annotation.Validated;
  8 +
  9 +import java.util.*;
  10 +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
  11 +import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivablePlanDO;
  12 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  13 +
  14 +import cn.iocoder.yudao.module.crm.convert.receivable.ReceivablePlanConvert;
  15 +import cn.iocoder.yudao.module.crm.dal.mysql.receivable.ReceivablePlanMapper;
  16 +
  17 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  18 +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
  19 +
  20 +import cn.hutool.core.collection.CollUtil;
  21 +import cn.hutool.core.collection.ListUtil;
  22 +
  23 +/**
  24 + * 回款计划 Service 实现类
  25 + *
  26 + * @author 芋道源码
  27 + */
  28 +@Service
  29 +@Validated
  30 +public class ReceivablePlanServiceImpl implements ReceivablePlanService {
  31 +
  32 + @Resource
  33 + private ReceivablePlanMapper receivablePlanMapper;
  34 +
  35 + @Override
  36 + public Long createReceivablePlan(ReceivablePlanCreateReqVO createReqVO) {
  37 + // 插入
  38 + ReceivablePlanDO receivablePlan = ReceivablePlanConvert.INSTANCE.convert(createReqVO);
  39 + if(ObjectUtil.isNull(receivablePlan.getStatus())){
  40 + receivablePlan.setStatus(CommonStatusEnum.ENABLE.getStatus());
  41 + }
  42 + receivablePlanMapper.insert(receivablePlan);
  43 + // 返回
  44 + return receivablePlan.getId();
  45 + }
  46 +
  47 + @Override
  48 + public void updateReceivablePlan(ReceivablePlanUpdateReqVO updateReqVO) {
  49 + // 校验存在
  50 + validateReceivablePlanExists(updateReqVO.getId());
  51 + // 更新
  52 + ReceivablePlanDO updateObj = ReceivablePlanConvert.INSTANCE.convert(updateReqVO);
  53 + receivablePlanMapper.updateById(updateObj);
  54 + }
  55 +
  56 + @Override
  57 + public void deleteReceivablePlan(Long id) {
  58 + // 校验存在
  59 + validateReceivablePlanExists(id);
  60 + // 删除
  61 + receivablePlanMapper.deleteById(id);
  62 + }
  63 +
  64 + private void validateReceivablePlanExists(Long id) {
  65 + if (receivablePlanMapper.selectById(id) == null) {
  66 + throw exception(RECEIVABLE_PLAN_NOT_EXISTS);
  67 + }
  68 + }
  69 +
  70 + @Override
  71 + public ReceivablePlanDO getReceivablePlan(Long id) {
  72 + return receivablePlanMapper.selectById(id);
  73 + }
  74 +
  75 + @Override
  76 + public List<ReceivablePlanDO> getReceivablePlanList(Collection<Long> ids) {
  77 + if (CollUtil.isEmpty(ids)) {
  78 + return ListUtil.empty();
  79 + }
  80 + return receivablePlanMapper.selectBatchIds(ids);
  81 + }
  82 +
  83 + @Override
  84 + public PageResult<ReceivablePlanDO> getReceivablePlanPage(ReceivablePlanPageReqVO pageReqVO) {
  85 + return receivablePlanMapper.selectPage(pageReqVO);
  86 + }
  87 +
  88 + @Override
  89 + public List<ReceivablePlanDO> getReceivablePlanList(ReceivablePlanExportReqVO exportReqVO) {
  90 + return receivablePlanMapper.selectList(exportReqVO);
  91 + }
  92 +
  93 +}
... ...
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/main/resources/mapper/receivable/ReceivablePlanMapper.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.ReceivablePlanMapper">
  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/ReceivablePlanServiceImplTest.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.ReceivablePlanDO;
  13 +import cn.iocoder.yudao.module.crm.dal.mysql.receivable.ReceivablePlanMapper;
  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 ReceivablePlanServiceImpl} 的单元测试类
  33 + *
  34 + * @author 芋道源码
  35 + */
  36 +@Import(ReceivablePlanServiceImpl.class)
  37 +public class ReceivablePlanServiceImplTest extends BaseDbUnitTest {
  38 +
  39 + @Resource
  40 + private ReceivablePlanServiceImpl receivablePlanService;
  41 +
  42 + @Resource
  43 + private ReceivablePlanMapper receivablePlanMapper;
  44 +
  45 + @Test
  46 + public void testCreateReceivablePlan_success() {
  47 + // 准备参数
  48 + ReceivablePlanCreateReqVO reqVO = randomPojo(ReceivablePlanCreateReqVO.class);
  49 +
  50 + // 调用
  51 + Long receivablePlanId = receivablePlanService.createReceivablePlan(reqVO);
  52 + // 断言
  53 + assertNotNull(receivablePlanId);
  54 + // 校验记录的属性是否正确
  55 + ReceivablePlanDO receivablePlan = receivablePlanMapper.selectById(receivablePlanId);
  56 + assertPojoEquals(reqVO, receivablePlan);
  57 + }
  58 +
  59 + @Test
  60 + public void testUpdateReceivablePlan_success() {
  61 + // mock 数据
  62 + ReceivablePlanDO dbReceivablePlan = randomPojo(ReceivablePlanDO.class);
  63 + receivablePlanMapper.insert(dbReceivablePlan);// @Sql: 先插入出一条存在的数据
  64 + // 准备参数
  65 + ReceivablePlanUpdateReqVO reqVO = randomPojo(ReceivablePlanUpdateReqVO.class, o -> {
  66 + o.setId(dbReceivablePlan.getId()); // 设置更新的 ID
  67 + });
  68 +
  69 + // 调用
  70 + receivablePlanService.updateReceivablePlan(reqVO);
  71 + // 校验是否更新正确
  72 + ReceivablePlanDO receivablePlan = receivablePlanMapper.selectById(reqVO.getId()); // 获取最新的
  73 + assertPojoEquals(reqVO, receivablePlan);
  74 + }
  75 +
  76 + @Test
  77 + public void testUpdateReceivablePlan_notExists() {
  78 + // 准备参数
  79 + ReceivablePlanUpdateReqVO reqVO = randomPojo(ReceivablePlanUpdateReqVO.class);
  80 +
  81 + // 调用, 并断言异常
  82 + assertServiceException(() -> receivablePlanService.updateReceivablePlan(reqVO), RECEIVABLE_PLAN_NOT_EXISTS);
  83 + }
  84 +
  85 + @Test
  86 + public void testDeleteReceivablePlan_success() {
  87 + // mock 数据
  88 + ReceivablePlanDO dbReceivablePlan = randomPojo(ReceivablePlanDO.class);
  89 + receivablePlanMapper.insert(dbReceivablePlan);// @Sql: 先插入出一条存在的数据
  90 + // 准备参数
  91 + Long id = dbReceivablePlan.getId();
  92 +
  93 + // 调用
  94 + receivablePlanService.deleteReceivablePlan(id);
  95 + // 校验数据不存在了
  96 + assertNull(receivablePlanMapper.selectById(id));
  97 + }
  98 +
  99 + @Test
  100 + public void testDeleteReceivablePlan_notExists() {
  101 + // 准备参数
  102 + Long id = randomLongId();
  103 +
  104 + // 调用, 并断言异常
  105 + assertServiceException(() -> receivablePlanService.deleteReceivablePlan(id), RECEIVABLE_PLAN_NOT_EXISTS);
  106 + }
  107 +
  108 + @Test
  109 + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
  110 + public void testGetReceivablePlanPage() {
  111 + // mock 数据
  112 + ReceivablePlanDO dbReceivablePlan = randomPojo(ReceivablePlanDO.class, o -> { // 等会查询到
  113 + o.setIndexNo(null);
  114 + o.setStatus(null);
  115 + o.setCheckStatus(null);
  116 + o.setReturnTime(null);
  117 + o.setRemindDays(null);
  118 + o.setRemindTime(null);
  119 + o.setCustomerId(null);
  120 + o.setContractId(null);
  121 + o.setOwnerUserId(null);
  122 + o.setRemark(null);
  123 + o.setCreateTime(null);
  124 + });
  125 + receivablePlanMapper.insert(dbReceivablePlan);
  126 + // 测试 indexNo 不匹配
  127 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setIndexNo(null)));
  128 + // 测试 status 不匹配
  129 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setStatus(null)));
  130 + // 测试 checkStatus 不匹配
  131 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCheckStatus(null)));
  132 + // 测试 returnTime 不匹配
  133 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setReturnTime(null)));
  134 + // 测试 remindDays 不匹配
  135 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setRemindDays(null)));
  136 + // 测试 remindTime 不匹配
  137 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setRemindTime(null)));
  138 + // 测试 customerId 不匹配
  139 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCustomerId(null)));
  140 + // 测试 contractId 不匹配
  141 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setContractId(null)));
  142 + // 测试 ownerUserId 不匹配
  143 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setOwnerUserId(null)));
  144 + // 测试 remark 不匹配
  145 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setRemark(null)));
  146 + // 测试 createTime 不匹配
  147 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCreateTime(null)));
  148 + // 准备参数
  149 + ReceivablePlanPageReqVO reqVO = new ReceivablePlanPageReqVO();
  150 + reqVO.setIndexNo(null);
  151 + reqVO.setStatus(null);
  152 + reqVO.setCheckStatus(null);
  153 + reqVO.setReturnTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
  154 + reqVO.setRemindDays(null);
  155 + reqVO.setRemindTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
  156 + reqVO.setCustomerId(null);
  157 + reqVO.setContractId(null);
  158 + reqVO.setOwnerUserId(null);
  159 + reqVO.setRemark(null);
  160 + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
  161 +
  162 + // 调用
  163 + PageResult<ReceivablePlanDO> pageResult = receivablePlanService.getReceivablePlanPage(reqVO);
  164 + // 断言
  165 + assertEquals(1, pageResult.getTotal());
  166 + assertEquals(1, pageResult.getList().size());
  167 + assertPojoEquals(dbReceivablePlan, pageResult.getList().get(0));
  168 + }
  169 +
  170 + @Test
  171 + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
  172 + public void testGetReceivablePlanList() {
  173 + // mock 数据
  174 + ReceivablePlanDO dbReceivablePlan = randomPojo(ReceivablePlanDO.class, o -> { // 等会查询到
  175 + o.setIndexNo(null);
  176 + o.setStatus(null);
  177 + o.setCheckStatus(null);
  178 + o.setReturnTime(null);
  179 + o.setRemindDays(null);
  180 + o.setRemindTime(null);
  181 + o.setCustomerId(null);
  182 + o.setContractId(null);
  183 + o.setOwnerUserId(null);
  184 + o.setRemark(null);
  185 + o.setCreateTime(null);
  186 + });
  187 + receivablePlanMapper.insert(dbReceivablePlan);
  188 + // 测试 indexNo 不匹配
  189 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setIndexNo(null)));
  190 + // 测试 status 不匹配
  191 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setStatus(null)));
  192 + // 测试 checkStatus 不匹配
  193 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCheckStatus(null)));
  194 + // 测试 returnTime 不匹配
  195 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setReturnTime(null)));
  196 + // 测试 remindDays 不匹配
  197 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setRemindDays(null)));
  198 + // 测试 remindTime 不匹配
  199 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setRemindTime(null)));
  200 + // 测试 customerId 不匹配
  201 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCustomerId(null)));
  202 + // 测试 contractId 不匹配
  203 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setContractId(null)));
  204 + // 测试 ownerUserId 不匹配
  205 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setOwnerUserId(null)));
  206 + // 测试 remark 不匹配
  207 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setRemark(null)));
  208 + // 测试 createTime 不匹配
  209 + receivablePlanMapper.insert(cloneIgnoreId(dbReceivablePlan, o -> o.setCreateTime(null)));
  210 + // 准备参数
  211 + ReceivablePlanExportReqVO reqVO = new ReceivablePlanExportReqVO();
  212 + reqVO.setIndexNo(null);
  213 + reqVO.setStatus(null);
  214 + reqVO.setCheckStatus(null);
  215 + reqVO.setReturnTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
  216 + reqVO.setRemindDays(null);
  217 + reqVO.setRemindTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
  218 + reqVO.setCustomerId(null);
  219 + reqVO.setContractId(null);
  220 + reqVO.setOwnerUserId(null);
  221 + reqVO.setRemark(null);
  222 + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
  223 +
  224 + // 调用
  225 + List<ReceivablePlanDO> list = receivablePlanService.getReceivablePlanList(reqVO);
  226 + // 断言
  227 + assertEquals(1, list.size());
  228 + assertPojoEquals(dbReceivablePlan, list.get(0));
  229 + }
  230 +
  231 +}
... ...
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
1 1 DELETE FROM "crm_contract";
2 2  
3   -DELETE FROM "crm_clue";
4 3 \ No newline at end of file
  4 +DELETE FROM "crm_clue";
  5 +
  6 +DELETE FROM "crm_receivable";
  7 +
  8 +DELETE FROM "crm_receivable_plan";
... ...
yudao-module-crm/yudao-module-crm-biz/src/test/resources/sql/create_tables.sql
... ... @@ -46,4 +46,55 @@ CREATE TABLE IF NOT EXISTS &quot;crm_clue&quot; (
46 46 "deleted" bit NOT NULL DEFAULT FALSE,
47 47 "tenant_id" bigint NOT NULL,
48 48 PRIMARY KEY ("id")
49   -) COMMENT '线索表';
50 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 '回款管理';
  77 +
  78 +CREATE TABLE IF NOT EXISTS "crm_receivable_plan" (
  79 + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
  80 + "index_no" bigint,
  81 + "receivable_id" bigint,
  82 + "status" int NOT NULL,
  83 + "check_status" varchar,
  84 + "process_instance_id" bigint,
  85 + "price" varchar,
  86 + "return_time" varchar,
  87 + "remind_days" bigint,
  88 + "remind_time" varchar,
  89 + "customer_id" bigint,
  90 + "contract_id" bigint,
  91 + "owner_user_id" bigint,
  92 + "sort" int,
  93 + "remark" varchar,
  94 + "creator" varchar DEFAULT '',
  95 + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  96 + "updater" varchar DEFAULT '',
  97 + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  98 + "deleted" bit NOT NULL DEFAULT FALSE,
  99 + PRIMARY KEY ("id")
  100 +) COMMENT '回款计划';
  101 +
... ...