Commit 5dc762df4603618add5d3aa1406a7992bcb3a1dd

Authored by “wangming”
1 parent 0c63f3b7

Enhance performance statistics with refund metrics

- Added refund performance and count fields to personal and store total performance statistics.
- Introduced actual performance calculations that account for refunds.
- Updated relevant DTOs and entity classes to include new fields.
- Improved front-end tables to display refund-related data in performance statistics views.
antis-ncc-admin/src/views/lqInventory/InventoryInfoDialog.vue
... ... @@ -191,4 +191,3 @@ export default {
191 191 text-align: right;
192 192 }
193 193 </style>
194   -
... ...
antis-ncc-admin/src/views/personalPerformanceStatistics/index.vue
... ... @@ -50,7 +50,7 @@
50 50 <el-table-column prop="EmployeeName" label="员工姓名" width="120" fixed="left"></el-table-column>
51 51 <el-table-column prop="StoreName" label="门店名称" width="150" fixed="left"></el-table-column>
52 52 <el-table-column prop="Position" label="岗位" width="100" fixed="left"></el-table-column>
53   - <el-table-column prop="GoldTriangleTeam" label="金三角战队" width="120" fixed="left"></el-table-column>
  53 + <el-table-column prop="GoldTriangleName" label="金三角战队" width="120" fixed="left"></el-table-column>
54 54 <el-table-column prop="TotalPerformance" label="总业绩" width="100" align="right">
55 55 <template slot-scope="scope">
56 56 {{ formatMoney(scope.row.TotalPerformance) }}
... ... @@ -66,6 +66,22 @@
66 66 {{ formatMoney(scope.row.UpgradeOrderPerformance) }}
67 67 </template>
68 68 </el-table-column>
  69 + <el-table-column prop="RefundPerformance" label="退单业绩" width="100" align="right">
  70 + <template slot-scope="scope">
  71 + <span style="color: #F56C6C;">{{ formatMoney(scope.row.RefundPerformance) }}</span>
  72 + </template>
  73 + </el-table-column>
  74 + <el-table-column prop="RefundCount" label="退单次数" width="100" align="right">
  75 + <template slot-scope="scope">
  76 + <span style="color: #F56C6C;">{{ scope.row.RefundCount || 0 }}</span>
  77 + </template>
  78 + </el-table-column>
  79 + <el-table-column prop="ActualPerformance" label="实际业绩" width="100" align="right">
  80 + <template slot-scope="scope">
  81 + <span style="color: #67C23A; font-weight: bold;">{{ formatMoney(scope.row.ActualPerformance)
  82 + }}</span>
  83 + </template>
  84 + </el-table-column>
69 85 <el-table-column prop="FirstOrderCount" label="首开单数量" width="100" align="right"></el-table-column>
70 86 <el-table-column prop="UpgradeOrderCount" label="升单数量" width="100" align="right"></el-table-column>
71 87 <el-table-column prop="OrderCount" label="订单总数" width="100" align="right"></el-table-column>
... ...
antis-ncc-admin/src/views/storeTotalPerformanceStatistics/index.vue
... ... @@ -81,6 +81,12 @@
81 81 <span style="color: #F56C6C;">{{ scope.row.RefundCount || 0 }}</span>
82 82 </template>
83 83 </el-table-column>
  84 + <el-table-column prop="ActualPerformance" label="实际业绩" width="120" align="right">
  85 + <template slot-scope="scope">
  86 + <span style="color: #67C23A; font-weight: bold;">{{ formatMoney(scope.row.ActualPerformance)
  87 + }}</span>
  88 + </template>
  89 + </el-table-column>
84 90 <el-table-column prop="CreateTime" label="创建时间" width="150" align="center">
85 91 <template slot-scope="scope">
86 92 {{ formatDateTime(scope.row.CreateTime) }}
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqMdxx/LqMdxxInfoOutput.cs
... ... @@ -123,21 +123,21 @@ namespace NCC.Extend.Entitys.Dto.LqMdxx
123 123 /// <summary>
124 124 /// 门店类别
125 125 /// </summary>
126   - public int? StoreCategory { get; set; }
  126 + public int? storeCategory { get; set; }
