From 1a93e3a1101243fb249b98d277fe20603c11accb Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 28 Nov 2023 21:07:23 +0800 Subject: [PATCH] =?UTF-8?q?crm=EF=BC=9Acode=20review=20=E8=81=94=E7=B3=BB?= =?UTF-8?q?=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/contact/ContactController.java | 2 +- .../controller/admin/contact/vo/ContactBaseVO.java | 2 +- .../admin/contact/vo/ContactSimpleRespVO.java | 3 +-- .../module/crm/convert/contact/ContactConvert.java | 4 ++-- .../crm/service/contact/ContactServiceImpl.java | 13 +++++++------ 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/ContactController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/ContactController.java index 87850cc7f..5f3da2d91 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/ContactController.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/ContactController.java @@ -144,7 +144,7 @@ public class ContactController { List crmCustomerDOList = crmCustomerService.getCustomerList(convertSet(contactDOList, ContactDO::getCustomerId)); // 2. 获取创建人、责任人列表 List userIdsList = convertListByFlatMap(contactDOList, item -> Stream.of(NumberUtils.parseLong(item.getCreator()), item.getOwnerUserId()) - .filter(Objects::nonNull)); + .filter(Objects::nonNull)); // TODO @zyna:里面已经忽略 null 啦 Map userMap = adminUserApi.getUserMap(userIdsList); // 3. 直属上级 Set contactIdsList = convertSet(contactDOList, ContactDO::getParentId); diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/ContactBaseVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/ContactBaseVO.java index 250e78193..c15b882dc 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/ContactBaseVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/ContactBaseVO.java @@ -18,7 +18,7 @@ import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -// TODO zyna:参考新的 vo,重新拆分下 VO +// TODO zyna:要不按照新的,干掉这个 basevo,都放子类里 /** * CRM 联系人 Base VO,提供给添加、修改、详细的子 VO 使用 * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/ContactSimpleRespVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/ContactSimpleRespVO.java index 51342d353..872a0c77d 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/ContactSimpleRespVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/ContactSimpleRespVO.java @@ -14,6 +14,5 @@ public class ContactSimpleRespVO { @Schema(description = "姓名", example = "芋艿") private String name; - - + } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contact/ContactConvert.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contact/ContactConvert.java index 81767422d..ea2c614f4 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contact/ContactConvert.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contact/ContactConvert.java @@ -78,10 +78,10 @@ public interface ContactConvert { Map customerMap = convertMap(customerList, CrmCustomerDO::getId); result.forEach(item -> { setUserInfo(item, userMap); - findAndThen(customerMap, item.getCustomerId(), customer -> { + findAndThen(customerMap, item.getCustomerId(), customer -> { // TODO @zyna:这里的 { 可以去掉 item.setCustomerName(customer.getName()); }); - findAndThen(parentContactMap, item.getParentId(), contactDO -> { + findAndThen(parentContactMap, item.getParentId(), contactDO -> { // TODO @zyna:这里的 { 可以去掉 item.setParentName(contactDO.getName()); }); }); diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/ContactServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/ContactServiceImpl.java index 94c4d1e11..d0c9f1226 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/ContactServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/ContactServiceImpl.java @@ -45,13 +45,12 @@ public class ContactServiceImpl implements ContactService { @Resource private CrmCustomerService customerService; + @Resource + private CrmPermissionService crmPermissionService; @Resource private AdminUserApi adminUserApi; - @Resource - private CrmPermissionService crmPermissionService; - @Override public Long createContact(ContactCreateReqVO createReqVO, Long userId) { //@todo @@ -126,18 +125,20 @@ public class ContactServiceImpl implements ContactService { return contactMapper.selectList(); } + // TODO 芋艿:后面在看下这个方法; private void validateDataExist(ContactBaseVO contactBaseVO){ - //1.校验客户 + // 1.校验客户 if (contactBaseVO.getCustomerId() != null) { Optional.ofNullable(customerService.getCustomer(contactBaseVO.getCustomerId())).orElseThrow(() -> exception(CUSTOMER_NOT_EXISTS)); } - //2.校验负责人 + // 2.校验负责人 if (contactBaseVO.getOwnerUserId() != null) { Optional.ofNullable(adminUserApi.getUser(contactBaseVO.getOwnerUserId())).orElseThrow(() -> exception(USER_NOT_EXISTS)); } - //3.直属上级 + // 3.直属上级 if (contactBaseVO.getParentId() != null) { Optional.ofNullable(contactMapper.selectById(contactBaseVO.getParentId())).orElseThrow(() -> exception(CONTACT_NOT_EXISTS)); } } + }