Commit 6b449d657c33eed09afc427cb3eb3e96f2b38d36

Authored by “wangming”
1 parent 18e03666

合并代码

antis-ncc-admin/.env.development
... ... @@ -2,6 +2,6 @@
2 2  
3 3 VUE_CLI_BABEL_TRANSPILE_MODULES = true
4 4 # VUE_APP_BASE_API = 'https://erp.lvqianmeiye.com'
5   -VUE_APP_BASE_API = 'http://erp_test.lvqianmeiye.com'
6   -# VUE_APP_BASE_API = 'http://localhost:2011'
  5 +# VUE_APP_BASE_API = 'http://erp_test.lvqianmeiye.com'
  6 +VUE_APP_BASE_API = 'http://localhost:2011'
7 7 VUE_APP_BASE_WSS = 'ws://192.168.110.45:2011/websocket'
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/Dto/LqMdTarget/LqMdTargetCrInput.cs
... ... @@ -57,6 +57,11 @@ namespace NCC.Extend.Entitys.Dto.LqMdTarget
57 57 public decimal educationDepartmentTarget { get; set; } = 0;
58 58  
59 59 /// <summary>
  60 + /// 大项目部业绩目标
  61 + /// </summary>
  62 + public decimal majorProjectDepartmentTarget { get; set; } = 0;
  63 +
  64 + /// <summary>
60 65 /// 事业部总经理
61 66 /// </summary>
62 67 public string businessUnitGeneralManager { get; set; }
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/Dto/LqMdTarget/LqMdTargetInfoOutput.cs
... ... @@ -58,6 +58,11 @@ namespace NCC.Extend.Entitys.Dto.LqMdTarget
58 58 public decimal educationDepartmentTarget { get; set; }
59 59  
60 60 /// <summary>
  61 + /// 大项目部业绩目标
  62 + /// </summary>
  63 + public decimal majorProjectDepartmentTarget { get; set; }
  64 +
  65 + /// <summary>
61 66 /// 事业部总经理
62 67 /// </summary>
63 68 public string businessUnitGeneralManager { get; set; }
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/Dto/LqMdTarget/LqMdTargetListOutput.cs
... ... @@ -58,6 +58,11 @@ namespace NCC.Extend.Entitys.Dto.LqMdTarget
58 58 public decimal educationDepartmentTarget { get; set; }
59 59  
60 60 /// <summary>
  61 + /// 大项目部业绩目标
  62 + /// </summary>
  63 + public decimal majorProjectDepartmentTarget { get; set; }
  64 +
  65 + /// <summary>
61 66 /// 事业部总经理
62 67 /// </summary>
63 68 public string businessUnitGeneralManager { get; set; }
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/Dto/LqMdTarget/LqMdTargetUpInput.cs
... ... @@ -57,6 +57,11 @@ namespace NCC.Extend.Entitys.Dto.LqMdTarget
57 57 public decimal educationDepartmentTarget { get; set; } = 0;
58 58  
59 59 /// <summary>
  60 + /// 大项目部业绩目标
  61 + /// </summary>
  62 + public decimal majorProjectDepartmentTarget { get; set; } = 0;
  63 +
  64 + /// <summary>
60 65 /// 事业部总经理
61 66 /// </summary>
62 67 public string businessUnitGeneralManager { get; set; }
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_md_target/LqMdTargetEntity.cs
... ... @@ -72,6 +72,12 @@ namespace NCC.Extend.Entitys.lq_md_target
72 72 public decimal EducationDepartmentTarget { get; set; } = 0;
73 73  
74 74 /// <summary>
  75 + /// 大项目部业绩目标
  76 + /// </summary>
  77 + [SugarColumn(ColumnName = "F_MajorProjectDepartmentTarget")]
  78 + public decimal MajorProjectDepartmentTarget { get; set; } = 0;
  79 +
  80 + /// <summary>
75 81 /// 事业部总经理
76 82 /// </summary>
77 83 [SugarColumn(ColumnName = "F_BusinessUnitGeneralManager")]
... ...
netcore/src/Modularity/Extend/NCC.Extend/LqDailyReportService.cs
... ... @@ -191,7 +191,7 @@ namespace NCC.Extend
191 191 /// 返回说明:
192 192 /// - StoreId: 门店ID
193 193 /// - StoreName: 门店名称
194   - /// - TargetPerformance: 目标业绩(生命线,来自门店信息表
  194 + /// - TargetPerformance: 目标业绩(门店目标业绩,来自门店目标表lq_md_target的F_StoreTarget字段,根据开始时间所在月份获取,如果未查询到则为0
