mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 23:31:52 +08:00
!868 feat: 待回款提醒,即将到期的合同,待审核回款
Merge pull request !868 from dhb52/develop
This commit is contained in:
commit
a03e661a56
@ -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;
|
||||
|
||||
@ -30,4 +33,10 @@ public class CrmContractPageReqVO extends PageParam {
|
||||
@InEnum(CrmSceneTypeEnum.class)
|
||||
private Integer sceneType; // 场景类型,为 null 时则表示全部
|
||||
|
||||
@Schema(description = "审批状态", example = "20")
|
||||
private Integer auditStatus;
|
||||
|
||||
@Schema(description = "过期类型", example = "1")
|
||||
private Integer expiryType; // 过期类型,为 null 时则表示全部
|
||||
|
||||
}
|
||||
|
@ -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 时则表示全部
|
||||
|
||||
}
|
||||
|
@ -27,4 +27,7 @@ public class CrmReceivablePageReqVO extends PageParam {
|
||||
@InEnum(CrmSceneTypeEnum.class)
|
||||
private Integer sceneType; // 场景类型,为 null 时则表示全部
|
||||
|
||||
@Schema(description = "审批状态", example = "20")
|
||||
private Integer auditStatus;
|
||||
|
||||
}
|
||||
|
@ -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,18 +42,35 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> {
|
||||
}
|
||||
|
||||
default PageResult<CrmContractDO> selectPage(CrmContractPageReqVO pageReqVO, Long userId) {
|
||||
MPJLambdaWrapperX<CrmContractDO> mpjLambdaWrapperX = new MPJLambdaWrapperX<>();
|
||||
MPJLambdaWrapperX<CrmContractDO> 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<CrmContractDO> selectBatchIds(Collection<Long> ids, Long userId) {
|
||||
|
@ -45,6 +45,7 @@ public interface CrmReceivableMapper extends BaseMapperX<CrmReceivableDO> {
|
||||
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);
|
||||
}
|
||||
|
@ -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<CrmReceivablePlanDO
|
||||
.eqIfPresent(CrmReceivablePlanDO::getCustomerId, pageReqVO.getCustomerId())
|
||||
.eqIfPresent(CrmReceivablePlanDO::getContractId, pageReqVO.getContractId())
|
||||
.orderByDesc(CrmReceivablePlanDO::getId);
|
||||
|
||||
// Backlog: 回款提醒类型
|
||||
LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now());
|
||||
LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now());
|
||||
if (CrmReceivablePlanPageReqVO.REMIND_NEEDED.equals(pageReqVO.getRemindType())) {
|
||||
// 待回款
|
||||
query.isNull(CrmReceivablePlanDO::getReceivableId)
|
||||
.gt(CrmReceivablePlanDO::getReturnTime, beginOfToday)
|
||||
.apply("to_days(return_time) <= to_days(now())+ remind_days");
|
||||
} else if (CrmReceivablePlanPageReqVO.REMIND_EXPIRED.equals(pageReqVO.getRemindType())) {
|
||||
// 已逾期
|
||||
query.isNull(CrmReceivablePlanDO::getReceivableId)
|
||||
.lt(CrmReceivablePlanDO::getReturnTime, endOfToday);
|
||||
} else if (CrmReceivablePlanPageReqVO.REMIND_RECEIVED.equals(pageReqVO.getRemindType())) {
|
||||
// 已回款
|
||||
query.isNotNull(CrmReceivablePlanDO::getReceivableId)
|
||||
.gt(CrmReceivablePlanDO::getReturnTime, beginOfToday)
|
||||
.apply("to_days(return_time) <= to_days(now()) + remind_days");
|
||||
}
|
||||
|
||||
|
||||
return selectJoinPage(pageReqVO, CrmReceivablePlanDO.class, query);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user