Commit 1a93e3a1101243fb249b98d277fe20603c11accb
1 parent
591bc367
crm:code review 联系人
Showing
5 changed files
with
12 additions
and
12 deletions
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 { | @@ -144,7 +144,7 @@ public class ContactController { | ||
| 144 | List<CrmCustomerDO> crmCustomerDOList = crmCustomerService.getCustomerList(convertSet(contactDOList, ContactDO::getCustomerId)); | 144 | List<CrmCustomerDO> crmCustomerDOList = crmCustomerService.getCustomerList(convertSet(contactDOList, ContactDO::getCustomerId)); |
| 145 | // 2. 获取创建人、责任人列表 | 145 | // 2. 获取创建人、责任人列表 |
| 146 | List<Long> userIdsList = convertListByFlatMap(contactDOList, item -> Stream.of(NumberUtils.parseLong(item.getCreator()), item.getOwnerUserId()) | 146 | List<Long> userIdsList = convertListByFlatMap(contactDOList, item -> Stream.of(NumberUtils.parseLong(item.getCreator()), item.getOwnerUserId()) |
| 147 | - .filter(Objects::nonNull)); | 147 | + .filter(Objects::nonNull)); // TODO @zyna:里面已经忽略 null 啦 |
| 148 | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIdsList); | 148 | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIdsList); |
| 149 | // 3. 直属上级 | 149 | // 3. 直属上级 |
| 150 | Set<Long> contactIdsList = convertSet(contactDOList, ContactDO::getParentId); | 150 | Set<Long> contactIdsList = convertSet(contactDOList, ContactDO::getParentId); |
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; | @@ -18,7 +18,7 @@ import java.time.LocalDateTime; | ||
| 18 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; | 18 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; |
| 19 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 19 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 20 | 20 | ||
| 21 | -// TODO zyna:参考新的 vo,重新拆分下 VO | 21 | +// TODO zyna:要不按照新的,干掉这个 basevo,都放子类里 |
| 22 | /** | 22 | /** |
| 23 | * CRM 联系人 Base VO,提供给添加、修改、详细的子 VO 使用 | 23 | * CRM 联系人 Base VO,提供给添加、修改、详细的子 VO 使用 |
| 24 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | 24 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/ContactSimpleRespVO.java
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 { | @@ -78,10 +78,10 @@ public interface ContactConvert { | ||
| 78 | Map<Long, CrmCustomerDO> customerMap = convertMap(customerList, CrmCustomerDO::getId); | 78 | Map<Long, CrmCustomerDO> customerMap = convertMap(customerList, CrmCustomerDO::getId); |
| 79 | result.forEach(item -> { | 79 | result.forEach(item -> { |
| 80 | setUserInfo(item, userMap); | 80 | setUserInfo(item, userMap); |
| 81 | - findAndThen(customerMap, item.getCustomerId(), customer -> { | 81 | + findAndThen(customerMap, item.getCustomerId(), customer -> { // TODO @zyna:这里的 { 可以去掉 |
| 82 | item.setCustomerName(customer.getName()); | 82 | item.setCustomerName(customer.getName()); |
| 83 | }); | 83 | }); |
| 84 | - findAndThen(parentContactMap, item.getParentId(), contactDO -> { | 84 | + findAndThen(parentContactMap, item.getParentId(), contactDO -> { // TODO @zyna:这里的 { 可以去掉 |
| 85 | item.setParentName(contactDO.getName()); | 85 | item.setParentName(contactDO.getName()); |
| 86 | }); | 86 | }); |
| 87 | }); | 87 | }); |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/ContactServiceImpl.java
| @@ -45,12 +45,11 @@ public class ContactServiceImpl implements ContactService { | @@ -45,12 +45,11 @@ public class ContactServiceImpl implements ContactService { | ||
| 45 | 45 | ||
| 46 | @Resource | 46 | @Resource |
| 47 | private CrmCustomerService customerService; | 47 | private CrmCustomerService customerService; |
| 48 | - | ||
| 49 | @Resource | 48 | @Resource |
| 50 | - private AdminUserApi adminUserApi; | 49 | + private CrmPermissionService crmPermissionService; |
| 51 | 50 | ||
| 52 | @Resource | 51 | @Resource |
| 53 | - private CrmPermissionService crmPermissionService; | 52 | + private AdminUserApi adminUserApi; |
| 54 | 53 | ||
| 55 | @Override | 54 | @Override |
| 56 | public Long createContact(ContactCreateReqVO createReqVO, Long userId) { | 55 | public Long createContact(ContactCreateReqVO createReqVO, Long userId) { |
| @@ -126,18 +125,20 @@ public class ContactServiceImpl implements ContactService { | @@ -126,18 +125,20 @@ public class ContactServiceImpl implements ContactService { | ||
| 126 | return contactMapper.selectList(); | 125 | return contactMapper.selectList(); |
| 127 | } | 126 | } |
| 128 | 127 | ||
| 128 | + // TODO 芋艿:后面在看下这个方法; | ||
| 129 | private void validateDataExist(ContactBaseVO contactBaseVO){ | 129 | private void validateDataExist(ContactBaseVO contactBaseVO){ |
| 130 | - //1.校验客户 | 130 | + // 1.校验客户 |
| 131 | if (contactBaseVO.getCustomerId() != null) { | 131 | if (contactBaseVO.getCustomerId() != null) { |
| 132 | Optional.ofNullable(customerService.getCustomer(contactBaseVO.getCustomerId())).orElseThrow(() -> exception(CUSTOMER_NOT_EXISTS)); | 132 | Optional.ofNullable(customerService.getCustomer(contactBaseVO.getCustomerId())).orElseThrow(() -> exception(CUSTOMER_NOT_EXISTS)); |
| 133 | } | 133 | } |
| 134 | - //2.校验负责人 | 134 | + // 2.校验负责人 |
| 135 | if (contactBaseVO.getOwnerUserId() != null) { | 135 | if (contactBaseVO.getOwnerUserId() != null) { |
| 136 | Optional.ofNullable(adminUserApi.getUser(contactBaseVO.getOwnerUserId())).orElseThrow(() -> exception(USER_NOT_EXISTS)); | 136 | Optional.ofNullable(adminUserApi.getUser(contactBaseVO.getOwnerUserId())).orElseThrow(() -> exception(USER_NOT_EXISTS)); |
| 137 | } | 137 | } |
| 138 | - //3.直属上级 | 138 | + // 3.直属上级 |
| 139 | if (contactBaseVO.getParentId() != null) { | 139 | if (contactBaseVO.getParentId() != null) { |
| 140 | Optional.ofNullable(contactMapper.selectById(contactBaseVO.getParentId())).orElseThrow(() -> exception(CONTACT_NOT_EXISTS)); | 140 | Optional.ofNullable(contactMapper.selectById(contactBaseVO.getParentId())).orElseThrow(() -> exception(CONTACT_NOT_EXISTS)); |
| 141 | } | 141 | } |
| 142 | } | 142 | } |
| 143 | + | ||
| 143 | } | 144 | } |