195 195 /// - BillingPerformance: 开单业绩(开单业绩总和)
196 196 /// - RefundPerformance: 退款业绩(退卡业绩总和)
197 197 /// - ActualPerformance: 实际业绩(开单业绩 - 退款业绩)
... ... @@ -210,6 +210,9 @@ namespace NCC.Extend
210 210 // 获取时间范围
211 211 var (startDate, endDate) = GetTimeRange(input.StartTime, input.EndTime);
212 212  
  213 + // 根据开始时间确定月份(YYYYMM格式)
  214 + var month = startDate.ToString("yyyyMM");
  215 +
213 216 // 构建门店过滤条件
214 217 var storeFilter = "";
215 218 if (input.StoreIds != null && input.StoreIds.Any())
... ... @@ -223,8 +226,8 @@ namespace NCC.Extend
223 226 SELECT
224 227 store.F_Id as StoreId,
225 228 store.dm as StoreName,
226   - -- 目标业绩(生命线)
227   - COALESCE(store.xsyj, 0) as TargetPerformance,
  229 + -- 目标业绩(门店目标业绩,来自门店目标表)
  230 + COALESCE(target.F_StoreTarget, 0) as TargetPerformance,
228 231 -- 开单业绩总和
229 232 COALESCE((
230 233 SELECT SUM(billing.sfyj)
... ... @@ -244,6 +247,7 @@ namespace NCC.Extend
244 247 AND DATE(refund.tksj) <= '{endDate:yyyy-MM-dd}'
245 248 ), 0) as RefundPerformance
246 249 FROM lq_mdxx store
  250 + LEFT JOIN lq_md_target target ON target.F_StoreId = store.F_Id AND target.F_Month = '{month}'
247 251 WHERE 1=1 {storeFilter}
248 252 ORDER BY (BillingPerformance - RefundPerformance) DESC";
249 253  
... ... @@ -298,10 +302,10 @@ namespace NCC.Extend
298 302 /// 返回说明:
299 303 /// - BusinessUnitId: 事业部ID
300 304 /// - BusinessUnitName: 事业部名称
301   - /// - TargetPerformance: 目标业绩(管理门店的生命线总和
  305 + /// - TargetPerformance: 目标业绩(来自门店目标表lq_md_target的F_BusinessUnitTarget字段,根据开始时间所在月份获取,通过F_BusinessUnit字段关联,如果未查询到则为0
302 306 /// - CompletedPerformance: 完成业绩(指定时间范围内的开单业绩总和)
303 307 /// - CompletionRate: 完成率(百分比,CompletedPerformance / TargetPerformance * 100)
304   - /// - StoreCount: 门店数量
  308 + /// - StoreCount: 门店数量(根据门店目标表中归属该事业部的门店数统计)
305 309 /// </remarks>
306 310 /// <param name="input">查询参数</param>
307 311 /// <returns>事业部业绩完成情况列表</returns>
... ... @@ -315,6 +319,9 @@ namespace NCC.Extend
315 319 // 获取时间范围
316 320 var (startDate, endDate) = GetTimeRange(input.StartTime, input.EndTime);
317 321  
  322 + // 根据开始时间确定月份(YYYYMM格式)
  323 + var month = startDate.ToString("yyyyMM");
  324 +
318 325 // 构建事业部过滤条件
319 326 var businessUnitFilter = "";
320 327 if (input.BusinessUnitIds != null && input.BusinessUnitIds.Any())
... ... @@ -329,10 +336,10 @@ namespace NCC.Extend
329 336 SELECT
330 337 o.F_Id as BusinessUnitId,
331 338 o.F_FullName as BusinessUnitName,
332   - COALESCE(SUM(store.xsyj), 0) as TargetPerformance,
333   - COUNT(DISTINCT store.F_Id) as StoreCount
  339 + COALESCE(SUM(target.F_BusinessUnitTarget), 0) as TargetPerformance,
  340 + COUNT(DISTINCT target.F_StoreId) as StoreCount
334 341 FROM base_organize o
335   - LEFT JOIN lq_mdxx store ON store.syb = o.F_Id
  342 + LEFT JOIN lq_md_target target ON target.F_BusinessUnit = o.F_Id AND target.F_Month = '{month}'
