From 3b612b2e6d7f775bceaf5e72e68fca54220bed2f Mon Sep 17 00:00:00 2001 From: dhb52 Date: Wed, 7 Feb 2024 23:53:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BE=85=E5=9B=9E=E6=AC=BE=E6=8F=90?= =?UTF-8?q?=E9=86=92,=E5=8D=B3=E5=B0=86=E5=88=B0=E6=9C=9F=E7=9A=84?= =?UTF-8?q?=E5=90=88=E5=90=8C,=E5=BE=85=E5=AE=A1=E6=A0=B8=E5=9B=9E?= =?UTF-8?q?=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contract/vo/CrmContractPageReqVO.java | 6 +++++ .../vo/plan/CrmReceivablePlanPageReqVO.java | 10 +++++++ .../vo/receivable/CrmReceivablePageReqVO.java | 3 +++ .../dal/mysql/contract/CrmContractMapper.java | 27 ++++++++++++++++--- .../mysql/receivable/CrmReceivableMapper.java | 1 + .../receivable/CrmReceivablePlanMapper.java | 23 ++++++++++++++++ 6 files changed, 66 insertions(+), 4 deletions(-) diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractPageReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractPageReqVO.java index 2e14f1566..70529198a 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractPageReqVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractPageReqVO.java @@ -14,6 +14,9 @@ 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") private String no; @@ -33,4 +36,7 @@ public class CrmContractPageReqVO extends PageParam { @Schema(description = "审批状态", example = "20") private Integer auditStatus; + @Schema(description = "过期类型", example = "1") + private Integer expiryType; // 过期类型,为 null 时则表示全部 + } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanPageReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanPageReqVO.java index f86aa346d..a041fa030 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanPageReqVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanPageReqVO.java @@ -14,6 +14,13 @@ 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; + @Schema(description = "客户编号", example = "18026") private Long customerId; @@ -25,4 +32,7 @@ public class CrmReceivablePlanPageReqVO extends PageParam { @InEnum(CrmSceneTypeEnum.class) private Integer sceneType; // 场景类型,为 null 时则表示全部 + @Schema(description = "提醒类型", example = "1") + private Integer remindType; // 提醒类型,为 null 时则表示全部 + } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivablePageReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivablePageReqVO.java index 1bca32fa3..d47ca83f0 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivablePageReqVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivablePageReqVO.java @@ -27,4 +27,7 @@ public class CrmReceivablePageReqVO extends PageParam { @InEnum(CrmSceneTypeEnum.class) private Integer sceneType; // 场景类型,为 null 时则表示全部 + @Schema(description = "审批状态", example = "20") + private Integer auditStatus; + } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/CrmContractMapper.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/CrmContractMapper.java index e7c56a622..d553962ee 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/CrmContractMapper.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/CrmContractMapper.java @@ -1,16 +1,19 @@ package cn.iocoder.yudao.module.crm.dal.mysql.contract; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX; import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO; import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; +import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; import cn.iocoder.yudao.module.crm.util.CrmQueryWrapperUtils; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.apache.ibatis.annotations.Mapper; +import java.time.LocalDateTime; import java.util.Collection; import java.util.List; @@ -39,19 +42,35 @@ public interface CrmContractMapper extends BaseMapperX { } default PageResult selectPage(CrmContractPageReqVO pageReqVO, Long userId) { - MPJLambdaWrapperX mpjLambdaWrapperX = new MPJLambdaWrapperX<>(); + MPJLambdaWrapperX query = new MPJLambdaWrapperX<>(); // 拼接数据权限的查询条件 - CrmQueryWrapperUtils.appendPermissionCondition(mpjLambdaWrapperX, CrmBizTypeEnum.CRM_CONTRACT.getType(), + CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CONTRACT.getType(), CrmContractDO::getId, userId, pageReqVO.getSceneType(), Boolean.FALSE); // 拼接自身的查询条件 - mpjLambdaWrapperX.selectAll(CrmContractDO.class) + query.selectAll(CrmContractDO.class) .likeIfPresent(CrmContractDO::getNo, pageReqVO.getNo()) .likeIfPresent(CrmContractDO::getName, pageReqVO.getName()) .eqIfPresent(CrmContractDO::getCustomerId, pageReqVO.getCustomerId()) .eqIfPresent(CrmContractDO::getBusinessId, pageReqVO.getBusinessId()) .eqIfPresent(CrmContractDO::getAuditStatus, pageReqVO.getAuditStatus()) .orderByDesc(CrmContractDO::getId); - return selectJoinPage(pageReqVO, CrmContractDO.class, mpjLambdaWrapperX); + + // Backlog: 即将到期的合同 + LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now()); + LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now()); + 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())) { + // 已到期 + query.eq(CrmContractDO::getAuditStatus, CrmAuditStatusEnum.APPROVE.getStatus()) + .lt(CrmContractDO::getEndTime, endOfToday); + } + + return selectJoinPage(pageReqVO, CrmContractDO.class, query); } default List selectBatchIds(Collection ids, Long userId) { diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivableMapper.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivableMapper.java index 3ad8009f0..28b2298ec 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivableMapper.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivableMapper.java @@ -45,6 +45,7 @@ public interface CrmReceivableMapper extends BaseMapperX { query.selectAll(CrmReceivableDO.class) .eqIfPresent(CrmReceivableDO::getNo, pageReqVO.getNo()) .eqIfPresent(CrmReceivableDO::getPlanId, pageReqVO.getPlanId()) + .eqIfPresent(CrmReceivableDO::getAuditStatus, pageReqVO.getAuditStatus()) .orderByDesc(CrmReceivableDO::getId); return selectJoinPage(pageReqVO, CrmReceivableDO.class, query); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivablePlanMapper.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivablePlanMapper.java index eb6587174..618a95750 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivablePlanMapper.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivablePlanMapper.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.crm.dal.mysql.receivable; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; @@ -11,6 +12,7 @@ import cn.iocoder.yudao.module.crm.util.CrmQueryWrapperUtils; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.apache.ibatis.annotations.Mapper; +import java.time.LocalDateTime; import java.util.Collection; import java.util.List; @@ -45,6 +47,27 @@ public interface CrmReceivablePlanMapper extends BaseMapperX