127 127  
128 128 /// <summary>
129 129 /// 门店类别名称
130 130 /// </summary>
131   - public string StoreCategoryName => StoreCategory.HasValue ? EnumHelper.GetEnumDesc<StoreCategoryEnum>(StoreCategory.Value) : string.Empty;
  131 + public string storeCategoryName => storeCategory.HasValue ? EnumHelper.GetEnumDesc<StoreCategoryEnum>(storeCategory.Value) : string.Empty;
132 132  
133 133 /// <summary>
134 134 /// 门店类型
135 135 /// </summary>
136   - public int? StoreType { get; set; }
  136 + public int? storeType { get; set; }
137 137  
138 138 /// <summary>
139 139 /// 门店类型名称
140 140 /// </summary>
141   - public string StoreTypeName => StoreType.HasValue ? EnumHelper.GetEnumDesc<StoreTypeEnum>(StoreType.Value) : string.Empty;
  141 + public string storeTypeName => storeType.HasValue ? EnumHelper.GetEnumDesc<StoreTypeEnum>(storeType.Value) : string.Empty;
142 142 }
143 143 }
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqMdxx/LqMdxxListOutput.cs
... ... @@ -152,21 +152,21 @@ namespace NCC.Extend.Entitys.Dto.LqMdxx
152 152 /// <summary>
153 153 /// 门店类别
154 154 /// </summary>
155   - public int? StoreCategory { get; set; }
  155 + public int? storeCategory { get; set; }
156 156  
157 157 /// <summary>
158 158 /// 门店类别名称
159 159 /// </summary>
160   - public string StoreCategoryName => StoreCategory.HasValue ? EnumHelper.GetEnumDesc<StoreCategoryEnum>(StoreCategory.Value) : string.Empty;
  160 + public string storeCategoryName => storeCategory.HasValue ? EnumHelper.GetEnumDesc<StoreCategoryEnum>(storeCategory.Value) : string.Empty;
161 161  
162 162 /// <summary>
163 163 /// 门店类型
164 164 /// </summary>
165   - public int? StoreType { get; set; }
  165 + public int? storeType { get; set; }
166 166  
167 167 /// <summary>
168 168 /// 门店类型名称
169 169 /// </summary>
170   - public string StoreTypeName => StoreType.HasValue ? EnumHelper.GetEnumDesc<StoreTypeEnum>(StoreType.Value) : string.Empty;
  170 + public string storeTypeName => storeType.HasValue ? EnumHelper.GetEnumDesc<StoreTypeEnum>(storeType.Value) : string.Empty;
171 171 }
172 172 }
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatistics/LqStoreTotalPerformanceStatisticsListOutput.cs
... ... @@ -73,6 +73,11 @@ namespace NCC.Extend.Entitys.Dto.LqStatistics
73 73 public int RefundCount { get; set; }
74 74  
75 75 /// <summary>
  76 + /// 实际业绩
  77 + /// </summary>
  78 + public decimal ActualPerformance { get; set; }
  79 +
  80 + /// <summary>
76 81 /// 创建时间
77 82 /// </summary>
78 83 public DateTime CreateTime { get; set; }
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatisticsPersonalPerformance/LqStatisticsPersonalPerformanceListOutput.cs
... ... @@ -93,6 +93,21 @@ namespace NCC.Extend.Entitys.Dto.LqStatisticsPersonalPerformance
93 93 public decimal UpgradeOrderPerformance { get; set; }
94 94  
95 95 /// <summary>
  96 + /// 退单业绩
  97 + /// </summary>
  98 + public decimal RefundPerformance { get; set; }
  99 +
  100 + /// <summary>
  101 + /// 退单次数
  102 + /// </summary>
  103 + public int RefundCount { get; set; }
  104 +
  105 + /// <summary>
  106 + /// 实际业绩
  107 + /// </summary>
  108 + public decimal ActualPerformance { get; set; }
  109 +
  110 + /// <summary>
