Commit 13e5d70be7fe7e61b5352c7d8558a84fe8a6eb81

Authored by YunaiV
1 parent ec67e63c

crm:解决冲突

yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java
1 1 package cn.iocoder.yudao.module.crm.service.customer;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4   -import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
5 4 import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*;
6 5 import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert;
7 6 import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
... ... @@ -16,7 +15,6 @@ import org.springframework.transaction.annotation.Transactional;
16 15 import org.springframework.validation.annotation.Validated;
17 16  
18 17 import javax.annotation.Resource;
19   -import java.util.ArrayList;
20 18 import java.util.Collections;
21 19 import java.util.List;
22 20 import java.util.Objects;
... ... @@ -251,46 +249,4 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
251 249 CrmPermissionLevelEnum.OWNER.getLevel());
252 250 }
253 251  
254   - private void transferCustomerOwner(List<Long> cIds, Long ownerId) {
255   - // 先一次性校验完成客户是否可用
256   - // TODO @xiaqing:批量一次性加载客户列表,然后去逐个校验;
257   - for (Long cId : cIds) {
258   - //校验是否存在
259   - validateCustomerExists(cId);
260   - //todo 校验是否已有负责人
261   - validCustomerOwnerExist(cId);
262   - //todo 校验是否锁定
263   - validCustomerIsLocked(cId);
264   - //todo 校验成交状态
265   - validCustomerDeal(cId);
266   - }
267   - // TODO @xiaqing:每个客户更新的时候,where 条件,加上 owner_user_id is null,防止并发问题;
268   - List<CrmCustomerDO> updateDos = new ArrayList<>();
269   - for (Long cId : cIds) {
270   - CrmCustomerDO customerDO = new CrmCustomerDO();
271   - customerDO.setId(cId);
272   - customerDO.setOwnerUserId(SecurityFrameworkUtils.getLoginUserId());
273   - }
274   - // 统一修改状态
275   - customerMapper.updateBatch(updateDos);
276   - }
277   -
278   - private void validCustomerOwnerExist(Long id) {
279   - if (customerMapper.selectById(id).getOwnerUserId() != null) {
280   - throw exception(CUSTOMER_OWNER_EXISTS);
281   - }
282   - }
283   -
284   - private void validCustomerIsLocked(Long id) {
285   - if (customerMapper.selectById(id).getLockStatus() == true) {
286   - throw exception(CUSTOMER_LOCKED);
287   - }
288   - }
289   -
290   - private void validCustomerDeal(Long id) {
291   - if (customerMapper.selectById(id).getDealStatus() == true) {
292   - throw exception(CUSTOMER_ALREADY_DEAL);
293   - }
294   - }
295   -
296 252 }
... ...