mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 23:31:52 +08:00
crm:code review 联系人
This commit is contained in:
parent
591bc36737
commit
1a93e3a110
@ -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);
|
||||
|
@ -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 文档生成
|
||||
|
@ -14,6 +14,5 @@ public class ContactSimpleRespVO {
|
||||
|
||||
@Schema(description = "姓名", example = "芋艿")
|
||||
private String name;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -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());
|
||||
});
|
||||
});
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user