Commit b7900c2035d23df2581d37de1d7f0d8845de8a26

Authored by YunaiV
1 parent 71ce831d

code review:回款逻辑

Showing 15 changed files with 75 additions and 43 deletions
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/AuditStatusEnum.java
@@ -4,12 +4,16 @@ import cn.iocoder.yudao.framework.common.core.IntArrayValuable; @@ -4,12 +4,16 @@ import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
4 4
5 import java.util.Arrays; 5 import java.util.Arrays;
6 6
  7 +// TODO @liuhongfeng:这个状态,还是搞成专属 CrmReceivableDO 专属的 status;
7 /** 8 /**
8 * 流程审批状态枚举类 9 * 流程审批状态枚举类
9 - * 0 未审核 1 审核通过 2 审核拒绝 3 审核中 4 已撤回 10 + * 0 未审核 1 审核通过 2 审核拒绝 3 审核中 4 已撤回 TODO @liuhongfeng:这一行可以删除,因为已经有枚举属性了哈;
10 * @author 赤焰 11 * @author 赤焰
11 */ 12 */
  13 +// TODO @liuhongfeng:可以使用 @Getter、@AllArgsConstructor 简化 get、构造方法
12 public enum AuditStatusEnum implements IntArrayValuable { 14 public enum AuditStatusEnum implements IntArrayValuable {
  15 +
  16 + // TODO @liuhongfeng:草稿 0;10 审核中;20 审核通过;30 审核拒绝;40 已撤回;主要是留好间隙,万一每个地方要做点拓展; 然后,枚举字段的顺序调整下,审批中,一定要放两个审批通过、拒绝前面哈;
13 /** 17 /**
14 * 未审批 18 * 未审批
15 */ 19 */
@@ -31,16 +35,12 @@ public enum AuditStatusEnum implements IntArrayValuable { @@ -31,16 +35,12 @@ public enum AuditStatusEnum implements IntArrayValuable {
31 */ 35 */
32 AUDIT_RETURN(4, "已撤回"); 36 AUDIT_RETURN(4, "已撤回");
33 37
  38 + // TODO liuhongfeng:value 改成 status;desc 改成 name;
34 private final Integer value; 39 private final Integer value;
35 private final String desc; 40 private final String desc;
36 41
37 public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(AuditStatusEnum::getValue).toArray(); 42 public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(AuditStatusEnum::getValue).toArray();
38 43
39 - /**  
40 - *  
41 - * @param value  
42 - * @param desc  
43 - */  
44 AuditStatusEnum(Integer value, String desc) { 44 AuditStatusEnum(Integer value, String desc) {
45 this.value = value; 45 this.value = value;
46 this.desc = desc; 46 this.desc = desc;
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ReturnTypeEnum.java
1 package cn.iocoder.yudao.module.crm.enums; 1 package cn.iocoder.yudao.module.crm.enums;
2 2
  3 +// TODO @liuhongfeng:这个的作用是?
3 /** 4 /**
4 * @author 赤焰 5 * @author 赤焰
5 */ 6 */
6 -  
7 public enum ReturnTypeEnum { 7 public enum ReturnTypeEnum {
8 } 8 }
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivableController.java
@@ -30,6 +30,7 @@ import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.E @@ -30,6 +30,7 @@ import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.E
30 @Validated 30 @Validated
31 public class CrmReceivableController { 31 public class CrmReceivableController {
32 32
  33 + // TODO @liuhongfeng:crmReceivableService 可以使用 receivableService ;在自己模块里,相对简洁一点;
33 @Resource 34 @Resource
34 private CrmReceivableService crmReceivableService; 35 private CrmReceivableService crmReceivableService;
35 36
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableBaseVO.java
@@ -20,15 +20,19 @@ public class CrmReceivableBaseVO { @@ -20,15 +20,19 @@ public class CrmReceivableBaseVO {
20 @Schema(description = "回款编号",requiredMode = Schema.RequiredMode.REQUIRED, example = "31177") 20 @Schema(description = "回款编号",requiredMode = Schema.RequiredMode.REQUIRED, example = "31177")
21 private String no; 21 private String no;
22 22
  23 + // TODO @liuhongfeng:回款计划编号
23 @Schema(description = "回款计划", example = "31177") 24 @Schema(description = "回款计划", example = "31177")
24 private Long planId; 25 private Long planId;
25 26
  27 + // TODO @liuhongfeng:客户编号
26 @Schema(description = "客户名称", example = "4963") 28 @Schema(description = "客户名称", example = "4963")
27 private Long customerId; 29 private Long customerId;
28 30
  31 + // TODO @liuhongfeng:客户编号
29 @Schema(description = "合同名称", example = "30305") 32 @Schema(description = "合同名称", example = "30305")
30 private Long contractId; 33 private Long contractId;
31 34
  35 + // TODO @liuhongfeng:这个字段,应该不是前端传递的噢,而是后端自己生成的
32 @Schema(description = "审批状态", example = "1") 36 @Schema(description = "审批状态", example = "1")
33 @InEnum(AuditStatusEnum.class) 37 @InEnum(AuditStatusEnum.class)
34 private Integer checkStatus; 38 private Integer checkStatus;
@@ -40,9 +44,10 @@ public class CrmReceivableBaseVO { @@ -40,9 +44,10 @@ public class CrmReceivableBaseVO {
40 @Schema(description = "回款方式", example = "2") 44 @Schema(description = "回款方式", example = "2")
41 private String returnType; 45 private String returnType;
42 46
43 - @Schema(description = "回款金额", example = "31859") 47 + @Schema(description = "回款金额,单位:分", example = "31859")
44 private Integer price; 48 private Integer price;
45 49
  50 + // TODO @liuhongfeng:负责人编号
46 @Schema(description = "负责人", example = "22202") 51 @Schema(description = "负责人", example = "22202")
47 private Long ownerUserId; 52 private Long ownerUserId;
48 53
@@ -55,6 +60,7 @@ public class CrmReceivableBaseVO { @@ -55,6 +60,7 @@ public class CrmReceivableBaseVO {
55 @Schema(description = "备注", example = "备注") 60 @Schema(description = "备注", example = "备注")
56 private String remark; 61 private String remark;
57 62
  63 + // TODO @liuhongfeng:这个字段,这个字段,应该不是前端传递的噢,而是后端自己生成的,所以不适合放在 base 里面;
58 @Schema(description = "完成状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") 64 @Schema(description = "完成状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
59 private Integer status; 65 private Integer status;
60 66
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableExcelVO.java
1 package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo; 1 package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
2 2
3 -import cn.iocoder.yudao.module.system.enums.DictTypeConstants;  
4 -import lombok.*;  
5 -  
6 -import java.time.LocalDateTime;  
7 -  
8 -import com.alibaba.excel.annotation.ExcelProperty;  
9 import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; 3 import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
10 import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; 4 import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
  5 +import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
  6 +import com.alibaba.excel.annotation.ExcelProperty;
  7 +import lombok.Data;
11 8
  9 +import java.time.LocalDateTime;
12 10
13 -/**  
14 - * CRM 回款管理 Excel VO  
15 - *  
16 - * @author 赤焰  
17 - */ 11 +// TODO liuhongfeng:导出可以等其它功能做完,统一在搞;
18 @Data 12 @Data
19 public class CrmReceivableExcelVO { 13 public class CrmReceivableExcelVO {
20 14
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivableExportReqVO.java
@@ -8,9 +8,7 @@ import java.time.LocalDateTime; @@ -8,9 +8,7 @@ import java.time.LocalDateTime;
8 8
9 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; 9 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
10 10
11 -/**  
12 - * @author 赤焰  
13 - */ 11 +// TODO liuhongfeng:导出可以等其它功能做完,统一在搞;
14 @Schema(description = "管理后台 - CRM 回款 Excel 导出 Request VO,参数和 CrmReceivablePageReqVO 是一致的") 12 @Schema(description = "管理后台 - CRM 回款 Excel 导出 Request VO,参数和 CrmReceivablePageReqVO 是一致的")
15 @Data 13 @Data
16 public class CrmReceivableExportReqVO { 14 public class CrmReceivableExportReqVO {
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivablePageReqVO.java
@@ -17,6 +17,8 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @@ -17,6 +17,8 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
17 @ToString(callSuper = true) 17 @ToString(callSuper = true)
18 public class CrmReceivablePageReqVO extends PageParam { 18 public class CrmReceivablePageReqVO extends PageParam {
19 19
  20 + // TODO @liuhongfeng:可以根据需求,去除掉一些不要的过滤条件;另外,planId、customerId、contractId、ownerUserId 注释不正确,应该都是对应的编号
  21 +
20 @Schema(description = "回款编号") 22 @Schema(description = "回款编号")
21 private String no; 23 private String no;
22 24
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivablePlanBaseVO.java
@@ -20,6 +20,7 @@ public class CrmReceivablePlanBaseVO { @@ -20,6 +20,7 @@ public class CrmReceivablePlanBaseVO {
20 @Schema(description = "期数", example = "1") 20 @Schema(description = "期数", example = "1")
21 private Integer period; 21 private Integer period;
22 22
  23 + // TODO @liuhongfeng:回款计划编号
23 @Schema(description = "回款计划", example = "19852") 24 @Schema(description = "回款计划", example = "19852")
24 private Long receivableId; 25 private Long receivableId;
25 26
@@ -44,12 +45,15 @@ public class CrmReceivablePlanBaseVO { @@ -44,12 +45,15 @@ public class CrmReceivablePlanBaseVO {
44 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) 45 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
45 private LocalDateTime remindTime; 46 private LocalDateTime remindTime;
46 47
  48 + // TODO @liuhongfeng:客户编号
47 @Schema(description = "客户名称", example = "18026") 49 @Schema(description = "客户名称", example = "18026")
48 private Long customerId; 50 private Long customerId;
49 51
  52 + // TODO @liuhongfeng:合同编号
50 @Schema(description = "合同名称", example = "3473") 53 @Schema(description = "合同名称", example = "3473")
51 private Long contractId; 54 private Long contractId;
52 55
  56 + // TODO @liuhongfeng:负责人编号
53 @Schema(description = "负责人", example = "17828") 57 @Schema(description = "负责人", example = "17828")
54 private Long ownerUserId; 58 private Long ownerUserId;
55 59
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivablePlanExcelVO.java
1 package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo; 1 package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
2 2
3 -import cn.iocoder.yudao.module.system.enums.DictTypeConstants;  
4 -import lombok.*;  
5 -  
6 -import java.time.LocalDateTime;  
7 -  
8 -import com.alibaba.excel.annotation.ExcelProperty;  
9 import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; 3 import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
10 import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; 4 import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
  5 +import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
  6 +import com.alibaba.excel.annotation.ExcelProperty;
  7 +import lombok.Data;
11 8
  9 +import java.time.LocalDateTime;
12 10
  11 +// TODO liuhongfeng:导出可以等其它功能做完,统一在搞;
13 /** 12 /**
14 * CRM 回款计划 Excel VO 13 * CRM 回款计划 Excel VO
15 * 14 *
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivablePlanExportReqVO.java
1 package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo; 1 package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
2 2
3 -import lombok.*;  
4 import io.swagger.v3.oas.annotations.media.Schema; 3 import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.Data;
  5 +import org.springframework.format.annotation.DateTimeFormat;
5 6
6 import java.time.LocalDateTime; 7 import java.time.LocalDateTime;
7 -import org.springframework.format.annotation.DateTimeFormat;  
8 8
9 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; 9 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
10 10
  11 +// TODO liuhongfeng:导出可以等其它功能做完,统一在搞;
11 @Schema(description = "管理后台 - CRM 回款计划 Excel 导出 Request VO,参数和 CrmReceivablePlanPageReqVO 是一致的") 12 @Schema(description = "管理后台 - CRM 回款计划 Excel 导出 Request VO,参数和 CrmReceivablePlanPageReqVO 是一致的")
12 @Data 13 @Data
13 public class CrmReceivablePlanExportReqVO { 14 public class CrmReceivablePlanExportReqVO {
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/CrmReceivablePlanPageReqVO.java
@@ -17,6 +17,8 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @@ -17,6 +17,8 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
17 @ToString(callSuper = true) 17 @ToString(callSuper = true)
18 public class CrmReceivablePlanPageReqVO extends PageParam { 18 public class CrmReceivablePlanPageReqVO extends PageParam {
19 19
  20 + // TODO @liuhongfeng:可以根据需求,去除掉一些不要的过滤条件;另外,customerId、contractId、ownerUserId 注释不正确,应该都是对应的编号
  21 +
20 @Schema(description = "完成状态", example = "2") 22 @Schema(description = "完成状态", example = "2")
21 private Integer status; 23 private Integer status;
22 24
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/receivable/CrmReceivableDO.java
@@ -32,24 +32,28 @@ public class CrmReceivableDO extends BaseDO { @@ -32,24 +32,28 @@ public class CrmReceivableDO extends BaseDO {
32 * 回款编号 32 * 回款编号
33 */ 33 */
34 private String no; 34 private String no;
  35 + // TODO @liuhongfeng:“对应实体”,参考别的模块,关联 {@link TableField.MetaInfo#getJdbcType()}
35 /** 36 /**
36 * 回款计划 37 * 回款计划
37 * 38 *
  39 + * TODO @liuhongfeng:这个字段什么时候更新,也可以写下
  40 + *
38 * 对应实体 {@link CrmReceivablePlanDO} 41 * 对应实体 {@link CrmReceivablePlanDO}
39 */ 42 */
40 private Long planId; 43 private Long planId;
41 /** 44 /**
42 - * 客户ID 45 + * 客户 ID
43 * 46 *
44 * 对应实体 {@link cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO} 47 * 对应实体 {@link cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO}
45 */ 48 */
46 private Long customerId; 49 private Long customerId;
47 /** 50 /**
48 - * 合同ID 51 + * 合同 ID
49 * 52 *
50 * 对应实体 {@link cn.iocoder.yudao.module.crm.dal.dataobject.contract.ContractDO} 53 * 对应实体 {@link cn.iocoder.yudao.module.crm.dal.dataobject.contract.ContractDO}
51 */ 54 */
52 private Long contractId; 55 private Long contractId;
  56 + // TODO @liuhongfeng:“对应字典”,参考别的模块,枚举 {@link XXXX};另外,这个字段就叫 status,整体状态,不只审批
53 /** 57 /**
54 * 审批状态 58 * 审批状态
55 * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_RECEIVABLE_CHECK_STATUS} 59 * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_RECEIVABLE_CHECK_STATUS}
@@ -65,6 +69,7 @@ public class CrmReceivableDO extends BaseDO { @@ -65,6 +69,7 @@ public class CrmReceivableDO extends BaseDO {
65 * 回款日期 69 * 回款日期
66 */ 70 */
67 private LocalDateTime returnTime; 71 private LocalDateTime returnTime;
  72 + // TODO @liuhongfeng:少个枚举
68 /** 73 /**
69 * 回款方式 74 * 回款方式
70 */ 75 */
@@ -73,10 +78,12 @@ public class CrmReceivableDO extends BaseDO { @@ -73,10 +78,12 @@ public class CrmReceivableDO extends BaseDO {
73 * 回款金额 78 * 回款金额
74 */ 79 */
75 private Integer price; 80 private Integer price;
  81 + // TODO @liuhongfeng:少关联实体;
76 /** 82 /**
77 * 负责人 83 * 负责人
78 */ 84 */
79 private Long ownerUserId; 85 private Long ownerUserId;
  86 + // TODO @liuhongfeng:应该不需要 batchId 字段
80 /** 87 /**
81 * 批次 88 * 批次
82 */ 89 */
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/receivable/CrmReceivablePlanDO.java
1 package cn.iocoder.yudao.module.crm.dal.dataobject.receivable; 1 package cn.iocoder.yudao.module.crm.dal.dataobject.receivable;
2 2
  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;
3 import lombok.*; 7 import lombok.*;
4 8
5 import java.time.LocalDateTime; 9 import java.time.LocalDateTime;
6 10
7 -import com.baomidou.mybatisplus.annotation.*;  
8 -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;  
9 -  
10 /** 11 /**
11 * 回款计划 DO 12 * 回款计划 DO
12 * 13 *
@@ -33,26 +34,32 @@ public class CrmReceivablePlanDO extends BaseDO { @@ -33,26 +34,32 @@ public class CrmReceivablePlanDO extends BaseDO {
33 private Integer period; 34 private Integer period;
34 /** 35 /**
35 * 回款ID 36 * 回款ID
  37 + *
  38 + * TODO @liuhongfeng:少关联实体;
36 */ 39 */
37 private Long receivableId; 40 private Long receivableId;
  41 + // TODO @liuhongfeng:还款计划,没有 status 和 checkStatus,改成 finishStatus Boolean;是否完成
38 /** 42 /**
39 * 状态 43 * 状态
40 * 44 *
41 * 枚举 {@link cn.iocoder.yudao.framework.common.enums.CommonStatusEnum} 45 * 枚举 {@link cn.iocoder.yudao.framework.common.enums.CommonStatusEnum}
42 - *  
43 */ 46 */
44 private Integer status; 47 private Integer status;
45 /** 48 /**
46 * 审批状态 49 * 审批状态
  50 + *
47 * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_RECEIVABLE_CHECK_STATUS} 51 * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_RECEIVABLE_CHECK_STATUS}
  52 + * // TODO @liuhongfeng:关联的枚举
48 */ 53 */
49 private Integer checkStatus; 54 private Integer checkStatus;
50 /** 55 /**
51 * 工作流编号 56 * 工作流编号
  57 + *
  58 + * TODO @liuhongfeng:少关联实体;
52 */ 59 */
53 private Long processInstanceId; 60 private Long processInstanceId;
54 /** 61 /**
55 - * 计划回款金额 62 + * 计划回款金额,单位:分
56 */ 63 */
57 private Integer price; 64 private Integer price;
58 /** 65 /**
@@ -68,15 +75,21 @@ public class CrmReceivablePlanDO extends BaseDO { @@ -68,15 +75,21 @@ public class CrmReceivablePlanDO extends BaseDO {
68 */ 75 */
69 private LocalDateTime remindTime; 76 private LocalDateTime remindTime;
70 /** 77 /**
71 - * 客户ID 78 + * 客户 ID
  79 + *
  80 + * TODO @liuhongfeng:少关联实体;
72 */ 81 */
73 private Long customerId; 82 private Long customerId;
74 /** 83 /**
75 - * 合同ID 84 + * 合同 ID
  85 + *
  86 + * TODO @liuhongfeng:少关联实体;
76 */ 87 */
77 private Long contractId; 88 private Long contractId;
78 /** 89 /**
79 - * 负责人 90 + * 负责人 ID
  91 + *
  92 + * TODO @liuhongfeng:少关联实体;
80 */ 93 */
81 private Long ownerUserId; 94 private Long ownerUserId;
82 /** 95 /**
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivablePlanServiceImpl.java
@@ -27,6 +27,7 @@ import java.util.List; @@ -27,6 +27,7 @@ import java.util.List;
27 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; 27 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
28 import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; 28 import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
29 29
  30 +// TODO @liuhongfeng:参考 CrmReceivableServiceImpl 写的 todo 哈;
30 /** 31 /**
31 * 回款计划 Service 实现类 32 * 回款计划 Service 实现类
32 * 33 *
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableServiceImpl.java
@@ -37,6 +37,7 @@ import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; @@ -37,6 +37,7 @@ import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
37 @Validated 37 @Validated
38 public class CrmReceivableServiceImpl implements CrmReceivableService { 38 public class CrmReceivableServiceImpl implements CrmReceivableService {
39 39
  40 + // TODO @liuhongfeng:crm 前缀,变量可以不带哈;
40 @Resource 41 @Resource
41 private CrmReceivableMapper crmReceivableMapper; 42 private CrmReceivableMapper crmReceivableMapper;
42 @Resource 43 @Resource
@@ -46,10 +47,12 @@ public class CrmReceivableServiceImpl implements CrmReceivableService { @@ -46,10 +47,12 @@ public class CrmReceivableServiceImpl implements CrmReceivableService {
46 @Resource 47 @Resource
47 private CrmReceivablePlanService crmReceivablePlanService; 48 private CrmReceivablePlanService crmReceivablePlanService;
48 49
  50 + // TODO @liuhongfeng:创建还款后,是不是什么时候,要更新 plan?
49 @Override 51 @Override
50 public Long createReceivable(CrmReceivableCreateReqVO createReqVO) { 52 public Long createReceivable(CrmReceivableCreateReqVO createReqVO) {
51 // 插入 53 // 插入
52 CrmReceivableDO receivable = CrmReceivableConvert.INSTANCE.convert(createReqVO); 54 CrmReceivableDO receivable = CrmReceivableConvert.INSTANCE.convert(createReqVO);
  55 + // TODO @liuhongfeng:这里的括号要注意排版;
53 if (ObjectUtil.isNull(receivable.getStatus())){ 56 if (ObjectUtil.isNull(receivable.getStatus())){
54 receivable.setStatus(CommonStatusEnum.ENABLE.getStatus()); 57 receivable.setStatus(CommonStatusEnum.ENABLE.getStatus());
55 } 58 }
@@ -57,16 +60,17 @@ public class CrmReceivableServiceImpl implements CrmReceivableService { @@ -57,16 +60,17 @@ public class CrmReceivableServiceImpl implements CrmReceivableService {
57 receivable.setCheckStatus(AuditStatusEnum.AUDIT_NEW.getValue()); 60 receivable.setCheckStatus(AuditStatusEnum.AUDIT_NEW.getValue());
58 } 61 }
59 62
60 - //校验 63 + // TODO @liuhongfeng:一般来说,逻辑的写法,是要先检查,后操作 db;所以,你这个 check 应该放到 CrmReceivableDO receivable 之前;
  64 + // 校验
61 checkReceivable(receivable); 65 checkReceivable(receivable);
62 66
63 crmReceivableMapper.insert(receivable); 67 crmReceivableMapper.insert(receivable);
64 - // 返回  
65 return receivable.getId(); 68 return receivable.getId();
66 } 69 }
67 70
  71 + // TODO @liuhongfeng:这里的括号要注意排版;
68 private void checkReceivable(CrmReceivableDO receivable) { 72 private void checkReceivable(CrmReceivableDO receivable) {
69 - 73 + // TODO @liuhongfeng:这个放在参数校验合适
70 if(ObjectUtil.isNull(receivable.getContractId())){ 74 if(ObjectUtil.isNull(receivable.getContractId())){
71 throw exception(CONTRACT_NOT_EXISTS); 75 throw exception(CONTRACT_NOT_EXISTS);
72 } 76 }