Commit bcdc9e9acf1a1649067ca5ebd63f97fa9dfac1e5
1 parent
ae64a2f0
feat: 在GetEmployeePerformanceStatistics中新增开单项目数和消耗项目数统计
- 新增BillingProjectCount和ConsumeProjectCount字段到EmployeePerformanceStatisticsOutput - 新增GetBillingProjectCount方法统计开单项目数 - 新增GetConsumeProjectCount方法统计消耗项目数 - 通过项目编号(px)去重统计项目数 - 更新API注释,添加新字段说明
Showing
3 changed files
with
60 additions
and
2 deletions
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatistics/EmployeePerformanceStatisticsOutput.cs
| ... | ... | @@ -69,5 +69,15 @@ namespace NCC.Extend.Entitys.Dto.LqStatistics |
| 69 | 69 | /// 人次(日度去重客户数) |
| 70 | 70 | /// </summary> |
| 71 | 71 | public int PersonCount { get; set; } |
| 72 | + | |
| 73 | + /// <summary> | |
| 74 | + /// 开单项目数 | |
| 75 | + /// </summary> | |
| 76 | + public int BillingProjectCount { get; set; } | |
| 77 | + | |
| 78 | + /// <summary> | |
| 79 | + /// 消耗项目数 | |
| 80 | + /// </summary> | |
| 81 | + public int ConsumeProjectCount { get; set; } | |
| 72 | 82 | } |
| 73 | 83 | } | ... | ... |
netcore/src/Modularity/Extend/NCC.Extend/LqEventService.cs
netcore/src/Modularity/Extend/NCC.Extend/LqStatisticsService.cs
| ... | ... | @@ -3389,7 +3389,7 @@ namespace NCC.Extend.LqStatistics |
| 3389 | 3389 | /// </summary> |
| 3390 | 3390 | /// <remarks> |
| 3391 | 3391 | /// 根据员工ID和月份统计员工的完整业绩数据 |
| 3392 | - /// 包括:拓客人数、邀约人数、预约人数、开单、消耗、退卡、人头、人次 | |
| 3392 | + /// 包括:拓客人数、邀约人数、预约人数、开单、消耗、退卡、人头、人次、项目数 | |
| 3393 | 3393 | /// |
| 3394 | 3394 | /// 示例请求: |
| 3395 | 3395 | /// ```json |
| ... | ... | @@ -3411,8 +3411,10 @@ namespace NCC.Extend.LqStatistics |
| 3411 | 3411 | /// - AppointmentCount: 预约人数 |
| 3412 | 3412 | /// - BillingCount: 开单数量 |
| 3413 | 3413 | /// - BillingAmount: 开单金额 |
| 3414 | + /// - BillingProjectCount: 开单项目数 | |
| 3414 | 3415 | /// - ConsumeCount: 消耗数量 |
| 3415 | 3416 | /// - ConsumeAmount: 消耗金额 |
| 3417 | + /// - ConsumeProjectCount: 消耗项目数 | |
| 3416 | 3418 | /// - RefundCount: 退卡数量 |
| 3417 | 3419 | /// - RefundAmount: 退卡金额 |
| 3418 | 3420 | /// - HeadCount: 人头(月度去重客户数) |
| ... | ... | @@ -3461,6 +3463,12 @@ namespace NCC.Extend.LqStatistics |
| 3461 | 3463 | // 8. 人次统计 |
| 3462 | 3464 | var personCount = await GetPersonCount(input.UserId, statisticsMonth); |
| 3463 | 3465 | |
| 3466 | + // 9. 开单项目数统计 | |
| 3467 | + var billingProjectCount = await GetBillingProjectCount(input.UserId, statisticsMonth); | |
| 3468 | + | |
| 3469 | + // 10. 消耗项目数统计 | |
| 3470 | + var consumeProjectCount = await GetConsumeProjectCount(input.UserId, statisticsMonth); | |
| 3471 | + | |
| 3464 | 3472 | return new EmployeePerformanceStatisticsOutput |
| 3465 | 3473 | { |
| 3466 | 3474 | UserId = input.UserId, |
| ... | ... | @@ -3475,7 +3483,9 @@ namespace NCC.Extend.LqStatistics |
| 3475 | 3483 | RefundCount = refundStats.Count, |
| 3476 | 3484 | RefundAmount = refundStats.Amount, |
| 3477 | 3485 | HeadCount = headCount, |
| 3478 | - PersonCount = personCount | |
| 3486 | + PersonCount = personCount, | |
| 3487 | + BillingProjectCount = billingProjectCount, | |
| 3488 | + ConsumeProjectCount = consumeProjectCount | |
| 3479 | 3489 | }; |
| 3480 | 3490 | } |
| 3481 | 3491 | catch (Exception ex) |
| ... | ... | @@ -3625,6 +3635,42 @@ namespace NCC.Extend.LqStatistics |
| 3625 | 3635 | return Convert.ToInt32(result.FirstOrDefault()?.Count ?? 0); |
| 3626 | 3636 | } |
| 3627 | 3637 | |
| 3638 | + /// <summary> | |
| 3639 | + /// 统计开单项目数 | |
| 3640 | + /// </summary> | |
| 3641 | + private async Task<int> GetBillingProjectCount(string userId, string month) | |
| 3642 | + { | |
| 3643 | + var sql = $@" | |
| 3644 | + SELECT COUNT(DISTINCT pxmx.px) as Count | |
| 3645 | + FROM lq_kd_jksyj jksyj | |
| 3646 | + INNER JOIN lq_kd_pxmx pxmx ON jksyj.F_kdpxid = pxmx.F_Id | |
| 3647 | + WHERE jksyj.jkszh = '{userId}' | |
| 3648 | + AND jksyj.F_IsEffective = 1 | |
| 3649 | + AND DATE_FORMAT(jksyj.yjsj, '%Y%m') = '{month}'"; | |
| 3650 | + | |
| 3651 | + var result = await _db.Ado.SqlQueryAsync<dynamic>(sql); | |
| 3652 | + return Convert.ToInt32(result.FirstOrDefault()?.Count ?? 0); | |
| 3653 | + } | |
| 3654 | + | |
| 3655 | + /// <summary> | |
| 3656 | + /// 统计消耗项目数 | |
| 3657 | + /// </summary> | |
| 3658 | + private async Task<int> GetConsumeProjectCount(string userId, string month) | |
| 3659 | + { | |
| 3660 | + var sql = $@" | |
| 3661 | + SELECT COUNT(DISTINCT pxmx.px) as Count | |
| 3662 | + FROM lq_xh_jksyj jksyj | |
| 3663 | + INNER JOIN lq_xh_hyhk hyhk ON jksyj.glkdbh = hyhk.F_Id | |
| 3664 | + INNER JOIN lq_xh_pxmx pxmx ON pxmx.F_ConsumeInfoId = hyhk.F_Id | |
| 3665 | + WHERE jksyj.jkszh = '{userId}' | |
| 3666 | + AND jksyj.F_IsEffective = 1 | |
| 3667 | + AND hyhk.F_IsEffective = 1 | |
| 3668 | + AND DATE_FORMAT(hyhk.hksj, '%Y%m') = '{month}'"; | |
| 3669 | + | |
| 3670 | + var result = await _db.Ado.SqlQueryAsync<dynamic>(sql); | |
| 3671 | + return Convert.ToInt32(result.FirstOrDefault()?.Count ?? 0); | |
| 3672 | + } | |
| 3673 | + | |
| 3628 | 3674 | #endregion |
| 3629 | 3675 | |
| 3630 | 3676 | } | ... | ... |