|
@@ -52,7 +52,7 @@ import static java.util.Collections.singletonList;
|
|
|
public class CrmContactServiceImpl implements CrmContactService {
|
|
|
|
|
|
@Resource
|
|
|
- private CrmContactMapper contactMapper;
|
|
|
+ private CrmContactMapper crmContactMapper;
|
|
|
|
|
|
@Resource
|
|
|
private CrmCustomerService customerService;
|
|
@@ -80,7 +80,7 @@ public class CrmContactServiceImpl implements CrmContactService {
|
|
|
|
|
|
// 2. 插入联系人
|
|
|
CrmContactDO contact = BeanUtils.toBean(createReqVO, CrmContactDO.class);
|
|
|
- contactMapper.insert(contact);
|
|
|
+ crmContactMapper.insert(contact);
|
|
|
|
|
|
// 3. 创建数据权限
|
|
|
permissionService.createPermission(new CrmPermissionCreateReqBO().setUserId(userId)
|
|
@@ -111,7 +111,7 @@ public class CrmContactServiceImpl implements CrmContactService {
|
|
|
|
|
|
// 2. 更新联系人
|
|
|
CrmContactDO updateObj = BeanUtils.toBean(updateReqVO, CrmContactDO.class);
|
|
|
- contactMapper.updateById(updateObj);
|
|
|
+ crmContactMapper.updateById(updateObj);
|
|
|
|
|
|
// 3. 记录操作日志
|
|
|
LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(oldContact, CrmContactSaveReqVO.class));
|
|
@@ -156,7 +156,7 @@ public class CrmContactServiceImpl implements CrmContactService {
|
|
|
}
|
|
|
|
|
|
// 2. 删除联系人
|
|
|
- contactMapper.deleteById(id);
|
|
|
+ crmContactMapper.deleteById(id);
|
|
|
|
|
|
// 4.1 删除数据权限
|
|
|
permissionService.deletePermission(CrmBizTypeEnum.CRM_CONTACT.getType(), id);
|
|
@@ -168,7 +168,7 @@ public class CrmContactServiceImpl implements CrmContactService {
|
|
|
}
|
|
|
|
|
|
private CrmContactDO validateContactExists(Long id) {
|
|
|
- CrmContactDO contact = contactMapper.selectById(id);
|
|
|
+ CrmContactDO contact = crmContactMapper.selectById(id);
|
|
|
if (contact == null) {
|
|
|
throw exception(CONTACT_NOT_EXISTS);
|
|
|
}
|
|
@@ -188,7 +188,7 @@ public class CrmContactServiceImpl implements CrmContactService {
|
|
|
permissionService.transferPermission(new CrmPermissionTransferReqBO(userId, CrmBizTypeEnum.CRM_CONTACT.getType(),
|
|
|
reqVO.getId(), reqVO.getNewOwnerUserId(), reqVO.getOldOwnerPermissionLevel()));
|
|
|
// 2.2 设置新的负责人
|
|
|
- contactMapper.updateById(new CrmContactDO().setId(reqVO.getId()).setOwnerUserId(reqVO.getNewOwnerUserId()));
|
|
|
+ crmContactMapper.updateById(new CrmContactDO().setId(reqVO.getId()).setOwnerUserId(reqVO.getNewOwnerUserId()));
|
|
|
|
|
|
// 3. 记录转移日志
|
|
|
LogRecordContext.putVariable("contact", contact);
|
|
@@ -199,11 +199,11 @@ public class CrmContactServiceImpl implements CrmContactService {
|
|
|
@CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#customerId", level = CrmPermissionLevelEnum.OWNER)
|
|
|
public void updateOwnerUserIdByCustomerId(Long customerId, Long ownerUserId) {
|
|
|
// 1. 校验存在
|
|
|
- List<CrmContactDO> contacts = contactMapper.selectListByCustomerId(customerId);
|
|
|
+ List<CrmContactDO> contacts = crmContactMapper.selectListByCustomerId(customerId);
|
|
|
if (CollUtil.isEmpty(contacts)) {
|
|
|
return;
|
|
|
}
|
|
|
- int count = contactMapper.updateOwnerUserIdByCustomerId(customerId, ownerUserId);
|
|
|
+ int count = crmContactMapper.updateOwnerUserIdByCustomerId(customerId, ownerUserId);
|
|
|
if (count == 0) {
|
|
|
throw exception(CONTACT_UPDATE_OWNER_USER_FAIL);
|
|
|
}
|
|
@@ -231,7 +231,7 @@ public class CrmContactServiceImpl implements CrmContactService {
|
|
|
CrmContactDO contact = validateContactExists(id);
|
|
|
|
|
|
// 2. 更新联系人的跟进信息
|
|
|
- contactMapper.updateById(new CrmContactDO().setId(id).setContactNextTime(contactNextTime)
|
|
|
+ crmContactMapper.updateById(new CrmContactDO().setId(id).setContactNextTime(contactNextTime)
|
|
|
.setContactLastTime(LocalDateTime.now()).setContactLastContent(contactLastContent));
|
|
|
|
|
|
// 3. 记录操作日志上下文
|
|
@@ -241,7 +241,7 @@ public class CrmContactServiceImpl implements CrmContactService {
|
|
|
@Override
|
|
|
@CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACT, bizId = "#ids", level = CrmPermissionLevelEnum.WRITE)
|
|
|
public void updateContactContactNextTime(Collection<Long> ids, LocalDateTime contactNextTime) {
|
|
|
- contactMapper.updateBatch(convertList(ids, id -> new CrmContactDO().setId(id).setContactNextTime(contactNextTime)));
|
|
|
+ crmContactMapper.updateBatch(convertList(ids, id -> new CrmContactDO().setId(id).setContactNextTime(contactNextTime)));
|
|
|
}
|
|
|
|
|
|
//======================= 查询相关 =======================
|
|
@@ -249,7 +249,7 @@ public class CrmContactServiceImpl implements CrmContactService {
|
|
|
@Override
|
|
|
@CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACT, bizId = "#id", level = CrmPermissionLevelEnum.READ)
|
|
|
public CrmContactDO getContact(Long id) {
|
|
|
- return contactMapper.selectById(id);
|
|
|
+ return crmContactMapper.selectById(id);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -262,25 +262,25 @@ public class CrmContactServiceImpl implements CrmContactService {
|
|
|
if (CollUtil.isEmpty(ids)) {
|
|
|
return ListUtil.empty();
|
|
|
}
|
|
|
- return contactMapper.selectBatchIds(ids);
|
|
|
+ return crmContactMapper.selectBatchIds(ids);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<CrmContactDO> getContactList(Long userId) {
|
|
|
CrmContactPageReqVO reqVO = new CrmContactPageReqVO();
|
|
|
reqVO.setPageSize(PAGE_SIZE_NONE); // 不分页
|
|
|
- return contactMapper.selectPage(reqVO, userId).getList();
|
|
|
+ return crmContactMapper.selectPage(reqVO, userId).getList();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public PageResult<CrmContactDO> getContactPage(CrmContactPageReqVO pageReqVO, Long userId) {
|
|
|
- return contactMapper.selectPage(pageReqVO, userId);
|
|
|
+ return crmContactMapper.selectPage(pageReqVO, userId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#pageVO.customerId", level = CrmPermissionLevelEnum.READ)
|
|
|
public PageResult<CrmContactDO> getContactPageByCustomerId(CrmContactPageReqVO pageVO) {
|
|
|
- return contactMapper.selectPageByCustomerId(pageVO);
|
|
|
+ return crmContactMapper.selectPageByCustomerId(pageVO);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -290,17 +290,17 @@ public class CrmContactServiceImpl implements CrmContactService {
|
|
|
if (CollUtil.isEmpty(contactBusinessList)) {
|
|
|
return PageResult.empty();
|
|
|
}
|
|
|
- return contactMapper.selectPageByBusinessId(pageVO, convertSet(contactBusinessList, CrmContactBusinessDO::getContactId));
|
|
|
+ return crmContactMapper.selectPageByBusinessId(pageVO, convertSet(contactBusinessList, CrmContactBusinessDO::getContactId));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Long getContactCountByCustomerId(Long customerId) {
|
|
|
- return contactMapper.selectCount(CrmContactDO::getCustomerId, customerId);
|
|
|
+ return crmContactMapper.selectCount(CrmContactDO::getCustomerId, customerId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<CrmContactDO> getContactListByCustomerIdOwnerUserId(Long customerId, Long ownerUserId) {
|
|
|
- return contactMapper.selectListByCustomerIdOwnerUserId(customerId, ownerUserId);
|
|
|
+ return crmContactMapper.selectListByCustomerIdOwnerUserId(customerId, ownerUserId);
|
|
|
}
|
|
|
|
|
|
}
|