📖 CRM:线索模块的 review

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

View File

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