fix(customer): 解决客户档案删除时私海数据未清理问题
- 添加客户私海关联检查逻辑
- 在删除客户前验证是否存在私海数据
- 阻止删除操作并提示用户先回收私海数据
- 保持原有的销售合同检查机制不变
| | |
| | | if (!salesLedgers.isEmpty()) { |
| | | throw new RuntimeException("客户档案下有销售合同,请先删除销售合同"); |
| | | } |
| | | List<CustomerPrivatePool> customerPrivatePools = customerPrivatePoolMapper.selectList(new QueryWrapper<CustomerPrivatePool>().lambda().in(CustomerPrivatePool::getCustomerId, idList)); |
| | | if (!customerPrivatePools.isEmpty()) { |
| | | throw new RuntimeException("客户档案下有客户私海,请先收回私海数据"); |
| | | } |
| | | // 删除客户的同时也需要删除对应的客户跟随、附件和回访提醒 |
| | | for (Long id : ids) { |
| | | customerFollowUpService.deleteByCustomerId(id); |