crm:code review 联系人

This commit is contained in:
YunaiV 2023-11-28 21:07:23 +08:00
parent 591bc36737
commit 1a93e3a110
5 changed files with 12 additions and 12 deletions

View File

@ -144,7 +144,7 @@ public class ContactController {
List<CrmCustomerDO> crmCustomerDOList = crmCustomerService.getCustomerList(convertSet(contactDOList, ContactDO::getCustomerId));
// 2. 获取创建人责任人列表
List<Long> userIdsList = convertListByFlatMap(contactDOList, item -> Stream.of(NumberUtils.parseLong(item.getCreator()), item.getOwnerUserId())
.filter(Objects::nonNull));
.filter(Objects::nonNull)); // TODO @zyna里面已经忽略 null
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIdsList);
// 3. 直属上级
Set<Long> contactIdsList = convertSet(contactDOList, ContactDO::getParentId);

View File

@ -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 文档生成

View File

@ -14,6 +14,5 @@ public class ContactSimpleRespVO {
@Schema(description = "姓名", example = "芋艿")
private String name;
}

View File

@ -78,10 +78,10 @@ public interface ContactConvert {
Map<Long, CrmCustomerDO> 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());
});
});

View File

@ -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));
}
}
}