!871 fix: 根据code-review修改Crm Backlog

Merge pull request !871 from dhb52/develop
This commit is contained in:
芋道源码 2024-02-19 14:10:17 +00:00 committed by Gitee
commit bac476c131
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
10 changed files with 28 additions and 36 deletions

View File

@ -56,15 +56,14 @@ public interface CrmClueMapper extends BaseMapperX<CrmClueDO> {
return selectJoinList(CrmClueDO.class, query);
}
// TODO @dhb52db 统一都是 select 关键字
default Long getFollowLeadsCount(Long userId) {
default Long selectFollowLeadsCount(Long userId) {
MPJLambdaWrapperX<CrmClueDO> query = new MPJLambdaWrapperX<>();
// 我负责的 + 非公海
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_LEADS.getType(),
CrmClueDO::getId, userId, CrmSceneTypeEnum.OWNER.getType(), Boolean.FALSE);
// 未跟进 + 未转化 TODO @dhb52是不是 eq 会更好哈mysql 不等于对索引不友好
query.ne(CrmClueDO::getFollowUpStatus, true)
.ne(CrmClueDO::getTransformStatus, true);
// 未跟进 + 未转化
query.eq(CrmClueDO::getFollowUpStatus, false)
.eq(CrmClueDO::getTransformStatus, false);
return selectCount(query);
}

View File

@ -88,8 +88,7 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> {
return selectCount(CrmContractDO::getBusinessId, businessId);
}
// TODO @dhb52db 统一都是 select 关键字
default Long getCheckContractCount(Long userId) {
default Long selectCheckContractCount(Long userId) {
MPJLambdaWrapperX<CrmContractDO> query = new MPJLambdaWrapperX<>();
// 我负责的 + 非公海
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CONTRACT.getType(),
@ -99,8 +98,7 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> {
return selectCount(query);
}
// TODO @dhb52db 统一都是 select 关键字
default Long getEndContractCount(Long userId) {
default Long selectEndContractCount(Long userId) {
MPJLambdaWrapperX<CrmContractDO> query = new MPJLambdaWrapperX<>();
// 我负责的 + 非公海
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CONTRACT.getType(),
@ -108,7 +106,7 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> {
// 即将到期
LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now());
LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now());
// TODO: @芋艿 需要配置 提前提醒天数
// TODO: @dhb52 需要配置 提前提醒天数
int REMIND_DAYS = 20;
query.eq(CrmContractDO::getAuditStatus, CrmAuditStatusEnum.APPROVE.getStatus())
.between(CrmContractDO::getEndTime, beginOfToday, endOfToday.plusDays(REMIND_DAYS));

View File

@ -148,8 +148,7 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
return selectCount(query);
}
// TODO @dhb52db 统一都是 select 关键字
default Long getTodayCustomerCount(Long userId) {
default Long selectTodayCustomerCount(Long userId) {
MPJLambdaWrapperX<CrmCustomerDO> query = new MPJLambdaWrapperX<>();
// 我负责的 + 非公海
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(),
@ -161,14 +160,13 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
return selectCount(query);
}
// TODO @dhb52db 统一都是 select 关键字
default Long getFollowCustomerCount(Long userId) {
default Long selectFollowCustomerCount(Long userId) {
MPJLambdaWrapperX<CrmCustomerDO> query = new MPJLambdaWrapperX<>();
// 我负责的 + 非公海
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(),
CrmCustomerDO::getId, userId, CrmSceneTypeEnum.OWNER.getType(), Boolean.FALSE);
// 未跟进 TODO @dhb52是不是 eq 会更好哈mysql 不等于对索引不友好
query.ne(CrmClueDO::getFollowUpStatus, true);
// 未跟进
query.eq(CrmClueDO::getFollowUpStatus, false);
return selectCount(query);
}

View File

@ -62,8 +62,7 @@ public interface CrmReceivableMapper extends BaseMapperX<CrmReceivableDO> {
return selectJoinList(CrmReceivableDO.class, query);
}
// TODO @dhb52db 统一都是 select 关键字
default Long getCheckReceivablesCount(Long userId) {
default Long selectCheckReceivablesCount(Long userId) {
MPJLambdaWrapperX<CrmReceivableDO> query = new MPJLambdaWrapperX<>();
// 我负责的 + 非公海
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_RECEIVABLE.getType(),

View File

@ -50,21 +50,19 @@ public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO
.orderByDesc(CrmReceivablePlanDO::getId);
// Backlog: 回款提醒类型
// TODO: @dhb52 需要配置 提前提醒天数
int REMIND_DAYS = 20;
LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now());
LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now());
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");
.between(CrmReceivablePlanDO::getReturnTime, beginOfToday, endOfToday.plusDays(REMIND_DAYS));
} else if (CrmReceivablePlanPageReqVO.REMIND_TYPE_EXPIRED.equals(pageReqVO.getRemindType())) { // 已逾期
query.isNull(CrmReceivablePlanDO::getReceivableId)
.lt(CrmReceivablePlanDO::getReturnTime, endOfToday);
} 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");
.between(CrmReceivablePlanDO::getReturnTime, beginOfToday, endOfToday.plusDays(REMIND_DAYS));;
}
return selectJoinPage(pageReqVO, CrmReceivablePlanDO.class, query);
@ -79,17 +77,17 @@ public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO
return selectJoinList(CrmReceivablePlanDO.class, query);
}
// TODO @dhb52db 统一都是 select 关键字
default Long getRemindReceivablePlanCount(Long userId) {
default Long selectRemindReceivablePlanCount(Long userId) {
MPJLambdaWrapperX<CrmReceivablePlanDO> query = new MPJLambdaWrapperX<>();
// 我负责的 + 非公海
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_RECEIVABLE_PLAN.getType(),
CrmReceivablePlanDO::getId, userId, CrmSceneTypeEnum.OWNER.getType(), Boolean.FALSE);
// 待回款 TODO @dhb52to_days(return_time) <= to_days(now())+ remind_days 看看怎么改成不用数据库自己去计算这样的时间
// TODO: @dhb52 需要配置 提前提醒天数
int REMIND_DAYS = 20;
LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now());
LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now());
query.isNull(CrmReceivablePlanDO::getReceivableId)
.gt(CrmReceivablePlanDO::getReturnTime, beginOfToday)
.apply("to_days(return_time) <= to_days(now())+ remind_days");
.between(CrmReceivablePlanDO::getReturnTime, beginOfToday, endOfToday.plusDays(REMIND_DAYS));
return selectCount(query);
}

