Commit 206899bfc09b7017a7c8b5b0ccc286d9e862fdb3
1 parent
422b19ca
📖 CRM:code review 待办事项
Showing
4 changed files
with
25 additions
and
24 deletions
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ErrorCodeConstants.java
| ... | ... | @@ -87,6 +87,5 @@ public interface ErrorCodeConstants { |
| 87 | 87 | ErrorCode FOLLOW_UP_RECORD_DELETE_DENIED = new ErrorCode(1_020_013_001, "删除跟进记录失败,原因:没有权限"); |
| 88 | 88 | |
| 89 | 89 | // ========== 待办消息 1_020_014_000 ========== |
| 90 | - ErrorCode BACKLOG_CONTACT_STATUS_INVALID = new ErrorCode(1_020_014_000, "客户联系状态有误"); | |
| 91 | 90 | |
| 92 | 91 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/backlog/vo/CrmTodayCustomerPageReqVO.java
| ... | ... | @@ -14,11 +14,19 @@ import lombok.ToString; |
| 14 | 14 | @ToString(callSuper = true) |
| 15 | 15 | public class CrmTodayCustomerPageReqVO extends PageParam { |
| 16 | 16 | |
| 17 | + /** | |
| 18 | + * 联系状态 - 今日需联系 | |
| 19 | + */ | |
| 17 | 20 | public static final int CONTACT_TODAY = 1; |
| 21 | + /** | |
| 22 | + * 联系状态 - 已逾期 | |
| 23 | + */ | |
| 18 | 24 | public static final int CONTACT_EXPIRED = 2; |
| 25 | + /** | |
| 26 | + * 联系状态 - 已联系 | |
| 27 | + */ | |
| 19 | 28 | public static final int CONTACT_ALREADY = 3; |
| 20 | 29 | |
| 21 | - | |
| 22 | 30 | @Schema(description = "联系状态", example = "1") |
| 23 | 31 | private Integer contactStatus; |
| 24 | 32 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.dal.mysql.customer; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.date.LocalDateTimeUtil; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 5 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 6 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| ... | ... | @@ -13,15 +14,10 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 13 | 14 | import org.apache.ibatis.annotations.Mapper; |
| 14 | 15 | import org.springframework.lang.Nullable; |
| 15 | 16 | |
| 16 | -import java.time.LocalDate; | |
| 17 | 17 | import java.time.LocalDateTime; |
| 18 | -import java.time.LocalTime; | |
| 19 | 18 | import java.util.Collection; |
| 20 | 19 | import java.util.List; |
| 21 | 20 | |
| 22 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 23 | -import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BACKLOG_CONTACT_STATUS_INVALID; | |
| 24 | - | |
| 25 | 21 | /** |
| 26 | 22 | * 客户 Mapper |
| 27 | 23 | * |
| ... | ... | @@ -85,24 +81,21 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> { |
| 85 | 81 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(), |
| 86 | 82 | CrmCustomerDO::getId, userId, pageReqVO.getSceneType(), null); |
| 87 | 83 | |
| 88 | - query.selectAll(CrmCustomerDO.class); | |
| 89 | - | |
| 90 | 84 | // 拼接自身的查询条件 |
| 91 | - LocalDateTime beginOfToday = LocalDate.now().atTime(LocalTime.MIN); | |
| 92 | - LocalDateTime endOfToday = LocalDate.now().atTime(LocalTime.MAX); | |
| 93 | - if (pageReqVO.getContactStatus().equals(CrmTodayCustomerPageReqVO.CONTACT_TODAY)) { | |
| 94 | - // 今天需联系 | |
| 95 | - query.between(CrmCustomerDO::getContactNextTime, beginOfToday, endOfToday); | |
| 96 | - } else if (pageReqVO.getContactStatus().equals(CrmTodayCustomerPageReqVO.CONTACT_EXPIRED)) { | |
| 97 | - // 已逾期 | |
| 98 | - query.lt(CrmCustomerDO::getContactNextTime, beginOfToday); | |
| 99 | - } else if (pageReqVO.getContactStatus().equals(CrmTodayCustomerPageReqVO.CONTACT_ALREADY)) { | |
| 100 | - // 已联系 | |
| 101 | - query.between(CrmCustomerDO::getContactLastTime, beginOfToday, endOfToday); | |
| 102 | - } else { | |
| 103 | - throw exception(BACKLOG_CONTACT_STATUS_INVALID); | |
| 85 | + query.selectAll(CrmCustomerDO.class); | |
| 86 | + if (pageReqVO.getContactStatus() != null) { | |
| 87 | + LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now()); | |
| 88 | + LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now()); | |
| 89 | + if (pageReqVO.getContactStatus().equals(CrmTodayCustomerPageReqVO.CONTACT_TODAY)) { // 今天需联系 | |
| 90 | + query.between(CrmCustomerDO::getContactNextTime, beginOfToday, endOfToday); | |
| 91 | + } else if (pageReqVO.getContactStatus().equals(CrmTodayCustomerPageReqVO.CONTACT_EXPIRED)) { // 已逾期 | |
| 92 | + query.lt(CrmCustomerDO::getContactNextTime, beginOfToday); | |
| 93 | + } else if (pageReqVO.getContactStatus().equals(CrmTodayCustomerPageReqVO.CONTACT_ALREADY)) { // 已联系 | |
| 94 | + query.between(CrmCustomerDO::getContactLastTime, beginOfToday, endOfToday); | |
| 95 | + } else { | |
| 96 | + throw new IllegalArgumentException("未知联系状态:" + pageReqVO.getContactStatus()); | |
| 97 | + } | |
| 104 | 98 | } |
| 105 | - | |
| 106 | 99 | return selectJoinPage(pageReqVO, CrmCustomerDO.class, query); |
| 107 | 100 | } |
| 108 | 101 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/message/CrmBacklogServiceImpl.java