Commit 5955f39e24aa0de718ac91f33f1539ed78a2cbaf

Authored by YunaiV
1 parent a03e661a

📖 CRM:code review 待办项目的实现

yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractPageReqVO.java
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.crm.controller.admin.contract.vo; @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.crm.controller.admin.contract.vo;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageParam; 3 import cn.iocoder.yudao.framework.common.pojo.PageParam;
4 import cn.iocoder.yudao.framework.common.validation.InEnum; 4 import cn.iocoder.yudao.framework.common.validation.InEnum;
  5 +import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum;
5 import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum; 6 import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum;
6 import io.swagger.v3.oas.annotations.media.Schema; 7 import io.swagger.v3.oas.annotations.media.Schema;
7 import lombok.Data; 8 import lombok.Data;
@@ -14,7 +15,13 @@ import lombok.ToString; @@ -14,7 +15,13 @@ import lombok.ToString;
14 @ToString(callSuper = true) 15 @ToString(callSuper = true)
15 public class CrmContractPageReqVO extends PageParam { 16 public class CrmContractPageReqVO extends PageParam {
16 17
  18 + /**
  19 + * 过期类型 - 即将过期
  20 + */
17 public static final Integer EXPIRY_TYPE_ABOUT_TO_EXPIRE = 1; 21 public static final Integer EXPIRY_TYPE_ABOUT_TO_EXPIRE = 1;
  22 + /**
  23 + * 过期类型 - 已过期
  24 + */
18 public static final Integer EXPIRY_TYPE_EXPIRED = 2; 25 public static final Integer EXPIRY_TYPE_EXPIRED = 2;
19 26
20 @Schema(description = "合同编号", example = "XYZ008") 27 @Schema(description = "合同编号", example = "XYZ008")
@@ -34,6 +41,7 @@ public class CrmContractPageReqVO extends PageParam { @@ -34,6 +41,7 @@ public class CrmContractPageReqVO extends PageParam {
34 private Integer sceneType; // 场景类型,为 null 时则表示全部 41 private Integer sceneType; // 场景类型,为 null 时则表示全部
35 42
36 @Schema(description = "审批状态", example = "20") 43 @Schema(description = "审批状态", example = "20")
  44 + @InEnum(CrmAuditStatusEnum.class)
37 private Integer auditStatus; 45 private Integer auditStatus;
38 46
39 @Schema(description = "过期类型", example = "1") 47 @Schema(description = "过期类型", example = "1")
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanPageReqVO.java
@@ -14,12 +14,18 @@ import lombok.ToString; @@ -14,12 +14,18 @@ import lombok.ToString;
14 @ToString(callSuper = true) 14 @ToString(callSuper = true)
15 public class CrmReceivablePlanPageReqVO extends PageParam { 15 public class CrmReceivablePlanPageReqVO extends PageParam {
16 16
17 - // 待回款  
18 - public final static Integer REMIND_NEEDED = 1;  
19 - // 已逾期  
20 - public final static Integer REMIND_EXPIRED = 2;  
21 - // 已回款  
22 - public final static Integer REMIND_RECEIVED = 3; 17 + /**
  18 + * 提醒类型 - 待回款
  19 + */
  20 + public final static Integer REMIND_TYPE_NEEDED = 1;
  21 + /**
  22 + * 提醒类型 - 已逾期
  23 + */
  24 + public final static Integer REMIND_TYPE_EXPIRED = 2;
  25 + /**
  26 + * 提醒类型 - 已回款
  27 + */
  28 + public final static Integer REMIND_TYPE_RECEIVED = 3;
23 29
24 @Schema(description = "客户编号", example = "18026") 30 @Schema(description = "客户编号", example = "18026")
25 private Long customerId; 31 private Long customerId;
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivablePageReqVO.java
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable; @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageParam; 3 import cn.iocoder.yudao.framework.common.pojo.PageParam;
4 import cn.iocoder.yudao.framework.common.validation.InEnum; 4 import cn.iocoder.yudao.framework.common.validation.InEnum;
  5 +import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum;
5 import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum; 6 import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum;
6 import io.swagger.v3.oas.annotations.media.Schema; 7 import io.swagger.v3.oas.annotations.media.Schema;
7 import lombok.Data; 8 import lombok.Data;
@@ -28,6 +29,7 @@ public class CrmReceivablePageReqVO extends PageParam { @@ -28,6 +29,7 @@ public class CrmReceivablePageReqVO extends PageParam {
28 private Integer sceneType; // 场景类型,为 null 时则表示全部 29 private Integer sceneType; // 场景类型,为 null 时则表示全部
29 30
30 @Schema(description = "审批状态", example = "20") 31 @Schema(description = "审批状态", example = "20")
  32 + @InEnum(CrmAuditStatusEnum.class)
31 private Integer auditStatus; 33 private Integer auditStatus;
32 34
33 } 35 }
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/CrmContractMapper.java
@@ -58,18 +58,15 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> { @@ -58,18 +58,15 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> {
58 // Backlog: 即将到期的合同 58 // Backlog: 即将到期的合同
59 LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now()); 59 LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now());
60 LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now()); 60 LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now());
61 - if (CrmContractPageReqVO.EXPIRY_TYPE_ABOUT_TO_EXPIRE.equals(pageReqVO.getExpiryType())) {  
62 - // 即将到期 61 + if (CrmContractPageReqVO.EXPIRY_TYPE_ABOUT_TO_EXPIRE.equals(pageReqVO.getExpiryType())) { // 即将到期
63 // TODO: @芋艿 需要配置 提前提醒天数 62 // TODO: @芋艿 需要配置 提前提醒天数
64 int REMIND_DAYS = 20; 63 int REMIND_DAYS = 20;
65 query.eq(CrmContractDO::getAuditStatus, CrmAuditStatusEnum.APPROVE.getStatus()) 64 query.eq(CrmContractDO::getAuditStatus, CrmAuditStatusEnum.APPROVE.getStatus())
66 .between(CrmContractDO::getEndTime, beginOfToday, endOfToday.plusDays(REMIND_DAYS)); 65 .between(CrmContractDO::getEndTime, beginOfToday, endOfToday.plusDays(REMIND_DAYS));
67 - } else if (CrmContractPageReqVO.EXPIRY_TYPE_EXPIRED.equals(pageReqVO.getExpiryType())) {  
68 - // 已到期 66 + } else if (CrmContractPageReqVO.EXPIRY_TYPE_EXPIRED.equals(pageReqVO.getExpiryType())) { // 已到期
69 query.eq(CrmContractDO::getAuditStatus, CrmAuditStatusEnum.APPROVE.getStatus()) 67 query.eq(CrmContractDO::getAuditStatus, CrmAuditStatusEnum.APPROVE.getStatus())
70 .lt(CrmContractDO::getEndTime, endOfToday); 68 .lt(CrmContractDO::getEndTime, endOfToday);
71 } 69 }
72 -  
73 return selectJoinPage(pageReqVO, CrmContractDO.class, query); 70 return selectJoinPage(pageReqVO, CrmContractDO.class, query);
74 } 71 }
75 72
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivablePlanMapper.java
@@ -51,23 +51,21 @@ public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO @@ -51,23 +51,21 @@ public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO
51 // Backlog: 回款提醒类型 51 // Backlog: 回款提醒类型
52 LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now()); 52 LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now());
53 LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now()); 53 LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now());
54 - if (CrmReceivablePlanPageReqVO.REMIND_NEEDED.equals(pageReqVO.getRemindType())) {  
55 - // 待回款 54 + if (CrmReceivablePlanPageReqVO.REMIND_TYPE_NEEDED.equals(pageReqVO.getRemindType())) { // 待回款
56 query.isNull(CrmReceivablePlanDO::getReceivableId) 55 query.isNull(CrmReceivablePlanDO::getReceivableId)
57 .gt(CrmReceivablePlanDO::getReturnTime, beginOfToday) 56 .gt(CrmReceivablePlanDO::getReturnTime, beginOfToday)
  57 + // TODO @dhb52:这里看看怎么改成不要使用 to_days
58 .apply("to_days(return_time) <= to_days(now())+ remind_days"); 58 .apply("to_days(return_time) <= to_days(now())+ remind_days");
59 - } else if (CrmReceivablePlanPageReqVO.REMIND_EXPIRED.equals(pageReqVO.getRemindType())) {  
60 - // 已逾期 59 + } else if (CrmReceivablePlanPageReqVO.REMIND_TYPE_EXPIRED.equals(pageReqVO.getRemindType())) { // 已逾期
61 query.isNull(CrmReceivablePlanDO::getReceivableId) 60 query.isNull(CrmReceivablePlanDO::getReceivableId)
62 .lt(CrmReceivablePlanDO::getReturnTime, endOfToday); 61 .lt(CrmReceivablePlanDO::getReturnTime, endOfToday);
63 - } else if (CrmReceivablePlanPageReqVO.REMIND_RECEIVED.equals(pageReqVO.getRemindType())) {  
64 - // 已回款 62 + } else if (CrmReceivablePlanPageReqVO.REMIND_TYPE_RECEIVED.equals(pageReqVO.getRemindType())) { // 已回款
65 query.isNotNull(CrmReceivablePlanDO::getReceivableId) 63 query.isNotNull(CrmReceivablePlanDO::getReceivableId)
66 .gt(CrmReceivablePlanDO::getReturnTime, beginOfToday) 64 .gt(CrmReceivablePlanDO::getReturnTime, beginOfToday)
  65 + // TODO @dhb52:这里看看怎么改成不要使用 to_days
67 .apply("to_days(return_time) <= to_days(now()) + remind_days"); 66 .apply("to_days(return_time) <= to_days(now()) + remind_days");
68 } 67 }
69 68
70 -  
71 return selectJoinPage(pageReqVO, CrmReceivablePlanDO.class, query); 69 return selectJoinPage(pageReqVO, CrmReceivablePlanDO.class, query);
72 } 70 }
73 71