📖 CRM:线索模块的 review

This commit is contained in:
YunaiV 2024-01-13 11:07:28 +08:00
parent 8d2008f2b5
commit df29f0682f

View File

@ -141,17 +141,13 @@ public class CrmClueServiceImpl implements CrmClueService {
// 遍历线索(过滤掉已转化的线索)创建对应的客户 // 遍历线索(过滤掉已转化的线索)创建对应的客户
clues.stream().filter(clue -> ObjectUtil.notEqual(Boolean.TRUE, clue.getTransformStatus())) clues.stream().filter(clue -> ObjectUtil.notEqual(Boolean.TRUE, clue.getTransformStatus()))
.forEach(clue -> { .forEach(clue -> {
// 1.创建客户 // 1. 创建客户
CrmCustomerSaveReqVO customerSaveReqVO = BeanUtils.toBean(clue, CrmCustomerSaveReqVO.class) CrmCustomerSaveReqVO customerSaveReqVO = BeanUtils.toBean(clue, CrmCustomerSaveReqVO.class).setId(null);
.setId(null);
Long customerId = customerService.createCustomer(customerSaveReqVO, userId); Long customerId = customerService.createCustomer(customerSaveReqVO, userId);
// TODO @puhui999如果有跟进记录需要一起转过去 // TODO @puhui999如果有跟进记录需要一起转过去
// 2.更新线索新建一个 CrmClueDO 去更新尽量规避直接用原本的对象去更新因为这样万一并发更新会存在覆盖的问题 // 2. 更新线索
clueMapper.updateById(BeanUtils.toBean(clue, CrmClueDO.class) clueMapper.updateById(new CrmClueDO().setId(clue.getId())
// 线索状态设置为已转化 .setTransformStatus(Boolean.TRUE).setCustomerId(customerId));
.setTransformStatus(Boolean.TRUE)
// 设置关联的客户编号
.setCustomerId(customerId));
}); });
} }