96 111 /// 最后订单日期
97 112 /// </summary>
98 113 public DateTime? LastOrderDate { get; set; }
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatisticsStoreTotalPerformance/LqStatisticsStoreTotalPerformanceListOutput.cs
... ... @@ -86,5 +86,10 @@ namespace NCC.Extend.Entitys.Dto.LqStatisticsStoreTotalPerformance
86 86 /// 创建时间
87 87 /// </summary>
88 88 public DateTime? createTime { get; set; }
  89 +
  90 + /// <summary>
  91 + /// 实际业绩
  92 + /// </summary>
  93 + public decimal actualPerformance { get; set; }
89 94 }
90 95 }
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_statistics_personal_performance/LqStatisticsPersonalPerformanceEntity.cs
... ... @@ -114,6 +114,24 @@ namespace NCC.Extend.Entitys.lq_statistics_personal_performance
114 114 public decimal UpgradeOrderPerformance { get; set; }
115 115  
116 116 /// <summary>
  117 + /// 退单业绩
  118 + /// </summary>
  119 + [SugarColumn(ColumnName = "F_RefundPerformance")]
  120 + public decimal RefundPerformance { get; set; }
  121 +
  122 + /// <summary>
  123 + /// 退单次数
  124 + /// </summary>
  125 + [SugarColumn(ColumnName = "F_RefundCount")]
  126 + public int RefundCount { get; set; }
  127 +
  128 + /// <summary>
  129 + /// 实际业绩
  130 + /// </summary>
  131 + [SugarColumn(ColumnName = "F_ActualPerformance")]
  132 + public decimal ActualPerformance { get; set; }
  133 +
  134 + /// <summary>
117 135 /// 最后订单日期
118 136 /// </summary>
119 137 [SugarColumn(ColumnName = "F_LastOrderDate")]
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_statistics_store_total_performance/LqStatisticsStoreTotalPerformanceEntity.cs
... ... @@ -102,6 +102,12 @@ namespace NCC.Extend.Entitys.lq_statistics_store_total_performance
102 102 public int RefundCount { get; set; }
103 103  
104 104 /// <summary>
  105 + /// 实际业绩
  106 + /// </summary>
  107 + [SugarColumn(ColumnName = "F_ActualPerformance")]
  108 + public decimal ActualPerformance { get; set; }
  109 +
  110 + /// <summary>
105 111 /// 创建时间
106 112 /// </summary>
107 113 [SugarColumn(ColumnName = "F_CreateTime")]
... ...
netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs
... ... @@ -1179,6 +1179,25 @@ namespace NCC.Extend.LqKdKdjlb
1179 1179 }
1180 1180 #endregion
1181 1181  
  1182 + #region 获取状态枚举内容(所有的状态通用)
  1183 + /// <summary>
  1184 + /// 获取状态枚举内容
  1185 + /// </summary>
  1186 + /// <returns>状态枚举列表</returns>
  1187 + [HttpGet("status-enum")]
  1188 + public List<EnumOutput> GetStatusEnum()
  1189 + {
  1190 + return Enum.GetValues<StatusEnum>()
  1191 + .Select(e => new EnumOutput
  1192 + {
  1193 + Value = (int)e,
  1194 + Name = e.ToString(),
  1195 + Description = e.GetDescription(),
  1196 + })
  1197 + .ToList();
  1198 + }
  1199 + #endregion
  1200 +
