Commit 6f8fd383f7f6989616594966918f318c8d6f31fb

Authored by YunaiV
1 parent 24e6deb8

code review:CRM 商机的逻辑

yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java
@@ -19,7 +19,6 @@ import javax.annotation.Resource; @@ -19,7 +19,6 @@ import javax.annotation.Resource;
19 import javax.servlet.http.HttpServletResponse; 19 import javax.servlet.http.HttpServletResponse;
20 import javax.validation.Valid; 20 import javax.validation.Valid;
21 import java.io.IOException; 21 import java.io.IOException;
22 -import java.util.Collection;  
23 import java.util.List; 22 import java.util.List;
24 23
25 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; 24 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@@ -67,15 +66,6 @@ public class CrmBusinessController { @@ -67,15 +66,6 @@ public class CrmBusinessController {
67 return success(CrmBusinessConvert.INSTANCE.convert(business)); 66 return success(CrmBusinessConvert.INSTANCE.convert(business));
68 } 67 }
69 68
70 - @GetMapping("/list")  
71 - @Operation(summary = "获得商机列表")  
72 - @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")  
73 - @PreAuthorize("@ss.hasPermission('crm:business:query')")  
74 - public CommonResult<List<CrmBusinessRespVO>> getBusinessList(@RequestParam("ids") Collection<Long> ids) {  
75 - List<CrmBusinessDO> list = businessService.getBusinessList(ids);  
76 - return success(CrmBusinessConvert.INSTANCE.convertList(list));  
77 - }  
78 -  
79 @GetMapping("/page") 69 @GetMapping("/page")
80 @Operation(summary = "获得商机分页") 70 @Operation(summary = "获得商机分页")
81 @PreAuthorize("@ss.hasPermission('crm:business:query')") 71 @PreAuthorize("@ss.hasPermission('crm:business:query')")
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessBaseVO.java
@@ -21,10 +21,12 @@ public class CrmBusinessBaseVO { @@ -21,10 +21,12 @@ public class CrmBusinessBaseVO {
21 @NotNull(message = "商机名称不能为空") 21 @NotNull(message = "商机名称不能为空")
22 private String name; 22 private String name;
23 23
  24 + // TODO @ljileo:要写 requiredMode = Schema.RequiredMode.REQUIRED
24 @Schema(description = "商机状态类型编号", example = "25714") 25 @Schema(description = "商机状态类型编号", example = "25714")
25 @NotNull(message = "商机状态类型不能为空") 26 @NotNull(message = "商机状态类型不能为空")
26 private Long statusTypeId; 27 private Long statusTypeId;
27 28
  29 + // TODO @ljileo:要写 requiredMode = Schema.RequiredMode.REQUIRED
28 @Schema(description = "商机状态编号", example = "30320") 30 @Schema(description = "商机状态编号", example = "30320")
29 @NotNull(message = "商机状态不能为空") 31 @NotNull(message = "商机状态不能为空")
30 private Long statusId; 32 private Long statusId;
@@ -41,9 +43,11 @@ public class CrmBusinessBaseVO { @@ -41,9 +43,11 @@ public class CrmBusinessBaseVO {
41 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) 43 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
42 private LocalDateTime dealTime; 44 private LocalDateTime dealTime;
43 45
  46 + // TODO @ljileo:金额使用 Integer 类型,转换成分
44 @Schema(description = "商机金额", example = "12371") 47 @Schema(description = "商机金额", example = "12371")
45 private BigDecimal price; 48 private BigDecimal price;
46 49
  50 + // TODO @ljileo:折扣使用 Integer 类型,存储时,默认 * 100;展示的时候,前端需要 / 100;避免精度丢失问题
47 @Schema(description = "整单折扣") 51 @Schema(description = "整单折扣")
48 private BigDecimal discountPercent; 52 private BigDecimal discountPercent;
49 53
@@ -53,25 +57,32 @@ public class CrmBusinessBaseVO { @@ -53,25 +57,32 @@ public class CrmBusinessBaseVO {
53 @Schema(description = "备注", example = "随便") 57 @Schema(description = "备注", example = "随便")
54 private String remark; 58 private String remark;
55 59
  60 + // TODO @ljileo:这个新建和修改的时候,应该不传递哈;应该新建的人,就是它的负责人
56 @Schema(description = "负责人的用户编号", example = "25562") 61 @Schema(description = "负责人的用户编号", example = "25562")
57 private Long ownerUserId; 62 private Long ownerUserId;
58 63
  64 + // TODO @ljileo:这个新建和修改的时候,应该不传递哈
59 @Schema(description = "只读权限的用户编号数组", requiredMode = Schema.RequiredMode.REQUIRED) 65 @Schema(description = "只读权限的用户编号数组", requiredMode = Schema.RequiredMode.REQUIRED)
60 private String roUserIds; 66 private String roUserIds;
61 67
  68 + // TODO @ljileo:这个新建和修改的时候,应该不传递哈
62 @Schema(description = "读写权限的用户编号数组", requiredMode = Schema.RequiredMode.REQUIRED) 69 @Schema(description = "读写权限的用户编号数组", requiredMode = Schema.RequiredMode.REQUIRED)
63 private String rwUserIds; 70 private String rwUserIds;
64 71
  72 + // TODO @lijieo:新建的时候,不传递这个字段哈;
65 @Schema(description = "1赢单2输单3无效", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 73 @Schema(description = "1赢单2输单3无效", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
66 private Integer endStatus; 74 private Integer endStatus;
67 75
  76 + // TODO @lijieo:新建的时候,不传递这个字段哈;
68 @Schema(description = "结束时的备注", example = "你说的对") 77 @Schema(description = "结束时的备注", example = "你说的对")
69 private String endRemark; 78 private String endRemark;
70 79
  80 + // TODO @lijieo:新建的时候,不传递这个字段哈;
71 @Schema(description = "最后跟进时间") 81 @Schema(description = "最后跟进时间")
72 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) 82 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
73 private LocalDateTime contactLastTime; 83 private LocalDateTime contactLastTime;
74 84
  85 + // TODO @lijieo:新建的时候,不传递这个字段哈;
75 @Schema(description = "跟进状态", example = "1") 86 @Schema(description = "跟进状态", example = "1")
76 private Integer followUpStatus; 87 private Integer followUpStatus;
77 88
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessCreateReqVO.java
1 package cn.iocoder.yudao.module.crm.controller.admin.business.vo; 1 package cn.iocoder.yudao.module.crm.controller.admin.business.vo;
2 2
3 -import lombok.*;  
4 -import java.util.*;  
5 import io.swagger.v3.oas.annotations.media.Schema; 3 import io.swagger.v3.oas.annotations.media.Schema;
6 -import javax.validation.constraints.*; 4 +import lombok.Data;
  5 +import lombok.EqualsAndHashCode;
  6 +import lombok.ToString;
7 7
8 @Schema(description = "管理后台 - 商机创建 Request VO") 8 @Schema(description = "管理后台 - 商机创建 Request VO")
9 @Data 9 @Data
@@ -11,4 +11,6 @@ import javax.validation.constraints.*; @@ -11,4 +11,6 @@ import javax.validation.constraints.*;
11 @ToString(callSuper = true) 11 @ToString(callSuper = true)
12 public class CrmBusinessCreateReqVO extends CrmBusinessBaseVO { 12 public class CrmBusinessCreateReqVO extends CrmBusinessBaseVO {
13 13
  14 + // TODO @ljileo:新建的时候,应该可以传递添加的产品;
  15 +
14 } 16 }
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessPageReqVO.java
@@ -18,6 +18,8 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @@ -18,6 +18,8 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
18 @ToString(callSuper = true) 18 @ToString(callSuper = true)
19 public class CrmBusinessPageReqVO extends PageParam { 19 public class CrmBusinessPageReqVO extends PageParam {
20 20
  21 + // TODO @ljileo:目前就使用 name 检索即可;
  22 +
21 @Schema(description = "商机名称", example = "李四") 23 @Schema(description = "商机名称", example = "李四")
22 private String name; 24 private String name;
23 25
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessUpdateReqVO.java
1 package cn.iocoder.yudao.module.crm.controller.admin.business.vo; 1 package cn.iocoder.yudao.module.crm.controller.admin.business.vo;
2 2
3 import io.swagger.v3.oas.annotations.media.Schema; 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 @Schema(description = "管理后台 - 商机更新 Request VO") 10 @Schema(description = "管理后台 - 商机更新 Request VO")
9 @Data 11 @Data
@@ -15,4 +17,6 @@ public class CrmBusinessUpdateReqVO extends CrmBusinessBaseVO { @@ -15,4 +17,6 @@ public class CrmBusinessUpdateReqVO extends CrmBusinessBaseVO {
15 @NotNull(message = "主键不能为空") 17 @NotNull(message = "主键不能为空")
16 private Long id; 18 private Long id;
17 19
  20 + // TODO @ljileo:修改的时候,应该可以传递添加的产品;
  21 +
18 } 22 }
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/business/CrmBusinessConvert.java
@@ -25,8 +25,6 @@ public interface CrmBusinessConvert { @@ -25,8 +25,6 @@ public interface CrmBusinessConvert {
25 25
26 CrmBusinessRespVO convert(CrmBusinessDO bean); 26 CrmBusinessRespVO convert(CrmBusinessDO bean);
27 27
28 - List<CrmBusinessRespVO> convertList(List<CrmBusinessDO> list);  
29 -  
30 PageResult<CrmBusinessRespVO> convertPage(PageResult<CrmBusinessDO> page); 28 PageResult<CrmBusinessRespVO> convertPage(PageResult<CrmBusinessDO> page);
31 29
32 List<CrmBusinessExcelVO> convertList02(List<CrmBusinessDO> list); 30 List<CrmBusinessExcelVO> convertList02(List<CrmBusinessDO> list);
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessDO.java
@@ -35,10 +35,14 @@ public class CrmBusinessDO extends BaseDO { @@ -35,10 +35,14 @@ public class CrmBusinessDO extends BaseDO {
35 private String name; 35 private String name;
36 /** 36 /**
37 * 商机状态类型编号 37 * 商机状态类型编号
  38 + *
  39 + * TODO @ljileo:这个字段,后续要写下关联的实体哈
38 */ 40 */
39 private Long statusTypeId; 41 private Long statusTypeId;
40 /** 42 /**
41 * 商机状态编号 43 * 商机状态编号
  44 + *
  45 + * TODO @ljileo:这个字段,后续要写下关联的实体哈
42 */ 46 */
43 private Long statusId; 47 private Long statusId;
44 /** 48 /**
@@ -47,6 +51,8 @@ public class CrmBusinessDO extends BaseDO { @@ -47,6 +51,8 @@ public class CrmBusinessDO extends BaseDO {
47 private LocalDateTime contactNextTime; 51 private LocalDateTime contactNextTime;
48 /** 52 /**
49 * 客户编号 53 * 客户编号
  54 + *
  55 + * TODO @ljileo:这个字段,后续要写下关联的实体哈
50 */ 56 */
51 private Long customerId; 57 private Long customerId;
52 /** 58 /**
@@ -55,14 +61,20 @@ public class CrmBusinessDO extends BaseDO { @@ -55,14 +61,20 @@ public class CrmBusinessDO extends BaseDO {
55 private LocalDateTime dealTime; 61 private LocalDateTime dealTime;
56 /** 62 /**
57 * 商机金额 63 * 商机金额
  64 + *
  65 + * TODO @lijie:Integer
58 */ 66 */
59 private BigDecimal price; 67 private BigDecimal price;
60 /** 68 /**
61 * 整单折扣 69 * 整单折扣
  70 + *
  71 + * TODO @lijie:Integer
62 */ 72 */
63 private BigDecimal discountPercent; 73 private BigDecimal discountPercent;
64 /** 74 /**
65 * 产品总金额 75 * 产品总金额
  76 + *
  77 + * TODO @lijie:Integer
66 */ 78 */
67 private BigDecimal productPrice; 79 private BigDecimal productPrice;
68 /** 80 /**
@@ -75,14 +87,20 @@ public class CrmBusinessDO extends BaseDO { @@ -75,14 +87,20 @@ public class CrmBusinessDO extends BaseDO {
75 private Long ownerUserId; 87 private Long ownerUserId;
76 /** 88 /**
77 * 只读权限的用户编号数组 89 * 只读权限的用户编号数组
  90 + *
  91 + * TODO @lijie:应该是 List<Long>,然后使用下对应的 typehandler
78 */ 92 */
79 private String roUserIds; 93 private String roUserIds;
80 /** 94 /**
81 * 读写权限的用户编号数组 95 * 读写权限的用户编号数组
  96 + *
  97 + * TODO @lijie:应该是 List<Long>,然后使用下对应的 typehandler
82 */ 98 */
83 private String rwUserIds; 99 private String rwUserIds;
84 /** 100 /**
85 * 1赢单2输单3无效 101 * 1赢单2输单3无效
  102 + *
  103 + * TODO @lijie:搞个枚举;
86 */ 104 */
87 private Integer endStatus; 105 private Integer endStatus;
88 /** 106 /**
@@ -95,6 +113,8 @@ public class CrmBusinessDO extends BaseDO { @@ -95,6 +113,8 @@ public class CrmBusinessDO extends BaseDO {
95 private LocalDateTime contactLastTime; 113 private LocalDateTime contactLastTime;
96 /** 114 /**
97 * 跟进状态 115 * 跟进状态
  116 + *
  117 + * TODO @lijie:目前就是 Boolean;是否跟进
98 */ 118 */
99 private Integer followUpStatus; 119 private Integer followUpStatus;
100 120