336 343 WHERE o.F_Category = 'department'
337 344 AND (o.F_DeleteMark IS NULL OR o.F_DeleteMark != 1)
338 345 AND o.F_FullName IN ('事业一部', '事业二部', '事业三部', '事业四部', '事业五部', '事业六部')
... ... @@ -432,10 +439,10 @@ namespace NCC.Extend
432 439 /// 返回说明:
433 440 /// - DepartmentId: 部门ID
434 441 /// - DepartmentName: 部门名称(教育一部、教育二部、科技一部、科技二部、大项目一部、大项目二部)
435   - /// - TargetPerformance: 目标业绩(管理门店的生命线总和
  442 + /// - TargetPerformance: 目标业绩(来自门店目标表lq_md_target,根据部门类型使用对应字段:教育部使用F_EducationDepartmentTarget,科技部使用F_TechDepartmentTarget,大项目部使用F_MajorProjectDepartmentTarget,根据开始时间所在月份获取,通过对应归属字段关联,如果未查询到则为0
436 443 /// - CompletedPerformance: 完成业绩(指定时间范围内的开单业绩总和)
437 444 /// - CompletionRate: 完成率(百分比,CompletedPerformance / TargetPerformance * 100)
438   - /// - StoreCount: 门店数量
  445 + /// - StoreCount: 门店数量(根据门店目标表中归属该部门的门店数统计)
439 446 /// </remarks>
440 447 /// <param name="input">查询参数</param>
441 448 /// <returns>天王团业绩完成情况列表</returns>
... ... @@ -449,6 +456,9 @@ namespace NCC.Extend
449 456 // 获取时间范围
450 457 var (startDate, endDate) = GetTimeRange(input.StartTime, input.EndTime);
451 458  
  459 + // 根据开始时间确定月份(YYYYMM格式)
  460 + var month = startDate.ToString("yyyyMM");
  461 +
452 462 // 构建部门过滤条件
453 463 var departmentFilter = "";
454 464 if (input.DepartmentIds != null && input.DepartmentIds.Any())
... ... @@ -457,12 +467,12 @@ namespace NCC.Extend
457 467 departmentFilter = $"AND o.F_Id IN ('{filterDeptIdsStr}')";
458 468 }
459 469  
460   - // 天王团部门信息(字段名和部门名称的映射)
461   - var tianwangDepartments = new Dictionary<string, (string fieldName, string[] departmentNames)>
  470 + // 天王团部门信息(字段名、目标字段名和部门名称的映射)
  471 + var tianwangDepartments = new Dictionary<string, (string fieldName, string targetFieldName, string[] departmentNames)>
462 472 {
463   - { "jyb", ("jyb", new[] { "教育一部", "教育二部" }) },
464   - { "kjb", ("kjb", new[] { "科技一部", "科技二部" }) },
465   - { "dxmb", ("dxmb", new[] { "大项目一部", "大项目二部" }) }
  473 + { "jyb", ("F_EducationDepartment", "F_EducationDepartmentTarget", new[] { "教育一部", "教育二部" }) },
  474 + { "kjb", ("F_TechDepartment", "F_TechDepartmentTarget", new[] { "科技一部", "科技二部" }) },
  475 + { "dxmb", ("F_MajorProjectDepartment", "F_MajorProjectDepartmentTarget", new[] { "大项目一部", "大项目二部" }) }
466 476 };
467 477  
468 478 // 分步查询,提高效率
... ... @@ -480,10 +490,10 @@ namespace NCC.Extend
480 490 SELECT
481 491 o.F_Id as DepartmentId,
482 492 o.F_FullName as DepartmentName,
483   - COALESCE(SUM(store.xsyj), 0) as TargetPerformance,
484   - COUNT(DISTINCT store.F_Id) as StoreCount
  493 + COALESCE(SUM(target.{deptType.Value.targetFieldName}), 0) as TargetPerformance,
  494 + COUNT(DISTINCT target.F_StoreId) as StoreCount
485 495 FROM base_organize o
486   - LEFT JOIN lq_mdxx store ON store.{deptType.Key} = o.F_Id
  496 + LEFT JOIN lq_md_target target ON target.{deptType.Value.fieldName} = o.F_Id AND target.F_Month = '{month}'
