diff --git a/sql/mysql/crm.sql b/sql/mysql/crm.sql index b11091fbe..e3e2ca0a0 100644 --- a/sql/mysql/crm.sql +++ b/sql/mysql/crm.sql @@ -1,107 +1 @@ SET NAMES utf8mb4; - - - - --- ---------------------------- --- 回款表 --- ---------------------------- -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; - - --- ---------------------------- --- 回款计划表 --- ---------------------------- -DROP TABLE IF EXISTS `crm_receivable_plan`; -CREATE TABLE `crm_receivable_plan` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', - `period` tinyint(4) DEFAULT NULL COMMENT '期数', - `receivable_id` bigint(20) NULL DEFAULT NULL COMMENT '回款ID', - `status` tinyint(4) NOT NULL COMMENT '完成状态', - `check_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '审批状态', - `process_instance_id` bigint(20) NULL DEFAULT NULL COMMENT '工作流编号', - `price` decimal(10, 2) NULL DEFAULT NULL COMMENT '计划回款金额', - `return_time` datetime NULL DEFAULT NULL COMMENT '计划回款日期', - `remind_days` bigint(20) NULL DEFAULT NULL COMMENT '提前几天提醒', - `remind_time` datetime NULL DEFAULT NULL COMMENT '提醒日期', - `customer_id` bigint(20) NULL DEFAULT NULL COMMENT '客户ID', - `contract_id` bigint(20) NULL DEFAULT NULL COMMENT '合同ID', - `owner_user_id` bigint(20) NULL DEFAULT NULL COMMENT '负责人', - `sort` int(11) NULL DEFAULT NULL COMMENT '显示顺序', - `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; - --- ---------------------------- --- 产品表 --- ---------------------------- -DROP TABLE IF EXISTS `crm_product`; -CREATE TABLE `crm_product` -( - `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id', - `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '产品名称', - `no` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '产品编码', - `unit` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '单位', - `price` bigint(20) NULL DEFAULT 0 COMMENT '价格', - `status` tinyint(2) NOT NULL DEFAULT 1 COMMENT '状态 1-上架 0-下架', - `category_id` bigint(20) NOT NULL COMMENT '产品分类ID', - `description` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '产品描述', - `owner_user_id` bigint(20) NOT 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 '更新时间', - `tenant_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号', - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '产品表' ROW_FORMAT = Dynamic; - --- ---------------------------- --- 产品分类表 --- ---------------------------- -DROP TABLE IF EXISTS `crm_product_category`; -CREATE TABLE `crm_product_category` -( - `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id', - `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '名称', - `parent_id` bigint(20) NOT NULL COMMENT '父级id', - `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 '更新时间', - `tenant_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号', - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '产品分类表' ROW_FORMAT = Dynamic; \ No newline at end of file diff --git a/sql/mysql/crm_data.sql b/sql/mysql/crm_data.sql index 149c65268..b5be1e691 100644 --- a/sql/mysql/crm_data.sql +++ b/sql/mysql/crm_data.sql @@ -1,5 +1,6 @@ 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'); @@ -8,6 +9,7 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st 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'); @@ -16,9 +18,3 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st 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'); - -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'); - -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'); -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'); - diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/ProductController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/ProductController.java index da55dd0b6..34c832f82 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/ProductController.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/ProductController.java @@ -1,32 +1,28 @@ package cn.iocoder.yudao.module.crm.controller.admin.product; -import org.springframework.web.bind.annotation.*; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.security.access.prepost.PreAuthorize; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Operation; - -import javax.validation.constraints.*; -import javax.validation.*; -import javax.servlet.http.*; -import java.util.*; -import java.io.IOException; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; - +import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; - import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; - import cn.iocoder.yudao.module.crm.controller.admin.product.vo.*; -import cn.iocoder.yudao.module.crm.dal.dataobject.product.ProductDO; import cn.iocoder.yudao.module.crm.convert.product.ProductConvert; +import cn.iocoder.yudao.module.crm.dal.dataobject.product.ProductDO; import cn.iocoder.yudao.module.crm.service.product.ProductService; +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.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; @Tag(name = "管理后台 - 产品") @RestController @@ -70,15 +66,6 @@ public class ProductController { return success(ProductConvert.INSTANCE.convert(product)); } - @GetMapping("/list") - @Operation(summary = "获得产品列表") - @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") - @PreAuthorize("@ss.hasPermission('crm:product:query')") - public CommonResult> getProductList(@RequestParam("ids") Collection ids) { - List list = productService.getProductList(ids); - return success(ProductConvert.INSTANCE.convertList(list)); - } - @GetMapping("/page") @Operation(summary = "获得产品分页") @PreAuthorize("@ss.hasPermission('crm:product:query')") diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductBaseVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductBaseVO.java index e6ba132f7..15718f4c5 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductBaseVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductBaseVO.java @@ -1,12 +1,11 @@ package cn.iocoder.yudao.module.crm.controller.admin.product.vo; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import java.time.LocalDateTime; -import java.time.LocalDateTime; -import javax.validation.constraints.*; +import lombok.Data; +import javax.validation.constraints.NotNull; + +// TODO @zange:需要加 CRM 前置噢 /** * 产品 Base VO,提供给添加、修改、详细的子 VO 使用 * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 @@ -14,6 +13,8 @@ import javax.validation.constraints.*; @Data public class ProductBaseVO { + // TODO @zange:example 要写哈;主要是接口文档,可以基于 example 可以生产请求参数 + @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") @NotNull(message = "产品名称不能为空") private String name; @@ -39,6 +40,8 @@ public class ProductBaseVO { @Schema(description = "产品描述", example = "你说的对") private String description; + // TODO @zange:这个字段只有 create 可以传递,update 不传递;所以放到 create 和 resp 里; + @Schema(description = "负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31926") @NotNull(message = "负责人的用户编号不能为空") private Long ownerUserId; diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductExcelVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductExcelVO.java index 0e2178f63..b4d46873e 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductExcelVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductExcelVO.java @@ -1,16 +1,13 @@ package cn.iocoder.yudao.module.crm.controller.admin.product.vo; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -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; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; +import java.time.LocalDateTime; +// TODO 芋艿:这个导出最后搞 /** * 产品 Excel VO * diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductExportReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductExportReqVO.java index 9c8aa4051..ead2df93f 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductExportReqVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductExportReqVO.java @@ -1,14 +1,14 @@ package cn.iocoder.yudao.module.crm.controller.admin.product.vo; -import lombok.*; -import java.util.*; import io.swagger.v3.oas.annotations.media.Schema; -import cn.iocoder.yudao.framework.common.pojo.PageParam; -import java.time.LocalDateTime; +import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +// TODO 芋艿:这个导出最后搞 @Schema(description = "管理后台 - 产品 Excel 导出 Request VO,参数和 ProductPageReqVO 是一致的") @Data public class ProductExportReqVO { diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductPageReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductPageReqVO.java index 46285b9e3..db2d3f94e 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductPageReqVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/ProductPageReqVO.java @@ -1,14 +1,17 @@ package cn.iocoder.yudao.module.crm.controller.admin.product.vo; -import lombok.*; -import java.util.*; -import io.swagger.v3.oas.annotations.media.Schema; import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; + import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +// TODO @zange:按照需求,裁剪下筛选的字段,目前应该只要 name 和 status @Schema(description = "管理后台 - 产品分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/productcategory/vo/ProductCategoryBaseVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/productcategory/vo/ProductCategoryBaseVO.java index e120a4567..9681520a4 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/productcategory/vo/ProductCategoryBaseVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/productcategory/vo/ProductCategoryBaseVO.java @@ -1,11 +1,9 @@ package cn.iocoder.yudao.module.crm.controller.admin.productcategory.vo; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import java.time.LocalDateTime; -import java.time.LocalDateTime; -import javax.validation.constraints.*; +import lombok.Data; + +import javax.validation.constraints.NotNull; /** * 产品分类 Base VO,提供给添加、修改、详细的子 VO 使用 @@ -18,8 +16,8 @@ public class ProductCategoryBaseVO { @NotNull(message = "名称不能为空") private String name; - @Schema(description = "父级id", requiredMode = Schema.RequiredMode.REQUIRED, example = "4680") - @NotNull(message = "父级id不能为空") + @Schema(description = "父级 id", requiredMode = Schema.RequiredMode.REQUIRED, example = "4680") + @NotNull(message = "父级 id 不能为空") private Long parentId; } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/productcategory/vo/ProductCategoryListReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/productcategory/vo/ProductCategoryListReqVO.java index c29c72148..e74df4a0c 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/productcategory/vo/ProductCategoryListReqVO.java +++ b/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; import java.time.LocalDateTime; -/** - * 产品分类 List VO - * - * @author ZanGe丶 - */ +// TODO 芋艿:这个导出最后搞;命名应该是按照 ProductExportReqVO 风格 @Schema(description = "管理后台 - 产品分类列表 Request VO") @Data public class ProductCategoryListReqVO { @@ -18,7 +14,7 @@ public class ProductCategoryListReqVO { @ExcelProperty("名称") private String name; - @ExcelProperty("父级id") + @ExcelProperty("父级 id") private Long parentId; @ExcelProperty("创建时间") diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/productcategory/vo/ProductCategoryUpdateReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/productcategory/vo/ProductCategoryUpdateReqVO.java index 48d7bf4f2..82575fbb1 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/productcategory/vo/ProductCategoryUpdateReqVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/productcategory/vo/ProductCategoryUpdateReqVO.java @@ -1,9 +1,11 @@ package cn.iocoder.yudao.module.crm.controller.admin.productcategory.vo; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import javax.validation.constraints.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import javax.validation.constraints.NotNull; @Schema(description = "管理后台 - 产品分类更新 Request VO") @Data @@ -11,8 +13,8 @@ import javax.validation.constraints.*; @ToString(callSuper = true) public class ProductCategoryUpdateReqVO extends ProductCategoryBaseVO { - @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23902") - @NotNull(message = "主键id不能为空") + @Schema(description = "主键 id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23902") + @NotNull(message = "主键 id 不能为空") private Long id; } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/product/ProductDO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/product/ProductDO.java index c7b8ec009..c44ef7553 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/product/ProductDO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/product/ProductDO.java @@ -1,11 +1,10 @@ package cn.iocoder.yudao.module.crm.dal.dataobject.product; -import lombok.*; -import java.util.*; -import java.time.LocalDateTime; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.*; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; /** * 产品 DO @@ -23,7 +22,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; public class ProductDO extends BaseDO { /** - * 主键id + * 主键 id */ @TableId private Long id; @@ -47,10 +46,12 @@ public class ProductDO extends BaseDO { * 状态 * * 枚举 {@link TODO crm_product_status 对应的类} + * // TODO @zange:这个写个枚举类,然后 {@link关联下 */ private Integer status; /** - * 产品分类ID + * 产品分类 ID + * // TODO @zange:这个要写下关联 CategoryDO 的 id 字段;参考下别的模块哈 */ private Long categoryId; /** diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/productcategory/ProductCategoryDO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/productcategory/ProductCategoryDO.java index 9e968ac86..8dcfaac36 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/productcategory/ProductCategoryDO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/productcategory/ProductCategoryDO.java @@ -1,11 +1,10 @@ package cn.iocoder.yudao.module.crm.dal.dataobject.productcategory; -import lombok.*; -import java.util.*; -import java.time.LocalDateTime; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.*; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; /** * 产品分类 DO @@ -32,7 +31,8 @@ public class ProductCategoryDO extends BaseDO { */ private String name; /** - * 父级id + * 父级 id + * // TODO @zange:这个要写下关联 CategoryDO 的 id 字段;参考下别的模块哈 */ private Long parentId; diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/ProductServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/ProductServiceImpl.java index 82294de85..e9a49d04f 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/ProductServiceImpl.java +++ b/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 { @Override public Long createProduct(ProductCreateReqVO createReqVO) { - //校验产品编号是否存在 + // 校验产品编号是否存在 validateProductNo(createReqVO.getNo()); + // TODO @zange:需要校验 categoryId 是否存在; // 插入 ProductDO product = ProductConvert.INSTANCE.convert(createReqVO); productMapper.insert(product); @@ -49,6 +50,7 @@ public class ProductServiceImpl implements ProductService { public void updateProduct(ProductUpdateReqVO updateReqVO) { // 校验存在 validateProductExists(updateReqVO.getId(), updateReqVO.getNo()); + // TODO @zange:需要校验 categoryId 是否存在; // 更新 ProductDO updateObj = ProductConvert.INSTANCE.convert(updateReqVO); productMapper.updateById(updateObj); @@ -62,6 +64,7 @@ public class ProductServiceImpl implements ProductService { productMapper.deleteById(id); } + // TODO @zange:validateProductExists 要不只校验是否存在;然后是否 no 重复,交给 validateProductNo,名字改成 validateProductNoDuplicate,和别的模块保持一致哈; private void validateProductExists(Long id, String no) { ProductDO product = productMapper.selectById(id); if (product == null) { @@ -101,4 +104,5 @@ public class ProductServiceImpl implements ProductService { throw exception(PRODUCT_NO_EXISTS); } } + } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/productcategory/ProductCategoryServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/productcategory/ProductCategoryServiceImpl.java index 7d3d6fa86..01a51d425 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/productcategory/ProductCategoryServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/productcategory/ProductCategoryServiceImpl.java @@ -1,23 +1,21 @@ package cn.iocoder.yudao.module.crm.service.productcategory; +import cn.iocoder.yudao.module.crm.controller.admin.productcategory.vo.ProductCategoryCreateReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.productcategory.vo.ProductCategoryListReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.productcategory.vo.ProductCategoryUpdateReqVO; +import cn.iocoder.yudao.module.crm.convert.productcategory.ProductCategoryConvert; +import cn.iocoder.yudao.module.crm.dal.dataobject.productcategory.ProductCategoryDO; +import cn.iocoder.yudao.module.crm.dal.mysql.productcategory.ProductCategoryMapper; import org.springframework.stereotype.Service; -import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; -import java.util.*; -import cn.iocoder.yudao.module.crm.controller.admin.productcategory.vo.*; -import cn.iocoder.yudao.module.crm.dal.dataobject.productcategory.ProductCategoryDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import cn.iocoder.yudao.module.crm.convert.productcategory.ProductCategoryConvert; -import cn.iocoder.yudao.module.crm.dal.mysql.productcategory.ProductCategoryMapper; +import javax.annotation.Resource; +import java.util.List; 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; +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.PRODUCT_CATEGORY_NOT_EXISTS; +// TODO @zange:这个类所在的包,放到 product 下; /** * 产品分类 Service 实现类 * @@ -32,6 +30,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { @Override public Long createProductCategory(ProductCategoryCreateReqVO createReqVO) { + // TODO zange:参考 mall: ProductCategoryServiceImpl 补充下必要的参数校验; // 插入 ProductCategoryDO productCategory = ProductCategoryConvert.INSTANCE.convert(createReqVO); productCategoryMapper.insert(productCategory); @@ -41,6 +40,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { @Override public void updateProductCategory(ProductCategoryUpdateReqVO updateReqVO) { + // TODO zange:参考 mall: ProductCategoryServiceImpl 补充下必要的参数校验; // 校验存在 validateProductCategoryExists(updateReqVO.getId()); // 更新 @@ -50,6 +50,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { @Override public void deleteProductCategory(Long id) { + // TODO zange:参考 mall: ProductCategoryServiceImpl 补充下必要的参数校验; // 校验存在 validateProductCategoryExists(id); // 删除