From c6c8dddfec8d6266630f4800e41771901e582f28 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Jan 2024 19:05:16 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=96=20CRM=EF=BC=9Acode=20review=20?= =?UTF-8?q?=E8=B7=9F=E8=BF=9B=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/crm/convert/business/CrmBusinessConvert.java | 4 ++-- .../yudao/module/crm/convert/contact/CrmContactConvert.java | 4 ++-- .../crm/service/followup/CrmFollowUpRecordServiceImpl.java | 1 + .../crm/service/followup/bo/CrmUpdateFollowUpReqBO.java | 1 - .../product/convert/comment/ProductCommentConvert.java | 4 ---- .../service/comment/ProductCommentServiceImplTest.java | 5 +++-- 6 files changed, 8 insertions(+), 11 deletions(-) diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/business/CrmBusinessConvert.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/business/CrmBusinessConvert.java index 56bba541e..d7f990043 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/business/CrmBusinessConvert.java +++ b/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 { @Mapping(target = "id", source = "reqBO.bizId") CrmBusinessDO convert(CrmUpdateFollowUpReqBO reqBO); - default List convertList(List updateFollowUpReqBOList) { - return CollectionUtils.convertList(updateFollowUpReqBOList, INSTANCE::convert); + default List convertList(List list) { + return CollectionUtils.convertList(list, INSTANCE::convert); } } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contact/CrmContactConvert.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contact/CrmContactConvert.java index 1d32331bb..5fd2afa67 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contact/CrmContactConvert.java +++ b/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 { @Mapping(target = "id", source = "reqBO.bizId") CrmContactDO convert(CrmUpdateFollowUpReqBO reqBO); - default List convertList(List updateFollowUpReqBOList) { - return CollectionUtils.convertList(updateFollowUpReqBOList, INSTANCE::convert); + default List convertList(List list) { + return CollectionUtils.convertList(list, INSTANCE::convert); } } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordServiceImpl.java index d812ce048..a2da1ee3e 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordServiceImpl.java +++ b/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 { crmFollowUpRecordMapper.insert(followUpRecord); LocalDateTime now = LocalDateTime.now(); + // TODO @puhui999:感觉可以这里基于 type 做 102 到 104 这种判断;然后,每个类型的调用封装一个小方法,之后调用这些小方法;再之后,74-76、80-82 也是等价的处理; // 2. 更新 bizId 对应的记录; updateBizTypeFollowUp(followUpRecord, now); // 3.1 更新 contactIds 对应的记录 diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/followup/bo/CrmUpdateFollowUpReqBO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/followup/bo/CrmUpdateFollowUpReqBO.java index 6ddf71c7d..74e789436 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/followup/bo/CrmUpdateFollowUpReqBO.java +++ b/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; import java.time.LocalDateTime; - /** * 跟进信息 Update Req BO * diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/comment/ProductCommentConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/comment/ProductCommentConvert.java index 27cb92637..7a3a3c011 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/comment/ProductCommentConvert.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/comment/ProductCommentConvert.java @@ -1,11 +1,9 @@ package cn.iocoder.yudao.module.product.convert.comment; -import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDTO; import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentCreateReqVO; -import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentRespVO; import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; @@ -61,6 +59,4 @@ public interface ProductCommentConvert { return divide.intValue(); } - PageResult convertPage(PageResult productCommentDOPageResult); - } diff --git a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/comment/ProductCommentServiceImplTest.java b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/comment/ProductCommentServiceImplTest.java index 50ff0af56..1b92e21f2 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/comment/ProductCommentServiceImplTest.java +++ b/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; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.RandomUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO; import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyReqVO; import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentRespVO; import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentUpdateVisibleReqVO; import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO; -import cn.iocoder.yudao.module.product.convert.comment.ProductCommentConvert; import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; import cn.iocoder.yudao.module.product.dal.mysql.comment.ProductCommentMapper; import cn.iocoder.yudao.module.product.enums.comment.ProductCommentScoresEnum; @@ -128,7 +128,8 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest { productCommentPageReqVO.setReplyStatus(Boolean.TRUE); PageResult commentPage = productCommentService.getCommentPage(productCommentPageReqVO); - PageResult result = ProductCommentConvert.INSTANCE.convertPage(productCommentMapper.selectPage(productCommentPageReqVO)); + PageResult result = BeanUtils.toBean(productCommentMapper.selectPage(productCommentPageReqVO), + ProductCommentRespVO.class); assertEquals(result.getTotal(), commentPage.getTotal()); PageResult all = productCommentService.getCommentPage(new ProductCommentPageReqVO());