487 497 WHERE o.F_Category = 'department'
488 498 AND (o.F_DeleteMark IS NULL OR o.F_DeleteMark != 1)
489 499 AND o.F_FullName IN ('{deptNamesStr}')
... ... @@ -608,7 +618,7 @@ namespace NCC.Extend
608 618 /// - ManagerId: 经理用户ID
609 619 /// - ManagerName: 经理姓名
610 620 /// - StoreId/StoreName: 门店信息
611   - /// - Target1/2/3: 目标业绩一/二/三阶段(smx1/smx2/smx3
  621 + /// - Target1/2/3: 目标业绩一/二/三阶段(来自门店总经理生命线设置表lq_md_general_manager_lifeline的F_Lifeline1/F_Lifeline2/F_Lifeline3字段,根据开始时间所在月份获取,如果未查询到则为0
612 622 /// - CompletedPerformance: 完成业绩(指定时间范围内的开单业绩总和)
613 623 /// - CompletionRate1/2/3: 完成率各阶段(百分比)
614 624 /// </remarks>
... ... @@ -624,38 +634,41 @@ namespace NCC.Extend
624 634 // 获取时间范围
625 635 var (startDate, endDate) = GetTimeRange(input.StartTime, input.EndTime);
626 636  
  637 + // 根据开始时间确定月份(YYYYMM格式)
  638 + var month = startDate.ToString("yyyyMM");
  639 +
627 640 // 构建经理过滤条件
628 641 var managerFilter = "";
629 642 if (!string.IsNullOrWhiteSpace(input.ManagerId))
630 643 {
631   - managerFilter = $"AND target.zjl_userid = '{input.ManagerId}'";
  644 + managerFilter = $"AND target.F_GeneralManagerId = '{input.ManagerId}'";
632 645 }
633 646  
634 647 // SQL查询:获取经理在各门店的目标业绩和完成业绩
635 648 var sql = $@"
636 649 SELECT
637   - target.zjl_userid as ManagerId,
  650 + target.F_GeneralManagerId as ManagerId,
638 651 u.F_RealName as ManagerName,
639   - target.md_id as StoreId,
  652 + target.F_StoreId as StoreId,
640 653 store.dm as StoreName,
641   - target.smx1 as Target1,
642   - target.smx2 as Target2,
643   - target.smx3 as Target3,
  654 + target.F_Lifeline1 as Target1,
  655 + target.F_Lifeline2 as Target2,
  656 + target.F_Lifeline3 as Target3,
644 657 -- 完成业绩
645 658 COALESCE((
646 659 SELECT SUM(billing.sfyj)
647 660 FROM lq_kd_kdjlb billing
648   - WHERE billing.djmd = target.md_id
  661 + WHERE billing.djmd = target.F_StoreId
649 662 AND billing.F_IsEffective = 1
650 663 AND DATE(billing.kdrq) >= '{startDate:yyyy-MM-dd}'
651 664 AND DATE(billing.kdrq) <= '{endDate:yyyy-MM-dd}'
652 665 ), 0) as CompletedPerformance
653   - FROM lq_zjl_mdsmxsz target
654   - INNER JOIN BASE_USER u ON target.zjl_userid = u.F_Id
655   - INNER JOIN lq_mdxx store ON target.md_id = store.F_Id
656   - WHERE target.deletemark = 0
  666 + FROM lq_md_general_manager_lifeline target
  667 + INNER JOIN BASE_USER u ON target.F_GeneralManagerId = u.F_Id
  668 + INNER JOIN lq_mdxx store ON target.F_StoreId = store.F_Id
  669 + WHERE target.F_Month = '{month}'
657 670 {managerFilter}
658   - ORDER BY target.zjl_userid, store.dm";
  671 + ORDER BY target.F_GeneralManagerId, store.dm";
659 672  
660 673 var result = await _db.Ado.SqlQueryAsync<dynamic>(sql);
661 674  
... ... @@ -712,10 +725,10 @@ namespace NCC.Extend
712 725 /// 返回说明:
713 726 /// - ManagerId: 经理用户ID
714 727 /// - ManagerName: 经理姓名
715   - /// - TotalTarget1/2/3: 总目标业绩一/二/三阶段
  728 + /// - TotalTarget1/2/3: 总目标业绩一/二/三阶段(来自门店总经理生命线设置表lq_md_general_manager_lifeline的F_Lifeline1/F_Lifeline2/F_Lifeline3字段,根据开始时间所在月份获取并汇总)