1182 1201 #region 修改开单记录
1183 1202 /// <summary>
1184 1203 /// 修改开单记录
... ... @@ -2486,7 +2505,7 @@ namespace NCC.Extend.LqKdKdjlb
2486 2505 {
2487 2506 Id = YitIdHelper.NextId().ToString(),
2488 2507 Gltkbh = refundId,
2489   - Jks = jks.Jks,
  2508 + Jks = jks.Jkszh,
2490 2509 Jksxm = jks.Jksxm,
2491 2510 Jkszh = jks.Jkszh,
2492 2511 Jksyj = (totalItemDeduction / refundKdyjEntities.Count()),
... ... @@ -2588,7 +2607,7 @@ namespace NCC.Extend.LqKdKdjlb
2588 2607 {
2589 2608 Id = YitIdHelper.NextId().ToString(),
2590 2609 Glkdbh = billingId,
2591   - Jks = jks.Jks,
  2610 + Jks = jks.Jkszh,
2592 2611 Jksxm = jks.Jksxm,
2593 2612 Jkszh = jks.Jkszh,
2594 2613 Jksyj = jks.Jksyj.ToString(),
... ... @@ -2709,7 +2728,5 @@ namespace NCC.Extend.LqKdKdjlb
2709 2728 }
2710 2729 }
2711 2730 #endregion
2712   -
2713   -
2714 2731 }
2715 2732 }
... ...
netcore/src/Modularity/Extend/NCC.Extend/LqMdxxService.cs
... ... @@ -24,6 +24,7 @@ using NCC.DataEncryption;
24 24 using NCC.ClayObject;
25 25 using NCC.Extend.Entitys.Enum;
26 26 using NCC.Code;
  27 +using NCC.Extend.Entitys.Dto.Common;
27 28  
28 29 namespace NCC.Extend.LqMdxx
29 30 {
... ... @@ -120,8 +121,8 @@ namespace NCC.Extend.LqMdxx
120 121 rt1 = it.Rt1,
121 122 rt2 = it.Rt2,
122 123 rc = it.Rc,
123   - StoreCategory = it.StoreCategory,
124   - StoreType = it.StoreType,
  124 + storeCategory = it.StoreCategory,
  125 + storeType = it.StoreType,
125 126 }).MergeTable().OrderBy(sidx + " " + input.sort).ToPagedListAsync(input.currentPage, input.pageSize);
126 127 return PageResult<LqMdxxListOutput>.SqlSugarPageResult(data);
127 128 }
... ... @@ -191,8 +192,21 @@ namespace NCC.Extend.LqMdxx
191 192 gsmc = it.Gsmc,
192 193 fr = it.Fr,
193 194 ywsb = it.Ywsb,
194   - StoreCategory = it.StoreCategory,
195   - StoreType = it.StoreType,
  195 + jyb = it.Jyb,
  196 + kjb = it.Kjb,
  197 + dxmb = it.Dxmb,
  198 + syb = it.Syb,
  199 + gsqssj = it.Gsqssj,
  200 + gszzsj = it.Gszzsj,
  201 + status = it.Status,
  202 + xsyj = it.Xsyj,
  203 + xhyj = it.Xhyj,
  204 + xms = it.Xms,
  205 + rt1 = it.Rt1,
  206 + rt2 = it.Rt2,
  207 + rc = it.Rc,
  208 + storeCategory = it.StoreCategory,
  209 + storeType = it.StoreType,
196 210 }).MergeTable().OrderBy(sidx + " " + input.sort).ToListAsync();
197 211 return data;
198 212 }
... ... @@ -359,11 +373,14 @@ namespace NCC.Extend.LqMdxx
359 373 /// </summary>
360 374 /// <returns></returns>
361 375 [HttpGet("Selector/StoreCategory")]
362   - public async Task<dynamic> GetStoreCategorySelector()
  376 + public List<EnumOutput> GetStoreCategorySelector()
363 377 {
364   - //从Enum中获取门店类别
365   - var storeCategoryEnum = EnumExtensions.GetEnumDescDictionary(typeof(StoreCategoryEnum));
366   - return new { list = storeCategoryEnum };
  378 + return Enum.GetValues<StoreCategoryEnum>().Select(e => new EnumOutput
  379 + {
  380 + Value = (int)e,
  381 + Name = e.ToString(),
  382 + Description = e.GetDescription(),
  383 + }).ToList();
367 384 }
368 385 #endregion
369 386  
... ... @@ -373,11 +390,18 @@ namespace NCC.Extend.LqMdxx
373 390 /// </summary>
374 391 /// <returns></returns>
375 392 [HttpGet("Selector/StoreType")]
376   - public async Task<dynamic> GetStoreTypeSelector()
  393 + public List<EnumOutput> GetStoreTypeSelector()
