CRM:将 bi 调整成 statistics

This commit is contained in:
YunaiV 2024-02-24 22:26:24 +08:00
parent cd87f2e4aa
commit c726cd3aff
9 changed files with 103 additions and 103 deletions

View File

@ -1,9 +0,0 @@
### 合同金额排行榜
GET {{baseUrl}}/crm/bi-rank/get-contract-price-rank?deptId=100&times[0]=2022-12-12 00:00:00&times[1]=2024-12-12 23:59:59
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
### 回款金额排行榜
GET {{baseUrl}}/crm/bi-rank/get-receivable-price-rank?deptId=100&times[0]=2022-12-12 00:00:00&times[1]=2024-12-12 23:59:59
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}

View File

@ -0,0 +1,9 @@
### 合同金额排行榜
GET {{baseUrl}}/crm/statistics-rank/get-contract-price-rank?deptId=100&times[0]=2022-12-12 00:00:00&times[1]=2024-12-12 23:59:59
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
### 回款金额排行榜
GET {{baseUrl}}/crm/statistics-rank/get-receivable-price-rank?deptId=100&times[0]=2022-12-12 00:00:00&times[1]=2024-12-12 23:59:59
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}

View File

@ -1,9 +1,9 @@
package cn.iocoder.yudao.module.crm.controller.admin.bi;
package cn.iocoder.yudao.module.crm.controller.admin.statistics;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO;
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRankReqVO;
import cn.iocoder.yudao.module.crm.service.bi.CrmBiRankingService;
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO;
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRankReqVO;
import cn.iocoder.yudao.module.crm.service.statistics.CrmStatisticsRankingService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
@ -19,68 +19,68 @@ import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - CRM BI 排行榜")
@Tag(name = "管理后台 - CRM 排行榜统计")
@RestController
@RequestMapping("/crm/bi-rank")
@RequestMapping("/crm/statistics-rank")
@Validated
public class CrmBiRankController {
public class CrmStatisticsRankController {
@Resource
private CrmBiRankingService rankingService;
private CrmStatisticsRankingService rankingService;
@GetMapping("/get-contract-price-rank")
@Operation(summary = "获得合同金额排行榜")
@PreAuthorize("@ss.hasPermission('crm:bi-rank:query')")
public CommonResult<List<CrmBiRanKRespVO>> getContractPriceRank(@Valid CrmBiRankReqVO rankingReqVO) {
@PreAuthorize("@ss.hasPermission('crm:statistics-rank:query')")
public CommonResult<List<CrmStatisticsRanKRespVO>> getContractPriceRank(@Valid CrmStatisticsRankReqVO rankingReqVO) {
return success(rankingService.getContractPriceRank(rankingReqVO));
}
@GetMapping("/get-receivable-price-rank")
@Operation(summary = "获得回款金额排行榜")
@PreAuthorize("@ss.hasPermission('crm:bi-rank:query')")
public CommonResult<List<CrmBiRanKRespVO>> getReceivablePriceRank(@Valid CrmBiRankReqVO rankingReqVO) {
@PreAuthorize("@ss.hasPermission('crm:statistics-rank:query')")
public CommonResult<List<CrmStatisticsRanKRespVO>> getReceivablePriceRank(@Valid CrmStatisticsRankReqVO rankingReqVO) {
return success(rankingService.getReceivablePriceRank(rankingReqVO));
}
@GetMapping("/get-contract-count-rank")
@Operation(summary = "获得签约合同数量排行榜")
@PreAuthorize("@ss.hasPermission('crm:bi-rank:query')")
public CommonResult<List<CrmBiRanKRespVO>> getContractCountRank(@Valid CrmBiRankReqVO rankingReqVO) {
@PreAuthorize("@ss.hasPermission('crm:statistics-rank:query')")
public CommonResult<List<CrmStatisticsRanKRespVO>> getContractCountRank(@Valid CrmStatisticsRankReqVO rankingReqVO) {
return success(rankingService.getContractCountRank(rankingReqVO));
}
@GetMapping("/get-product-sales-rank")
@Operation(summary = "获得产品销量排行榜")
@PreAuthorize("@ss.hasPermission('crm:bi-rank:query')")
public CommonResult<List<CrmBiRanKRespVO>> getProductSalesRank(@Valid CrmBiRankReqVO rankingReqVO) {
@PreAuthorize("@ss.hasPermission('crm:statistics-rank:query')")
public CommonResult<List<CrmStatisticsRanKRespVO>> getProductSalesRank(@Valid CrmStatisticsRankReqVO rankingReqVO) {
return success(rankingService.getProductSalesRank(rankingReqVO));
}
@GetMapping("/get-customer-count-rank")
@Operation(summary = "获得新增客户数排行榜")
@PreAuthorize("@ss.hasPermission('crm:bi-rank:query')")
public CommonResult<List<CrmBiRanKRespVO>> getCustomerCountRank(@Valid CrmBiRankReqVO rankingReqVO) {
@PreAuthorize("@ss.hasPermission('crm:statistics-rank:query')")
public CommonResult<List<CrmStatisticsRanKRespVO>> getCustomerCountRank(@Valid CrmStatisticsRankReqVO rankingReqVO) {
return success(rankingService.getCustomerCountRank(rankingReqVO));
}
@GetMapping("/get-contacts-count-rank")
@Operation(summary = "获得新增联系人数排行榜")
@PreAuthorize("@ss.hasPermission('crm:bi-rank:query')")
public CommonResult<List<CrmBiRanKRespVO>> getContactsCountRank(@Valid CrmBiRankReqVO rankingReqVO) {
@PreAuthorize("@ss.hasPermission('crm:statistics-rank:query')")
public CommonResult<List<CrmStatisticsRanKRespVO>> getContactsCountRank(@Valid CrmStatisticsRankReqVO rankingReqVO) {
return success(rankingService.getContactsCountRank(rankingReqVO));
}
@GetMapping("/get-follow-count-rank")
@Operation(summary = "获得跟进次数排行榜")
@PreAuthorize("@ss.hasPermission('crm:bi-rank:query')")
public CommonResult<List<CrmBiRanKRespVO>> getFollowCountRank(@Valid CrmBiRankReqVO rankingReqVO) {
@PreAuthorize("@ss.hasPermission('crm:statistics-rank:query')")
public CommonResult<List<CrmStatisticsRanKRespVO>> getFollowCountRank(@Valid CrmStatisticsRankReqVO rankingReqVO) {
return success(rankingService.getFollowCountRank(rankingReqVO));
}
@GetMapping("/get-follow-customer-count-rank")
@Operation(summary = "获得跟进客户数排行榜")
@PreAuthorize("@ss.hasPermission('crm:bi-rank:query')")
public CommonResult<List<CrmBiRanKRespVO>> getFollowCustomerCountRank(@Valid CrmBiRankReqVO rankingReqVO) {
@PreAuthorize("@ss.hasPermission('crm:statistics-rank:query')")
public CommonResult<List<CrmStatisticsRanKRespVO>> getFollowCustomerCountRank(@Valid CrmStatisticsRankReqVO rankingReqVO) {
return success(rankingService.getFollowCustomerCountRank(rankingReqVO));
}

View File

@ -1,12 +1,12 @@
package cn.iocoder.yudao.module.crm.controller.admin.bi.vo;
package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - CRM BI 排行榜 Response VO")
@Schema(description = "管理后台 - CRM BI 排行榜统计 Response VO")
@Data
public class CrmBiRanKRespVO {
public class CrmStatisticsRanKRespVO {
@Schema(description = "负责人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long ownerUserId;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.crm.controller.admin.bi.vo;
package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
@ -11,9 +11,9 @@ import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - CRM BI 排行榜 Request VO")
@Schema(description = "管理后台 - CRM 排行榜统计 Request VO")
@Data
public class CrmBiRankReqVO {
public class CrmStatisticsRankReqVO {
@Schema(description = "部门 id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "部门 id 不能为空")

View File

@ -1,18 +1,18 @@
package cn.iocoder.yudao.module.crm.dal.mysql.bi;
package cn.iocoder.yudao.module.crm.dal.mysql.statistics;
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO;
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRankReqVO;
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO;
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRankReqVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* CRM BI 排行榜 Mapper
* CRM 排行榜统计 Mapper
*
* @author anhaohao
*/
@Mapper
public interface CrmBiRankingMapper {
public interface CrmStatisticsRankingMapper {
/**
* 查询合同金额排行榜
@ -20,7 +20,7 @@ public interface CrmBiRankingMapper {
* @param rankReqVO 参数
* @return 合同金额排行榜
*/
List<CrmBiRanKRespVO> selectContractPriceRank(CrmBiRankReqVO rankReqVO);
List<CrmStatisticsRanKRespVO> selectContractPriceRank(CrmStatisticsRankReqVO rankReqVO);
/**
* 查询回款金额排行榜
@ -28,7 +28,7 @@ public interface CrmBiRankingMapper {
* @param rankReqVO 参数
* @return 回款金额排行榜
*/
List<CrmBiRanKRespVO> selectReceivablePriceRank(CrmBiRankReqVO rankReqVO);
List<CrmStatisticsRanKRespVO> selectReceivablePriceRank(CrmStatisticsRankReqVO rankReqVO);
/**
* 查询签约合同数量排行榜
@ -36,7 +36,7 @@ public interface CrmBiRankingMapper {
* @param rankReqVO 参数
* @return 签约合同数量排行榜
*/
List<CrmBiRanKRespVO> selectContractCountRank(CrmBiRankReqVO rankReqVO);
List<CrmStatisticsRanKRespVO> selectContractCountRank(CrmStatisticsRankReqVO rankReqVO);
/**
* 查询产品销量排行榜
@ -44,7 +44,7 @@ public interface CrmBiRankingMapper {
* @param rankReqVO 参数
* @return 产品销量排行榜
*/
List<CrmBiRanKRespVO> selectProductSalesRank(CrmBiRankReqVO rankReqVO);
List<CrmStatisticsRanKRespVO> selectProductSalesRank(CrmStatisticsRankReqVO rankReqVO);
/**
* 查询新增客户数排行榜
@ -52,7 +52,7 @@ public interface CrmBiRankingMapper {
* @param rankReqVO 参数
* @return 新增客户数排行榜
*/
List<CrmBiRanKRespVO> selectCustomerCountRank(CrmBiRankReqVO rankReqVO);
List<CrmStatisticsRanKRespVO> selectCustomerCountRank(CrmStatisticsRankReqVO rankReqVO);
/**
* 查询联系人数量排行榜
@ -60,7 +60,7 @@ public interface CrmBiRankingMapper {
* @param rankReqVO 参数
* @return 联系人数量排行榜
*/
List<CrmBiRanKRespVO> selectContactsCountRank(CrmBiRankReqVO rankReqVO);
List<CrmStatisticsRanKRespVO> selectContactsCountRank(CrmStatisticsRankReqVO rankReqVO);
/**
* 查询跟进次数排行榜
@ -68,7 +68,7 @@ public interface CrmBiRankingMapper {
* @param rankReqVO 参数
* @return 跟进次数排行榜
*/
List<CrmBiRanKRespVO> selectFollowCountRank(CrmBiRankReqVO rankReqVO);
List<CrmStatisticsRanKRespVO> selectFollowCountRank(CrmStatisticsRankReqVO rankReqVO);
/**
* 查询跟进客户数排行榜
@ -76,6 +76,6 @@ public interface CrmBiRankingMapper {
* @param rankReqVO 参数
* @return 跟进客户数排行榜
*/
List<CrmBiRanKRespVO> selectFollowCustomerCountRank(CrmBiRankReqVO rankReqVO);
List<CrmStatisticsRanKRespVO> selectFollowCustomerCountRank(CrmStatisticsRankReqVO rankReqVO);
}

View File

@ -1,17 +1,17 @@
package cn.iocoder.yudao.module.crm.service.bi;
package cn.iocoder.yudao.module.crm.service.statistics;
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO;
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRankReqVO;
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO;
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRankReqVO;
import java.util.List;
/**
* CRM BI 排行榜 Service 接口
* CRM 排行榜统计 Service 接口
*
* @author anhaohao
*/
public interface CrmBiRankingService {
public interface CrmStatisticsRankingService {
/**
* 获得合同金额排行榜
@ -19,7 +19,7 @@ public interface CrmBiRankingService {
* @param rankReqVO 排行参数
* @return 合同金额排行榜
*/
List<CrmBiRanKRespVO> getContractPriceRank(CrmBiRankReqVO rankReqVO);
List<CrmStatisticsRanKRespVO> getContractPriceRank(CrmStatisticsRankReqVO rankReqVO);
/**
* 获得回款金额排行榜
@ -27,7 +27,7 @@ public interface CrmBiRankingService {
* @param rankReqVO 排行参数
* @return 回款金额排行榜
*/
List<CrmBiRanKRespVO> getReceivablePriceRank(CrmBiRankReqVO rankReqVO);
List<CrmStatisticsRanKRespVO> getReceivablePriceRank(CrmStatisticsRankReqVO rankReqVO);
/**
* 获得签约合同数量排行榜
@ -35,7 +35,7 @@ public interface CrmBiRankingService {
* @param rankReqVO 排行参数
* @return 签约合同数量排行榜
*/
List<CrmBiRanKRespVO> getContractCountRank(CrmBiRankReqVO rankReqVO);
List<CrmStatisticsRanKRespVO> getContractCountRank(CrmStatisticsRankReqVO rankReqVO);
/**
* 获得产品销量排行榜
@ -43,7 +43,7 @@ public interface CrmBiRankingService {
* @param rankReqVO 排行参数
* @return 产品销量排行榜
*/
List<CrmBiRanKRespVO> getProductSalesRank(CrmBiRankReqVO rankReqVO);
List<CrmStatisticsRanKRespVO> getProductSalesRank(CrmStatisticsRankReqVO rankReqVO);
/**
* 获得新增客户数排行榜
@ -51,7 +51,7 @@ public interface CrmBiRankingService {
* @param rankReqVO 排行参数
* @return 新增客户数排行榜
*/
List<CrmBiRanKRespVO> getCustomerCountRank(CrmBiRankReqVO rankReqVO);
List<CrmStatisticsRanKRespVO> getCustomerCountRank(CrmStatisticsRankReqVO rankReqVO);
/**
* 获得联系人数量排行榜
@ -59,7 +59,7 @@ public interface CrmBiRankingService {
* @param rankReqVO 排行参数
* @return 联系人数量排行榜
*/
List<CrmBiRanKRespVO> getContactsCountRank(CrmBiRankReqVO rankReqVO);
List<CrmStatisticsRanKRespVO> getContactsCountRank(CrmStatisticsRankReqVO rankReqVO);
/**
* 获得跟进次数排行榜
@ -67,7 +67,7 @@ public interface CrmBiRankingService {
* @param rankReqVO 排行参数
* @return 跟进次数排行榜
*/
List<CrmBiRanKRespVO> getFollowCountRank(CrmBiRankReqVO rankReqVO);
List<CrmStatisticsRanKRespVO> getFollowCountRank(CrmStatisticsRankReqVO rankReqVO);
/**
* 获得跟进客户数排行榜
@ -75,6 +75,6 @@ public interface CrmBiRankingService {
* @param rankReqVO 排行参数
* @return 跟进客户数排行榜
*/
List<CrmBiRanKRespVO> getFollowCustomerCountRank(CrmBiRankReqVO rankReqVO);
List<CrmStatisticsRanKRespVO> getFollowCustomerCountRank(CrmStatisticsRankReqVO rankReqVO);
}

View File

@ -1,10 +1,10 @@
package cn.iocoder.yudao.module.crm.service.bi;
package cn.iocoder.yudao.module.crm.service.statistics;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO;
import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRankReqVO;
import cn.iocoder.yudao.module.crm.dal.mysql.bi.CrmBiRankingMapper;
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO;
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRankReqVO;
import cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsRankingMapper;
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
@ -23,16 +23,16 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
/**
* CRM BI 排行榜 Service 实现类
* CRM 排行榜统计 Service 实现类
*
* @author anhaohao
*/
@Service
@Validated
public class CrmBiRankingServiceImpl implements CrmBiRankingService {
public class CrmStatisticsRankingServiceImpl implements CrmStatisticsRankingService {
@Resource
private CrmBiRankingMapper biRankingMapper;
private CrmStatisticsRankingMapper rankMapper;
@Resource
private AdminUserApi adminUserApi;
@ -40,43 +40,43 @@ public class CrmBiRankingServiceImpl implements CrmBiRankingService {
private DeptApi deptApi;
@Override
public List<CrmBiRanKRespVO> getContractPriceRank(CrmBiRankReqVO rankReqVO) {
return getRank(rankReqVO, biRankingMapper::selectContractPriceRank);
public List<CrmStatisticsRanKRespVO> getContractPriceRank(CrmStatisticsRankReqVO rankReqVO) {
return getRank(rankReqVO, rankMapper::selectContractPriceRank);
}
@Override
public List<CrmBiRanKRespVO> getReceivablePriceRank(CrmBiRankReqVO rankReqVO) {
return getRank(rankReqVO, biRankingMapper::selectReceivablePriceRank);
public List<CrmStatisticsRanKRespVO> getReceivablePriceRank(CrmStatisticsRankReqVO rankReqVO) {
return getRank(rankReqVO, rankMapper::selectReceivablePriceRank);
}
@Override
public List<CrmBiRanKRespVO> getContractCountRank(CrmBiRankReqVO rankReqVO) {
return getRank(rankReqVO, biRankingMapper::selectContractCountRank);
public List<CrmStatisticsRanKRespVO> getContractCountRank(CrmStatisticsRankReqVO rankReqVO) {
return getRank(rankReqVO, rankMapper::selectContractCountRank);
}
@Override
public List<CrmBiRanKRespVO> getProductSalesRank(CrmBiRankReqVO rankReqVO) {
return getRank(rankReqVO, biRankingMapper::selectProductSalesRank);
public List<CrmStatisticsRanKRespVO> getProductSalesRank(CrmStatisticsRankReqVO rankReqVO) {
return getRank(rankReqVO, rankMapper::selectProductSalesRank);
}
@Override
public List<CrmBiRanKRespVO> getCustomerCountRank(CrmBiRankReqVO rankReqVO) {
return getRank(rankReqVO, biRankingMapper::selectCustomerCountRank);
public List<CrmStatisticsRanKRespVO> getCustomerCountRank(CrmStatisticsRankReqVO rankReqVO) {
return getRank(rankReqVO, rankMapper::selectCustomerCountRank);
}
@Override
public List<CrmBiRanKRespVO> getContactsCountRank(CrmBiRankReqVO rankReqVO) {
return getRank(rankReqVO, biRankingMapper::selectContactsCountRank);
public List<CrmStatisticsRanKRespVO> getContactsCountRank(CrmStatisticsRankReqVO rankReqVO) {
return getRank(rankReqVO, rankMapper::selectContactsCountRank);
}
@Override
public List<CrmBiRanKRespVO> getFollowCountRank(CrmBiRankReqVO rankReqVO) {
return getRank(rankReqVO, biRankingMapper::selectFollowCountRank);
public List<CrmStatisticsRanKRespVO> getFollowCountRank(CrmStatisticsRankReqVO rankReqVO) {
return getRank(rankReqVO, rankMapper::selectFollowCountRank);
}
@Override
public List<CrmBiRanKRespVO> getFollowCustomerCountRank(CrmBiRankReqVO rankReqVO) {
return getRank(rankReqVO, biRankingMapper::selectFollowCustomerCountRank);
public List<CrmStatisticsRanKRespVO> getFollowCustomerCountRank(CrmStatisticsRankReqVO rankReqVO) {
return getRank(rankReqVO, rankMapper::selectFollowCustomerCountRank);
}
/**
@ -86,18 +86,18 @@ public class CrmBiRankingServiceImpl implements CrmBiRankingService {
* @param rankFunction 排行榜方法
* @return 排行版数据
*/
private List<CrmBiRanKRespVO> getRank(CrmBiRankReqVO rankReqVO, Function<CrmBiRankReqVO, List<CrmBiRanKRespVO>> rankFunction) {
private List<CrmStatisticsRanKRespVO> getRank(CrmStatisticsRankReqVO rankReqVO, Function<CrmStatisticsRankReqVO, List<CrmStatisticsRanKRespVO>> rankFunction) {
// 1. 获得用户编号数组
rankReqVO.setUserIds(getUserIds(rankReqVO.getDeptId()));
if (CollUtil.isEmpty(rankReqVO.getUserIds())) {
return Collections.emptyList();
}
// 2. 获得排行数据
List<CrmBiRanKRespVO> ranks = rankFunction.apply(rankReqVO);
List<CrmStatisticsRanKRespVO> ranks = rankFunction.apply(rankReqVO);
if (CollUtil.isEmpty(ranks)) {
return Collections.emptyList();
}
ranks.sort(Comparator.comparing(CrmBiRanKRespVO::getCount).reversed());
ranks.sort(Comparator.comparing(CrmStatisticsRanKRespVO::getCount).reversed());
// 3. 拼接用户信息
appendUserInfo(ranks);
return ranks;
@ -108,8 +108,8 @@ public class CrmBiRankingServiceImpl implements CrmBiRankingService {
*
* @param ranks 排行榜数据
*/
private void appendUserInfo(List<CrmBiRanKRespVO> ranks) {
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertSet(ranks, CrmBiRanKRespVO::getOwnerUserId));
private void appendUserInfo(List<CrmStatisticsRanKRespVO> ranks) {
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertSet(ranks, CrmStatisticsRanKRespVO::getOwnerUserId));
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
ranks.forEach(rank -> MapUtils.findAndThen(userMap, rank.getOwnerUserId(), user -> {
rank.setNickname(user.getNickname());

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.bi.CrmBiRankingMapper">
<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsRankingMapper">
<select id="selectContractPriceRank"
resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO">
SELECT IFNULL(SUM(price), 0) AS count, owner_user_id
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO">
SELECT IFNULL(SUM(total_price), 0) AS count, owner_user_id
FROM crm_contract
WHERE deleted = 0
AND audit_status = 20
@ -18,7 +18,7 @@
</select>
<select id="selectReceivablePriceRank"
resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO">
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO">
SELECT IFNULL(SUM(price), 0) AS count, owner_user_id
FROM crm_receivable
WHERE deleted = 0
@ -33,7 +33,7 @@
</select>
<select id="selectContractCountRank"
resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO">
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO">
SELECT COUNT(1) AS count, owner_user_id
FROM crm_contract
WHERE deleted = 0
@ -49,7 +49,7 @@
<!-- TODO 待定 这里是否需要关联 crm_contract_product 表,计算销售额 -->
<select id="selectProductSalesRank"
resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO">
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO">
SELECT COUNT(1) AS count, owner_user_id
FROM crm_contract
WHERE deleted = 0
@ -64,7 +64,7 @@
</select>
<select id="selectCustomerCountRank"
resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO">
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO">
SELECT COUNT(1) AS count, owner_user_id
FROM crm_customer
WHERE deleted = 0
@ -78,7 +78,7 @@
</select>
<select id="selectContactsCountRank"
resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO">
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO">
SELECT COUNT(1) AS count, owner_user_id
FROM crm_contact
WHERE deleted = 0
@ -92,7 +92,7 @@
</select>
<select id="selectFollowCountRank"
resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO">
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO">
SELECT COUNT(1) AS count, cc.owner_user_id
FROM crm_follow_up_record AS cfur
LEFT JOIN crm_contact AS cc ON FIND_IN_SET(cc.id, cfur.contact_ids)
@ -108,7 +108,7 @@
</select>
<select id="selectFollowCustomerCountRank"
resultType="cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO">
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO">
SELECT COUNT(DISTINCT cc.id) AS count, cc.owner_user_id
FROM crm_follow_up_record AS cfur
LEFT JOIN crm_contact AS cc ON FIND_IN_SET(cc.id, cfur.contact_ids)