Commit ca552825168c74734088ed4694faff6d347f9d4b
1 parent
4c200eda
CRM:商机 code review
Showing
20 changed files
with
60 additions
and
98 deletions
sql/mysql/optinal/crm_20240114.sql
| @@ -20,36 +20,4 @@ CREATE TABLE `crm_business_product` ( | @@ -20,36 +20,4 @@ CREATE TABLE `crm_business_product` ( | ||
| 20 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 20 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 21 | `tenant_id` bigint(0) NOT NULL DEFAULT 1 COMMENT '租户编号', | 21 | `tenant_id` bigint(0) NOT NULL DEFAULT 1 COMMENT '租户编号', |
| 22 | PRIMARY KEY (`id`) USING BTREE | 22 | PRIMARY KEY (`id`) USING BTREE |
| 23 | -) ENGINE = InnoDB AUTO_INCREMENT = 29 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '商机产品关联表' ROW_FORMAT = Dynamic; | ||
| 24 | - | ||
| 25 | --- ---------------------------- | ||
| 26 | --- Table structure for crm_business_status | ||
| 27 | --- ---------------------------- | ||
| 28 | -DROP TABLE IF EXISTS `crm_business_status`; | ||
| 29 | -CREATE TABLE `crm_business_status` ( | ||
| 30 | - `id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID', | ||
| 31 | - `type_id` bigint(0) NOT NULL COMMENT '状态类型编号', | ||
| 32 | - `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '状态名', | ||
| 33 | - `percent` bigint(0) NULL DEFAULT NULL COMMENT '赢单率', | ||
| 34 | - `sort` int(0) NULL DEFAULT NULL COMMENT '排序', | ||
| 35 | - `tenant_id` bigint(0) NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 36 | - PRIMARY KEY (`id`) USING BTREE | ||
| 37 | -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '商机状态' ROW_FORMAT = Dynamic; | ||
| 38 | - | ||
| 39 | --- ---------------------------- | ||
| 40 | --- Table structure for crm_business_status_type | ||
| 41 | --- ---------------------------- | ||
| 42 | -DROP TABLE IF EXISTS `crm_business_status_type`; | ||
| 43 | -CREATE TABLE `crm_business_status_type` ( | ||
| 44 | - `id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID', | ||
| 45 | - `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '状态类型名', | ||
| 46 | - `dept_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '使用的部门编号', | ||
| 47 | - `status` int(0) NOT NULL DEFAULT 1 COMMENT '开启状态', | ||
| 48 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | ||
| 49 | - `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 50 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 51 | - `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', | ||
| 52 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 53 | - `tenant_id` bigint(0) NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 54 | - PRIMARY KEY (`id`) USING BTREE | ||
| 55 | -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '商机状态类型' ROW_FORMAT = Dynamic; | 23 | +) ENGINE = InnoDB AUTO_INCREMENT = 29 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '商机产品关联表' ROW_FORMAT = Dynamic; |
| 56 | \ No newline at end of file | 24 | \ No newline at end of file |
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/business/CrmBizEndStatus.java
| 1 | package cn.iocoder.yudao.module.crm.enums.business; | 1 | package cn.iocoder.yudao.module.crm.enums.business; |
| 2 | 2 | ||
| 3 | -import cn.hutool.core.util.ObjUtil; | ||
| 4 | import cn.hutool.core.util.ObjectUtil; | 3 | import cn.hutool.core.util.ObjectUtil; |
| 5 | import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | 4 | import cn.iocoder.yudao.framework.common.core.IntArrayValuable; |
| 6 | import lombok.Getter; | 5 | import lombok.Getter; |
| @@ -8,6 +7,7 @@ import lombok.RequiredArgsConstructor; | @@ -8,6 +7,7 @@ import lombok.RequiredArgsConstructor; | ||
| 8 | 7 | ||
| 9 | import java.util.Arrays; | 8 | import java.util.Arrays; |
| 10 | 9 | ||
| 10 | +// TODO @lzxhqs:1)title、description、create 可以删除,非标准的 javadoc 注释哈,然后可以在类上加下这个类的注释;2)CrmBizEndStatus 改成 CrmBusinessEndStatus,非必要不缩写哈,可阅读比较重要 | ||
| 11 | /** | 11 | /** |
| 12 | * @author lzxhqs | 12 | * @author lzxhqs |
| 13 | * @version 1.0 | 13 | * @version 1.0 |
| @@ -18,12 +18,14 @@ import java.util.Arrays; | @@ -18,12 +18,14 @@ import java.util.Arrays; | ||
| 18 | @RequiredArgsConstructor | 18 | @RequiredArgsConstructor |
| 19 | @Getter | 19 | @Getter |
| 20 | public enum CrmBizEndStatus implements IntArrayValuable { | 20 | public enum CrmBizEndStatus implements IntArrayValuable { |
| 21 | + | ||
| 21 | WIN(1, "赢单"), | 22 | WIN(1, "赢单"), |
| 22 | LOSE(2, "输单"), | 23 | LOSE(2, "输单"), |
| 23 | INVALID(3, "无效"); | 24 | INVALID(3, "无效"); |
| 24 | 25 | ||
| 25 | public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CrmBizEndStatus::getStatus).toArray(); | 26 | public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CrmBizEndStatus::getStatus).toArray(); |
| 26 | 27 | ||
| 28 | + // TODO @lzxhqs:这里的方法,建议放到 49 行之后;一般类里是,静态变量,普通变量;静态方法;普通方法 | ||
| 27 | public static boolean isWin(Integer status) { | 29 | public static boolean isWin(Integer status) { |
| 28 | return ObjectUtil.equal(WIN.getStatus(), status); | 30 | return ObjectUtil.equal(WIN.getStatus(), status); |
| 29 | } | 31 | } |
| @@ -49,4 +51,5 @@ public enum CrmBizEndStatus implements IntArrayValuable { | @@ -49,4 +51,5 @@ public enum CrmBizEndStatus implements IntArrayValuable { | ||
| 49 | public int[] array() { | 51 | public int[] array() { |
| 50 | return ARRAYS; | 52 | return ARRAYS; |
| 51 | } | 53 | } |
| 54 | + | ||
| 52 | } | 55 | } |
yudao-module-crm/yudao-module-crm-biz/pom.xml
| @@ -24,11 +24,6 @@ | @@ -24,11 +24,6 @@ | ||
| 24 | </dependency> | 24 | </dependency> |
| 25 | <dependency> | 25 | <dependency> |
| 26 | <groupId>cn.iocoder.boot</groupId> | 26 | <groupId>cn.iocoder.boot</groupId> |
| 27 | - <artifactId>yudao-module-system-biz</artifactId> | ||
| 28 | - <version>${revision}</version> | ||
| 29 | - </dependency> | ||
| 30 | - <dependency> | ||
| 31 | - <groupId>cn.iocoder.boot</groupId> | ||
| 32 | <artifactId>yudao-module-crm-api</artifactId> | 27 | <artifactId>yudao-module-crm-api</artifactId> |
| 33 | <version>${revision}</version> | 28 | <version>${revision}</version> |
| 34 | </dependency> | 29 | </dependency> |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessStatusTypeController.java
| @@ -25,19 +25,17 @@ import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | @@ -25,19 +25,17 @@ import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | ||
| 25 | import io.swagger.v3.oas.annotations.Operation; | 25 | import io.swagger.v3.oas.annotations.Operation; |
| 26 | import io.swagger.v3.oas.annotations.Parameter; | 26 | import io.swagger.v3.oas.annotations.Parameter; |
| 27 | import io.swagger.v3.oas.annotations.tags.Tag; | 27 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 28 | +import jakarta.annotation.Resource; | ||
| 29 | +import jakarta.servlet.http.HttpServletResponse; | ||
| 30 | +import jakarta.validation.Valid; | ||
| 28 | import org.springframework.security.access.prepost.PreAuthorize; | 31 | import org.springframework.security.access.prepost.PreAuthorize; |
| 29 | import org.springframework.validation.annotation.Validated; | 32 | import org.springframework.validation.annotation.Validated; |
| 30 | import org.springframework.web.bind.annotation.*; | 33 | import org.springframework.web.bind.annotation.*; |
| 31 | 34 | ||
| 32 | -import jakarta.annotation.Resource; | ||
| 33 | -import jakarta.servlet.http.HttpServletResponse; | ||
| 34 | -import jakarta.validation.Valid; | ||
| 35 | import java.io.IOException; | 35 | import java.io.IOException; |
| 36 | import java.util.Collection; | 36 | import java.util.Collection; |
| 37 | import java.util.List; | 37 | import java.util.List; |
| 38 | -import java.util.Objects; | ||
| 39 | import java.util.Set; | 38 | import java.util.Set; |
| 40 | -import java.util.stream.Collectors; | ||
| 41 | 39 | ||
| 42 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 40 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 43 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | 41 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| @@ -86,13 +84,13 @@ public class CrmBusinessStatusTypeController { | @@ -86,13 +84,13 @@ public class CrmBusinessStatusTypeController { | ||
| 86 | @Parameter(name = "id", description = "编号", required = true, example = "1024") | 84 | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| 87 | @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") | 85 | @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") |
| 88 | public CommonResult<CrmBusinessStatusTypeRespVO> getBusinessStatusType(@RequestParam("id") Long id) { | 86 | public CommonResult<CrmBusinessStatusTypeRespVO> getBusinessStatusType(@RequestParam("id") Long id) { |
| 89 | - CrmBusinessStatusTypeDO businessStatusType = businessStatusTypeService.getBusinessStatusType(id); | 87 | + CrmBusinessStatusTypeDO statusType = businessStatusTypeService.getBusinessStatusType(id); |
| 90 | // 处理状态回显 | 88 | // 处理状态回显 |
| 91 | - // TODO @ljlleo:可以使用 CollectionUtils.convertSet 替代常用的 stream 操作,更简洁一点;下面几个也是哈; | 89 | + // TODO @lzxhqs:可以在 businessStatusService 加个 getBusinessStatusListByTypeId 方法,直接返回 List<CrmBusinessStatusDO> 哈,常用的,尽量封装个简单易懂的方法,不用追求绝对通用哈; |
| 92 | CrmBusinessStatusQueryVO queryVO = new CrmBusinessStatusQueryVO(); | 90 | CrmBusinessStatusQueryVO queryVO = new CrmBusinessStatusQueryVO(); |
| 93 | queryVO.setTypeId(id); | 91 | queryVO.setTypeId(id); |
| 94 | List<CrmBusinessStatusDO> statusList = businessStatusService.selectList(queryVO); | 92 | List<CrmBusinessStatusDO> statusList = businessStatusService.selectList(queryVO); |
| 95 | - return success(CrmBusinessStatusTypeConvert.INSTANCE.convert(businessStatusType, statusList)); | 93 | + return success(CrmBusinessStatusTypeConvert.INSTANCE.convert(statusType, statusList)); |
| 96 | } | 94 | } |
| 97 | 95 | ||
| 98 | @GetMapping("/page") | 96 | @GetMapping("/page") |
| @@ -101,12 +99,6 @@ public class CrmBusinessStatusTypeController { | @@ -101,12 +99,6 @@ public class CrmBusinessStatusTypeController { | ||
| 101 | public CommonResult<PageResult<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypePage(@Valid CrmBusinessStatusTypePageReqVO pageReqVO) { | 99 | public CommonResult<PageResult<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypePage(@Valid CrmBusinessStatusTypePageReqVO pageReqVO) { |
| 102 | PageResult<CrmBusinessStatusTypeDO> pageResult = businessStatusTypeService.getBusinessStatusTypePage(pageReqVO); | 100 | PageResult<CrmBusinessStatusTypeDO> pageResult = businessStatusTypeService.getBusinessStatusTypePage(pageReqVO); |
| 103 | // 处理部门回显 | 101 | // 处理部门回显 |
| 104 | - // TODO @ljlleo:可以使用 CollectionUtils.convertSet 替代常用的 stream 操作,更简洁一点;下面几个也是哈; | ||
| 105 | -// Set<Long> deptIds = pageResult.getList().stream() | ||
| 106 | -// .map(CrmBusinessStatusTypeDO::getDeptIds) | ||
| 107 | -// .filter(Objects::nonNull) | ||
| 108 | -// .flatMap(Collection::stream) | ||
| 109 | -// .collect(Collectors.toSet()); | ||
| 110 | Set<Long> deptIds = CollectionUtils.convertSetByFlatMap(pageResult.getList(), CrmBusinessStatusTypeDO::getDeptIds,Collection::stream); | 102 | Set<Long> deptIds = CollectionUtils.convertSetByFlatMap(pageResult.getList(), CrmBusinessStatusTypeDO::getDeptIds,Collection::stream); |
| 111 | List<DeptRespDTO> deptList = deptApi.getDeptList(deptIds); | 103 | List<DeptRespDTO> deptList = deptApi.getDeptList(deptIds); |
| 112 | return success(CrmBusinessStatusTypeConvert.INSTANCE.convertPage(pageResult, deptList)); | 104 | return success(CrmBusinessStatusTypeConvert.INSTANCE.convertPage(pageResult, deptList)); |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessSaveReqVO.java
| @@ -17,7 +17,6 @@ import java.util.List; | @@ -17,7 +17,6 @@ import java.util.List; | ||
| 17 | 17 | ||
| 18 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 18 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 19 | 19 | ||
| 20 | -// TODO @ljileo:DiffLogField function 完善一下 | ||
| 21 | @Schema(description = "管理后台 - CRM 商机创建/更新 Request VO") | 20 | @Schema(description = "管理后台 - CRM 商机创建/更新 Request VO") |
| 22 | @Data | 21 | @Data |
| 23 | public class CrmBusinessSaveReqVO { | 22 | public class CrmBusinessSaveReqVO { |
| @@ -59,7 +58,7 @@ public class CrmBusinessSaveReqVO { | @@ -59,7 +58,7 @@ public class CrmBusinessSaveReqVO { | ||
| 59 | @DiffLogField(name = "商机金额") | 58 | @DiffLogField(name = "商机金额") |
| 60 | private Integer price; | 59 | private Integer price; |
| 61 | 60 | ||
| 62 | - // TODO @ljileo:折扣使用 Integer 类型,存储时,默认 * 100;展示的时候,前端需要 / 100;避免精度丢失问题 | 61 | + // TODO @lzxhqs:折扣使用 Integer 类型,存储时,默认 * 100;展示的时候,前端需要 / 100;避免精度丢失问题 |
| 63 | @Schema(description = "整单折扣") | 62 | @Schema(description = "整单折扣") |
| 64 | @DiffLogField(name = "整单折扣") | 63 | @DiffLogField(name = "整单折扣") |
| 65 | private Integer discountPercent; | 64 | private Integer discountPercent; |
| @@ -71,17 +70,16 @@ public class CrmBusinessSaveReqVO { | @@ -71,17 +70,16 @@ public class CrmBusinessSaveReqVO { | ||
| 71 | @Schema(description = "备注", example = "随便") | 70 | @Schema(description = "备注", example = "随便") |
| 72 | @DiffLogField(name = "备注") | 71 | @DiffLogField(name = "备注") |
| 73 | private String remark; | 72 | private String remark; |
| 74 | - // TODO @ljileo:修改的时候,应该可以传递添加的产品; | ||
| 75 | - @Schema(description = "联系人编号", example = "110") | ||
| 76 | - @NotNull(message = "联系人编号不能为空") | ||
| 77 | - private Long contactId; | ||
| 78 | 73 | ||
| 79 | - @Schema(description = "1赢单2输单3无效", example = "1") | 74 | + @Schema(description = "结束状态", example = "1") |
| 80 | @InEnum(CrmBizEndStatus.class) | 75 | @InEnum(CrmBizEndStatus.class) |
| 81 | private Integer endStatus; | 76 | private Integer endStatus; |
| 82 | 77 | ||
| 83 | - @Schema(description = "商机产品列表", example = "") | 78 | + // TODO @lzxhqs:不设置默认 new ArrayList<>();一般 pojo 不设置默认值哈 |
| 79 | + @Schema(description = "商机产品列表") | ||
| 84 | private List<CrmBusinessProductSaveReqVO> products = new ArrayList<>(); | 80 | private List<CrmBusinessProductSaveReqVO> products = new ArrayList<>(); |
| 85 | 81 | ||
| 82 | + @Schema(description = "联系人编号", example = "110") | ||
| 83 | + private Long contactId; // 使用场景,在【联系人详情】添加商机时,如果需要关联两者,需要传递 contactId 字段 | ||
| 86 | 84 | ||
| 87 | } | 85 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/product/CrmBusinessProductPageReqVO.java
| @@ -6,10 +6,7 @@ import lombok.Data; | @@ -6,10 +6,7 @@ import lombok.Data; | ||
| 6 | import lombok.EqualsAndHashCode; | 6 | import lombok.EqualsAndHashCode; |
| 7 | import lombok.ToString; | 7 | import lombok.ToString; |
| 8 | 8 | ||
| 9 | - | ||
| 10 | -/** | ||
| 11 | - * @author lzxhqs | ||
| 12 | - */ | 9 | +// TODO @lzxhqs:这个类,如果没用到,可以考虑删除哈 |
| 13 | @Schema(description = "管理后台 - 商机产品分页 Request VO") | 10 | @Schema(description = "管理后台 - 商机产品分页 Request VO") |
| 14 | @Data | 11 | @Data |
| 15 | @EqualsAndHashCode(callSuper = true) | 12 | @EqualsAndHashCode(callSuper = true) |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/product/CrmBusinessProductRespVO.java
| @@ -4,9 +4,6 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | @@ -4,9 +4,6 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | import lombok.Data; | 5 | import lombok.Data; |
| 6 | 6 | ||
| 7 | -/** | ||
| 8 | - * @author lzxhqs | ||
| 9 | - */ | ||
| 10 | @Schema(description = "管理后台 - 商机产品关联 Response VO") | 7 | @Schema(description = "管理后台 - 商机产品关联 Response VO") |
| 11 | @Data | 8 | @Data |
| 12 | @ExcelIgnoreUnannotated | 9 | @ExcelIgnoreUnannotated |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/product/CrmBusinessProductSaveReqVO.java
| @@ -6,9 +6,6 @@ import lombok.Data; | @@ -6,9 +6,6 @@ import lombok.Data; | ||
| 6 | 6 | ||
| 7 | import java.math.BigDecimal; | 7 | import java.math.BigDecimal; |
| 8 | 8 | ||
| 9 | -/** | ||
| 10 | - * @author lzxhqs | ||
| 11 | - */ | ||
| 12 | @Schema(description = "管理后台 - CRM 商机产品关联表 创建/更新 Request VO") | 9 | @Schema(description = "管理后台 - CRM 商机产品关联表 创建/更新 Request VO") |
| 13 | @Data | 10 | @Data |
| 14 | public class CrmBusinessProductSaveReqVO { | 11 | public class CrmBusinessProductSaveReqVO { |
| @@ -16,12 +13,14 @@ public class CrmBusinessProductSaveReqVO { | @@ -16,12 +13,14 @@ public class CrmBusinessProductSaveReqVO { | ||
| 16 | @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32129") | 13 | @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32129") |
| 17 | private Long id; | 14 | private Long id; |
| 18 | 15 | ||
| 19 | - @Schema(description = "商机ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") | ||
| 20 | - @NotNull(message = "商机ID不能为空") | 16 | + // TODO @lzxhqs:这个字段,应该是 Long 类型 |
| 17 | + @Schema(description = "商机编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") | ||
| 18 | + @NotNull(message = "商机编号不能为空") | ||
| 21 | private Integer businessId; | 19 | private Integer businessId; |
| 22 | 20 | ||
| 23 | - @Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") | ||
| 24 | - @NotNull(message = "产品ID不能为空") | 21 | + // TODO @lzxhqs:这个字段,应该是 Long 类型 |
| 22 | + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") | ||
| 23 | + @NotNull(message = "产品编号不能为空") | ||
| 25 | private Integer productId; | 24 | private Integer productId; |
| 26 | 25 | ||
| 27 | @Schema(description = "产品单价", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") | 26 | @Schema(description = "产品单价", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") |
| @@ -44,7 +43,9 @@ public class CrmBusinessProductSaveReqVO { | @@ -44,7 +43,9 @@ public class CrmBusinessProductSaveReqVO { | ||
| 44 | @NotNull(message = "小计(折扣后价格)不能为空") | 43 | @NotNull(message = "小计(折扣后价格)不能为空") |
| 45 | private BigDecimal subtotal; | 44 | private BigDecimal subtotal; |
| 46 | 45 | ||
| 46 | + // TODO @lzxhqs:字符串,用 @NotEmpty,因为要考虑 "" 前端搞了这个玩意 | ||
| 47 | @Schema(description = "单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") | 47 | @Schema(description = "单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") |
| 48 | @NotNull(message = "单位不能为空") | 48 | @NotNull(message = "单位不能为空") |
| 49 | private String unit; | 49 | private String unit; |
| 50 | + | ||
| 50 | } | 51 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/status/CrmBusinessStatusSaveReqVO.java
| @@ -21,11 +21,11 @@ public class CrmBusinessStatusSaveReqVO { | @@ -21,11 +21,11 @@ public class CrmBusinessStatusSaveReqVO { | ||
| 21 | @NotEmpty(message = "状态名不能为空") | 21 | @NotEmpty(message = "状态名不能为空") |
| 22 | private String name; | 22 | private String name; |
| 23 | 23 | ||
| 24 | - // TODO @lilleo:percent 应该是 Integer; | 24 | + // TODO @lzxhqs::percent 应该是 Integer; |
| 25 | @Schema(description = "赢单率") | 25 | @Schema(description = "赢单率") |
| 26 | private String percent; | 26 | private String percent; |
| 27 | 27 | ||
| 28 | - // TODO @lilleo:这个是不是不用前端新增和修改的时候传递,交给顺序计算出来,存储起来就好了; | 28 | + // TODO @lzxhqs:这个是不是不用前端新增和修改的时候传递,交给顺序计算出来,存储起来就好了; |
| 29 | @Schema(description = "排序") | 29 | @Schema(description = "排序") |
| 30 | private Integer sort; | 30 | private Integer sort; |
| 31 | 31 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/type/CrmBusinessStatusTypeSaveReqVO.java
| @@ -19,10 +19,10 @@ public class CrmBusinessStatusTypeSaveReqVO { | @@ -19,10 +19,10 @@ public class CrmBusinessStatusTypeSaveReqVO { | ||
| 19 | @NotEmpty(message = "状态类型名不能为空") | 19 | @NotEmpty(message = "状态类型名不能为空") |
| 20 | private String name; | 20 | private String name; |
| 21 | 21 | ||
| 22 | + // TODO @lzxhqs: VO 里面,我们不使用默认值哈。这里 Lists.newArrayList() 看看怎么去掉。上面 deptIds 也是类似噢 | ||
| 22 | @Schema(description = "使用的部门编号", requiredMode = Schema.RequiredMode.REQUIRED) | 23 | @Schema(description = "使用的部门编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| 23 | private List<Long> deptIds = Lists.newArrayList(); | 24 | private List<Long> deptIds = Lists.newArrayList(); |
| 24 | 25 | ||
| 25 | - // TODO @ljlleo VO 里面,我们不使用默认值哈。这里 Lists.newArrayList() 看看怎么去掉。上面 deptIds 也是类似噢 | ||
| 26 | @Schema(description = "商机状态集合", requiredMode = Schema.RequiredMode.REQUIRED) | 26 | @Schema(description = "商机状态集合", requiredMode = Schema.RequiredMode.REQUIRED) |
| 27 | private List<CrmBusinessStatusSaveReqVO> statusList; | 27 | private List<CrmBusinessStatusSaveReqVO> statusList; |
| 28 | 28 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessproduct/CrmBusinessProductConvert.java
| @@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessProductDO; | @@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessProductDO; | ||
| 5 | import org.mapstruct.Mapper; | 5 | import org.mapstruct.Mapper; |
| 6 | import org.mapstruct.factory.Mappers; | 6 | import org.mapstruct.factory.Mappers; |
| 7 | 7 | ||
| 8 | +// TODO @lzxhqs:看看是不是用 BeanUtils 替代了 | ||
| 8 | /** | 9 | /** |
| 9 | * @author lzxhqs | 10 | * @author lzxhqs |
| 10 | * @version 1.0 | 11 | * @version 1.0 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessstatustype/CrmBusinessStatusTypeConvert.java
| @@ -14,6 +14,7 @@ import java.util.Map; | @@ -14,6 +14,7 @@ import java.util.Map; | ||
| 14 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | 14 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; |
| 15 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | 15 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; |
| 16 | 16 | ||
| 17 | +// TODO @lzxhqs:看看是不是用 BeanUtils 替代了 | ||
| 17 | /** | 18 | /** |
| 18 | * 商机状态类型 Convert | 19 | * 商机状态类型 Convert |
| 19 | * | 20 | * |
| @@ -24,7 +25,6 @@ public interface CrmBusinessStatusTypeConvert { | @@ -24,7 +25,6 @@ public interface CrmBusinessStatusTypeConvert { | ||
| 24 | 25 | ||
| 25 | CrmBusinessStatusTypeConvert INSTANCE = Mappers.getMapper(CrmBusinessStatusTypeConvert.class); | 26 | CrmBusinessStatusTypeConvert INSTANCE = Mappers.getMapper(CrmBusinessStatusTypeConvert.class); |
| 26 | 27 | ||
| 27 | - | ||
| 28 | CrmBusinessStatusTypeRespVO convert(CrmBusinessStatusTypeDO bean); | 28 | CrmBusinessStatusTypeRespVO convert(CrmBusinessStatusTypeDO bean); |
| 29 | 29 | ||
| 30 | PageResult<CrmBusinessStatusTypeRespVO> convertPage(PageResult<CrmBusinessStatusTypeDO> page); | 30 | PageResult<CrmBusinessStatusTypeRespVO> convertPage(PageResult<CrmBusinessStatusTypeDO> page); |
| @@ -38,9 +38,6 @@ public interface CrmBusinessStatusTypeConvert { | @@ -38,9 +38,6 @@ public interface CrmBusinessStatusTypeConvert { | ||
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | default CrmBusinessStatusTypeRespVO convert(CrmBusinessStatusTypeDO bean, List<CrmBusinessStatusDO> statusList) { | 40 | default CrmBusinessStatusTypeRespVO convert(CrmBusinessStatusTypeDO bean, List<CrmBusinessStatusDO> statusList) { |
| 41 | - // TODO @ljlleo 可以链式赋值,简化成一行; | ||
| 42 | -// CrmBusinessStatusTypeRespVO result = convert(bean); | ||
| 43 | -// result.setStatusList(statusList); | ||
| 44 | return convert(bean).setStatusList(statusList); | 41 | return convert(bean).setStatusList(statusList); |
| 45 | } | 42 | } |
| 46 | 43 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessDO.java
| @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.crm.dal.dataobject.business; | @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.crm.dal.dataobject.business; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 4 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 5 | -import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; | 5 | +import cn.iocoder.yudao.module.crm.enums.business.CrmBizEndStatus; |
| 6 | import com.baomidou.mybatisplus.annotation.KeySequence; | 6 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 7 | import com.baomidou.mybatisplus.annotation.TableId; | 7 | import com.baomidou.mybatisplus.annotation.TableId; |
| 8 | import com.baomidou.mybatisplus.annotation.TableName; | 8 | import com.baomidou.mybatisplus.annotation.TableName; |
| @@ -80,9 +80,9 @@ public class CrmBusinessDO extends BaseDO { | @@ -80,9 +80,9 @@ public class CrmBusinessDO extends BaseDO { | ||
| 80 | */ | 80 | */ |
| 81 | private String remark; | 81 | private String remark; |
| 82 | /** | 82 | /** |
| 83 | - * 1赢单2输单3无效 | 83 | + * 结束状态 |
| 84 | * | 84 | * |
| 85 | - * TODO @lijie:搞个枚举; | 85 | + * 枚举 {@link CrmBizEndStatus} |
| 86 | */ | 86 | */ |
| 87 | private Integer endStatus; | 87 | private Integer endStatus; |
| 88 | /** | 88 | /** |
| @@ -96,7 +96,7 @@ public class CrmBusinessDO extends BaseDO { | @@ -96,7 +96,7 @@ public class CrmBusinessDO extends BaseDO { | ||
| 96 | /** | 96 | /** |
| 97 | * 跟进状态 | 97 | * 跟进状态 |
| 98 | * | 98 | * |
| 99 | - * TODO @lijie:目前就是 Boolean;是否跟进 | 99 | + * TODO @lzxhqs:目前就是 Boolean;是否跟进 |
| 100 | */ | 100 | */ |
| 101 | private Integer followUpStatus; | 101 | private Integer followUpStatus; |
| 102 | 102 | ||
| @@ -104,7 +104,6 @@ public class CrmBusinessDO extends BaseDO { | @@ -104,7 +104,6 @@ public class CrmBusinessDO extends BaseDO { | ||
| 104 | * 负责人的用户编号 | 104 | * 负责人的用户编号 |
| 105 | * | 105 | * |
| 106 | * 关联 AdminUserDO 的 id 字段 | 106 | * 关联 AdminUserDO 的 id 字段 |
| 107 | - * {@link AdminUserDO#getId()} | ||
| 108 | */ | 107 | */ |
| 109 | private Long ownerUserId; | 108 | private Long ownerUserId; |
| 110 | 109 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessProductDO.java
| @@ -31,17 +31,20 @@ public class CrmBusinessProductDO extends BaseDO { | @@ -31,17 +31,20 @@ public class CrmBusinessProductDO extends BaseDO { | ||
| 31 | private Long id; | 31 | private Long id; |
| 32 | 32 | ||
| 33 | /** | 33 | /** |
| 34 | - * 商机ID | 34 | + * 商机编号 |
| 35 | + * | ||
| 35 | * 关联 {@link CrmBusinessDO#getId()} | 36 | * 关联 {@link CrmBusinessDO#getId()} |
| 36 | */ | 37 | */ |
| 37 | private Long businessId; | 38 | private Long businessId; |
| 38 | 39 | ||
| 39 | /** | 40 | /** |
| 40 | - * 产品ID | ||
| 41 | - * 关联{@link CrmProductDO#getId()} | 41 | + * 产品编号 |
| 42 | + * | ||
| 43 | + * 关联 {@link CrmProductDO#getId()} | ||
| 42 | */ | 44 | */ |
| 43 | private Long productId; | 45 | private Long productId; |
| 44 | 46 | ||
| 47 | + // TODO @lzxhqs:改成 Integer,单位:分。目前整体倾向放大 100 倍哈 | ||
| 45 | /** | 48 | /** |
| 46 | * 产品单价 | 49 | * 产品单价 |
| 47 | */ | 50 | */ |
| @@ -52,16 +55,19 @@ public class CrmBusinessProductDO extends BaseDO { | @@ -52,16 +55,19 @@ public class CrmBusinessProductDO extends BaseDO { | ||
| 52 | */ | 55 | */ |
| 53 | private BigDecimal salesPrice; | 56 | private BigDecimal salesPrice; |
| 54 | 57 | ||
| 58 | + // TODO @lzxhqs:改成 count | ||
| 55 | /** | 59 | /** |
| 56 | * 数量 | 60 | * 数量 |
| 57 | */ | 61 | */ |
| 58 | private BigDecimal num; | 62 | private BigDecimal num; |
| 59 | 63 | ||
| 64 | + // TODO @lzxhqs:改成 discountPercent | ||
| 60 | /** | 65 | /** |
| 61 | * 折扣 | 66 | * 折扣 |
| 62 | */ | 67 | */ |
| 63 | private BigDecimal discount; | 68 | private BigDecimal discount; |
| 64 | 69 | ||
| 70 | + // TODO @lzxhqs:改成 totalPrice;总计价格,和现有项目风格一致; | ||
| 65 | /** | 71 | /** |
| 66 | * 小计(折扣后价格) | 72 | * 小计(折扣后价格) |
| 67 | */ | 73 | */ |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessStatusDO.java
| @@ -35,9 +35,7 @@ public class CrmBusinessStatusDO { | @@ -35,9 +35,7 @@ public class CrmBusinessStatusDO { | ||
| 35 | */ | 35 | */ |
| 36 | private String name; | 36 | private String name; |
| 37 | /** | 37 | /** |
| 38 | - * 赢单率 | ||
| 39 | - * | ||
| 40 | - * TODO 这里是不是改成 Integer 存储,百分比 * 100 ; | 38 | + * 赢单率,百分比 |
| 41 | */ | 39 | */ |
| 42 | private Integer percent; | 40 | private Integer percent; |
| 43 | /** | 41 | /** |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessStatusTypeDO.java
| @@ -44,7 +44,7 @@ public class CrmBusinessStatusTypeDO extends BaseDO { | @@ -44,7 +44,7 @@ public class CrmBusinessStatusTypeDO extends BaseDO { | ||
| 44 | * 开启状态 | 44 | * 开启状态 |
| 45 | * | 45 | * |
| 46 | * TODO 改成 Integer,关联 CommonStatus | 46 | * TODO 改成 Integer,关联 CommonStatus |
| 47 | - * {@link CommonStatusEnum} | 47 | + * 枚举 {@link CommonStatusEnum} |
| 48 | */ | 48 | */ |
| 49 | private Boolean status; | 49 | private Boolean status; |
| 50 | 50 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessProductMapper.java
| @@ -6,16 +6,16 @@ import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessProductDO; | @@ -6,16 +6,16 @@ import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessProductDO; | ||
| 6 | import org.apache.ibatis.annotations.Mapper; | 6 | import org.apache.ibatis.annotations.Mapper; |
| 7 | 7 | ||
| 8 | /** | 8 | /** |
| 9 | - * 商机产品 Mapper | 9 | + * 商机产品 Mapper // TODO @lzxhqs:类注释,和作者之间要有一个空行 |
| 10 | * @author lzxhqs | 10 | * @author lzxhqs |
| 11 | */ | 11 | */ |
| 12 | @Mapper | 12 | @Mapper |
| 13 | public interface CrmBusinessProductMapper extends BaseMapperX<CrmBusinessProductDO> { | 13 | public interface CrmBusinessProductMapper extends BaseMapperX<CrmBusinessProductDO> { |
| 14 | - default void deleteByBusinessId(Long id) { | 14 | + default void deleteByBusinessId(Long id) { // TODO @lzxhqs:第一个方法,和类之间最好空一行; |
| 15 | delete(CrmBusinessProductDO::getBusinessId, id); | 15 | delete(CrmBusinessProductDO::getBusinessId, id); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | - default CrmBusinessProductDO selectByBusinessId(Long id) { | 18 | + default CrmBusinessProductDO selectByBusinessId(Long id) { // TODO @lzxhqs:id 最好改成 businessId,上面也是;这样一看更容易懂 |
| 19 | return selectOne(CrmBusinessProductDO::getBusinessId, id); | 19 | return selectOne(CrmBusinessProductDO::getBusinessId, id); |
| 20 | } | 20 | } |
| 21 | } | 21 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessStatusTypeMapper.java
| @@ -29,6 +29,7 @@ public interface CrmBusinessStatusTypeMapper extends BaseMapperX<CrmBusinessStat | @@ -29,6 +29,7 @@ public interface CrmBusinessStatusTypeMapper extends BaseMapperX<CrmBusinessStat | ||
| 29 | .inIfPresent(CrmBusinessStatusTypeDO::getId, queryVO.getIdList())); | 29 | .inIfPresent(CrmBusinessStatusTypeDO::getId, queryVO.getIdList())); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | + // TODO @lzxhqs:这个可以改成 selectByName。业务上基于在判断 id 匹配;这样更通用一些;mapper 尽量通用,不关注或者特别关联业务; | ||
| 32 | /** | 33 | /** |
| 33 | * 根据ID和name查询 | 34 | * 根据ID和name查询 |
| 34 | * | 35 | * |
| @@ -39,4 +40,5 @@ public interface CrmBusinessStatusTypeMapper extends BaseMapperX<CrmBusinessStat | @@ -39,4 +40,5 @@ public interface CrmBusinessStatusTypeMapper extends BaseMapperX<CrmBusinessStat | ||
| 39 | default CrmBusinessStatusTypeDO selectByIdAndName(Long id, String name) { | 40 | default CrmBusinessStatusTypeDO selectByIdAndName(Long id, String name) { |
| 40 | return selectOne(CrmBusinessStatusTypeDO::getId, id, CrmBusinessStatusTypeDO::getName, name); | 41 | return selectOne(CrmBusinessStatusTypeDO::getId, id, CrmBusinessStatusTypeDO::getName, name); |
| 41 | } | 42 | } |
| 43 | + | ||
| 42 | } | 44 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/CrmContractMapper.java
| @@ -63,7 +63,7 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> { | @@ -63,7 +63,7 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> { | ||
| 63 | default Long selectCountByContactId(Long contactId) { | 63 | default Long selectCountByContactId(Long contactId) { |
| 64 | return selectCount(CrmContractDO::getContactId, contactId); | 64 | return selectCount(CrmContractDO::getContactId, contactId); |
| 65 | } | 65 | } |
| 66 | - default CrmContractDO selectByBizId(Long businessId) { | 66 | + default CrmContractDO selectByBizId(Long businessId) { // TODO @lzxhqs:1)方法和方法之间要有空行;2)selectCountByBusinessId,一个是应该求数量,一个是不要缩写 BizId 可读性; |
| 67 | return selectOne(CrmContractDO::getBusinessId, businessId); | 67 | return selectOne(CrmContractDO::getBusinessId, businessId); |
| 68 | } | 68 | } |
| 69 | 69 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
| @@ -57,9 +57,11 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -57,9 +57,11 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 57 | 57 | ||
| 58 | @Resource | 58 | @Resource |
| 59 | private CrmBusinessProductMapper businessProductMapper; | 59 | private CrmBusinessProductMapper businessProductMapper; |
| 60 | + // TODO @lzxhqs:不直接调用这个 mapper,要调用对方的 service;每个业务独立收敛 | ||
| 60 | @Resource | 61 | @Resource |
| 61 | private CrmContractMapper contractMapper; | 62 | private CrmContractMapper contractMapper; |
| 62 | 63 | ||
| 64 | + // TODO @lzxhqs:不直接调用这个 mapper,要调用对方的 service;每个业务独立收敛 | ||
| 63 | @Resource | 65 | @Resource |
| 64 | private CrmContactBusinessMapper contactBusinessMapper; | 66 | private CrmContactBusinessMapper contactBusinessMapper; |
| 65 | @Resource | 67 | @Resource |
| @@ -78,7 +80,9 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -78,7 +80,9 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 78 | .setOwnerUserId(userId); | 80 | .setOwnerUserId(userId); |
| 79 | businessMapper.insert(business); | 81 | businessMapper.insert(business); |
| 80 | // TODO 商机待定:插入商机与产品的关联表;校验商品存在 | 82 | // TODO 商机待定:插入商机与产品的关联表;校验商品存在 |
| 83 | + // TODO lzxhqs:新增时,是不是不用调用这个方法哈; | ||
| 81 | verifyCrmBusinessProduct(business.getId()); | 84 | verifyCrmBusinessProduct(business.getId()); |
| 85 | + // TODO @lzxhqs:用 CollUtils.isNotEmpty; | ||
| 82 | if (!createReqVO.getProducts().isEmpty()) { | 86 | if (!createReqVO.getProducts().isEmpty()) { |
| 83 | createBusinessProducts(createReqVO.getProducts(), business.getId()); | 87 | createBusinessProducts(createReqVO.getProducts(), business.getId()); |
| 84 | } | 88 | } |
| @@ -95,6 +99,7 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -95,6 +99,7 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 95 | return business.getId(); | 99 | return business.getId(); |
| 96 | } | 100 | } |
| 97 | 101 | ||
| 102 | + // TODO @lzxhqs:CrmContactBusinessService 调用这个;这样逻辑才能收敛哈; | ||
| 98 | /** | 103 | /** |
| 99 | * @param businessId 商机id | 104 | * @param businessId 商机id |
| 100 | * @param contactId 联系人id | 105 | * @param contactId 联系人id |
| @@ -110,12 +115,14 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -110,12 +115,14 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 110 | 115 | ||
| 111 | } | 116 | } |
| 112 | 117 | ||
| 118 | + // TODO @lzxhqs:这个方法注释格式不对;删除@description,然后把 插入商机产品关联表 作为方法注释; | ||
| 113 | /** | 119 | /** |
| 114 | * @param products 产品集合 | 120 | * @param products 产品集合 |
| 115 | * @description 插入商机产品关联表 | 121 | * @description 插入商机产品关联表 |
| 116 | * @author lzxhqs | 122 | * @author lzxhqs |
| 117 | */ | 123 | */ |
| 118 | private void createBusinessProducts(List<CrmBusinessProductSaveReqVO> products, Long businessId) { | 124 | private void createBusinessProducts(List<CrmBusinessProductSaveReqVO> products, Long businessId) { |
| 125 | + // TODO @lzxhqs:可以用 CollectionUtils.convertList; | ||
| 119 | List<CrmBusinessProductDO> list = new ArrayList<>(); | 126 | List<CrmBusinessProductDO> list = new ArrayList<>(); |
| 120 | for (CrmBusinessProductSaveReqVO product : products) { | 127 | for (CrmBusinessProductSaveReqVO product : products) { |
| 121 | CrmBusinessProductDO businessProductDO = CrmBusinessProductConvert.INSTANCE.convert(product); | 128 | CrmBusinessProductDO businessProductDO = CrmBusinessProductConvert.INSTANCE.convert(product); |
| @@ -152,6 +159,7 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -152,6 +159,7 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 152 | CrmBusinessDO updateObj = BeanUtils.toBean(updateReqVO, CrmBusinessDO.class); | 159 | CrmBusinessDO updateObj = BeanUtils.toBean(updateReqVO, CrmBusinessDO.class); |
| 153 | businessMapper.updateById(updateObj); | 160 | businessMapper.updateById(updateObj); |
| 154 | // TODO 商机待定:插入商机与产品的关联表;校验商品存在 | 161 | // TODO 商机待定:插入商机与产品的关联表;校验商品存在 |
| 162 | + // TODO @lzxhqs:更新时,可以调用 CollectionUtils 的 diffList,尽量避免这种先删除再插入;而是新增的插入、变更的更新,没的删除;不然这个表每次更新,会多好多数据; | ||
| 155 | verifyCrmBusinessProduct(updateReqVO.getId()); | 163 | verifyCrmBusinessProduct(updateReqVO.getId()); |
| 156 | if (!updateReqVO.getProducts().isEmpty()) { | 164 | if (!updateReqVO.getProducts().isEmpty()) { |
| 157 | createBusinessProducts(updateReqVO.getProducts(), updateReqVO.getId()); | 165 | createBusinessProducts(updateReqVO.getProducts(), updateReqVO.getId()); |