377 394 {
378 395 //从Enum中获取门店类型
379   - var storeTypeEnum = EnumExtensions.GetEnumDescDictionary(typeof(StoreTypeEnum));
380   - return new { list = storeTypeEnum };
  396 + var storeTypeEnum = Enum.GetValues<StoreTypeEnum>()
  397 + .Select(e => new EnumOutput
  398 + {
  399 + Value = (int)e,
  400 + Name = e.ToString(),
  401 + Description = e.GetDescription(),
  402 + })
  403 + .ToList();
  404 + return storeTypeEnum;
381 405 }
382 406 #endregion
383 407 }
... ...
netcore/src/Modularity/Extend/NCC.Extend/LqStatisticsService.cs
... ... @@ -1432,6 +1432,8 @@ namespace NCC.Extend.LqStatistics
1432 1432 order_stats.FirstOrderDate,
1433 1433 COALESCE(coop_stats.CooperationPerformance, 0) AS CooperationPerformance,
1434 1434 COALESCE(base_stats.BasePerformance, 0) AS BasePerformance,
  1435 + COALESCE(refund_stats.RefundPerformance, 0) AS RefundPerformance,
  1436 + COALESCE(refund_stats.RefundCount, 0) AS RefundCount,
1435 1437 order_stats.TotalPerformance
1436 1438 FROM (
1437 1439 -- 按开单记录统计基础数据,避免重复计算
... ... @@ -1541,6 +1543,23 @@ namespace NCC.Extend.LqStatistics
1541 1543 AND (xmzl.fl3 IS NULL OR xmzl.fl3 != '合作业绩')
1542 1544 GROUP BY jksyj.jkszh
1543 1545 ) base_stats ON order_stats.EmployeeId = base_stats.EmployeeId
  1546 + LEFT JOIN (
  1547 + -- 退单业绩统计
  1548 + SELECT
  1549 + hytk_jksyj.jkszh AS EmployeeId,
  1550 + SUM(CAST(hytk_jksyj.jksyj AS DECIMAL(18,2))) AS RefundPerformance,
  1551 + COUNT(*) AS RefundCount
  1552 + FROM lq_hytk_jksyj hytk_jksyj
  1553 + INNER JOIN lq_hytk_hytk hytk ON hytk_jksyj.gltkbh = hytk.F_Id
  1554 + WHERE hytk_jksyj.jksyj IS NOT NULL
  1555 + AND hytk_jksyj.jksyj != ''
  1556 + AND hytk_jksyj.jksyj != '0'
  1557 + AND hytk_jksyj.F_IsEffective = 1
  1558 + AND hytk.F_IsEffective = 1
  1559 + AND YEAR(hytk_jksyj.tksj) = @year
  1560 + AND MONTH(hytk_jksyj.tksj) = @month
  1561 + GROUP BY hytk_jksyj.jks
  1562 + ) refund_stats ON order_stats.EmployeeId = refund_stats.EmployeeId
1544 1563 ORDER BY order_stats.TotalPerformance DESC";
1545 1564  
1546 1565 // 解析统计月份
... ... @@ -1582,9 +1601,12 @@ namespace NCC.Extend.LqStatistics
1582 1601 Position = stats.Position?.ToString() ?? "",
1583 1602 EmployeeId = stats.EmployeeId?.ToString() ?? "",
1584 1603 EmployeeName = stats.EmployeeName?.ToString() ?? "",
1585   - TotalPerformance = Convert.ToDecimal(stats.TotalPerformance ?? 0),
  1604 + TotalPerformance = Convert.ToDecimal(stats.TotalPerformance ?? 0) - Convert.ToDecimal(stats.RefundPerformance ?? 0),
