📖 CRM:待办事项的 code review

This commit is contained in:
YunaiV
2024-01-15 12:15:52 +08:00
parent e16f1caae0
commit 64e1d68923
6 changed files with 13 additions and 4 deletions

View File

@ -20,7 +20,6 @@ import org.springframework.web.bind.annotation.RestController;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@Tag(name = "管理后台 - CRM消息")
@RestController
@RequestMapping("/crm/message")
@ -30,7 +29,8 @@ public class CrmMessageController {
@Resource
private CrmMessageService crmMessageService;
@GetMapping("/todayCustomer")
// TODO 芋艿:未来可能合并到 CrmCustomerController
@GetMapping("/todayCustomer") // TODO @dbh52【优先级低】url 使用中划线,项目规范。然后叫 today-customer-page通过 page 体现出它是个分页接口
@Operation(summary = "今日需联系客户")
@PreAuthorize("@ss.hasPermission('crm:message:todayCustomer')")
public CommonResult<PageResult<CrmCustomerRespVO>> getTodayCustomerPage(@Valid CrmTodayCustomerPageReqVO pageReqVO) {

View File

@ -15,6 +15,8 @@ import lombok.ToString;
@ToString(callSuper = true)
public class CrmTodayCustomerPageReqVO extends PageParam {
// TODO @dbh52CrmContactStatusEnum 可以直接枚举三个 Integer一般来说枚举类尽量给数据模型用这样枚举类少更聚焦这里的枚举更多是专门给这个接口用的哈
@Schema(description = "联系状态", example = "1")
@InEnum(CrmContactStatusEnum.class)
private Integer contactStatus;

View File

@ -85,6 +85,7 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
.eq(CrmFollowUpRecordDO::getType, CrmBizTypeEnum.CRM_CUSTOMER.getType());
// 拼接自身的查询条件
// TODO @dbh52这里不仅仅要获得 today、tomorrow。而是 today 要获取今天的 00:00:00 这种;
LocalDate today = LocalDate.now();
LocalDate tomorrow = today.plusDays(1);
LocalDate yesterday = today.minusDays(1);
@ -93,12 +94,14 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
// 1.【客户】的【下一次联系时间】 是【今天】
// 2. 无法找到【今天】创建的【跟进】记录
query.between(CrmCustomerDO::getContactNextTime, today, tomorrow)
// TODO @dbh52是不是查询 CrmCustomerDO::contactLastTime < today因为今天联系过应该会更新该字段减少链表查询
.between(CrmFollowUpRecordDO::getCreateTime, today, tomorrow)
.isNull(CrmFollowUpRecordDO::getId);
} else if (pageReqVO.getContactStatus().equals(CrmContactStatusEnum.EXPIRED.getType())) {
// 已逾期:
// 1. 【客户】的【下一次联系时间】 <= 【昨天】
// 2. 无法找到【今天】创建的【跟进】记录
// TODO @dbh52是不是 contactNextTime 在当前时间之前,且 contactLastTime < contactNextTime说白了就是下次联系时间超过当前时间且最后联系时间没去联系
query.le(CrmCustomerDO::getContactNextTime, yesterday)
.between(CrmFollowUpRecordDO::getCreateTime, today, tomorrow)
.isNull(CrmFollowUpRecordDO::getId);
@ -107,10 +110,11 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
// 1.【客户】的【下一次联系时间】 是【今天】
// 2. 找到【今天】创建的【跟进】记录
query.between(CrmCustomerDO::getContactNextTime, today, tomorrow)
// TODO @dbh52contactLastTime 是今天
.between(CrmFollowUpRecordDO::getCreateTime, today, tomorrow)
.isNotNull(CrmFollowUpRecordDO::getId);
} else {
// TODO: 参数错误,是不是要兜一下底
// TODO: 参数错误,是不是要兜一下底;直接抛出异常就好啦;
}
return selectJoinPage(pageReqVO, CrmCustomerDO.class, query);

View File

@ -13,6 +13,7 @@ import jakarta.validation.Valid;
public interface CrmMessageService {
/**
* TODO @dbh52注释要写下
*
* @param pageReqVO
* @return

View File

@ -8,7 +8,7 @@ import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;
// TODO @dbh52注释要写下
@Component
@Validated
public class CrmMessageServiceImpl implements CrmMessageService {