mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 10:18:42 +08:00 
			
		
		
		
	📖 CRM:code review 待办项目的实现
This commit is contained in:
		| @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.crm.controller.admin.contract.vo; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||||
| import cn.iocoder.yudao.framework.common.validation.InEnum; | ||||
| import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; | ||||
| import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum; | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import lombok.Data; | ||||
| @@ -14,7 +15,13 @@ import lombok.ToString; | ||||
| @ToString(callSuper = true) | ||||
| public class CrmContractPageReqVO extends PageParam { | ||||
|  | ||||
|     /** | ||||
|      * 过期类型 - 即将过期 | ||||
|      */ | ||||
|     public static final Integer EXPIRY_TYPE_ABOUT_TO_EXPIRE = 1; | ||||
|     /** | ||||
|      * 过期类型 - 已过期 | ||||
|      */ | ||||
|     public static  final Integer EXPIRY_TYPE_EXPIRED = 2; | ||||
|  | ||||
|     @Schema(description = "合同编号", example = "XYZ008") | ||||
| @@ -34,6 +41,7 @@ public class CrmContractPageReqVO extends PageParam { | ||||
|     private Integer sceneType; // 场景类型,为 null 时则表示全部 | ||||
|  | ||||
|     @Schema(description = "审批状态", example = "20") | ||||
|     @InEnum(CrmAuditStatusEnum.class) | ||||
|     private Integer auditStatus; | ||||
|  | ||||
|     @Schema(description = "过期类型", example = "1") | ||||
|   | ||||
| @@ -14,12 +14,18 @@ import lombok.ToString; | ||||
| @ToString(callSuper = true) | ||||
| public class CrmReceivablePlanPageReqVO extends PageParam { | ||||
|  | ||||
|     // 待回款 | ||||
|     public final static Integer REMIND_NEEDED = 1; | ||||
|     // 已逾期 | ||||
|     public final static Integer REMIND_EXPIRED = 2; | ||||
|     // 已回款 | ||||
|     public final static Integer REMIND_RECEIVED = 3; | ||||
|     /** | ||||
|      * 提醒类型 - 待回款 | ||||
|      */ | ||||
|     public final static Integer REMIND_TYPE_NEEDED = 1; | ||||
|     /** | ||||
|      * 提醒类型 - 已逾期 | ||||
|      */ | ||||
|     public final static Integer REMIND_TYPE_EXPIRED = 2; | ||||
|     /** | ||||
|      * 提醒类型 - 已回款 | ||||
|      */ | ||||
|     public final static Integer REMIND_TYPE_RECEIVED = 3; | ||||
|  | ||||
|     @Schema(description = "客户编号", example = "18026") | ||||
|     private Long customerId; | ||||
|   | ||||
| @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||||
| import cn.iocoder.yudao.framework.common.validation.InEnum; | ||||
| import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; | ||||
| import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum; | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import lombok.Data; | ||||
| @@ -28,6 +29,7 @@ public class CrmReceivablePageReqVO extends PageParam { | ||||
|     private Integer sceneType; // 场景类型,为 null 时则表示全部 | ||||
|  | ||||
|     @Schema(description = "审批状态", example = "20") | ||||
|     @InEnum(CrmAuditStatusEnum.class) | ||||
|     private Integer auditStatus; | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -58,18 +58,15 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> { | ||||
|         // Backlog: 即将到期的合同 | ||||
|         LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now()); | ||||
|         LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now()); | ||||
|         if (CrmContractPageReqVO.EXPIRY_TYPE_ABOUT_TO_EXPIRE.equals(pageReqVO.getExpiryType())) { | ||||
|             // 即将到期 | ||||
|         if (CrmContractPageReqVO.EXPIRY_TYPE_ABOUT_TO_EXPIRE.equals(pageReqVO.getExpiryType())) { // 即将到期 | ||||
|             // TODO: @芋艿 需要配置 提前提醒天数 | ||||
|             int REMIND_DAYS = 20; | ||||
|             query.eq(CrmContractDO::getAuditStatus, CrmAuditStatusEnum.APPROVE.getStatus()) | ||||
|                     .between(CrmContractDO::getEndTime, beginOfToday, endOfToday.plusDays(REMIND_DAYS)); | ||||
|         } else if (CrmContractPageReqVO.EXPIRY_TYPE_EXPIRED.equals(pageReqVO.getExpiryType())) { | ||||
|             // 已到期 | ||||
|         } else if (CrmContractPageReqVO.EXPIRY_TYPE_EXPIRED.equals(pageReqVO.getExpiryType())) { // 已到期 | ||||
|             query.eq(CrmContractDO::getAuditStatus, CrmAuditStatusEnum.APPROVE.getStatus()) | ||||
|                     .lt(CrmContractDO::getEndTime, endOfToday); | ||||
|         } | ||||
|  | ||||
|         return selectJoinPage(pageReqVO, CrmContractDO.class, query); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -51,23 +51,21 @@ public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO | ||||
|         // Backlog: 回款提醒类型 | ||||
|         LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now()); | ||||
|         LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now()); | ||||
|         if (CrmReceivablePlanPageReqVO.REMIND_NEEDED.equals(pageReqVO.getRemindType())) { | ||||
|             // 待回款 | ||||
|         if (CrmReceivablePlanPageReqVO.REMIND_TYPE_NEEDED.equals(pageReqVO.getRemindType())) { // 待回款 | ||||
|             query.isNull(CrmReceivablePlanDO::getReceivableId) | ||||
|                     .gt(CrmReceivablePlanDO::getReturnTime, beginOfToday) | ||||
|                     // TODO @dhb52:这里看看怎么改成不要使用 to_days | ||||
|                     .apply("to_days(return_time) <= to_days(now())+ remind_days"); | ||||
|         } else if (CrmReceivablePlanPageReqVO.REMIND_EXPIRED.equals(pageReqVO.getRemindType())) { | ||||
|             // 已逾期 | ||||
|         } else if (CrmReceivablePlanPageReqVO.REMIND_TYPE_EXPIRED.equals(pageReqVO.getRemindType())) {  // 已逾期 | ||||
|             query.isNull(CrmReceivablePlanDO::getReceivableId) | ||||
|                     .lt(CrmReceivablePlanDO::getReturnTime, endOfToday); | ||||
|         } else if (CrmReceivablePlanPageReqVO.REMIND_RECEIVED.equals(pageReqVO.getRemindType())) { | ||||
|             // 已回款 | ||||
|         } else if (CrmReceivablePlanPageReqVO.REMIND_TYPE_RECEIVED.equals(pageReqVO.getRemindType())) { // 已回款 | ||||
|             query.isNotNull(CrmReceivablePlanDO::getReceivableId) | ||||
|                     .gt(CrmReceivablePlanDO::getReturnTime, beginOfToday) | ||||
|                     // TODO @dhb52:这里看看怎么改成不要使用 to_days | ||||
|                     .apply("to_days(return_time) <= to_days(now()) + remind_days"); | ||||
|         } | ||||
|  | ||||
|  | ||||
|         return selectJoinPage(pageReqVO, CrmReceivablePlanDO.class, query); | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV