mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	CRM:code review【员工业绩】的实现
This commit is contained in:
		| @@ -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)); | ||||
|   | ||||
| @@ -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 = "时间范围不能为空") | ||||
|   | ||||
| @@ -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); | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV