mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 01:01:52 +08:00
📖 CRM:待办事项的 code review
This commit is contained in:
parent
e16f1caae0
commit
64e1d68923
@ -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.common.pojo.CommonResult.success;
|
||||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
|
|
||||||
|
|
||||||
@Tag(name = "管理后台 - CRM消息")
|
@Tag(name = "管理后台 - CRM消息")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/crm/message")
|
@RequestMapping("/crm/message")
|
||||||
@ -30,7 +29,8 @@ public class CrmMessageController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CrmMessageService crmMessageService;
|
private CrmMessageService crmMessageService;
|
||||||
|
|
||||||
@GetMapping("/todayCustomer")
|
// TODO 芋艿:未来可能合并到 CrmCustomerController
|
||||||
|
@GetMapping("/todayCustomer") // TODO @dbh52:【优先级低】url 使用中划线,项目规范。然后叫 today-customer-page,通过 page 体现出它是个分页接口
|
||||||
@Operation(summary = "今日需联系客户")
|
@Operation(summary = "今日需联系客户")
|
||||||
@PreAuthorize("@ss.hasPermission('crm:message:todayCustomer')")
|
@PreAuthorize("@ss.hasPermission('crm:message:todayCustomer')")
|
||||||
public CommonResult<PageResult<CrmCustomerRespVO>> getTodayCustomerPage(@Valid CrmTodayCustomerPageReqVO pageReqVO) {
|
public CommonResult<PageResult<CrmCustomerRespVO>> getTodayCustomerPage(@Valid CrmTodayCustomerPageReqVO pageReqVO) {
|
||||||
|
@ -15,6 +15,8 @@ import lombok.ToString;
|
|||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class CrmTodayCustomerPageReqVO extends PageParam {
|
public class CrmTodayCustomerPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
// TODO @dbh52:CrmContactStatusEnum 可以直接枚举三个 Integer;一般来说,枚举类尽量给数据模型用,这样枚举类少,更聚焦;这里的枚举,更多是专门给这个接口用的哈
|
||||||
|
|
||||||
@Schema(description = "联系状态", example = "1")
|
@Schema(description = "联系状态", example = "1")
|
||||||
@InEnum(CrmContactStatusEnum.class)
|
@InEnum(CrmContactStatusEnum.class)
|
||||||
private Integer contactStatus;
|
private Integer contactStatus;
|
||||||
|
@ -85,6 +85,7 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
|
|||||||
.eq(CrmFollowUpRecordDO::getType, CrmBizTypeEnum.CRM_CUSTOMER.getType());
|
.eq(CrmFollowUpRecordDO::getType, CrmBizTypeEnum.CRM_CUSTOMER.getType());
|
||||||
|
|
||||||
// 拼接自身的查询条件
|
// 拼接自身的查询条件
|
||||||
|
// TODO @dbh52:这里不仅仅要获得 today、tomorrow。而是 today 要获取今天的 00:00:00 这种;
|
||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
LocalDate tomorrow = today.plusDays(1);
|
LocalDate tomorrow = today.plusDays(1);
|
||||||
LocalDate yesterday = today.minusDays(1);
|
LocalDate yesterday = today.minusDays(1);
|
||||||
@ -93,12 +94,14 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
|
|||||||
// 1.【客户】的【下一次联系时间】 是【今天】
|
// 1.【客户】的【下一次联系时间】 是【今天】
|
||||||
// 2. 无法找到【今天】创建的【跟进】记录
|
// 2. 无法找到【今天】创建的【跟进】记录
|
||||||
query.between(CrmCustomerDO::getContactNextTime, today, tomorrow)
|
query.between(CrmCustomerDO::getContactNextTime, today, tomorrow)
|
||||||
|
// TODO @dbh52:是不是查询 CrmCustomerDO::contactLastTime < today?因为今天联系过,应该会更新该字段,减少链表查询;
|
||||||
.between(CrmFollowUpRecordDO::getCreateTime, today, tomorrow)
|
.between(CrmFollowUpRecordDO::getCreateTime, today, tomorrow)
|
||||||
.isNull(CrmFollowUpRecordDO::getId);
|
.isNull(CrmFollowUpRecordDO::getId);
|
||||||
} else if (pageReqVO.getContactStatus().equals(CrmContactStatusEnum.EXPIRED.getType())) {
|
} else if (pageReqVO.getContactStatus().equals(CrmContactStatusEnum.EXPIRED.getType())) {
|
||||||
// 已逾期:
|
// 已逾期:
|
||||||
// 1. 【客户】的【下一次联系时间】 <= 【昨天】
|
// 1. 【客户】的【下一次联系时间】 <= 【昨天】
|
||||||
// 2. 无法找到【今天】创建的【跟进】记录
|
// 2. 无法找到【今天】创建的【跟进】记录
|
||||||
|
// TODO @dbh52:是不是 contactNextTime 在当前时间之前,且 contactLastTime < contactNextTime?说白了,就是下次联系时间超过当前时间,且最后联系时间没去联系;
|
||||||
query.le(CrmCustomerDO::getContactNextTime, yesterday)
|
query.le(CrmCustomerDO::getContactNextTime, yesterday)
|
||||||
.between(CrmFollowUpRecordDO::getCreateTime, today, tomorrow)
|
.between(CrmFollowUpRecordDO::getCreateTime, today, tomorrow)
|
||||||
.isNull(CrmFollowUpRecordDO::getId);
|
.isNull(CrmFollowUpRecordDO::getId);
|
||||||
@ -107,10 +110,11 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
|
|||||||
// 1.【客户】的【下一次联系时间】 是【今天】
|
// 1.【客户】的【下一次联系时间】 是【今天】
|
||||||
// 2. 找到【今天】创建的【跟进】记录
|
// 2. 找到【今天】创建的【跟进】记录
|
||||||
query.between(CrmCustomerDO::getContactNextTime, today, tomorrow)
|
query.between(CrmCustomerDO::getContactNextTime, today, tomorrow)
|
||||||
|
// TODO @dbh52:contactLastTime 是今天
|
||||||
.between(CrmFollowUpRecordDO::getCreateTime, today, tomorrow)
|
.between(CrmFollowUpRecordDO::getCreateTime, today, tomorrow)
|
||||||
.isNotNull(CrmFollowUpRecordDO::getId);
|
.isNotNull(CrmFollowUpRecordDO::getId);
|
||||||
} else {
|
} else {
|
||||||
// TODO: 参数错误,是不是要兜一下底
|
// TODO: 参数错误,是不是要兜一下底;直接抛出异常就好啦;
|
||||||
}
|
}
|
||||||
|
|
||||||
return selectJoinPage(pageReqVO, CrmCustomerDO.class, query);
|
return selectJoinPage(pageReqVO, CrmCustomerDO.class, query);
|
||||||
|
@ -13,6 +13,7 @@ import jakarta.validation.Valid;
|
|||||||
public interface CrmMessageService {
|
public interface CrmMessageService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* TODO @dbh52:注释要写下
|
||||||
*
|
*
|
||||||
* @param pageReqVO
|
* @param pageReqVO
|
||||||
* @return
|
* @return
|
||||||
|
@ -8,7 +8,7 @@ import jakarta.annotation.Resource;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
// TODO @dbh52:注释要写下
|
||||||
@Component
|
@Component
|
||||||
@Validated
|
@Validated
|
||||||
public class CrmMessageServiceImpl implements CrmMessageService {
|
public class CrmMessageServiceImpl implements CrmMessageService {
|
||||||
|
@ -168,6 +168,7 @@ public class ProductSpuServiceImpl implements ProductSpuService {
|
|||||||
if (ObjectUtil.notEqual(spuDO.getStatus(), ProductSpuStatusEnum.RECYCLE.getStatus())) {
|
if (ObjectUtil.notEqual(spuDO.getStatus(), ProductSpuStatusEnum.RECYCLE.getStatus())) {
|
||||||
throw exception(SPU_NOT_RECYCLE);
|
throw exception(SPU_NOT_RECYCLE);
|
||||||
}
|
}
|
||||||
|
// TODO 芋艿:【可选】参与活动中的商品,不允许删除???
|
||||||
|
|
||||||
// 删除 SPU
|
// 删除 SPU
|
||||||
productSpuMapper.deleteById(id);
|
productSpuMapper.deleteById(id);
|
||||||
@ -235,6 +236,7 @@ public class ProductSpuServiceImpl implements ProductSpuService {
|
|||||||
public void updateSpuStatus(ProductSpuUpdateStatusReqVO updateReqVO) {
|
public void updateSpuStatus(ProductSpuUpdateStatusReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validateSpuExists(updateReqVO.getId());
|
validateSpuExists(updateReqVO.getId());
|
||||||
|
// TODO 芋艿:【可选】参与活动中的商品,不允许下架???
|
||||||
|
|
||||||
// 更新状态
|
// 更新状态
|
||||||
ProductSpuDO productSpuDO = productSpuMapper.selectById(updateReqVO.getId()).setStatus(updateReqVO.getStatus());
|
ProductSpuDO productSpuDO = productSpuMapper.selectById(updateReqVO.getId()).setStatus(updateReqVO.getStatus());
|
||||||
|
Loading…
Reference in New Issue
Block a user