Commit 64e1d68923eb9a7cc2035ec2fd5401cf997416fa
1 parent
e16f1caa
📖 CRM:待办事项的 code review
Showing
6 changed files
with
13 additions
and
4 deletions
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/message/CrmMessageController.java
| ... | ... | @@ -20,7 +20,6 @@ import org.springframework.web.bind.annotation.RestController; |
| 20 | 20 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 21 | 21 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| 22 | 22 | |
| 23 | - | |
| 24 | 23 | @Tag(name = "管理后台 - CRM消息") |
| 25 | 24 | @RestController |
| 26 | 25 | @RequestMapping("/crm/message") |
| ... | ... | @@ -30,7 +29,8 @@ public class CrmMessageController { |
| 30 | 29 | @Resource |
| 31 | 30 | private CrmMessageService crmMessageService; |
| 32 | 31 | |
| 33 | - @GetMapping("/todayCustomer") | |
| 32 | + // TODO 芋艿:未来可能合并到 CrmCustomerController | |
| 33 | + @GetMapping("/todayCustomer") // TODO @dbh52:【优先级低】url 使用中划线,项目规范。然后叫 today-customer-page,通过 page 体现出它是个分页接口 | |
| 34 | 34 | @Operation(summary = "今日需联系客户") |
| 35 | 35 | @PreAuthorize("@ss.hasPermission('crm:message:todayCustomer')") |
| 36 | 36 | public CommonResult<PageResult<CrmCustomerRespVO>> getTodayCustomerPage(@Valid CrmTodayCustomerPageReqVO pageReqVO) { | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/message/vo/CrmTodayCustomerPageReqVO.java
| ... | ... | @@ -15,6 +15,8 @@ import lombok.ToString; |
| 15 | 15 | @ToString(callSuper = true) |
| 16 | 16 | public class CrmTodayCustomerPageReqVO extends PageParam { |
| 17 | 17 | |
| 18 | + // TODO @dbh52:CrmContactStatusEnum 可以直接枚举三个 Integer;一般来说,枚举类尽量给数据模型用,这样枚举类少,更聚焦;这里的枚举,更多是专门给这个接口用的哈 | |
| 19 | + | |
| 18 | 20 | @Schema(description = "联系状态", example = "1") |
| 19 | 21 | @InEnum(CrmContactStatusEnum.class) |
| 20 | 22 | private Integer contactStatus; | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java
| ... | ... | @@ -85,6 +85,7 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> { |
| 85 | 85 | .eq(CrmFollowUpRecordDO::getType, CrmBizTypeEnum.CRM_CUSTOMER.getType()); |
| 86 | 86 | |
| 87 | 87 | // 拼接自身的查询条件 |
| 88 | + // TODO @dbh52:这里不仅仅要获得 today、tomorrow。而是 today 要获取今天的 00:00:00 这种; | |
| 88 | 89 | LocalDate today = LocalDate.now(); |
| 89 | 90 | LocalDate tomorrow = today.plusDays(1); |
| 90 | 91 | LocalDate yesterday = today.minusDays(1); |
| ... | ... | @@ -93,12 +94,14 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> { |
| 93 | 94 | // 1.【客户】的【下一次联系时间】 是【今天】 |
| 94 | 95 | // 2. 无法找到【今天】创建的【跟进】记录 |
| 95 | 96 | query.between(CrmCustomerDO::getContactNextTime, today, tomorrow) |
| 97 | + // TODO @dbh52:是不是查询 CrmCustomerDO::contactLastTime < today?因为今天联系过,应该会更新该字段,减少链表查询; | |
| 96 | 98 | .between(CrmFollowUpRecordDO::getCreateTime, today, tomorrow) |
| 97 | 99 | .isNull(CrmFollowUpRecordDO::getId); |
| 98 | 100 | } else if (pageReqVO.getContactStatus().equals(CrmContactStatusEnum.EXPIRED.getType())) { |
| 99 | 101 | // 已逾期: |
| 100 | 102 | // 1. 【客户】的【下一次联系时间】 <= 【昨天】 |
| 101 | 103 | // 2. 无法找到【今天】创建的【跟进】记录 |
| 104 | + // TODO @dbh52:是不是 contactNextTime 在当前时间之前,且 contactLastTime < contactNextTime?说白了,就是下次联系时间超过当前时间,且最后联系时间没去联系; | |
| 102 | 105 | query.le(CrmCustomerDO::getContactNextTime, yesterday) |
| 103 | 106 | .between(CrmFollowUpRecordDO::getCreateTime, today, tomorrow) |
| 104 | 107 | .isNull(CrmFollowUpRecordDO::getId); |
| ... | ... | @@ -107,10 +110,11 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> { |
| 107 | 110 | // 1.【客户】的【下一次联系时间】 是【今天】 |
| 108 | 111 | // 2. 找到【今天】创建的【跟进】记录 |
| 109 | 112 | query.between(CrmCustomerDO::getContactNextTime, today, tomorrow) |
| 113 | + // TODO @dbh52:contactLastTime 是今天 | |
| 110 | 114 | .between(CrmFollowUpRecordDO::getCreateTime, today, tomorrow) |
| 111 | 115 | .isNotNull(CrmFollowUpRecordDO::getId); |
| 112 | 116 | } else { |
| 113 | - // TODO: 参数错误,是不是要兜一下底 | |
| 117 | + // TODO: 参数错误,是不是要兜一下底;直接抛出异常就好啦; | |
| 114 | 118 | } |
| 115 | 119 | |
| 116 | 120 | return selectJoinPage(pageReqVO, CrmCustomerDO.class, query); | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/message/CrmMessageService.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/message/CrmMessageServiceImpl.java
| ... | ... | @@ -8,7 +8,7 @@ import jakarta.annotation.Resource; |
| 8 | 8 | import org.springframework.stereotype.Component; |
| 9 | 9 | import org.springframework.validation.annotation.Validated; |
| 10 | 10 | |
| 11 | - | |
| 11 | +// TODO @dbh52:注释要写下 | |
| 12 | 12 | @Component |
| 13 | 13 | @Validated |
| 14 | 14 | public class CrmMessageServiceImpl implements CrmMessageService { | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java
| ... | ... | @@ -168,6 +168,7 @@ public class ProductSpuServiceImpl implements ProductSpuService { |
| 168 | 168 | if (ObjectUtil.notEqual(spuDO.getStatus(), ProductSpuStatusEnum.RECYCLE.getStatus())) { |
| 169 | 169 | throw exception(SPU_NOT_RECYCLE); |
| 170 | 170 | } |
| 171 | + // TODO 芋艿:【可选】参与活动中的商品,不允许删除??? | |
| 171 | 172 | |
| 172 | 173 | // 删除 SPU |
| 173 | 174 | productSpuMapper.deleteById(id); |
| ... | ... | @@ -235,6 +236,7 @@ public class ProductSpuServiceImpl implements ProductSpuService { |
| 235 | 236 | public void updateSpuStatus(ProductSpuUpdateStatusReqVO updateReqVO) { |
| 236 | 237 | // 校验存在 |
| 237 | 238 | validateSpuExists(updateReqVO.getId()); |
| 239 | + // TODO 芋艿:【可选】参与活动中的商品,不允许下架??? | |
| 238 | 240 | |
| 239 | 241 | // 更新状态 |
| 240 | 242 | ProductSpuDO productSpuDO = productSpuMapper.selectById(updateReqVO.getId()).setStatus(updateReqVO.getStatus()); | ... | ... |