Commit 8efdf3141aec9393eb403c9e1780b4b076ae3fc6
1 parent
381b8ea6
code review:crm 商品逻辑
Showing
14 changed files
with
87 additions
and
205 deletions
sql/mysql/crm.sql
| 1 | 1 | SET NAMES utf8mb4; |
| 2 | - | |
| 3 | - | |
| 4 | - | |
| 5 | - | |
| 6 | --- ---------------------------- | |
| 7 | --- 回款表 | |
| 8 | --- ---------------------------- | |
| 9 | -DROP TABLE IF EXISTS `crm_receivable`; | |
| 10 | -CREATE TABLE `crm_receivable` ( | |
| 11 | - `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', | |
| 12 | - `no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '回款编号', | |
| 13 | - `plan_id` bigint(20) NULL DEFAULT NULL COMMENT '回款计划ID', | |
| 14 | - `customer_id` bigint(20) NULL DEFAULT NULL COMMENT '客户ID', | |
| 15 | - `contract_id` bigint(20) NULL DEFAULT NULL COMMENT '合同ID', | |
| 16 | - `check_status` tinyint(4) NULL DEFAULT NULL COMMENT '审批状态', | |
| 17 | - `process_instance_id` bigint(20) NULL DEFAULT NULL COMMENT '工作流编号', | |
| 18 | - `return_time` datetime NULL DEFAULT NULL COMMENT '回款日期', | |
| 19 | - `return_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '回款方式', | |
| 20 | - `price` decimal(10, 2) NULL DEFAULT NULL COMMENT '回款金额', | |
| 21 | - `owner_user_id` bigint(20) NULL DEFAULT NULL COMMENT '负责人的用户编号', | |
| 22 | - `batch_id` bigint(20) NULL DEFAULT NULL COMMENT '批次', | |
| 23 | - `sort` int(11) NULL DEFAULT NULL COMMENT '显示顺序', | |
| 24 | - `data_scope` tinyint(4) NULL DEFAULT 1 COMMENT '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)', | |
| 25 | - `data_scope_dept_ids` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '数据范围(指定部门数组)', | |
| 26 | - `status` tinyint(4) NOT NULL COMMENT '状态(0正常 1停用)', | |
| 27 | - `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注', | |
| 28 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | |
| 29 | - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |
| 30 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | |
| 31 | - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | |
| 32 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | |
| 33 | - `tenant_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号', | |
| 34 | - PRIMARY KEY (`id`) USING BTREE | |
| 35 | -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '回款管理' ROW_FORMAT = DYNAMIC; | |
| 36 | - | |
| 37 | - | |
| 38 | --- ---------------------------- | |
| 39 | --- 回款计划表 | |
| 40 | --- ---------------------------- | |
| 41 | -DROP TABLE IF EXISTS `crm_receivable_plan`; | |
| 42 | -CREATE TABLE `crm_receivable_plan` ( | |
| 43 | - `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', | |
| 44 | - `period` tinyint(4) DEFAULT NULL COMMENT '期数', | |
| 45 | - `receivable_id` bigint(20) NULL DEFAULT NULL COMMENT '回款ID', | |
| 46 | - `status` tinyint(4) NOT NULL COMMENT '完成状态', | |
| 47 | - `check_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '审批状态', | |
| 48 | - `process_instance_id` bigint(20) NULL DEFAULT NULL COMMENT '工作流编号', | |
| 49 | - `price` decimal(10, 2) NULL DEFAULT NULL COMMENT '计划回款金额', | |
| 50 | - `return_time` datetime NULL DEFAULT NULL COMMENT '计划回款日期', | |
| 51 | - `remind_days` bigint(20) NULL DEFAULT NULL COMMENT '提前几天提醒', | |
| 52 | - `remind_time` datetime NULL DEFAULT NULL COMMENT '提醒日期', | |
| 53 | - `customer_id` bigint(20) NULL DEFAULT NULL COMMENT '客户ID', | |
| 54 | - `contract_id` bigint(20) NULL DEFAULT NULL COMMENT '合同ID', | |
| 55 | - `owner_user_id` bigint(20) NULL DEFAULT NULL COMMENT '负责人', | |
| 56 | - `sort` int(11) NULL DEFAULT NULL COMMENT '显示顺序', | |
| 57 | - `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注', | |
| 58 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | |
| 59 | - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |
| 60 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | |
| 61 | - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | |
| 62 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | |
| 63 | - `tenant_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号', | |
| 64 | - PRIMARY KEY (`id`) USING BTREE | |
| 65 | -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '回款计划' ROW_FORMAT = DYNAMIC; | |
| 66 | - | |
| 67 | --- ---------------------------- | |
| 68 | --- 产品表 | |
| 69 | --- ---------------------------- | |
| 70 | -DROP TABLE IF EXISTS `crm_product`; | |
| 71 | -CREATE TABLE `crm_product` | |
| 72 | -( | |
| 73 | - `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id', | |
| 74 | - `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '产品名称', | |
| 75 | - `no` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '产品编码', | |
| 76 | - `unit` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '单位', | |
| 77 | - `price` bigint(20) NULL DEFAULT 0 COMMENT '价格', | |
| 78 | - `status` tinyint(2) NOT NULL DEFAULT 1 COMMENT '状态 1-上架 0-下架', | |
| 79 | - `category_id` bigint(20) NOT NULL COMMENT '产品分类ID', | |
| 80 | - `description` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '产品描述', | |
| 81 | - `owner_user_id` bigint(20) NOT NULL COMMENT '负责人的用户编号', | |
| 82 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | |
| 83 | - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |
| 84 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | |
| 85 | - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | |
| 86 | - `tenant_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号', | |
| 87 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | |
| 88 | - PRIMARY KEY (`id`) USING BTREE | |
| 89 | -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '产品表' ROW_FORMAT = Dynamic; | |
| 90 | - | |
| 91 | --- ---------------------------- | |
| 92 | --- 产品分类表 | |
| 93 | --- ---------------------------- | |
| 94 | -DROP TABLE IF EXISTS `crm_product_category`; | |
| 95 | -CREATE TABLE `crm_product_category` | |
| 96 | -( | |
| 97 | - `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id', | |
| 98 | - `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '名称', | |
| 99 | - `parent_id` bigint(20) NOT NULL COMMENT '父级id', | |
| 100 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | |
| 101 | - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |
| 102 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | |
| 103 | - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | |
| 104 | - `tenant_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号', | |
| 105 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | |
| 106 | - PRIMARY KEY (`id`) USING BTREE | |
| 107 | -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '产品分类表' ROW_FORMAT = Dynamic; | |
| 108 | 2 | \ No newline at end of file | ... | ... |
sql/mysql/crm_data.sql
| 1 | 1 | |
| 2 | 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 | + | |
| 3 | 4 | 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 | |
| 5 | 6 | |
| ... | ... | @@ -8,6 +9,7 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st |
| 8 | 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 (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 | 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 (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 | 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 (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'); |
| 12 | + | |
| 11 | 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 (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 | 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 (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 | 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 (1396, 3, '邮政汇款', '3', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:54:53', '1', '2023-10-18 21:54:53', b'0'); |
| ... | ... | @@ -16,9 +18,3 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st |
| 16 | 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 (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 | 19 | 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 | 20 | 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 | - | |
| 20 | -INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (604, '产品状态', 'crm_product_status', 0, '', '1', '2023-10-30 21:47:59', '1', '2023-10-30 21:48:45', b'0', '1970-01-01 00:00:00'); | |
| 21 | - | |
| 22 | -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 (1412, 1, '上架', '1', 'crm_product_status', 0, 'success', '', '', '1', '2023-10-30 21:49:34', '1', '2023-10-30 21:49:34', b'0'); | |
| 23 | -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 (1411, 0, '下架', '0', 'crm_product_status', 0, 'success', '', '', '1', '2023-10-30 21:49:13', '1', '2023-10-30 21:49:13', b'0'); | |
| 24 | - | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/ProductController.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.controller.admin.product; |
| 2 | 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 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 19 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 20 | - | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 21 | 5 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 22 | - | |
| 23 | 6 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 24 | -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; | |
| 25 | - | |
| 26 | 7 | import cn.iocoder.yudao.module.crm.controller.admin.product.vo.*; |
| 27 | -import cn.iocoder.yudao.module.crm.dal.dataobject.product.ProductDO; | |
| 28 | 8 | import cn.iocoder.yudao.module.crm.convert.product.ProductConvert; |
| 9 | +import cn.iocoder.yudao.module.crm.dal.dataobject.product.ProductDO; | |
| 29 | 10 | import cn.iocoder.yudao.module.crm.service.product.ProductService; |
| 11 | +import io.swagger.v3.oas.annotations.Operation; | |
| 12 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 13 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 14 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 15 | +import org.springframework.validation.annotation.Validated; | |
| 16 | +import org.springframework.web.bind.annotation.*; | |
| 17 | + | |
| 18 | +import javax.annotation.Resource; | |
| 19 | +import javax.servlet.http.HttpServletResponse; | |
| 20 | +import javax.validation.Valid; | |
| 21 | +import java.io.IOException; | |
| 22 | +import java.util.List; | |
| 23 | + | |
| 24 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 25 | +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | |
| 30 | 26 | |
| 31 | 27 | @Tag(name = "管理后台 - 产品") |
| 32 | 28 | @RestController |
| ... | ... | @@ -70,15 +66,6 @@ public class ProductController { |
| 70 | 66 | return success(ProductConvert.INSTANCE.convert(product)); |
| 71 | 67 | } |
| 72 | 68 | |
| 73 | - @GetMapping("/list") | |
| 74 | - @Operation(summary = "获得产品列表") | |
| 75 | - @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") | |
| 76 | - @PreAuthorize("@ss.hasPermission('crm:product:query')") | |
| 77 | - public CommonResult<List<ProductRespVO>> getProductList(@RequestParam("ids") Collection<Long> ids) { | |
| 78 | - List<ProductDO> list = productService.getProductList(ids); | |
| 79 | - return success(ProductConvert.INSTANCE.convertList(list)); | |
| 80 | - } | |
| 81 | - | |
| 82 | 69 | @GetMapping("/page") |
| 83 | 70 | @Operation(summary = "获得产品分页") |
| 84 | 71 | @PreAuthorize("@ss.hasPermission('crm:product:query')") | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductBaseVO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.controller.admin.product.vo; |
| 2 | 2 | |
| 3 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | -import java.time.LocalDateTime; | |
| 7 | -import java.time.LocalDateTime; | |
| 8 | -import javax.validation.constraints.*; | |
| 4 | +import lombok.Data; | |
| 9 | 5 | |
| 6 | +import javax.validation.constraints.NotNull; | |
| 7 | + | |
| 8 | +// TODO @zange:需要加 CRM 前置噢 | |
| 10 | 9 | /** |
| 11 | 10 | * 产品 Base VO,提供给添加、修改、详细的子 VO 使用 |
| 12 | 11 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| ... | ... | @@ -14,6 +13,8 @@ import javax.validation.constraints.*; |
| 14 | 13 | @Data |
| 15 | 14 | public class ProductBaseVO { |
| 16 | 15 | |
| 16 | + // TODO @zange:example 要写哈;主要是接口文档,可以基于 example 可以生产请求参数 | |
| 17 | + | |
| 17 | 18 | @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") |
| 18 | 19 | @NotNull(message = "产品名称不能为空") |
| 19 | 20 | private String name; |
| ... | ... | @@ -39,6 +40,8 @@ public class ProductBaseVO { |
| 39 | 40 | @Schema(description = "产品描述", example = "你说的对") |
| 40 | 41 | private String description; |
| 41 | 42 | |
| 43 | + // TODO @zange:这个字段只有 create 可以传递,update 不传递;所以放到 create 和 resp 里; | |
| 44 | + | |
| 42 | 45 | @Schema(description = "负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31926") |
| 43 | 46 | @NotNull(message = "负责人的用户编号不能为空") |
| 44 | 47 | private Long ownerUserId; | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductExcelVO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.controller.admin.product.vo; |
| 2 | 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.time.LocalDateTime; | |
| 8 | - | |
| 9 | -import com.alibaba.excel.annotation.ExcelProperty; | |
| 10 | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 11 | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | +import com.alibaba.excel.annotation.ExcelProperty; | |
| 6 | +import lombok.Data; | |
| 12 | 7 | |
| 8 | +import java.time.LocalDateTime; | |
| 13 | 9 | |
| 10 | +// TODO 芋艿:这个导出最后搞 | |
| 14 | 11 | /** |
| 15 | 12 | * 产品 Excel VO |
| 16 | 13 | * | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductExportReqVO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.controller.admin.product.vo; |
| 2 | 2 | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 7 | -import java.time.LocalDateTime; | |
| 4 | +import lombok.Data; | |
| 8 | 5 | import org.springframework.format.annotation.DateTimeFormat; |
| 9 | 6 | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | + | |
| 10 | 9 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 11 | 10 | |
| 11 | +// TODO 芋艿:这个导出最后搞 | |
| 12 | 12 | @Schema(description = "管理后台 - 产品 Excel 导出 Request VO,参数和 ProductPageReqVO 是一致的") |
| 13 | 13 | @Data |
| 14 | 14 | public class ProductExportReqVO { | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductPageReqVO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.controller.admin.product.vo; |
| 2 | 2 | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | +import lombok.ToString; | |
| 7 | 8 | import org.springframework.format.annotation.DateTimeFormat; |
| 9 | + | |
| 8 | 10 | import java.time.LocalDateTime; |
| 9 | 11 | |
| 10 | 12 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 11 | 13 | |
| 14 | +// TODO @zange:按照需求,裁剪下筛选的字段,目前应该只要 name 和 status | |
| 12 | 15 | @Schema(description = "管理后台 - 产品分页 Request VO") |
| 13 | 16 | @Data |
| 14 | 17 | @EqualsAndHashCode(callSuper = true) | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/productcategory/vo/ProductCategoryBaseVO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.controller.admin.productcategory.vo; |
| 2 | 2 | |
| 3 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | -import java.time.LocalDateTime; | |
| 7 | -import java.time.LocalDateTime; | |
| 8 | -import javax.validation.constraints.*; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import javax.validation.constraints.NotNull; | |
| 9 | 7 | |
| 10 | 8 | /** |
| 11 | 9 | * 产品分类 Base VO,提供给添加、修改、详细的子 VO 使用 |
| ... | ... | @@ -18,8 +16,8 @@ public class ProductCategoryBaseVO { |
| 18 | 16 | @NotNull(message = "名称不能为空") |
| 19 | 17 | private String name; |
| 20 | 18 | |
| 21 | - @Schema(description = "父级id", requiredMode = Schema.RequiredMode.REQUIRED, example = "4680") | |
| 22 | - @NotNull(message = "父级id不能为空") | |
| 19 | + @Schema(description = "父级 id", requiredMode = Schema.RequiredMode.REQUIRED, example = "4680") | |
| 20 | + @NotNull(message = "父级 id 不能为空") | |
| 23 | 21 | private Long parentId; |
| 24 | 22 | |
| 25 | 23 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/productcategory/vo/ProductCategoryListReqVO.java
| ... | ... | @@ -6,11 +6,7 @@ import lombok.Data; |
| 6 | 6 | |
| 7 | 7 | import java.time.LocalDateTime; |
| 8 | 8 | |
| 9 | -/** | |
| 10 | - * 产品分类 List VO | |
| 11 | - * | |
| 12 | - * @author ZanGe丶 | |
| 13 | - */ | |
| 9 | +// TODO 芋艿:这个导出最后搞;命名应该是按照 ProductExportReqVO 风格 | |
| 14 | 10 | @Schema(description = "管理后台 - 产品分类列表 Request VO") |
| 15 | 11 | @Data |
| 16 | 12 | public class ProductCategoryListReqVO { |
| ... | ... | @@ -18,7 +14,7 @@ public class ProductCategoryListReqVO { |
| 18 | 14 | @ExcelProperty("名称") |
| 19 | 15 | private String name; |
| 20 | 16 | |
| 21 | - @ExcelProperty("父级id") | |
| 17 | + @ExcelProperty("父级 id") | |
| 22 | 18 | private Long parentId; |
| 23 | 19 | |
| 24 | 20 | @ExcelProperty("创建时间") | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/productcategory/vo/ProductCategoryUpdateReqVO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.controller.admin.productcategory.vo; |
| 2 | 2 | |
| 3 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | -import javax.validation.constraints.*; | |
| 4 | +import lombok.Data; | |
| 5 | +import lombok.EqualsAndHashCode; | |
| 6 | +import lombok.ToString; | |
| 7 | + | |
| 8 | +import javax.validation.constraints.NotNull; | |
| 7 | 9 | |
| 8 | 10 | @Schema(description = "管理后台 - 产品分类更新 Request VO") |
| 9 | 11 | @Data |
| ... | ... | @@ -11,8 +13,8 @@ import javax.validation.constraints.*; |
| 11 | 13 | @ToString(callSuper = true) |
| 12 | 14 | public class ProductCategoryUpdateReqVO extends ProductCategoryBaseVO { |
| 13 | 15 | |
| 14 | - @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23902") | |
| 15 | - @NotNull(message = "主键id不能为空") | |
| 16 | + @Schema(description = "主键 id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23902") | |
| 17 | + @NotNull(message = "主键 id 不能为空") | |
| 16 | 18 | private Long id; |
| 17 | 19 | |
| 18 | 20 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/product/ProductDO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.dal.dataobject.product; |
| 2 | 2 | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import java.time.LocalDateTime; | |
| 6 | -import java.time.LocalDateTime; | |
| 7 | -import com.baomidou.mybatisplus.annotation.*; | |
| 8 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 7 | +import lombok.*; | |
| 9 | 8 | |
| 10 | 9 | /** |
| 11 | 10 | * 产品 DO |
| ... | ... | @@ -23,7 +22,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 23 | 22 | public class ProductDO extends BaseDO { |
| 24 | 23 | |
| 25 | 24 | /** |
| 26 | - * 主键id | |
| 25 | + * 主键 id | |
| 27 | 26 | */ |
| 28 | 27 | @TableId |
| 29 | 28 | private Long id; |
| ... | ... | @@ -47,10 +46,12 @@ public class ProductDO extends BaseDO { |
| 47 | 46 | * 状态 |
| 48 | 47 | * |
| 49 | 48 | * 枚举 {@link TODO crm_product_status 对应的类} |
| 49 | + * // TODO @zange:这个写个枚举类,然后 {@link关联下 | |
| 50 | 50 | */ |
| 51 | 51 | private Integer status; |
| 52 | 52 | /** |
| 53 | - * 产品分类ID | |
| 53 | + * 产品分类 ID | |
| 54 | + * // TODO @zange:这个要写下关联 CategoryDO 的 id 字段;参考下别的模块哈 | |
| 54 | 55 | */ |
| 55 | 56 | private Long categoryId; |
| 56 | 57 | /** | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/productcategory/ProductCategoryDO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.dal.dataobject.productcategory; |
| 2 | 2 | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import java.time.LocalDateTime; | |
| 6 | -import java.time.LocalDateTime; | |
| 7 | -import com.baomidou.mybatisplus.annotation.*; | |
| 8 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 7 | +import lombok.*; | |
| 9 | 8 | |
| 10 | 9 | /** |
| 11 | 10 | * 产品分类 DO |
| ... | ... | @@ -32,7 +31,8 @@ public class ProductCategoryDO extends BaseDO { |
| 32 | 31 | */ |
| 33 | 32 | private String name; |
| 34 | 33 | /** |
| 35 | - * 父级id | |
| 34 | + * 父级 id | |
| 35 | + * // TODO @zange:这个要写下关联 CategoryDO 的 id 字段;参考下别的模块哈 | |
| 36 | 36 | */ |
| 37 | 37 | private Long parentId; |
| 38 | 38 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/ProductServiceImpl.java
| ... | ... | @@ -36,8 +36,9 @@ public class ProductServiceImpl implements ProductService { |
| 36 | 36 | |
| 37 | 37 | @Override |
| 38 | 38 | public Long createProduct(ProductCreateReqVO createReqVO) { |
| 39 | - //校验产品编号是否存在 | |
| 39 | + // 校验产品编号是否存在 | |
| 40 | 40 | validateProductNo(createReqVO.getNo()); |
| 41 | + // TODO @zange:需要校验 categoryId 是否存在; | |
| 41 | 42 | // 插入 |
| 42 | 43 | ProductDO product = ProductConvert.INSTANCE.convert(createReqVO); |
| 43 | 44 | productMapper.insert(product); |
| ... | ... | @@ -49,6 +50,7 @@ public class ProductServiceImpl implements ProductService { |
| 49 | 50 | public void updateProduct(ProductUpdateReqVO updateReqVO) { |
| 50 | 51 | // 校验存在 |
| 51 | 52 | validateProductExists(updateReqVO.getId(), updateReqVO.getNo()); |
| 53 | + // TODO @zange:需要校验 categoryId 是否存在; | |
| 52 | 54 | // 更新 |
| 53 | 55 | ProductDO updateObj = ProductConvert.INSTANCE.convert(updateReqVO); |
| 54 | 56 | productMapper.updateById(updateObj); |
| ... | ... | @@ -62,6 +64,7 @@ public class ProductServiceImpl implements ProductService { |
| 62 | 64 | productMapper.deleteById(id); |
| 63 | 65 | } |
| 64 | 66 | |
| 67 | + // TODO @zange:validateProductExists 要不只校验是否存在;然后是否 no 重复,交给 validateProductNo,名字改成 validateProductNoDuplicate,和别的模块保持一致哈; | |
| 65 | 68 | private void validateProductExists(Long id, String no) { |
| 66 | 69 | ProductDO product = productMapper.selectById(id); |
| 67 | 70 | if (product == null) { |
| ... | ... | @@ -101,4 +104,5 @@ public class ProductServiceImpl implements ProductService { |
| 101 | 104 | throw exception(PRODUCT_NO_EXISTS); |
| 102 | 105 | } |
| 103 | 106 | } |
| 107 | + | |
| 104 | 108 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/productcategory/ProductCategoryServiceImpl.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.service.productcategory; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.module.crm.controller.admin.productcategory.vo.ProductCategoryCreateReqVO; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.productcategory.vo.ProductCategoryListReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.productcategory.vo.ProductCategoryUpdateReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.convert.productcategory.ProductCategoryConvert; | |
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.productcategory.ProductCategoryDO; | |
| 8 | +import cn.iocoder.yudao.module.crm.dal.mysql.productcategory.ProductCategoryMapper; | |
| 3 | 9 | import org.springframework.stereotype.Service; |
| 4 | -import javax.annotation.Resource; | |
| 5 | 10 | import org.springframework.validation.annotation.Validated; |
| 6 | 11 | |
| 7 | -import java.util.*; | |
| 8 | -import cn.iocoder.yudao.module.crm.controller.admin.productcategory.vo.*; | |
| 9 | -import cn.iocoder.yudao.module.crm.dal.dataobject.productcategory.ProductCategoryDO; | |
| 10 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 11 | - | |
| 12 | -import cn.iocoder.yudao.module.crm.convert.productcategory.ProductCategoryConvert; | |
| 13 | -import cn.iocoder.yudao.module.crm.dal.mysql.productcategory.ProductCategoryMapper; | |
| 12 | +import javax.annotation.Resource; | |
| 13 | +import java.util.List; | |
| 14 | 14 | |
| 15 | 15 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 16 | -import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; | |
| 17 | - | |
| 18 | -import cn.hutool.core.collection.CollUtil; | |
| 19 | -import cn.hutool.core.collection.ListUtil; | |
| 16 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.PRODUCT_CATEGORY_NOT_EXISTS; | |
| 20 | 17 | |
| 18 | +// TODO @zange:这个类所在的包,放到 product 下; | |
| 21 | 19 | /** |
| 22 | 20 | * 产品分类 Service 实现类 |
| 23 | 21 | * |
| ... | ... | @@ -32,6 +30,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { |
| 32 | 30 | |
| 33 | 31 | @Override |
| 34 | 32 | public Long createProductCategory(ProductCategoryCreateReqVO createReqVO) { |
| 33 | + // TODO zange:参考 mall: ProductCategoryServiceImpl 补充下必要的参数校验; | |
| 35 | 34 | // 插入 |
| 36 | 35 | ProductCategoryDO productCategory = ProductCategoryConvert.INSTANCE.convert(createReqVO); |
| 37 | 36 | productCategoryMapper.insert(productCategory); |
| ... | ... | @@ -41,6 +40,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { |
| 41 | 40 | |
| 42 | 41 | @Override |
| 43 | 42 | public void updateProductCategory(ProductCategoryUpdateReqVO updateReqVO) { |
| 43 | + // TODO zange:参考 mall: ProductCategoryServiceImpl 补充下必要的参数校验; | |
| 44 | 44 | // 校验存在 |
| 45 | 45 | validateProductCategoryExists(updateReqVO.getId()); |
| 46 | 46 | // 更新 |
| ... | ... | @@ -50,6 +50,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { |
| 50 | 50 | |
| 51 | 51 | @Override |
| 52 | 52 | public void deleteProductCategory(Long id) { |
| 53 | + // TODO zange:参考 mall: ProductCategoryServiceImpl 补充下必要的参数校验; | |
| 53 | 54 | // 校验存在 |
| 54 | 55 | validateProductCategoryExists(id); |
| 55 | 56 | // 删除 | ... | ... |