View File

@ -274,7 +274,7 @@ public class CrmClueServiceImpl implements CrmClueService {
@Override
public Long getFollowLeadsCount(Long userId) {
return clueMapper.getFollowLeadsCount(userId);
return clueMapper.selectFollowLeadsCount(userId);
}
}

View File

@ -364,12 +364,12 @@ public class CrmContractServiceImpl implements CrmContractService {
@Override
public Long getCheckContractCount(Long userId) {
return contractMapper.getCheckContractCount(userId);
return contractMapper.selectCheckContractCount(userId);
}
@Override
public Long getEndContractCount(Long userId) {
return contractMapper.getEndContractCount(userId);
return contractMapper.selectEndContractCount(userId);
}
}

View File

@ -482,12 +482,12 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
@Override
public Long getTodayCustomerCount(Long userId) {
return customerMapper.getTodayCustomerCount(userId);
return customerMapper.selectTodayCustomerCount(userId);
}
@Override
public Long getFollowCustomerCount(Long userId) {
return customerMapper.getFollowCustomerCount(userId);
return customerMapper.selectFollowCustomerCount(userId);
}
// ======================= 校验相关 =======================

View File

@ -164,7 +164,7 @@ public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService {
@Override
public Long getRemindReceivablePlanCount(Long userId) {
return receivablePlanMapper.getRemindReceivablePlanCount(userId);
return receivablePlanMapper.selectRemindReceivablePlanCount(userId);
}
}

View File

@ -184,7 +184,7 @@ public class CrmReceivableServiceImpl implements CrmReceivableService {
@Override
public Long getCheckReceivablesCount(Long userId) {
return receivableMapper.getCheckReceivablesCount(userId);
return receivableMapper.selectCheckReceivablesCount(userId);
}
}