|
|
|
@ -4,23 +4,25 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.collection.ListUtil;
|
|
|
|
import cn.hutool.core.collection.ListUtil;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueCreateReqVO;
|
|
|
|
import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueCreateReqVO;
|
|
|
|
import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueExportReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmCluePageReqVO;
|
|
|
|
import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmCluePageReqVO;
|
|
|
|
import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueUpdateReqVO;
|
|
|
|
import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueUpdateReqVO;
|
|
|
|
import cn.iocoder.yudao.module.crm.convert.clue.CrmClueConvert;
|
|
|
|
import cn.iocoder.yudao.module.crm.convert.clue.CrmClueConvert;
|
|
|
|
import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO;
|
|
|
|
import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO;
|
|
|
|
import cn.iocoder.yudao.module.crm.dal.mysql.clue.CrmClueMapper;
|
|
|
|
import cn.iocoder.yudao.module.crm.dal.mysql.clue.CrmClueMapper;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.crm.framework.core.annotations.CrmPermission;
|
|
|
|
import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
|
|
|
|
import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService;
|
|
|
|
|
|
|
|
import jakarta.annotation.Resource;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
|
|
|
|
|
|
import jakarta.annotation.Resource;
|
|
|
|
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
|
import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CLUE_NOT_EXISTS;
|
|
|
|
import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CLUE_NOT_EXISTS;
|
|
|
|
import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CUSTOMER_NOT_EXISTS;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 线索 Service 实现类
|
|
|
|
* 线索 Service 实现类
|
|
|
|
@ -35,6 +37,8 @@ public class CrmClueServiceImpl implements CrmClueService {
|
|
|
|
private CrmClueMapper clueMapper;
|
|
|
|
private CrmClueMapper clueMapper;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private CrmCustomerService customerService;
|
|
|
|
private CrmCustomerService customerService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private CrmPermissionService crmPermissionService;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Long createClue(CrmClueCreateReqVO createReqVO) {
|
|
|
|
public Long createClue(CrmClueCreateReqVO createReqVO) {
|
|
|
|
@ -48,6 +52,7 @@ public class CrmClueServiceImpl implements CrmClueService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|
|
|
|
@CrmPermission(bizType = CrmBizTypeEnum.CRM_LEADS, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE)
|
|
|
|
public void updateClue(CrmClueUpdateReqVO updateReqVO) {
|
|
|
|
public void updateClue(CrmClueUpdateReqVO updateReqVO) {
|
|
|
|
// 校验存在
|
|
|
|
// 校验存在
|
|
|
|
validateClueExists(updateReqVO.getId());
|
|
|
|
validateClueExists(updateReqVO.getId());
|
|
|
|
@ -60,11 +65,14 @@ public class CrmClueServiceImpl implements CrmClueService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|
|
|
|
@CrmPermission(bizType = CrmBizTypeEnum.CRM_LEADS, bizId = "#id", level = CrmPermissionLevelEnum.OWNER)
|
|
|
|
public void deleteClue(Long id) {
|
|
|
|
public void deleteClue(Long id) {
|
|
|
|
// 校验存在
|
|
|
|
// 校验存在
|
|
|
|
validateClueExists(id);
|
|
|
|
validateClueExists(id);
|
|
|
|
// 删除
|
|
|
|
// 删除
|
|
|
|
clueMapper.deleteById(id);
|
|
|
|
clueMapper.deleteById(id);
|
|
|
|
|
|
|
|
// 删除数据权限
|
|
|
|
|
|
|
|
crmPermissionService.deletePermission(CrmBizTypeEnum.CRM_LEADS.getType(), id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void validateClueExists(Long id) {
|
|
|
|
private void validateClueExists(Long id) {
|
|
|
|
@ -74,26 +82,22 @@ public class CrmClueServiceImpl implements CrmClueService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|
|
|
|
@CrmPermission(bizType = CrmBizTypeEnum.CRM_LEADS, bizId = "#id", level = CrmPermissionLevelEnum.READ)
|
|
|
|
public CrmClueDO getClue(Long id) {
|
|
|
|
public CrmClueDO getClue(Long id) {
|
|
|
|
return clueMapper.selectById(id);
|
|
|
|
return clueMapper.selectById(id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<CrmClueDO> getClueList(Collection<Long> ids) {
|
|
|
|
public List<CrmClueDO> getClueList(Collection<Long> ids, Long userId) {
|
|
|
|
if (CollUtil.isEmpty(ids)) {
|
|
|
|
if (CollUtil.isEmpty(ids)) {
|
|
|
|
return ListUtil.empty();
|
|
|
|
return ListUtil.empty();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return clueMapper.selectBatchIds(ids);
|
|
|
|
return clueMapper.selectBatchIds(ids, userId);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public PageResult<CrmClueDO> getCluePage(CrmCluePageReqVO pageReqVO) {
|
|
|
|
|
|
|
|
return clueMapper.selectPage(pageReqVO);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<CrmClueDO> getClueList(CrmClueExportReqVO exportReqVO) {
|
|
|
|
public PageResult<CrmClueDO> getCluePage(CrmCluePageReqVO pageReqVO, Long userId) {
|
|
|
|
return clueMapper.selectList(exportReqVO);
|
|
|
|
return clueMapper.selectPage(pageReqVO, userId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|