|
|
@@ -1,6 +1,8 @@
|
|
|
package com.jtzx.crm.module.sys.service;
|
|
|
|
|
|
|
|
|
+import cc.uncarbon.framework.core.context.UserContextHolder;
|
|
|
+import cc.uncarbon.framework.core.exception.BusinessException;
|
|
|
import cc.uncarbon.framework.core.page.PageResult;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
@@ -11,8 +13,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.jtzx.crm.module.sys.entity.SysCustomerDataEntity;
|
|
|
import com.jtzx.crm.module.sys.entity.SysParamBaseDataEntity;
|
|
|
+import com.jtzx.crm.module.sys.entity.SysUserEntity;
|
|
|
import com.jtzx.crm.module.sys.mapper.SysCustomerDataMapper;
|
|
|
import com.jtzx.crm.module.sys.mapper.SysParamBaseDataMapper;
|
|
|
+import com.jtzx.crm.module.sys.mapper.SysUserMapper;
|
|
|
import com.jtzx.crm.module.sys.model.request.*;
|
|
|
import com.jtzx.crm.module.sys.model.response.*;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
@@ -52,6 +56,8 @@ public class SysCustomerDataPublicService {
|
|
|
|
|
|
private final SysCustomerDataPermissionService permissionService;
|
|
|
|
|
|
+ private final SysUserMapper sysUserMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询公海客户页面顶部筛选条件数据
|
|
|
*
|
|
|
@@ -64,7 +70,7 @@ public class SysCustomerDataPublicService {
|
|
|
//学段信息
|
|
|
resultData.setStageData(sysCustomerUserCommonService.handleStageData());
|
|
|
//省市信息
|
|
|
- SysCustomerSelectBO sysCustomerSelectBO = sysCustomerUserCommonService.querySelectDataByType1( false);
|
|
|
+ SysCustomerSelectBO sysCustomerSelectBO = sysCustomerUserCommonService.querySelectDataByType1(false);
|
|
|
if (sysCustomerSelectBO != null) {
|
|
|
resultData.setRegionData(sysCustomerSelectBO.getRegionData());
|
|
|
}
|
|
|
@@ -90,7 +96,7 @@ public class SysCustomerDataPublicService {
|
|
|
// 城市id(不为空时)
|
|
|
.eq(Objects.nonNull(dto.getCityId()), SysCustomerDataEntity::getCityId, dto.getCityId())
|
|
|
// 城市id(为空时)
|
|
|
- .in(Objects.isNull(dto.getCityId())&&dto.getProvinceId()!=null, SysCustomerDataEntity::getCityId, sysCustomerUserCommonService.queryUserCityIds(dto.getProvinceId()))
|
|
|
+ .in(Objects.isNull(dto.getCityId()) && dto.getProvinceId() != null, SysCustomerDataEntity::getCityId, sysCustomerUserCommonService.queryUserCityIds(dto.getProvinceId()))
|
|
|
//认领状态
|
|
|
.eq(SysCustomerDataEntity::getClaimStatus, 0)
|
|
|
// 排序
|
|
|
@@ -194,19 +200,33 @@ public class SysCustomerDataPublicService {
|
|
|
*
|
|
|
* @param dto
|
|
|
*/
|
|
|
- public SysCustomerDetailBO queryCustomerDetail(AdminSysCustomerFollowReqDTO dto) {
|
|
|
+ public SysCustomerDetailBO queryCustomerDetail(AdminSysCustomerFollowReqDTO dto) throws BusinessException {
|
|
|
permissionService.publicPrivateCustomerPermission();
|
|
|
SysCustomerDetailBO detailBO = SysCustomerDetailBO.builder().build();
|
|
|
- //顶部筛选条件数据
|
|
|
- SysCustomerFollowHistorySelectBO publicCustomerSelectData = sysCustomerDataFollowService.queryCustomerFollowSelectCommonData(dto.getCustomerId(), null);
|
|
|
- detailBO.setSelectData(publicCustomerSelectData);
|
|
|
- //客户详情信息
|
|
|
- PageResult<SysCustomerFollowListBO> dataPageList = sysCustomerDataFollowService.queryCustomerFollowDataCommonByPage(dto);
|
|
|
- detailBO.setDataPageList(dataPageList);
|
|
|
- //信息总览
|
|
|
- detailBO.setProductOverviewData(sysCustomerFollowService.queryProductOverViewData(dto.getCustomerId(),null));
|
|
|
- //跟进记录总览
|
|
|
- detailBO.setFollowOverViewData(sysCustomerFollowService.handleCustomerFollowOverViewData(dto.getCustomerId(), null));
|
|
|
+ SysUserEntity sysUserEntity = sysUserMapper.selectById(UserContextHolder.getUserId());
|
|
|
+ if (sysUserEntity == null) {
|
|
|
+ throw new BusinessException("用户不存在");
|
|
|
+ }
|
|
|
+ dto.setUserId(null);
|
|
|
+
|
|
|
+ detailBO.setHistoryFollowStatus(sysUserEntity.getHistoryFollowStatus() == null ? 0 : sysUserEntity.getHistoryFollowStatus());
|
|
|
+ if(UserContextHolder.getUserContext().getRoles().contains("Admin")){
|
|
|
+ detailBO.setHistoryFollowStatus(1);
|
|
|
+ }
|
|
|
+ //历史跟进总览开关
|
|
|
+ if (UserContextHolder.getUserContext().getRoles().contains("Admin") ||
|
|
|
+ sysUserEntity.getHistoryFollowStatus() != null && sysUserEntity.getHistoryFollowStatus() == 1) {
|
|
|
+ //顶部筛选条件数据
|
|
|
+ SysCustomerFollowHistorySelectBO publicCustomerSelectData = sysCustomerDataFollowService.queryCustomerFollowSelectCommonData(dto.getCustomerId(), null);
|
|
|
+ detailBO.setSelectData(publicCustomerSelectData);
|
|
|
+ //客户详情信息
|
|
|
+ PageResult<SysCustomerFollowListBO> dataPageList = sysCustomerDataFollowService.queryCustomerFollowDataCommonByPage(dto);
|
|
|
+ detailBO.setDataPageList(dataPageList);
|
|
|
+ //信息总览
|
|
|
+ detailBO.setProductOverviewData(sysCustomerFollowService.queryProductOverViewData(dto.getCustomerId(), null));
|
|
|
+ //跟进记录总览
|
|
|
+ detailBO.setFollowOverViewData(sysCustomerFollowService.handleCustomerFollowOverViewData(dto.getCustomerId(), null));
|
|
|
+ }
|
|
|
return detailBO;
|
|
|
}
|
|
|
|
|
|
@@ -223,7 +243,7 @@ public class SysCustomerDataPublicService {
|
|
|
if (dto.getGroupId() != null) {
|
|
|
groupIds.add(dto.getGroupId());
|
|
|
}
|
|
|
- return sysCustomerOperLogService.adminList(dto,userIds, groupIds,false, false);
|
|
|
+ return sysCustomerOperLogService.adminList(dto, userIds, groupIds, false, false);
|
|
|
}
|
|
|
|
|
|
|