716 729 /// - TotalCompletedPerformance: 总完成业绩(指定时间范围内的开单业绩总和)
717 730 /// - TotalCompletionRate1/2/3: 总完成率各阶段
718   - /// - StoreCount: 管理门店数量
  731 + /// - StoreCount: 管理门店数量(根据门店总经理生命线设置表中归属该经理的门店数统计)
719 732 /// </remarks>
720 733 /// <param name="input">查询参数</param>
721 734 /// <returns>经理汇总业绩完成情况列表</returns>
... ... @@ -729,37 +742,40 @@ namespace NCC.Extend
729 742 // 获取时间范围
730 743 var (startDate, endDate) = GetTimeRange(input.StartTime, input.EndTime);
731 744  
  745 + // 根据开始时间确定月份(YYYYMM格式)
  746 + var month = startDate.ToString("yyyyMM");
  747 +
732 748 // 构建经理过滤条件
733 749 var managerFilter = "";
734 750 if (!string.IsNullOrWhiteSpace(input.ManagerId))
735 751 {
736   - managerFilter = $"AND target.zjl_userid = '{input.ManagerId}'";
  752 + managerFilter = $"AND target.F_GeneralManagerId = '{input.ManagerId}'";
737 753 }
738 754  
739 755 // SQL查询:获取经理汇总业绩
740 756 var sql = $@"
741 757 SELECT
742   - target.zjl_userid as ManagerId,
  758 + target.F_GeneralManagerId as ManagerId,
743 759 u.F_RealName as ManagerName,
744   - SUM(target.smx1) as TotalTarget1,
745   - COALESCE(SUM(target.smx2), 0) as TotalTarget2,
746   - COALESCE(SUM(target.smx3), 0) as TotalTarget3,
747   - COUNT(DISTINCT target.md_id) as StoreCount,
  760 + SUM(target.F_Lifeline1) as TotalTarget1,
  761 + COALESCE(SUM(target.F_Lifeline2), 0) as TotalTarget2,
  762 + COALESCE(SUM(target.F_Lifeline3), 0) as TotalTarget3,
  763 + COUNT(DISTINCT target.F_StoreId) as StoreCount,
748 764 -- 总完成业绩
749 765 SUM(COALESCE((
750 766 SELECT SUM(billing.sfyj)
751 767 FROM lq_kd_kdjlb billing
752   - WHERE billing.djmd = target.md_id
  768 + WHERE billing.djmd = target.F_StoreId
753 769 AND billing.F_IsEffective = 1
754 770 AND DATE(billing.kdrq) >= '{startDate:yyyy-MM-dd}'
755 771 AND DATE(billing.kdrq) <= '{endDate:yyyy-MM-dd}'
756 772 ), 0)) as TotalCompletedPerformance
757   - FROM lq_zjl_mdsmxsz target
758   - INNER JOIN BASE_USER u ON target.zjl_userid = u.F_Id
759   - INNER JOIN lq_mdxx store ON target.md_id = store.F_Id
760   - WHERE target.deletemark = 0
  773 + FROM lq_md_general_manager_lifeline target
  774 + INNER JOIN BASE_USER u ON target.F_GeneralManagerId = u.F_Id
  775 + INNER JOIN lq_mdxx store ON target.F_StoreId = store.F_Id
  776 + WHERE target.F_Month = '{month}'
761 777 {managerFilter}
762   - GROUP BY target.zjl_userid, u.F_RealName
  778 + GROUP BY target.F_GeneralManagerId, u.F_RealName
763 779 ORDER BY TotalCompletedPerformance DESC";
764 780  
765 781 var result = await _db.Ado.SqlQueryAsync<dynamic>(sql);
... ...
netcore/src/Modularity/Extend/NCC.Extend/LqMdTargetService.cs
... ... @@ -88,6 +88,7 @@ namespace NCC.Extend.LqMdTarget
88 88 businessUnitTarget = it.BusinessUnitTarget,
89 89 techDepartmentTarget = it.TechDepartmentTarget,
90 90 educationDepartmentTarget = it.EducationDepartmentTarget,
  91 + majorProjectDepartmentTarget = it.MajorProjectDepartmentTarget,
91 92 businessUnitGeneralManager = it.BusinessUnitGeneralManager,
92 93 businessUnitManager = it.BusinessUnitManager,
93 94 storeTarget = it.StoreTarget,
... ...