1586 1605 BasePerformance = Convert.ToDecimal(stats.BasePerformance ?? 0),
1587 1606 CooperationPerformance = Convert.ToDecimal(stats.CooperationPerformance ?? 0),
  1607 + RefundPerformance = Convert.ToDecimal(stats.RefundPerformance ?? 0),
  1608 + RefundCount = Convert.ToInt32(stats.RefundCount ?? 0),
  1609 + ActualPerformance = Convert.ToDecimal(stats.TotalPerformance ?? 0) - Convert.ToDecimal(stats.RefundPerformance ?? 0),
1588 1610 OrderCount = Convert.ToInt32(stats.OrderCount ?? 0),
1589 1611 FirstOrderCount = Convert.ToInt32(stats.FirstOrderCount ?? 0),
1590 1612 UpgradeOrderCount = Convert.ToInt32(stats.UpgradeOrderCount ?? 0),
... ... @@ -1665,7 +1687,7 @@ namespace NCC.Extend.LqStatistics
1665 1687 }
1666 1688  
1667 1689 /// <summary>
1668   - /// 分页查询个人开单业绩统计数据
  1690 + /// 分页查询个人开单业绩统计数据(在用)
1669 1691 /// </summary>
1670 1692 /// <remarks>
1671 1693 /// 分页查询个人业绩统计数据,支持多条件筛选
... ... @@ -1727,7 +1749,10 @@ namespace NCC.Extend.LqStatistics
1727 1749 UpgradeOrderPerformance = it.UpgradeOrderPerformance,
1728 1750 LastOrderDate = it.LastOrderDate,
1729 1751 FirstOrderDate = it.FirstOrderDate,
1730   - CreateTime = it.CreateTime
  1752 + CreateTime = it.CreateTime,
  1753 + RefundPerformance = it.RefundPerformance,
  1754 + RefundCount = it.RefundCount,
  1755 + ActualPerformance = it.ActualPerformance
1731 1756 }).ToPagedListAsync(input.currentPage, input.pageSize);
1732 1757  
1733 1758 return new
... ... @@ -2588,6 +2613,7 @@ namespace NCC.Extend.LqStatistics
2588 2613 UpgradeOrderPerformance = Convert.ToDecimal(data.F_UpgradeOrderPerformance ?? 0),
2589 2614 RefundAmount = Convert.ToDecimal(data.F_RefundAmount ?? 0),
2590 2615 RefundCount = Convert.ToInt32(data.F_RefundCount ?? 0),
  2616 + ActualPerformance = Convert.ToDecimal(data.F_TotalOrderPerformance ?? 0) - Convert.ToDecimal(data.F_RefundAmount ?? 0),
2591 2617 CreateTime = DateTime.Now
2592 2618 }).ToList();
2593 2619  
... ... @@ -2671,6 +2697,9 @@ namespace NCC.Extend.LqStatistics
2671 2697 upgradeOrderCount = it.UpgradeOrderCount,
2672 2698 firstOrderPerformance = it.FirstOrderPerformance,
2673 2699 upgradeOrderPerformance = it.UpgradeOrderPerformance,
  2700 + refundAmount = it.RefundAmount,
  2701 + refundCount = it.RefundCount,
  2702 + actualPerformance = it.ActualPerformance,
2674 2703 createTime = it.CreateTime
2675 2704 })
2676 2705 .OrderBy(sidx + " " + input.sort)
... ... @@ -3329,7 +3358,8 @@ namespace NCC.Extend.LqStatistics
3329 3358 UpgradeOrderCount = it.UpgradeOrderCount,
3330 3359 RefundAmount = it.RefundAmount,
3331 3360 RefundCount = it.RefundCount,
3332   - CreateTime = it.CreateTime.HasValue ? it.CreateTime.Value : DateTime.Now
  3361 + CreateTime = it.CreateTime.HasValue ? it.CreateTime.Value : DateTime.Now,
  3362 + ActualPerformance = it.ActualPerformance
3333 3363 }).ToList();
3334 3364  
3335 3365 return new
... ...