Commit dca262c64b1d460e8fb92ceffd9534c5f3327d95
1 parent
1bfb4060
fix: 根据code-review修改
Showing
11 changed files
with
29 additions
and
36 deletions
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/clue/CrmClueMapper.java
| ... | ... | @@ -55,15 +55,14 @@ public interface CrmClueMapper extends BaseMapperX<CrmClueDO> { |
| 55 | 55 | return selectJoinList(CrmClueDO.class, query); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - // TODO @dhb52:db 统一都是 select 关键字; | |
| 59 | - default Long getFollowLeadsCount(Long userId) { | |
| 58 | + default Long selectFollowLeadsCount(Long userId) { | |
| 60 | 59 | MPJLambdaWrapperX<CrmClueDO> query = new MPJLambdaWrapperX<>(); |
| 61 | 60 | // 我负责的 + 非公海 |
| 62 | 61 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_LEADS.getType(), |
| 63 | 62 | CrmClueDO::getId, userId, CrmSceneTypeEnum.OWNER.getType(), Boolean.FALSE); |
| 64 | - // 未跟进 + 未转化 TODO @dhb52:是不是 eq 会更好哈;mysql 不等于,对索引不友好 | |
| 65 | - query.ne(CrmClueDO::getFollowUpStatus, true) | |
| 66 | - .ne(CrmClueDO::getTransformStatus, true); | |
| 63 | + // 未跟进 + 未转化 | |
| 64 | + query.eq(CrmClueDO::getFollowUpStatus, false) | |
| 65 | + .eq(CrmClueDO::getTransformStatus, false); | |
| 67 | 66 | return selectCount(query); |
| 68 | 67 | } |
| 69 | 68 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/CrmContractMapper.java
| ... | ... | @@ -88,8 +88,7 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> { |
| 88 | 88 | return selectCount(CrmContractDO::getBusinessId, businessId); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - // TODO @dhb52:db 统一都是 select 关键字; | |
| 92 | - default Long getCheckContractCount(Long userId) { | |
| 91 | + default Long selectCheckContractCount(Long userId) { | |
| 93 | 92 | MPJLambdaWrapperX<CrmContractDO> query = new MPJLambdaWrapperX<>(); |
| 94 | 93 | // 我负责的 + 非公海 |
| 95 | 94 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CONTRACT.getType(), |
| ... | ... | @@ -99,8 +98,7 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> { |
| 99 | 98 | return selectCount(query); |
| 100 | 99 | } |
| 101 | 100 | |
| 102 | - // TODO @dhb52:db 统一都是 select 关键字; | |
| 103 | - default Long getEndContractCount(Long userId) { | |
| 101 | + default Long selectEndContractCount(Long userId) { | |
| 104 | 102 | MPJLambdaWrapperX<CrmContractDO> query = new MPJLambdaWrapperX<>(); |
| 105 | 103 | // 我负责的 + 非公海 |
| 106 | 104 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CONTRACT.getType(), |
| ... | ... | @@ -108,7 +106,7 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> { |
| 108 | 106 | // 即将到期 |
| 109 | 107 | LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now()); |
| 110 | 108 | LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now()); |
| 111 | - // TODO: @芋艿 需要配置 提前提醒天数 | |
| 109 | + // TODO: @dhb52 需要配置 提前提醒天数 | |
| 112 | 110 | int REMIND_DAYS = 20; |
| 113 | 111 | query.eq(CrmContractDO::getAuditStatus, CrmAuditStatusEnum.APPROVE.getStatus()) |
| 114 | 112 | .between(CrmContractDO::getEndTime, beginOfToday, endOfToday.plusDays(REMIND_DAYS)); | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java
| ... | ... | @@ -148,8 +148,7 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> { |
| 148 | 148 | return selectCount(query); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - // TODO @dhb52:db 统一都是 select 关键字; | |
| 152 | - default Long getTodayCustomerCount(Long userId) { | |
| 151 | + default Long selectTodayCustomerCount(Long userId) { | |
| 153 | 152 | MPJLambdaWrapperX<CrmCustomerDO> query = new MPJLambdaWrapperX<>(); |
| 154 | 153 | // 我负责的 + 非公海 |
| 155 | 154 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(), |
| ... | ... | @@ -161,14 +160,13 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> { |
| 161 | 160 | return selectCount(query); |
| 162 | 161 | } |
| 163 | 162 | |
| 164 | - // TODO @dhb52:db 统一都是 select 关键字; | |
| 165 | - default Long getFollowCustomerCount(Long userId) { | |
| 163 | + default Long selectFollowCustomerCount(Long userId) { | |
| 166 | 164 | MPJLambdaWrapperX<CrmCustomerDO> query = new MPJLambdaWrapperX<>(); |
| 167 | 165 | // 我负责的 + 非公海 |
| 168 | 166 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(), |
| 169 | 167 | CrmCustomerDO::getId, userId, CrmSceneTypeEnum.OWNER.getType(), Boolean.FALSE); |
| 170 | - // 未跟进 TODO @dhb52:是不是 eq 会更好哈;mysql 不等于,对索引不友好 | |
| 171 | - query.ne(CrmClueDO::getFollowUpStatus, true); | |
| 168 | + // 未跟进 | |
| 169 | + query.eq(CrmClueDO::getFollowUpStatus, false); | |
| 172 | 170 | return selectCount(query); |
| 173 | 171 | } |
| 174 | 172 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivableMapper.java
| ... | ... | @@ -62,8 +62,7 @@ public interface CrmReceivableMapper extends BaseMapperX<CrmReceivableDO> { |
| 62 | 62 | return selectJoinList(CrmReceivableDO.class, query); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - // TODO @dhb52:db 统一都是 select 关键字; | |
| 66 | - default Long getCheckReceivablesCount(Long userId) { | |
| 65 | + default Long selectCheckReceivablesCount(Long userId) { | |
| 67 | 66 | MPJLambdaWrapperX<CrmReceivableDO> query = new MPJLambdaWrapperX<>(); |
| 68 | 67 | // 我负责的 + 非公海 |
| 69 | 68 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_RECEIVABLE.getType(), | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivablePlanMapper.java
| ... | ... | @@ -50,21 +50,19 @@ public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO |
| 50 | 50 | .orderByDesc(CrmReceivablePlanDO::getId); |
| 51 | 51 | |
| 52 | 52 | // Backlog: 回款提醒类型 |
| 53 | + // TODO: @dhb52 需要配置 提前提醒天数 | |
| 54 | + int REMIND_DAYS = 20; | |
| 53 | 55 | LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now()); |
| 54 | 56 | LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now()); |
| 55 | 57 | if (CrmReceivablePlanPageReqVO.REMIND_TYPE_NEEDED.equals(pageReqVO.getRemindType())) { // 待回款 |
| 56 | 58 | query.isNull(CrmReceivablePlanDO::getReceivableId) |
| 57 | - .gt(CrmReceivablePlanDO::getReturnTime, beginOfToday) | |
| 58 | - // TODO @dhb52:这里看看怎么改成不要使用 to_days | |
| 59 | - .apply("to_days(return_time) <= to_days(now())+ remind_days"); | |
| 59 | + .between(CrmReceivablePlanDO::getReturnTime, beginOfToday, endOfToday.plusDays(REMIND_DAYS)); | |
| 60 | 60 | } else if (CrmReceivablePlanPageReqVO.REMIND_TYPE_EXPIRED.equals(pageReqVO.getRemindType())) { // 已逾期 |
| 61 | 61 | query.isNull(CrmReceivablePlanDO::getReceivableId) |
| 62 | 62 | .lt(CrmReceivablePlanDO::getReturnTime, endOfToday); |
| 63 | 63 | } else if (CrmReceivablePlanPageReqVO.REMIND_TYPE_RECEIVED.equals(pageReqVO.getRemindType())) { // 已回款 |
| 64 | 64 | query.isNotNull(CrmReceivablePlanDO::getReceivableId) |
| 65 | - .gt(CrmReceivablePlanDO::getReturnTime, beginOfToday) | |
| 66 | - // TODO @dhb52:这里看看怎么改成不要使用 to_days | |
| 67 | - .apply("to_days(return_time) <= to_days(now()) + remind_days"); | |
| 65 | + .between(CrmReceivablePlanDO::getReturnTime, beginOfToday, endOfToday.plusDays(REMIND_DAYS));; | |
| 68 | 66 | } |
| 69 | 67 | |
| 70 | 68 | return selectJoinPage(pageReqVO, CrmReceivablePlanDO.class, query); |
| ... | ... | @@ -79,17 +77,17 @@ public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO |
| 79 | 77 | return selectJoinList(CrmReceivablePlanDO.class, query); |
| 80 | 78 | } |
| 81 | 79 | |
| 82 | - // TODO @dhb52:db 统一都是 select 关键字; | |
| 83 | - default Long getRemindReceivablePlanCount(Long userId) { | |
| 80 | + default Long selectRemindReceivablePlanCount(Long userId) { | |
| 84 | 81 | MPJLambdaWrapperX<CrmReceivablePlanDO> query = new MPJLambdaWrapperX<>(); |
| 85 | 82 | // 我负责的 + 非公海 |
| 86 | 83 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_RECEIVABLE_PLAN.getType(), |
| 87 | 84 | CrmReceivablePlanDO::getId, userId, CrmSceneTypeEnum.OWNER.getType(), Boolean.FALSE); |
| 88 | - // 待回款 TODO @dhb52:to_days(return_time) <= to_days(now())+ remind_days 看看怎么改成,不用数据库自己去计算这样的时间; | |
| 85 | + // TODO: @dhb52 需要配置 提前提醒天数 | |
| 86 | + int REMIND_DAYS = 20; | |
| 89 | 87 | LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now()); |
| 88 | + LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now()); | |
| 90 | 89 | query.isNull(CrmReceivablePlanDO::getReceivableId) |
| 91 | - .gt(CrmReceivablePlanDO::getReturnTime, beginOfToday) | |
| 92 | - .apply("to_days(return_time) <= to_days(now())+ remind_days"); | |
| 90 | + .between(CrmReceivablePlanDO::getReturnTime, beginOfToday, endOfToday.plusDays(REMIND_DAYS)); | |
| 93 | 91 | return selectCount(query); |
| 94 | 92 | } |
| 95 | 93 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java
| ... | ... | @@ -278,7 +278,7 @@ public class CrmClueServiceImpl implements CrmClueService { |
| 278 | 278 | |
| 279 | 279 | @Override |
| 280 | 280 | public Long getFollowLeadsCount(Long userId) { |
| 281 | - return clueMapper.getFollowLeadsCount(userId); | |
| 281 | + return clueMapper.selectFollowLeadsCount(userId); | |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractService.java
| ... | ... | @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageR |
| 6 | 6 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractSaveReqVO; |
| 7 | 7 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO; |
| 8 | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| 9 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractProductDO; | |
| 9 | 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 10 | 11 | import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO; |
| 11 | 12 | import jakarta.validation.Valid; | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractServiceImpl.java
| ... | ... | @@ -364,12 +364,12 @@ public class CrmContractServiceImpl implements CrmContractService { |
| 364 | 364 | |
| 365 | 365 | @Override |
| 366 | 366 | public Long getCheckContractCount(Long userId) { |
| 367 | - return contractMapper.getCheckContractCount(userId); | |
| 367 | + return contractMapper.selectCheckContractCount(userId); | |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | @Override |
| 371 | 371 | public Long getEndContractCount(Long userId) { |
| 372 | - return contractMapper.getEndContractCount(userId); | |
| 372 | + return contractMapper.selectEndContractCount(userId); | |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java
| ... | ... | @@ -482,12 +482,12 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { |
| 482 | 482 | |
| 483 | 483 | @Override |
| 484 | 484 | public Long getTodayCustomerCount(Long userId) { |
| 485 | - return customerMapper.getTodayCustomerCount(userId); | |
| 485 | + return customerMapper.selectTodayCustomerCount(userId); | |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | @Override |
| 489 | 489 | public Long getFollowCustomerCount(Long userId) { |
| 490 | - return customerMapper.getFollowCustomerCount(userId); | |
| 490 | + return customerMapper.selectFollowCustomerCount(userId); | |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | // ======================= 校验相关 ======================= | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivablePlanServiceImpl.java
| ... | ... | @@ -164,7 +164,7 @@ public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService { |
| 164 | 164 | |
| 165 | 165 | @Override |
| 166 | 166 | public Long getRemindReceivablePlanCount(Long userId) { |
| 167 | - return receivablePlanMapper.getRemindReceivablePlanCount(userId); | |
| 167 | + return receivablePlanMapper.selectRemindReceivablePlanCount(userId); | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableServiceImpl.java
| ... | ... | @@ -184,7 +184,7 @@ public class CrmReceivableServiceImpl implements CrmReceivableService { |
| 184 | 184 | |
| 185 | 185 | @Override |
| 186 | 186 | public Long getCheckReceivablesCount(Long userId) { |
| 187 | - return receivableMapper.getCheckReceivablesCount(userId); | |
| 187 | + return receivableMapper.selectCheckReceivablesCount(userId); | |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | } | ... | ... |