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