Commit df29f0682f4a52a79ea0eb919096350750d996f0
1 parent
8d2008f2
📖 CRM:线索模块的 review
Showing
1 changed file
with
5 additions
and
9 deletions
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java
| ... | ... | @@ -141,17 +141,13 @@ public class CrmClueServiceImpl implements CrmClueService { |
| 141 | 141 | // 遍历线索(过滤掉已转化的线索),创建对应的客户 |
| 142 | 142 | clues.stream().filter(clue -> ObjectUtil.notEqual(Boolean.TRUE, clue.getTransformStatus())) |
| 143 | 143 | .forEach(clue -> { |
| 144 | - // 1.创建客户 | |
| 145 | - CrmCustomerSaveReqVO customerSaveReqVO = BeanUtils.toBean(clue, CrmCustomerSaveReqVO.class) | |
| 146 | - .setId(null); | |
| 144 | + // 1. 创建客户 | |
| 145 | + CrmCustomerSaveReqVO customerSaveReqVO = BeanUtils.toBean(clue, CrmCustomerSaveReqVO.class).setId(null); | |
| 147 | 146 | Long customerId = customerService.createCustomer(customerSaveReqVO, userId); |
| 148 | 147 | // TODO @puhui999:如果有跟进记录,需要一起转过去; |
| 149 | - // 2.更新线索,新建一个 CrmClueDO 去更新。尽量规避直接用原本的对象去更新。因为这样万一并发更新,会存在覆盖的问题。 | |
| 150 | - clueMapper.updateById(BeanUtils.toBean(clue, CrmClueDO.class) | |
| 151 | - // 线索状态设置为已转化 | |
| 152 | - .setTransformStatus(Boolean.TRUE) | |
| 153 | - // 设置关联的客户编号 | |
| 154 | - .setCustomerId(customerId)); | |
| 148 | + // 2. 更新线索 | |
| 149 | + clueMapper.updateById(new CrmClueDO().setId(clue.getId()) | |
| 150 | + .setTransformStatus(Boolean.TRUE).setCustomerId(customerId)); | |
| 155 | 151 | }); |
| 156 | 152 | } |
| 157 | 153 | ... | ... |