fix: 根据code-review修改

This commit is contained in:
dhb52 2024-02-18 22:58:23 +08:00
parent 1bfb406041
commit dca262c64b
11 changed files with 29 additions and 36 deletions

View File

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

View File

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

View File

@ -148,8 +148,7 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
return selectCount(query); return selectCount(query);
} }
// TODO @dhb52db 统一都是 select 关键字 default Long selectTodayCustomerCount(Long userId) {
default Long getTodayCustomerCount(Long userId) {
MPJLambdaWrapperX<CrmCustomerDO> query = new MPJLambdaWrapperX<>(); MPJLambdaWrapperX<CrmCustomerDO> query = new MPJLambdaWrapperX<>();
// 我负责的 + 非公海 // 我负责的 + 非公海
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(), CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(),
@ -161,14 +160,13 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
return selectCount(query); return selectCount(query);
} }
// TODO @dhb52db 统一都是 select 关键字 default Long selectFollowCustomerCount(Long userId) {
default Long getFollowCustomerCount(Long userId) {
MPJLambdaWrapperX<CrmCustomerDO> query = new MPJLambdaWrapperX<>(); MPJLambdaWrapperX<CrmCustomerDO> query = new MPJLambdaWrapperX<>();
// 我负责的 + 非公海 // 我负责的 + 非公海
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(), CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(),
CrmCustomerDO::getId, userId, CrmSceneTypeEnum.OWNER.getType(), Boolean.FALSE); 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); return selectCount(query);
} }

View File

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

View File

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

View File

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

View File

@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageR
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractSaveReqVO; import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractSaveReqVO;
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO; import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO;
import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractProductDO;
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO; import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO;
import jakarta.validation.Valid; import jakarta.validation.Valid;

View File

@ -364,12 +364,12 @@ public class CrmContractServiceImpl implements CrmContractService {
@Override @Override
public Long getCheckContractCount(Long userId) { public Long getCheckContractCount(Long userId) {
return contractMapper.getCheckContractCount(userId); return contractMapper.selectCheckContractCount(userId);
} }
@Override @Override
public Long getEndContractCount(Long userId) { 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 @Override
public Long getTodayCustomerCount(Long userId) { public Long getTodayCustomerCount(Long userId) {
return customerMapper.getTodayCustomerCount(userId); return customerMapper.selectTodayCustomerCount(userId);
} }
@Override @Override
public Long getFollowCustomerCount(Long userId) { 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 @Override
public Long getRemindReceivablePlanCount(Long userId) { 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 @Override
public Long getCheckReceivablesCount(Long userId) { public Long getCheckReceivablesCount(Long userId) {
return receivableMapper.getCheckReceivablesCount(userId); return receivableMapper.selectCheckReceivablesCount(userId);
} }
} }