CRM:code review【员工业绩】的实现

This commit is contained in:
YunaiV 2024-03-30 14:39:34 +08:00
parent 08c851aeab
commit f591a04317
3 changed files with 8 additions and 4 deletions

View File

@ -29,21 +29,21 @@ public class CrmStatisticsPerformanceController {
private CrmStatisticsPerformanceService performanceService;
@GetMapping("/get-contract-count-performance")
@Operation(summary = "员工业绩-签约合同数量")
@Operation(summary = "合同数量统计", description = "用于【合同数量分析】页面")
@PreAuthorize("@ss.hasPermission('crm:statistics-performance:query')")
public CommonResult<List<CrmStatisticsPerformanceRespVO>> getContractCountPerformance(@Valid CrmStatisticsPerformanceReqVO performanceReqVO) {
return success(performanceService.getContractCountPerformance(performanceReqVO));
}
@GetMapping("/get-contract-price-performance")
@Operation(summary = "员工业绩-获得合同金额")
@Operation(summary = "合同金额统计")
@PreAuthorize("@ss.hasPermission('crm:statistics-performance:query')")
public CommonResult<List<CrmStatisticsPerformanceRespVO>> getContractPriceStaffPerformance(@Valid CrmStatisticsPerformanceReqVO performanceReqVO) {
return success(performanceService.getContractPricePerformance(performanceReqVO));
}
@GetMapping("/get-receivable-price-performance")
@Operation(summary = "员工业绩-获得回款金额")
@Operation(summary = "回款金额统计")
@PreAuthorize("@ss.hasPermission('crm:statistics-performance:query')")
public CommonResult<List<CrmStatisticsPerformanceRespVO>> getReceivablePriceStaffPerformance(@Valid CrmStatisticsPerformanceReqVO performanceReqVO) {
return success(performanceService.getReceivablePricePerformance(performanceReqVO));

View File

@ -33,6 +33,7 @@ public class CrmStatisticsPerformanceReqVO {
@Schema(description = "负责人用户 id 集合", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "2")
private List<Long> userIds;
// TODO @scholar应该传递的是 int year年份
@Schema(description = "时间范围", requiredMode = Schema.RequiredMode.REQUIRED)
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@NotEmpty(message = "时间范围不能为空")

View File

@ -36,9 +36,12 @@ public class CrmStatisticsPerformanceServiceImpl implements CrmStatisticsPerform
@Resource
private DeptApi deptApi;
@Override
public List<CrmStatisticsPerformanceRespVO> getContractCountPerformance(CrmStatisticsPerformanceReqVO performanceReqVO) {
// TODO @scholar我们可以换个思路实现减少数据库的计算量
// 比如说2024 年的合同数据是不是 2022-12 2024-12-31每个月的统计呢
// 理解之后我们可以数据 group by -20222-12 2024-12-31 然后内存在聚合出 CrmStatisticsPerformanceRespVO 这样
// 这样我们就可以减少数据库的计算量提升性能同时 SQL 也会很简单开发者理解起来也简单哈
return getPerformance(performanceReqVO, performanceMapper::selectContractCountPerformance);
}