Commit 6b449d657c33eed09afc427cb3eb3e96f2b38d36

Authored by “wangming”
1 parent 18e03666

合并代码

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