【新增】回款管理 功能

This commit is contained in:
liuhongfeng 2023-10-20 22:16:34 +08:00
parent 439edcd1be
commit 73f4fc8ceb
21 changed files with 1249 additions and 4 deletions

View File

@ -60,4 +60,36 @@ CREATE TABLE `crm_clue` (
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '线索表' ROW_FORMAT = Dynamic;
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '线索表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- 回款表
-- ----------------------------
DROP TABLE IF EXISTS `crm_receivable`;
CREATE TABLE `crm_receivable` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '回款编号',
`plan_id` bigint(20) NULL DEFAULT NULL COMMENT '回款计划ID',
`customer_id` bigint(20) NULL DEFAULT NULL COMMENT '客户ID',
`contract_id` bigint(20) NULL DEFAULT NULL COMMENT '合同ID',
`check_status` tinyint(4) NULL DEFAULT NULL COMMENT '审批状态',
`process_instance_id` bigint(20) NULL DEFAULT NULL COMMENT '工作流编号',
`return_time` datetime NULL DEFAULT NULL COMMENT '回款日期',
`return_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '回款方式',
`price` decimal(10, 2) NULL DEFAULT NULL COMMENT '回款金额',
`owner_user_id` bigint(20) NULL DEFAULT NULL COMMENT '负责人的用户编号',
`batch_id` bigint(20) NULL DEFAULT NULL COMMENT '批次',
`sort` int(11) NULL DEFAULT NULL COMMENT '显示顺序',
`data_scope` tinyint(4) NULL DEFAULT 1 COMMENT '数据范围1全部数据权限 2自定数据权限 3本部门数据权限 4本部门及以下数据权限',
`data_scope_dept_ids` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '数据范围(指定部门数组)',
`status` tinyint(4) NOT NULL COMMENT '状态0正常 1停用',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '回款管理' ROW_FORMAT = DYNAMIC;

19
sql/mysql/crm_data.sql Normal file
View File

@ -0,0 +1,19 @@
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (184, '回款管理审批状态', 'crm_receivable_check_status', 0, '回款管理审批状态(0 未审核 1 审核通过 2 审核拒绝 3 审核中 4 已撤回)', '1', '2023-10-18 21:44:24', '1', '2023-10-18 21:44:24', b'0', '1970-01-01 00:00:00');
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (185, '回款管理-回款方式', 'crm_return_type', 0, '回款管理-回款方式', '1', '2023-10-18 21:54:10', '1', '2023-10-18 21:54:10', b'0', '1970-01-01 00:00:00');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1389, 0, '未审核', '0', 'crm_receivable_check_status', 0, 'default', '', '0 未审核 ', '1', '2023-10-18 21:46:00', '1', '2023-10-18 21:47:16', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (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');
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');
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');
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');
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');
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');
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');
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');
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');
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');
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');
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');

View File

@ -8,7 +8,7 @@ INSERT INTO system_menu(
path, icon, component, status, component_name
)
VALUES (
'合同管理', '', 2, 0, 1254,
'合同管理', '', 2, 0, 2375,
'contract', '', 'crm/contract/index', 0, 'Contract'
);
@ -117,3 +117,70 @@ VALUES (
'线索导出', 'crm:clue:export', 3, 5, @parentId,
'', '', '', 0
);
-- ----------------------------
-- 客户管理菜单
-- ----------------------------
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (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');
-- ----------------------------
-- 回款菜单
-- ----------------------------
-- 菜单 SQL
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status, component_name
)
VALUES (
'回款管理', '', 2, 0, 2375,
'receivable', '', 'crm/receivable/index', 0, 'Receivable'
);
-- 按钮父菜单ID
-- 暂时只支持 MySQL如果你是 OraclePostgreSQLSQLServer 的话需要手动修改 @parentId 的部分的代码
SELECT @parentId := LAST_INSERT_ID();
-- 按钮 SQL
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'回款管理查询', 'crm:receivable:query', 3, 1, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'回款管理创建', 'crm:receivable:create', 3, 2, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'回款管理更新', 'crm:receivable:update', 3, 3, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'回款管理删除', 'crm:receivable:delete', 3, 4, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'回款管理导出', 'crm:receivable:export', 3, 5, @parentId,
'', '', '', 0
);

View File

@ -15,4 +15,6 @@ public interface ErrorCodeConstants {
// TODO @wanwan要单独一个分段噢
ErrorCode CLUE_NOT_EXISTS = new ErrorCode(1_020_000_001, "线索不存在");
ErrorCode RECEIVABLE_NOT_EXISTS = new ErrorCode(1_030_000_001, "回款管理不存在");
}

View File

@ -0,0 +1,101 @@
package cn.iocoder.yudao.module.crm.controller.admin.receivable;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
import cn.iocoder.yudao.module.crm.convert.receivable.ReceivableConvert;
import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivableDO;
import cn.iocoder.yudao.module.crm.service.receivable.ReceivableService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
/**
* @author 赤焰
*/
@Tag(name = "管理后台 - 回款管理")
@RestController
@RequestMapping("/crm/receivable")
@Validated
public class ReceivableController {
@Resource
private ReceivableService receivableService;
@PostMapping("/create")
@Operation(summary = "创建回款管理")
@PreAuthorize("@ss.hasPermission('crm:receivable:create')")
public CommonResult<Long> createReceivable(@Valid @RequestBody ReceivableCreateReqVO createReqVO) {
return success(receivableService.createReceivable(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新回款管理")
@PreAuthorize("@ss.hasPermission('crm:receivable:update')")
public CommonResult<Boolean> updateReceivable(@Valid @RequestBody ReceivableUpdateReqVO updateReqVO) {
receivableService.updateReceivable(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除回款管理")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('crm:receivable:delete')")
public CommonResult<Boolean> deleteReceivable(@RequestParam("id") Long id) {
receivableService.deleteReceivable(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得回款管理")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('crm:receivable:query')")
public CommonResult<ReceivableRespVO> getReceivable(@RequestParam("id") Long id) {
ReceivableDO receivable = receivableService.getReceivable(id);
return success(ReceivableConvert.INSTANCE.convert(receivable));
}
@GetMapping("/list")
@Operation(summary = "获得回款管理列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('crm:receivable:query')")
public CommonResult<List<ReceivableRespVO>> getReceivableList(@RequestParam("ids") Collection<Long> ids) {
List<ReceivableDO> list = receivableService.getReceivableList(ids);
return success(ReceivableConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得回款管理分页")
@PreAuthorize("@ss.hasPermission('crm:receivable:query')")
public CommonResult<PageResult<ReceivableRespVO>> getReceivablePage(@Valid ReceivablePageReqVO pageVO) {
PageResult<ReceivableDO> pageResult = receivableService.getReceivablePage(pageVO);
return success(ReceivableConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出回款管理 Excel")
@PreAuthorize("@ss.hasPermission('crm:receivable:export')")
@OperateLog(type = EXPORT)
public void exportReceivableExcel(@Valid ReceivableExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<ReceivableDO> list = receivableService.getReceivableList(exportReqVO);
// 导出 Excel
List<ReceivableExcelVO> datas = ReceivableConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "回款管理.xls", "数据", ReceivableExcelVO.class, datas);
}
}

View File

@ -0,0 +1,72 @@
package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 回款管理 Base VO提供给添加修改详细的子 VO 使用
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/
@Data
public class ReceivableBaseVO {
@Schema(description = "回款编号")
private String no;
@Schema(description = "回款计划ID", example = "31177")
private Long planId;
@Schema(description = "客户ID", example = "4963")
private Long customerId;
@Schema(description = "合同ID", example = "30305")
private Long contractId;
@Schema(description = "审批状态", example = "1")
private Integer checkStatus;
@Schema(description = "工作流编号", example = "16568")
private Long processInstanceId;
@Schema(description = "回款日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime returnTime;
@Schema(description = "回款方式", example = "2")
private String returnType;
@Schema(description = "回款金额", example = "31859")
private BigDecimal price;
@Schema(description = "负责人", example = "22202")
private Long ownerUserId;
@Schema(description = "批次", example = "2539")
private Long batchId;
@Schema(description = "显示顺序")
private Integer sort;
@Schema(description = "数据范围1全部数据权限 2自定数据权限 3本部门数据权限 4本部门及以下数据权限")
private Integer dataScope;
@Schema(description = "数据范围(指定部门数组)")
private String dataScopeDeptIds;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "状态不能为空")
private Integer status;
@Schema(description = "备注", example = "随便")
private String remark;
}

View File

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 回款管理创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ReceivableCreateReqVO extends ReceivableBaseVO {
}

View File

@ -0,0 +1,80 @@
package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.ExcelProperty;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
/**
* 回款管理 Excel VO
*
* @author 赤焰
*/
@Data
public class ReceivableExcelVO {
@ExcelProperty("ID")
private Long id;
@ExcelProperty("回款编号")
private String no;
@ExcelProperty("回款计划ID")
private Long planId;
@ExcelProperty("客户ID")
private Long customerId;
@ExcelProperty("合同ID")
private Long contractId;
@ExcelProperty(value = "审批状态", converter = DictConvert.class)
@DictFormat("crm_receivable_check_status") // TODO 代码优化建议设置到对应的 XXXDictTypeConstants 枚举类中
private Integer checkStatus;
@ExcelProperty("工作流编号")
private Long processInstanceId;
@ExcelProperty("回款日期")
private LocalDateTime returnTime;
@ExcelProperty("回款方式")
private String returnType;
@ExcelProperty("回款金额")
private BigDecimal price;
@ExcelProperty("负责人")
private Long ownerUserId;
@ExcelProperty("批次")
private Long batchId;
//@ExcelProperty("显示顺序")
//private Integer sort;
//@ExcelProperty("数据范围1全部数据权限 2自定数据权限 3本部门数据权限 4本部门及以下数据权限")
//private Integer dataScope;
//@ExcelProperty("数据范围(指定部门数组)")
//private String dataScopeDeptIds;
@ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat("common_status") // TODO 代码优化建议设置到对应的 XXXDictTypeConstants 枚举类中
private Integer status;
@ExcelProperty("备注")
private String remark;
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,72 @@
package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* @author 赤焰
*/
@Schema(description = "管理后台 - 回款管理 Excel 导出 Request VO参数和 ReceivablePageReqVO 是一致的")
@Data
public class ReceivableExportReqVO {
@Schema(description = "回款编号")
private String no;
@Schema(description = "回款计划ID", example = "31177")
private Long planId;
@Schema(description = "客户ID", example = "4963")
private Long customerId;
@Schema(description = "合同ID", example = "30305")
private Long contractId;
@Schema(description = "审批状态", example = "1")
private Integer checkStatus;
@Schema(description = "工作流编号", example = "16568")
private Long processInstanceId;
@Schema(description = "回款日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] returnTime;
@Schema(description = "回款方式", example = "2")
private String returnType;
@Schema(description = "回款金额", example = "31859")
private BigDecimal price;
@Schema(description = "负责人", example = "22202")
private Long ownerUserId;
@Schema(description = "批次", example = "2539")
private Long batchId;
@Schema(description = "显示顺序")
private Integer sort;
@Schema(description = "数据范围1全部数据权限 2自定数据权限 3本部门数据权限 4本部门及以下数据权限")
private Integer dataScope;
@Schema(description = "数据范围(指定部门数组)")
private String dataScopeDeptIds;
@Schema(description = "状态", example = "1")
private Integer status;
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,73 @@
package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 回款管理分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ReceivablePageReqVO extends PageParam {
@Schema(description = "回款编号")
private String no;
@Schema(description = "回款计划ID", example = "31177")
private Long planId;
@Schema(description = "客户ID", example = "4963")
private Long customerId;
@Schema(description = "合同ID", example = "30305")
private Long contractId;
@Schema(description = "审批状态", example = "1")
private Integer checkStatus;
@Schema(description = "工作流编号", example = "16568")
private Long processInstanceId;
@Schema(description = "回款日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] returnTime;
@Schema(description = "回款方式", example = "2")
private String returnType;
@Schema(description = "回款金额", example = "31859")
private BigDecimal price;
@Schema(description = "负责人", example = "22202")
private Long ownerUserId;
@Schema(description = "批次", example = "2539")
private Long batchId;
@Schema(description = "显示顺序")
private Integer sort;
@Schema(description = "数据范围1全部数据权限 2自定数据权限 3本部门数据权限 4本部门及以下数据权限")
private Integer dataScope;
@Schema(description = "数据范围(指定部门数组)")
private String dataScopeDeptIds;
@Schema(description = "状态", example = "1")
private Integer status;
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

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

View File

@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 回款管理更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ReceivableUpdateReqVO extends ReceivableBaseVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25787")
@NotNull(message = "ID不能为空")
private Long id;
}

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.crm.convert.receivable;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivableDO;
/**
* 回款管理 Convert
*
* @author 赤焰
*/
@Mapper
public interface ReceivableConvert {
ReceivableConvert INSTANCE = Mappers.getMapper(ReceivableConvert.class);
ReceivableDO convert(ReceivableCreateReqVO bean);
ReceivableDO convert(ReceivableUpdateReqVO bean);
ReceivableRespVO convert(ReceivableDO bean);
List<ReceivableRespVO> convertList(List<ReceivableDO> list);
PageResult<ReceivableRespVO> convertPage(PageResult<ReceivableDO> page);
List<ReceivableExcelVO> convertList02(List<ReceivableDO> list);
}

View File

@ -0,0 +1,101 @@
package cn.iocoder.yudao.module.crm.dal.dataobject.receivable;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 回款管理 DO
*
* @author 赤焰
*/
@TableName("crm_receivable")
@KeySequence("crm_receivable_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ReceivableDO extends BaseDO {
/**
* ID
*/
@TableId
private Long id;
/**
* 回款编号
*/
private String no;
/**
* 回款计划ID
*/
private Long planId;
/**
* 客户ID
*/
private Long customerId;
/**
* 合同ID
*/
private Long contractId;
/**
* 审批状态
*
* 枚举 {@link TODO crm_receivable_check_status 对应的类}
*/
private Integer checkStatus;
/**
* 工作流编号
*/
private Long processInstanceId;
/**
* 回款日期
*/
private LocalDateTime returnTime;
/**
* 回款方式
*/
private String returnType;
/**
* 回款金额
*/
private BigDecimal price;
/**
* 负责人
*/
private Long ownerUserId;
/**
* 批次
*/
private Long batchId;
/**
* 显示顺序
*/
private Integer sort;
/**
* 数据范围1全部数据权限 2自定数据权限 3本部门数据权限 4本部门及以下数据权限
*/
private Integer dataScope;
/**
* 数据范围(指定部门数组)
*/
private String dataScopeDeptIds;
/**
* 状态
*
* 枚举 {@link TODO common_status 对应的类}
*/
private Integer status;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,64 @@
package cn.iocoder.yudao.module.crm.dal.mysql.receivable;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivableDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
/**
* 回款管理 Mapper
*
* @author 赤焰
*/
@Mapper
public interface ReceivableMapper extends BaseMapperX<ReceivableDO> {
default PageResult<ReceivableDO> selectPage(ReceivablePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ReceivableDO>()
.eqIfPresent(ReceivableDO::getNo, reqVO.getNo())
.eqIfPresent(ReceivableDO::getPlanId, reqVO.getPlanId())
.eqIfPresent(ReceivableDO::getCustomerId, reqVO.getCustomerId())
.eqIfPresent(ReceivableDO::getContractId, reqVO.getContractId())
.eqIfPresent(ReceivableDO::getCheckStatus, reqVO.getCheckStatus())
.eqIfPresent(ReceivableDO::getProcessInstanceId, reqVO.getProcessInstanceId())
.betweenIfPresent(ReceivableDO::getReturnTime, reqVO.getReturnTime())
.eqIfPresent(ReceivableDO::getReturnType, reqVO.getReturnType())
.eqIfPresent(ReceivableDO::getPrice, reqVO.getPrice())
.eqIfPresent(ReceivableDO::getOwnerUserId, reqVO.getOwnerUserId())
.eqIfPresent(ReceivableDO::getBatchId, reqVO.getBatchId())
.eqIfPresent(ReceivableDO::getSort, reqVO.getSort())
.eqIfPresent(ReceivableDO::getDataScope, reqVO.getDataScope())
.eqIfPresent(ReceivableDO::getDataScopeDeptIds, reqVO.getDataScopeDeptIds())
.eqIfPresent(ReceivableDO::getStatus, reqVO.getStatus())
.eqIfPresent(ReceivableDO::getRemark, reqVO.getRemark())
.betweenIfPresent(ReceivableDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ReceivableDO::getId));
}
default List<ReceivableDO> selectList(ReceivableExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<ReceivableDO>()
.eqIfPresent(ReceivableDO::getNo, reqVO.getNo())
.eqIfPresent(ReceivableDO::getPlanId, reqVO.getPlanId())
.eqIfPresent(ReceivableDO::getCustomerId, reqVO.getCustomerId())
.eqIfPresent(ReceivableDO::getContractId, reqVO.getContractId())
.eqIfPresent(ReceivableDO::getCheckStatus, reqVO.getCheckStatus())
.eqIfPresent(ReceivableDO::getProcessInstanceId, reqVO.getProcessInstanceId())
.betweenIfPresent(ReceivableDO::getReturnTime, reqVO.getReturnTime())
.eqIfPresent(ReceivableDO::getReturnType, reqVO.getReturnType())
.eqIfPresent(ReceivableDO::getPrice, reqVO.getPrice())
.eqIfPresent(ReceivableDO::getOwnerUserId, reqVO.getOwnerUserId())
.eqIfPresent(ReceivableDO::getBatchId, reqVO.getBatchId())
.eqIfPresent(ReceivableDO::getSort, reqVO.getSort())
.eqIfPresent(ReceivableDO::getDataScope, reqVO.getDataScope())
.eqIfPresent(ReceivableDO::getDataScopeDeptIds, reqVO.getDataScopeDeptIds())
.eqIfPresent(ReceivableDO::getStatus, reqVO.getStatus())
.eqIfPresent(ReceivableDO::getRemark, reqVO.getRemark())
.betweenIfPresent(ReceivableDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ReceivableDO::getId));
}
}

View File

@ -0,0 +1,71 @@
package cn.iocoder.yudao.module.crm.service.receivable;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivableDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
/**
* 回款管理 Service 接口
*
* @author 赤焰
*/
public interface ReceivableService {
/**
* 创建回款管理
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createReceivable(@Valid ReceivableCreateReqVO createReqVO);
/**
* 更新回款管理
*
* @param updateReqVO 更新信息
*/
void updateReceivable(@Valid ReceivableUpdateReqVO updateReqVO);
/**
* 删除回款管理
*
* @param id 编号
*/
void deleteReceivable(Long id);
/**
* 获得回款管理
*
* @param id 编号
* @return 回款管理
*/
ReceivableDO getReceivable(Long id);
/**
* 获得回款管理列表
*
* @param ids 编号
* @return 回款管理列表
*/
List<ReceivableDO> getReceivableList(Collection<Long> ids);
/**
* 获得回款管理分页
*
* @param pageReqVO 分页查询
* @return 回款管理分页
*/
PageResult<ReceivableDO> getReceivablePage(ReceivablePageReqVO pageReqVO);
/**
* 获得回款管理列表, 用于 Excel 导出
*
* @param exportReqVO 查询条件
* @return 回款管理列表
*/
List<ReceivableDO> getReceivableList(ReceivableExportReqVO exportReqVO);
}

View File

@ -0,0 +1,87 @@
package cn.iocoder.yudao.module.crm.service.receivable;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import java.util.*;
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivableDO;
import cn.iocoder.yudao.module.crm.convert.receivable.ReceivableConvert;
import cn.iocoder.yudao.module.crm.dal.mysql.receivable.ReceivableMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
/**
* 回款管理 Service 实现类
*
* @author 赤焰
*/
@Service
@Validated
public class ReceivableServiceImpl implements ReceivableService {
@Resource
private ReceivableMapper receivableMapper;
@Override
public Long createReceivable(ReceivableCreateReqVO createReqVO) {
// 插入
ReceivableDO receivable = ReceivableConvert.INSTANCE.convert(createReqVO);
receivableMapper.insert(receivable);
// 返回
return receivable.getId();
}
@Override
public void updateReceivable(ReceivableUpdateReqVO updateReqVO) {
// 校验存在
validateReceivableExists(updateReqVO.getId());
// 更新
ReceivableDO updateObj = ReceivableConvert.INSTANCE.convert(updateReqVO);
receivableMapper.updateById(updateObj);
}
@Override
public void deleteReceivable(Long id) {
// 校验存在
validateReceivableExists(id);
// 删除
receivableMapper.deleteById(id);
}
private void validateReceivableExists(Long id) {
if (receivableMapper.selectById(id) == null) {
throw exception(RECEIVABLE_NOT_EXISTS);
}
}
@Override
public ReceivableDO getReceivable(Long id) {
return receivableMapper.selectById(id);
}
@Override
public List<ReceivableDO> getReceivableList(Collection<Long> ids) {
if (CollUtil.isEmpty(ids)) {
return ListUtil.empty();
}
return receivableMapper.selectBatchIds(ids);
}
@Override
public PageResult<ReceivableDO> getReceivablePage(ReceivablePageReqVO pageReqVO) {
return receivableMapper.selectPage(pageReqVO);
}
@Override
public List<ReceivableDO> getReceivableList(ReceivableExportReqVO exportReqVO) {
return receivableMapper.selectList(exportReqVO);
}
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.receivable.ReceivableMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -0,0 +1,279 @@
package cn.iocoder.yudao.module.crm.service.receivable;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.mock.mockito.MockBean;
import javax.annotation.Resource;
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivableDO;
import cn.iocoder.yudao.module.crm.dal.mysql.receivable.ReceivableMapper;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import javax.annotation.Resource;
import org.springframework.context.annotation.Import;
import java.util.*;
import java.time.LocalDateTime;
import static cn.hutool.core.util.RandomUtil.*;
import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
/**
* {@link ReceivableServiceImpl} 的单元测试类
*
* @author 赤焰
*/
@Import(ReceivableServiceImpl.class)
public class ReceivableServiceImplTest extends BaseDbUnitTest {
@Resource
private ReceivableServiceImpl receivableService;
@Resource
private ReceivableMapper receivableMapper;
@Test
public void testCreateReceivable_success() {
// 准备参数
ReceivableCreateReqVO reqVO = randomPojo(ReceivableCreateReqVO.class);
// 调用
Long receivableId = receivableService.createReceivable(reqVO);
// 断言
assertNotNull(receivableId);
// 校验记录的属性是否正确
ReceivableDO receivable = receivableMapper.selectById(receivableId);
assertPojoEquals(reqVO, receivable);
}
@Test
public void testUpdateReceivable_success() {
// mock 数据
ReceivableDO dbReceivable = randomPojo(ReceivableDO.class);
receivableMapper.insert(dbReceivable);// @Sql: 先插入出一条存在的数据
// 准备参数
ReceivableUpdateReqVO reqVO = randomPojo(ReceivableUpdateReqVO.class, o -> {
o.setId(dbReceivable.getId()); // 设置更新的 ID
});
// 调用
receivableService.updateReceivable(reqVO);
// 校验是否更新正确
ReceivableDO receivable = receivableMapper.selectById(reqVO.getId()); // 获取最新的
assertPojoEquals(reqVO, receivable);
}
@Test
public void testUpdateReceivable_notExists() {
// 准备参数
ReceivableUpdateReqVO reqVO = randomPojo(ReceivableUpdateReqVO.class);
// 调用, 并断言异常
assertServiceException(() -> receivableService.updateReceivable(reqVO), RECEIVABLE_NOT_EXISTS);
}
@Test
public void testDeleteReceivable_success() {
// mock 数据
ReceivableDO dbReceivable = randomPojo(ReceivableDO.class);
receivableMapper.insert(dbReceivable);// @Sql: 先插入出一条存在的数据
// 准备参数
Long id = dbReceivable.getId();
// 调用
receivableService.deleteReceivable(id);
// 校验数据不存在了
assertNull(receivableMapper.selectById(id));
}
@Test
public void testDeleteReceivable_notExists() {
// 准备参数
Long id = randomLongId();
// 调用, 并断言异常
assertServiceException(() -> receivableService.deleteReceivable(id), RECEIVABLE_NOT_EXISTS);
}
@Test
@Disabled // TODO 请修改 null 为需要的值然后删除 @Disabled 注解
public void testGetReceivablePage() {
// mock 数据
ReceivableDO dbReceivable = randomPojo(ReceivableDO.class, o -> { // 等会查询到
o.setNo(null);
o.setPlanId(null);
o.setCustomerId(null);
o.setContractId(null);
o.setCheckStatus(null);
o.setProcessInstanceId(null);
o.setReturnTime(null);
o.setReturnType(null);
o.setPrice(null);
o.setOwnerUserId(null);
o.setBatchId(null);
o.setSort(null);
o.setDataScope(null);
o.setDataScopeDeptIds(null);
o.setStatus(null);
o.setRemark(null);
o.setCreateTime(null);
});
receivableMapper.insert(dbReceivable);
// 测试 no 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setNo(null)));
// 测试 planId 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setPlanId(null)));
// 测试 customerId 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCustomerId(null)));
// 测试 contractId 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setContractId(null)));
// 测试 checkStatus 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCheckStatus(null)));
// 测试 processInstanceId 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setProcessInstanceId(null)));
// 测试 returnTime 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setReturnTime(null)));
// 测试 returnType 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setReturnType(null)));
// 测试 price 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setPrice(null)));
// 测试 ownerUserId 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setOwnerUserId(null)));
// 测试 batchId 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setBatchId(null)));
// 测试 sort 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setSort(null)));
// 测试 dataScope 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setDataScope(null)));
// 测试 dataScopeDeptIds 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setDataScopeDeptIds(null)));
// 测试 status 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setStatus(null)));
// 测试 remark 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setRemark(null)));
// 测试 createTime 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCreateTime(null)));
// 准备参数
ReceivablePageReqVO reqVO = new ReceivablePageReqVO();
reqVO.setNo(null);
reqVO.setPlanId(null);
reqVO.setCustomerId(null);
reqVO.setContractId(null);
reqVO.setCheckStatus(null);
reqVO.setProcessInstanceId(null);
reqVO.setReturnTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setReturnType(null);
reqVO.setPrice(null);
reqVO.setOwnerUserId(null);
reqVO.setBatchId(null);
reqVO.setSort(null);
reqVO.setDataScope(null);
reqVO.setDataScopeDeptIds(null);
reqVO.setStatus(null);
reqVO.setRemark(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
// 调用
PageResult<ReceivableDO> pageResult = receivableService.getReceivablePage(reqVO);
// 断言
assertEquals(1, pageResult.getTotal());
assertEquals(1, pageResult.getList().size());
assertPojoEquals(dbReceivable, pageResult.getList().get(0));
}
@Test
@Disabled // TODO 请修改 null 为需要的值然后删除 @Disabled 注解
public void testGetReceivableList() {
// mock 数据
ReceivableDO dbReceivable = randomPojo(ReceivableDO.class, o -> { // 等会查询到
o.setNo(null);
o.setPlanId(null);
o.setCustomerId(null);
o.setContractId(null);
o.setCheckStatus(null);
o.setProcessInstanceId(null);
o.setReturnTime(null);
o.setReturnType(null);
o.setPrice(null);
o.setOwnerUserId(null);
o.setBatchId(null);
o.setSort(null);
o.setDataScope(null);
o.setDataScopeDeptIds(null);
o.setStatus(null);
o.setRemark(null);
o.setCreateTime(null);
});
receivableMapper.insert(dbReceivable);
// 测试 no 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setNo(null)));
// 测试 planId 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setPlanId(null)));
// 测试 customerId 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCustomerId(null)));
// 测试 contractId 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setContractId(null)));
// 测试 checkStatus 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCheckStatus(null)));
// 测试 processInstanceId 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setProcessInstanceId(null)));
// 测试 returnTime 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setReturnTime(null)));
// 测试 returnType 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setReturnType(null)));
// 测试 price 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setPrice(null)));
// 测试 ownerUserId 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setOwnerUserId(null)));
// 测试 batchId 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setBatchId(null)));
// 测试 sort 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setSort(null)));
// 测试 dataScope 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setDataScope(null)));
// 测试 dataScopeDeptIds 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setDataScopeDeptIds(null)));
// 测试 status 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setStatus(null)));
// 测试 remark 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setRemark(null)));
// 测试 createTime 不匹配
receivableMapper.insert(cloneIgnoreId(dbReceivable, o -> o.setCreateTime(null)));
// 准备参数
ReceivableExportReqVO reqVO = new ReceivableExportReqVO();
reqVO.setNo(null);
reqVO.setPlanId(null);
reqVO.setCustomerId(null);
reqVO.setContractId(null);
reqVO.setCheckStatus(null);
reqVO.setProcessInstanceId(null);
reqVO.setReturnTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setReturnType(null);
reqVO.setPrice(null);
reqVO.setOwnerUserId(null);
reqVO.setBatchId(null);
reqVO.setSort(null);
reqVO.setDataScope(null);
reqVO.setDataScopeDeptIds(null);
reqVO.setStatus(null);
reqVO.setRemark(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
// 调用
List<ReceivableDO> list = receivableService.getReceivableList(reqVO);
// 断言
assertEquals(1, list.size());
assertPojoEquals(dbReceivable, list.get(0));
}
}

View File

@ -1,3 +1,5 @@
DELETE FROM "crm_contract";
DELETE FROM "crm_clue";
DELETE FROM "crm_clue";
DELETE FROM "crm_receivable";

View File

@ -46,4 +46,30 @@ CREATE TABLE IF NOT EXISTS "crm_clue" (
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint NOT NULL,
PRIMARY KEY ("id")
) COMMENT '线索表';
) COMMENT '线索表';
CREATE TABLE IF NOT EXISTS "crm_receivable" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"no" varchar,
"plan_id" bigint,
"customer_id" bigint,
"contract_id" bigint,
"check_status" int,
"process_instance_id" bigint,
"return_time" varchar,
"return_type" varchar,
"price" varchar,
"owner_user_id" bigint,
"batch_id" bigint,
"sort" int,
"data_scope" int,
"data_scope_dept_ids" varchar,
"status" int NOT NULL,
"remark" varchar,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
PRIMARY KEY ("id")
) COMMENT '回款管理';