Commit 5955f39e24aa0de718ac91f33f1539ed78a2cbaf
1 parent
a03e661a
📖 CRM:code review 待办项目的实现
Showing
5 changed files
with
29 additions
and
18 deletions
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 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| 5 | +import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; | |
| 5 | 6 | import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum; |
| 6 | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 7 | 8 | import lombok.Data; |
| ... | ... | @@ -14,7 +15,13 @@ import lombok.ToString; |
| 14 | 15 | @ToString(callSuper = true) |
| 15 | 16 | public class CrmContractPageReqVO extends PageParam { |
| 16 | 17 | |
| 18 | + /** | |
| 19 | + * 过期类型 - 即将过期 | |
| 20 | + */ | |
| 17 | 21 | public static final Integer EXPIRY_TYPE_ABOUT_TO_EXPIRE = 1; |
| 22 | + /** | |
| 23 | + * 过期类型 - 已过期 | |
| 24 | + */ | |
| 18 | 25 | public static final Integer EXPIRY_TYPE_EXPIRED = 2; |
| 19 | 26 | |
| 20 | 27 | @Schema(description = "合同编号", example = "XYZ008") |
| ... | ... | @@ -34,6 +41,7 @@ public class CrmContractPageReqVO extends PageParam { |
| 34 | 41 | private Integer sceneType; // 场景类型,为 null 时则表示全部 |
| 35 | 42 | |
| 36 | 43 | @Schema(description = "审批状态", example = "20") |
| 44 | + @InEnum(CrmAuditStatusEnum.class) | |
| 37 | 45 | private Integer auditStatus; |
| 38 | 46 | |
| 39 | 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 | 14 | @ToString(callSuper = true) |
| 15 | 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 | 30 | @Schema(description = "客户编号", example = "18026") |
| 25 | 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 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| 5 | +import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; | |
| 5 | 6 | import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum; |
| 6 | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 7 | 8 | import lombok.Data; |
| ... | ... | @@ -28,6 +29,7 @@ public class CrmReceivablePageReqVO extends PageParam { |
| 28 | 29 | private Integer sceneType; // 场景类型,为 null 时则表示全部 |
| 29 | 30 | |
| 30 | 31 | @Schema(description = "审批状态", example = "20") |
| 32 | + @InEnum(CrmAuditStatusEnum.class) | |
| 31 | 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 | 58 | // Backlog: 即将到期的合同 |
| 59 | 59 | LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now()); |
| 60 | 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 | 62 | // TODO: @芋艿 需要配置 提前提醒天数 |
| 64 | 63 | int REMIND_DAYS = 20; |
| 65 | 64 | query.eq(CrmContractDO::getAuditStatus, CrmAuditStatusEnum.APPROVE.getStatus()) |
| 66 | 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 | 67 | query.eq(CrmContractDO::getAuditStatus, CrmAuditStatusEnum.APPROVE.getStatus()) |
| 70 | 68 | .lt(CrmContractDO::getEndTime, endOfToday); |
| 71 | 69 | } |
| 72 | - | |
| 73 | 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 | 51 | // Backlog: 回款提醒类型 |
| 52 | 52 | LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now()); |
| 53 | 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 | 55 | query.isNull(CrmReceivablePlanDO::getReceivableId) |
| 57 | 56 | .gt(CrmReceivablePlanDO::getReturnTime, beginOfToday) |
| 57 | + // TODO @dhb52:这里看看怎么改成不要使用 to_days | |
| 58 | 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 | 60 | query.isNull(CrmReceivablePlanDO::getReceivableId) |
| 62 | 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 | 63 | query.isNotNull(CrmReceivablePlanDO::getReceivableId) |
| 66 | 64 | .gt(CrmReceivablePlanDO::getReturnTime, beginOfToday) |
| 65 | + // TODO @dhb52:这里看看怎么改成不要使用 to_days | |
| 67 | 66 | .apply("to_days(return_time) <= to_days(now()) + remind_days"); |
| 68 | 67 | } |
| 69 | 68 | |
| 70 | - | |
| 71 | 69 | return selectJoinPage(pageReqVO, CrmReceivablePlanDO.class, query); |
| 72 | 70 | } |
| 73 | 71 | ... | ... |