Commit c6c8dddfec8d6266630f4800e41771901e582f28

Authored by YunaiV
1 parent 5b26d8fa

📖 CRM:code review 跟进记录

yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/business/CrmBusinessConvert.java
@@ -50,8 +50,8 @@ public interface CrmBusinessConvert { @@ -50,8 +50,8 @@ public interface CrmBusinessConvert {
50 @Mapping(target = "id", source = "reqBO.bizId") 50 @Mapping(target = "id", source = "reqBO.bizId")
51 CrmBusinessDO convert(CrmUpdateFollowUpReqBO reqBO); 51 CrmBusinessDO convert(CrmUpdateFollowUpReqBO reqBO);
52 52
53 - default List<CrmBusinessDO> convertList(List<CrmUpdateFollowUpReqBO> updateFollowUpReqBOList) {  
54 - return CollectionUtils.convertList(updateFollowUpReqBOList, INSTANCE::convert); 53 + default List<CrmBusinessDO> convertList(List<CrmUpdateFollowUpReqBO> list) {
  54 + return CollectionUtils.convertList(list, INSTANCE::convert);
55 } 55 }
56 56
57 } 57 }
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contact/CrmContactConvert.java
@@ -70,8 +70,8 @@ public interface CrmContactConvert { @@ -70,8 +70,8 @@ public interface CrmContactConvert {
70 @Mapping(target = "id", source = "reqBO.bizId") 70 @Mapping(target = "id", source = "reqBO.bizId")
71 CrmContactDO convert(CrmUpdateFollowUpReqBO reqBO); 71 CrmContactDO convert(CrmUpdateFollowUpReqBO reqBO);
72 72
73 - default List<CrmContactDO> convertList(List<CrmUpdateFollowUpReqBO> updateFollowUpReqBOList) {  
74 - return CollectionUtils.convertList(updateFollowUpReqBOList, INSTANCE::convert); 73 + default List<CrmContactDO> convertList(List<CrmUpdateFollowUpReqBO> list) {
  74 + return CollectionUtils.convertList(list, INSTANCE::convert);
75 } 75 }
76 76
77 } 77 }
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordServiceImpl.java
@@ -66,6 +66,7 @@ public class CrmFollowUpRecordServiceImpl implements CrmFollowUpRecordService { @@ -66,6 +66,7 @@ public class CrmFollowUpRecordServiceImpl implements CrmFollowUpRecordService {
66 crmFollowUpRecordMapper.insert(followUpRecord); 66 crmFollowUpRecordMapper.insert(followUpRecord);
67 67
68 LocalDateTime now = LocalDateTime.now(); 68 LocalDateTime now = LocalDateTime.now();
  69 + // TODO @puhui999:感觉可以这里基于 type 做 102 到 104 这种判断;然后,每个类型的调用封装一个小方法,之后调用这些小方法;再之后,74-76、80-82 也是等价的处理;
69 // 2. 更新 bizId 对应的记录; 70 // 2. 更新 bizId 对应的记录;
70 updateBizTypeFollowUp(followUpRecord, now); 71 updateBizTypeFollowUp(followUpRecord, now);
71 // 3.1 更新 contactIds 对应的记录 72 // 3.1 更新 contactIds 对应的记录
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/followup/bo/CrmUpdateFollowUpReqBO.java
@@ -7,7 +7,6 @@ import lombok.Data; @@ -7,7 +7,6 @@ import lombok.Data;
7 7
8 import java.time.LocalDateTime; 8 import java.time.LocalDateTime;
9 9
10 -  
11 /** 10 /**
12 * 跟进信息 Update Req BO 11 * 跟进信息 Update Req BO
13 * 12 *
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/comment/ProductCommentConvert.java
1 package cn.iocoder.yudao.module.product.convert.comment; 1 package cn.iocoder.yudao.module.product.convert.comment;
2 2
3 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
4 import cn.iocoder.yudao.framework.common.util.object.BeanUtils; 3 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
5 import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; 4 import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
6 import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDTO; 5 import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDTO;
7 import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentCreateReqVO; 6 import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentCreateReqVO;
8 -import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentRespVO;  
9 import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; 7 import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO;
10 import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; 8 import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
11 import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; 9 import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
@@ -61,6 +59,4 @@ public interface ProductCommentConvert { @@ -61,6 +59,4 @@ public interface ProductCommentConvert {
61 return divide.intValue(); 59 return divide.intValue();
62 } 60 }
63 61
64 - PageResult<ProductCommentRespVO> convertPage(PageResult<ProductCommentDO> productCommentDOPageResult);  
65 -  
66 } 62 }
yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/comment/ProductCommentServiceImplTest.java
@@ -3,13 +3,13 @@ package cn.iocoder.yudao.module.product.service.comment; @@ -3,13 +3,13 @@ package cn.iocoder.yudao.module.product.service.comment;
3 import cn.hutool.core.date.DateUtil; 3 import cn.hutool.core.date.DateUtil;
4 import cn.hutool.core.util.RandomUtil; 4 import cn.hutool.core.util.RandomUtil;
5 import cn.iocoder.yudao.framework.common.pojo.PageResult; 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
6 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; 7 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
7 import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO; 8 import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO;
8 import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyReqVO; 9 import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyReqVO;
9 import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentRespVO; 10 import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentRespVO;
10 import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentUpdateVisibleReqVO; 11 import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentUpdateVisibleReqVO;
11 import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO; 12 import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO;
12 -import cn.iocoder.yudao.module.product.convert.comment.ProductCommentConvert;  
13 import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; 13 import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO;
14 import cn.iocoder.yudao.module.product.dal.mysql.comment.ProductCommentMapper; 14 import cn.iocoder.yudao.module.product.dal.mysql.comment.ProductCommentMapper;
15 import cn.iocoder.yudao.module.product.enums.comment.ProductCommentScoresEnum; 15 import cn.iocoder.yudao.module.product.enums.comment.ProductCommentScoresEnum;
@@ -128,7 +128,8 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest { @@ -128,7 +128,8 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest {
128 productCommentPageReqVO.setReplyStatus(Boolean.TRUE); 128 productCommentPageReqVO.setReplyStatus(Boolean.TRUE);
129 129
130 PageResult<ProductCommentDO> commentPage = productCommentService.getCommentPage(productCommentPageReqVO); 130 PageResult<ProductCommentDO> commentPage = productCommentService.getCommentPage(productCommentPageReqVO);
131 - PageResult<ProductCommentRespVO> result = ProductCommentConvert.INSTANCE.convertPage(productCommentMapper.selectPage(productCommentPageReqVO)); 131 + PageResult<ProductCommentRespVO> result = BeanUtils.toBean(productCommentMapper.selectPage(productCommentPageReqVO),
  132 + ProductCommentRespVO.class);
132 assertEquals(result.getTotal(), commentPage.getTotal()); 133 assertEquals(result.getTotal(), commentPage.getTotal());
133 134
134 PageResult<ProductCommentDO> all = productCommentService.getCommentPage(new ProductCommentPageReqVO()); 135 PageResult<ProductCommentDO> all = productCommentService.getCommentPage(new ProductCommentPageReqVO());