Commit dac8767e1ae0a8659f044ee5dd5c6375f8ec46dd

Authored by “wangming”
1 parent 566cc104

111111111

antis-ncc-admin/src/views/departmentConsumePerformanceStatistics/index.vue
... ... @@ -47,7 +47,7 @@
47 47 <div class="table-container">
48 48 <el-table :data="tableData" v-loading="loading" element-loading-text="加载中..." :height="tableHeight"
49 49 border stripe style="width: 100%">
50   - <el-table-column prop="EmployeeName" label="员工姓名" width="120" fixed="left"></el-table-column>
  50 + <el-table-column prop="EmployeeName" label="员工姓名" 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 53 <el-table-column prop="TotalPerformance" label="总业绩" width="100" align="right">
... ... @@ -60,7 +60,17 @@
60 60 {{ formatMoney(scope.row.ConsumePerformance) }}
61 61 </template>
62 62 </el-table-column>
63   - <el-table-column prop="OrderCount" label="订单数量" width="100" align="right"></el-table-column>
  63 + <el-table-column prop="OrderCount" label="消耗项目数" width="100" align="right"></el-table-column>
  64 + <el-table-column prop="HeadCount" label="人头数" width="100" align="right">
  65 + <template slot-scope="scope">
  66 + {{ formatNumber(scope.row.HeadCount) }}
  67 + </template>
  68 + </el-table-column>
  69 + <el-table-column prop="PersonCount" label="人次" width="100" align="right">
  70 + <template slot-scope="scope">
  71 + {{ formatNumber(scope.row.PersonCount) }}
  72 + </template>
  73 + </el-table-column>
64 74 <el-table-column prop="CreateTime" label="创建时间" width="150" align="center">
65 75 <template slot-scope="scope">
66 76 {{ formatDateTime(scope.row.CreateTime) }}
... ... @@ -200,6 +210,21 @@ export default {
200 210 maximumFractionDigits: 2
201 211 })
202 212 },
  213 + formatNumber(value) {
  214 + if (value === null || value === undefined) return '0'
  215 + const num = Number(value)
  216 + if (num === 0) return '0'
  217 + if (num % 1 === 0) {
  218 + // 整数
  219 + return num.toLocaleString('zh-CN')
  220 + } else {
  221 + // 小数
  222 + return num.toLocaleString('zh-CN', {
  223 + minimumFractionDigits: 1,
  224 + maximumFractionDigits: 2
  225 + })
  226 + }
  227 + },
203 228 formatDateTime(value) {
204 229 if (!value) return '-'
205 230 return new Date(value).toLocaleString('zh-CN')
... ...
antis-ncc-admin/src/views/salaryStatistics/index.vue
... ... @@ -57,25 +57,25 @@
57 57 <el-table-column prop="StoreName" label="门店名称" width="120" fixed="left"></el-table-column>
58 58 <el-table-column prop="EmployeeName" label="员工姓名" width="100" fixed="left"></el-table-column>
59 59 <el-table-column prop="Position" label="岗位" width="100" fixed="left"></el-table-column>
60   - <el-table-column prop="GoldTriangleTeam" label="金三角战队" width="120"></el-table-column>
  60 + <el-table-column prop="GoldTriangleTeam" label="金三角战队" fixed="left" width="120"></el-table-column>
61 61  
62 62 <!-- 业绩相关 -->
63   - <el-table-column prop="TotalPerformance" label="总业绩" width="100" align="right">
  63 + <el-table-column prop="TotalPerformance" label="总业绩" width="100" align="center">
64 64 <template slot-scope="scope">
65 65 {{ formatMoney(scope.row.TotalPerformance) }}
66 66 </template>
67 67 </el-table-column>
68   - <el-table-column prop="BasePerformance" label="基础业绩" width="100" align="right">
  68 + <el-table-column prop="BasePerformance" label="基础业绩" width="100" align="center">
69 69 <template slot-scope="scope">
70 70 {{ formatMoney(scope.row.BasePerformance) }}
71 71 </template>
72 72 </el-table-column>
73   - <el-table-column prop="CooperationPerformance" label="合作业绩" width="100" align="right">
  73 + <el-table-column prop="CooperationPerformance" label="合作业绩" width="100" align="center">
74 74 <template slot-scope="scope">
75 75 {{ formatMoney(scope.row.CooperationPerformance) }}
76 76 </template>
77 77 </el-table-column>
78   - <el-table-column prop="RewardPerformance" label="奖励业绩" width="100" align="right">
  78 + <el-table-column prop="RewardPerformance" label="奖励业绩" width="100" align="center">
79 79 <template slot-scope="scope">
80 80 {{ formatMoney(scope.row.RewardPerformance) }}
81 81 </template>
... ... @@ -83,17 +83,17 @@
83 83  
84 84 <!-- 新客数据 -->
85 85 <el-table-column label="新客数据" align="center">
86   - <el-table-column prop="NewCustomerPerformance" label="新客业绩" width="100" align="right">
  86 + <el-table-column prop="NewCustomerPerformance" label="新客业绩" width="100" align="center">
87 87 <template slot-scope="scope">
88 88 {{ formatMoney(scope.row.NewCustomerPerformance) }}
89 89 </template>
90 90 </el-table-column>
91   - <el-table-column prop="NewCustomerConversionRate" label="新客成交率" width="100" align="right">
  91 + <el-table-column prop="NewCustomerConversionRate" label="新客成交率" width="100" align="center">
92 92 <template slot-scope="scope">
93 93 {{ formatPercent(scope.row.NewCustomerConversionRate) }}
94 94 </template>
95 95 </el-table-column>
96   - <el-table-column prop="NewCustomerPoint" label="新客提点" width="100" align="right">
  96 + <el-table-column prop="NewCustomerPoint" label="新客提点" width="100" align="center">
97 97 <template slot-scope="scope">
98 98 {{ formatPercent(scope.row.NewCustomerPoint) }}
99 99 </template>
... ... @@ -102,240 +102,242 @@
102 102  
103 103 <!-- 升单数据 -->
104 104 <el-table-column label="升单数据" align="center">
105   - <el-table-column prop="UpgradePerformance" label="升单业绩" width="100" align="right">
  105 + <el-table-column prop="UpgradePerformance" label="升单业绩" width="100" align="center">
106 106 <template slot-scope="scope">
107 107 {{ formatMoney(scope.row.UpgradePerformance) }}
108 108 </template>
109 109 </el-table-column>
110   - <el-table-column prop="UpgradePoint" label="升单提点" width="100" align="right">
  110 + <el-table-column prop="UpgradePoint" label="升单提点" width="100" align="center">
111 111 <template slot-scope="scope">
112 112 {{ formatPercent(scope.row.UpgradePoint) }}
113 113 </template>
114 114 </el-table-column>
115 115 </el-table-column>
116   -
117   - <!-- 其他数据 -->
118   - <el-table-column prop="Consumption" label="消耗" width="100" align="right">
119   - <template slot-scope="scope">
120   - {{ formatMoney(scope.row.Consumption) }}
121   - </template>
  116 + <!--消耗数据-->
  117 + <el-table-column label="消耗数据" align="center">
  118 + <el-table-column prop="Consumption" label="消耗业绩" width="100" align="center">
  119 + <template slot-scope="scope">
  120 + {{ formatMoney(scope.row.Consumption) }}
  121 + </template>
  122 + </el-table-column>
  123 + <el-table-column prop="ProjectCount" label="项目数" width="80" align="center"></el-table-column>
122 124 </el-table-column>
123   - <el-table-column prop="ProjectCount" label="项目数" width="80" align="right"></el-table-column>
124   - <el-table-column prop="StoreTotalPerformance" label="门店总业绩" width="120" align="right">
  125 + <!-- 其他数据 -->
  126 + <el-table-column prop="StoreTotalPerformance" label="门店总业绩" width="120" align="center">
125 127 <template slot-scope="scope">
126 128 {{ formatMoney(scope.row.StoreTotalPerformance) }}
127 129 </template>
128 130 </el-table-column>
129   - <el-table-column prop="TeamPerformance" label="队伍业绩" width="120" align="right">
  131 + <el-table-column prop="TeamPerformance" label="队伍业绩" width="120" align="center">
130 132 <template slot-scope="scope">
131 133 {{ formatMoney(scope.row.TeamPerformance) }}
132 134 </template>
133 135 </el-table-column>
134   - <el-table-column prop="Percentage" label="占比" width="100" align="right">
  136 + <el-table-column prop="Percentage" label="占比" width="100" align="center">
135 137 <template slot-scope="scope">
136 138 {{ formatPercent(scope.row.Percentage) }}
137 139 </template>
138 140 </el-table-column>
139   - <el-table-column prop="CustomerCount" label="到店人头" width="100" align="right"></el-table-column>
140   - <el-table-column prop="WorkingDays" label="在店天数" width="100" align="right"></el-table-column>
141   - <el-table-column prop="LeaveDays" label="请假天数" width="100" align="right"></el-table-column>
142   - <el-table-column prop="CommissionPoint" label="提点" width="100" align="right">
  141 + <el-table-column prop="CustomerCount" label="到店人头" width="100" align="center"></el-table-column>
  142 + <el-table-column prop="WorkingDays" label="在店天数" width="100" align="center"></el-table-column>
  143 + <el-table-column prop="LeaveDays" label="请假天数" width="100" align="center"></el-table-column>
  144 + <el-table-column prop="CommissionPoint" label="提点" width="100" align="center">
143 145 <template slot-scope="scope">
144 146 {{ formatPercent(scope.row.CommissionPoint) }}
145 147 </template>
146 148 </el-table-column>
147   - <el-table-column prop="BasePerformanceCommission" label="基础业绩提成" width="120" align="right">
  149 + <el-table-column prop="BasePerformanceCommission" label="基础业绩提成" width="120" align="center">
148 150 <template slot-scope="scope">
149 151 {{ formatMoney(scope.row.BasePerformanceCommission) }}
150 152 </template>
151 153 </el-table-column>
152   - <el-table-column prop="CooperationPerformanceCommission" label="合作业绩提成" width="120" align="right">
  154 + <el-table-column prop="CooperationPerformanceCommission" label="合作业绩提成" width="120" align="center">
153 155 <template slot-scope="scope">
154 156 {{ formatMoney(scope.row.CooperationPerformanceCommission) }}
155 157 </template>
156 158 </el-table-column>
157   - <el-table-column prop="ConsultantCommission" label="顾问提成" width="100" align="right">
  159 + <el-table-column prop="ConsultantCommission" label="顾问提成" width="100" align="center">
158 160 <template slot-scope="scope">
159 161 {{ formatMoney(scope.row.ConsultantCommission) }}
160 162 </template>
161 163 </el-table-column>
162   - <el-table-column prop="StoreTZoneCommission" label="门店T区提成" width="120" align="right">
  164 + <el-table-column prop="StoreTZoneCommission" label="门店T区提成" width="120" align="center">
163 165 <template slot-scope="scope">
164 166 {{ formatMoney(scope.row.StoreTZoneCommission) }}
165 167 </template>
166 168 </el-table-column>
167   - <el-table-column prop="TotalCommission" label="提成合计" width="120" align="right">
  169 + <el-table-column prop="TotalCommission" label="提成合计" width="120" align="center">
168 170 <template slot-scope="scope">
169 171 {{ formatMoney(scope.row.TotalCommission) }}
170 172 </template>
171 173 </el-table-column>
172   - <el-table-column prop="HealthCoachBaseSalary" label="健康师底薪" width="120" align="right">
  174 + <el-table-column prop="HealthCoachBaseSalary" label="健康师底薪" width="120" align="center">
173 175 <template slot-scope="scope">
174 176 {{ formatMoney(scope.row.HealthCoachBaseSalary) }}
175 177 </template>
176 178 </el-table-column>
177   - <el-table-column prop="HandworkFee" label="手工费" width="100" align="right">
  179 + <el-table-column prop="HandworkFee" label="手工费" width="100" align="center">
178 180 <template slot-scope="scope">
179 181 {{ formatMoney(scope.row.HandworkFee) }}
180 182 </template>
181 183 </el-table-column>
182   - <el-table-column prop="OutherHandworkFee" label="额外手工费" width="120" align="right">
  184 + <el-table-column prop="OutherHandworkFee" label="额外手工费" width="120" align="center">
183 185 <template slot-scope="scope">
184 186 {{ formatMoney(scope.row.OutherHandworkFee) }}
185 187 </template>
186 188 </el-table-column>
187   - <el-table-column prop="TransportationAllowance" label="车补" width="100" align="right">
  189 + <el-table-column prop="TransportationAllowance" label="车补" width="100" align="center">
188 190 <template slot-scope="scope">
189 191 {{ formatMoney(scope.row.TransportationAllowance) }}
190 192 </template>
191 193 </el-table-column>
192   - <el-table-column prop="LessRest" label="少休费" width="100" align="right">
  194 + <el-table-column prop="LessRest" label="少休费" width="100" align="center">
193 195 <template slot-scope="scope">
194 196 {{ formatMoney(scope.row.LessRest) }}
195 197 </template>
196 198 </el-table-column>
197   - <el-table-column prop="FullAttendance" label="全勤奖" width="100" align="right">
  199 + <el-table-column prop="FullAttendance" label="全勤奖" width="100" align="center">
198 200 <template slot-scope="scope">
199 201 {{ formatMoney(scope.row.FullAttendance) }}
200 202 </template>
201 203 </el-table-column>
202   - <el-table-column prop="CalculatedGrossSalary" label="核算应发工资" width="120" align="right">
  204 + <el-table-column prop="CalculatedGrossSalary" label="核算应发工资" width="120" align="center">
203 205 <template slot-scope="scope">
204 206 {{ formatMoney(scope.row.CalculatedGrossSalary) }}
205 207 </template>
206 208 </el-table-column>
207   - <el-table-column prop="GuaranteedSalary" label="保底工资" width="120" align="right">
  209 + <el-table-column prop="GuaranteedSalary" label="保底工资" width="120" align="center">
208 210 <template slot-scope="scope">
209 211 {{ formatMoney(scope.row.GuaranteedSalary) }}
210 212 </template>
211 213 </el-table-column>
212   - <el-table-column prop="GuaranteedLeaveDeduction" label="保底请假扣款" width="120" align="right">
  214 + <el-table-column prop="GuaranteedLeaveDeduction" label="保底请假扣款" width="120" align="center">
213 215 <template slot-scope="scope">
214 216 {{ formatMoney(scope.row.GuaranteedLeaveDeduction) }}
215 217 </template>
216 218 </el-table-column>
217   - <el-table-column prop="GuaranteedBaseSalary" label="保底底薪" width="120" align="right">
  219 + <el-table-column prop="GuaranteedBaseSalary" label="保底底薪" width="120" align="center">
218 220 <template slot-scope="scope">
219 221 {{ formatMoney(scope.row.GuaranteedBaseSalary) }}
220 222 </template>
221 223 </el-table-column>
222   - <el-table-column prop="GuaranteedSupplement" label="保底补差" width="120" align="right">
  224 + <el-table-column prop="GuaranteedSupplement" label="保底补差" width="120" align="center">
223 225 <template slot-scope="scope">
224 226 {{ formatMoney(scope.row.GuaranteedSupplement) }}
225 227 </template>
226 228 </el-table-column>
227   - <el-table-column prop="FinalGrossSalary" label="最终应发工资" width="120" align="right">
  229 + <el-table-column prop="FinalGrossSalary" label="最终应发工资" width="120" align="center">
228 230 <template slot-scope="scope">
229 231 {{ formatMoney(scope.row.FinalGrossSalary) }}
230 232 </template>
231 233 </el-table-column>
232   - <el-table-column prop="MonthlyTrainingSubsidy" label="当月培训补贴" width="120" align="right">
  234 + <el-table-column prop="MonthlyTrainingSubsidy" label="当月培训补贴" width="120" align="center">
233 235 <template slot-scope="scope">
234 236 {{ formatMoney(scope.row.MonthlyTrainingSubsidy) }}
235 237 </template>
236 238 </el-table-column>
237   - <el-table-column prop="MonthlyTransportSubsidy" label="当月交通补贴" width="120" align="right">
  239 + <el-table-column prop="MonthlyTransportSubsidy" label="当月交通补贴" width="120" align="center">
238 240 <template slot-scope="scope">
239 241 {{ formatMoney(scope.row.MonthlyTransportSubsidy) }}
240 242 </template>
241 243 </el-table-column>
242   - <el-table-column prop="LastMonthTrainingSubsidy" label="上月培训补贴" width="120" align="right">
  244 + <el-table-column prop="LastMonthTrainingSubsidy" label="上月培训补贴" width="120" align="center">
243 245 <template slot-scope="scope">
244 246 {{ formatMoney(scope.row.LastMonthTrainingSubsidy) }}
245 247 </template>
246 248 </el-table-column>
247   - <el-table-column prop="LastMonthTransportSubsidy" label="上月交通补贴" width="120" align="right">
  249 + <el-table-column prop="LastMonthTransportSubsidy" label="上月交通补贴" width="120" align="center">
248 250 <template slot-scope="scope">
249 251 {{ formatMoney(scope.row.LastMonthTransportSubsidy) }}
250 252 </template>
251 253 </el-table-column>
252   - <el-table-column prop="TotalSubsidy" label="补贴合计" width="120" align="right">
  254 + <el-table-column prop="TotalSubsidy" label="补贴合计" width="120" align="center">
253 255 <template slot-scope="scope">
254 256 {{ formatMoney(scope.row.TotalSubsidy) }}
255 257 </template>
256 258 </el-table-column>
257   - <el-table-column prop="MissingCard" label="缺卡扣款" width="120" align="right">
  259 + <el-table-column prop="MissingCard" label="缺卡扣款" width="120" align="center">
258 260 <template slot-scope="scope">
259 261 {{ formatMoney(scope.row.MissingCard) }}
260 262 </template>
261 263 </el-table-column>
262   - <el-table-column prop="LateArrival" label="迟到扣款" width="120" align="right">
  264 + <el-table-column prop="LateArrival" label="迟到扣款" width="120" align="center">
263 265 <template slot-scope="scope">
264 266 {{ formatMoney(scope.row.LateArrival) }}
265 267 </template>
266 268 </el-table-column>
267   - <el-table-column prop="LeaveDeduction" label="请假扣款" width="120" align="right">
  269 + <el-table-column prop="LeaveDeduction" label="请假扣款" width="120" align="center">
268 270 <template slot-scope="scope">
269 271 {{ formatMoney(scope.row.LeaveDeduction) }}
270 272 </template>
271 273 </el-table-column>
272   - <el-table-column prop="SocialInsuranceDeduction" label="扣社保" width="120" align="right">
  274 + <el-table-column prop="SocialInsuranceDeduction" label="扣社保" width="120" align="center">
273 275 <template slot-scope="scope">
274 276 {{ formatMoney(scope.row.SocialInsuranceDeduction) }}
275 277 </template>
276 278 </el-table-column>
277   - <el-table-column prop="RewardDeduction" label="扣除奖励" width="120" align="right">
  279 + <el-table-column prop="RewardDeduction" label="扣除奖励" width="120" align="center">
278 280 <template slot-scope="scope">
279 281 {{ formatMoney(scope.row.RewardDeduction) }}
280 282 </template>
281 283 </el-table-column>
282   - <el-table-column prop="AccommodationDeduction" label="扣住宿费" width="120" align="right">
  284 + <el-table-column prop="AccommodationDeduction" label="扣住宿费" width="120" align="center">
283 285 <template slot-scope="scope">
284 286 {{ formatMoney(scope.row.AccommodationDeduction) }}
285 287 </template>
286 288 </el-table-column>
287   - <el-table-column prop="StudyPeriodDeduction" label="扣学习期费用" width="120" align="right">
  289 + <el-table-column prop="StudyPeriodDeduction" label="扣学习期费用" width="120" align="center">
288 290 <template slot-scope="scope">
289 291 {{ formatMoney(scope.row.StudyPeriodDeduction) }}
290 292 </template>
291 293 </el-table-column>
292   - <el-table-column prop="WorkClothesDeduction" label="扣工作服费用" width="120" align="right">
  294 + <el-table-column prop="WorkClothesDeduction" label="扣工作服费用" width="120" align="center">
293 295 <template slot-scope="scope">
294 296 {{ formatMoney(scope.row.WorkClothesDeduction) }}
295 297 </template>
296 298 </el-table-column>
297   - <el-table-column prop="TotalDeduction" label="扣款合计" width="120" align="right">
  299 + <el-table-column prop="TotalDeduction" label="扣款合计" width="120" align="center">
298 300 <template slot-scope="scope">
299 301 {{ formatMoney(scope.row.TotalDeduction) }}
300 302 </template>
301 303 </el-table-column>
302   - <el-table-column prop="Bonus" label="发奖金" width="100" align="right">
  304 + <el-table-column prop="Bonus" label="发奖金" width="100" align="center">
303 305 <template slot-scope="scope">
304 306 {{ formatMoney(scope.row.Bonus) }}
305 307 </template>
306 308 </el-table-column>
307   - <el-table-column prop="ReturnPhoneDeposit" label="退手机押金" width="120" align="right">
  309 + <el-table-column prop="ReturnPhoneDeposit" label="退手机押金" width="120" align="center">
308 310 <template slot-scope="scope">
309 311 {{ formatMoney(scope.row.ReturnPhoneDeposit) }}
310 312 </template>
311 313 </el-table-column>
312   - <el-table-column prop="ReturnAccommodationDeposit" label="退住宿押金" width="120" align="right">
  314 + <el-table-column prop="ReturnAccommodationDeposit" label="退住宿押金" width="120" align="center">
313 315 <template slot-scope="scope">
314 316 {{ formatMoney(scope.row.ReturnAccommodationDeposit) }}
315 317 </template>
316 318 </el-table-column>
317   - <el-table-column prop="ActualSalary" label="实发工资" width="120" align="right">
  319 + <el-table-column prop="ActualSalary" label="实发工资" width="120" align="center">
318 320 <template slot-scope="scope">
319 321 {{ formatMoney(scope.row.ActualSalary) }}
320 322 </template>
321 323 </el-table-column>
322 324 <el-table-column prop="MonthlyPaymentStatus" label="当月是否发放" width="120" align="center"></el-table-column>
323   - <el-table-column prop="PaidAmount" label="支付金额" width="120" align="right">
  325 + <el-table-column prop="PaidAmount" label="支付金额" width="120" align="center">
324 326 <template slot-scope="scope">
325 327 {{ formatMoney(scope.row.PaidAmount) }}
326 328 </template>
327 329 </el-table-column>
328   - <el-table-column prop="PendingAmount" label="待支付金额" width="120" align="right">
  330 + <el-table-column prop="PendingAmount" label="待支付金额" width="120" align="center">
329 331 <template slot-scope="scope">
330 332 {{ formatMoney(scope.row.PendingAmount) }}
331 333 </template>
332 334 </el-table-column>
333   - <el-table-column prop="LastMonthSupplement" label="补发上月" width="120" align="right">
  335 + <el-table-column prop="LastMonthSupplement" label="补发上月" width="120" align="center">
334 336 <template slot-scope="scope">
335 337 {{ formatMoney(scope.row.LastMonthSupplement) }}
336 338 </template>
337 339 </el-table-column>
338   - <el-table-column prop="MonthlyTotalPayment" label="当月支付总额" width="120" align="right">
  340 + <el-table-column prop="MonthlyTotalPayment" label="当月支付总额" width="120" align="center">
339 341 <template slot-scope="scope">
340 342 {{ formatMoney(scope.row.MonthlyTotalPayment) }}
341 343 </template>
... ... @@ -368,7 +370,7 @@ export default {
368 370 return {
369 371 loading: false,
370 372 tableData: [],
371   - tableHeight: 500,
  373 + tableHeight: 890,
372 374 queryParams: {
373 375 statisticsMonth: '',
374 376 storeName: '',
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKhxx/LqKhxxListQueryInput.cs
... ... @@ -24,6 +24,11 @@ namespace NCC.Extend.Entitys.Dto.LqKhxx
24 24 public string id { get; set; }
25 25  
26 26 /// <summary>
  27 + /// 关键字
  28 + /// </summary>
  29 + public string keyWord { get; set; }
  30 +
  31 + /// <summary>
27 32 /// 客户名称
28 33 /// </summary>
29 34 public string khmc { get; set; }
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqSalaryStatistics/LqSalaryStatisticsListOutput.cs
... ... @@ -85,7 +85,7 @@ namespace NCC.Extend.Entitys.Dto.LqSalaryStatistics
85 85 /// <summary>
86 86 /// 项目数
87 87 /// </summary>
88   - public int ProjectCount { get; set; }
  88 + public decimal ProjectCount { get; set; }
89 89  
90 90 /// <summary>
91 91 /// 门店总业绩
... ... @@ -125,17 +125,18 @@ namespace NCC.Extend.Entitys.Dto.LqSalaryStatistics
125 125 /// <summary>
126 126 /// 到店人头
127 127 /// </summary>
128   - public int AttendanceDays { get; set; }
  128 + public decimal CustomerCount { get; set; }
129 129  
130 130 /// <summary>
131 131 /// 在店天数
132 132 /// </summary>
133   - public int StoreDays { get; set; }
  133 + public decimal WorkingDays { get; set; }
  134 +
134 135  
135 136 /// <summary>
136 137 /// 请假天数
137 138 /// </summary>
138   - public int LeaveDays { get; set; }
  139 + public decimal LeaveDays { get; set; }
139 140  
140 141 /// <summary>
141 142 /// 提点
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatistics/LqDepartmentConsumePerformanceStatisticsListOutput.cs
... ... @@ -55,7 +55,17 @@ namespace NCC.Extend.Entitys.Dto.LqStatistics
55 55 /// <summary>
56 56 /// 订单数量
57 57 /// </summary>
58   - public int OrderCount { get; set; }
  58 + public decimal OrderCount { get; set; }
  59 +
  60 + /// <summary>
  61 + /// 人头数(月度去重客户数)
  62 + /// </summary>
  63 + public decimal HeadCount { get; set; }
  64 +
  65 + /// <summary>
  66 + /// 人次(日度去重到店数)
  67 + /// </summary>
  68 + public decimal PersonCount { get; set; }
59 69  
60 70 /// <summary>
61 71 /// 创建时间
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_hytk_mx/LqHytkMxEntity.cs
... ... @@ -54,6 +54,13 @@ namespace NCC.Extend.Entitys.lq_hytk_mx
54 54 [SugarColumn(ColumnName = "tkje")]
55 55 public decimal? Tkje { get; set; }
56 56  
  57 +
  58 + /// <summary>
  59 + /// 退卡时间
  60 + /// </summary>
  61 + [SugarColumn(ColumnName = "tksj")]
  62 + public DateTime? Tksj { get; set; }
  63 +
57 64 /// <summary>
58 65 /// 项目次数
59 66 /// </summary>
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_kd_pxmx/LqKdPxmxEntity.cs
... ... @@ -41,6 +41,13 @@ namespace NCC.Extend.Entitys.lq_kd_pxmx
41 41 [SugarColumn(ColumnName = "pxjg")]
42 42 public decimal Pxjg { get; set; }
43 43  
  44 +
  45 + /// <summary>
  46 + /// 业绩时间
  47 + /// </summary>
  48 + [SugarColumn(ColumnName = "yjsj")]
  49 + public DateTime? Yjsj { get; set; }
  50 +
44 51 /// <summary>
45 52 /// 会员id
46 53 /// </summary>
... ... @@ -53,6 +60,9 @@ namespace NCC.Extend.Entitys.lq_kd_pxmx
53 60 [SugarColumn(ColumnName = "F_CreateTIme")]
54 61 public DateTime? CreateTIme { get; set; }
55 62  
  63 +
  64 +
  65 +
56 66 /// <summary>
57 67 /// 项目次数
58 68 /// </summary>
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_salary_statistics/LqSalaryStatisticsEntity.cs
... ... @@ -141,25 +141,25 @@ namespace NCC.Extend.Entitys.lq_salary_statistics
141 141 /// 项目数
142 142 /// </summary>
143 143 [SugarColumn(ColumnName = "F_ProjectCount")]
144   - public int ProjectCount { get; set; }
  144 + public decimal ProjectCount { get; set; }
145 145  
146 146 /// <summary>
147 147 /// 到店人头
148 148 /// </summary>
149 149 [SugarColumn(ColumnName = "F_CustomerCount")]
150   - public int CustomerCount { get; set; }
  150 + public decimal CustomerCount { get; set; }
151 151  
152 152 /// <summary>
153 153 /// 在店天数
154 154 /// </summary>
155 155 [SugarColumn(ColumnName = "F_WorkingDays")]
156   - public int WorkingDays { get; set; }
  156 + public decimal WorkingDays { get; set; }
157 157  
158 158 /// <summary>
159 159 /// 请假天数
160 160 /// </summary>
161 161 [SugarColumn(ColumnName = "F_LeaveDays")]
162   - public int LeaveDays { get; set; }
  162 + public decimal LeaveDays { get; set; }
163 163  
164 164 /// <summary>
165 165 /// 提点
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_statistics_department_consume_performance/LqStatisticsDepartmentConsumePerformanceEntity.cs
... ... @@ -100,5 +100,17 @@ namespace NCC.Extend.Entitys.lq_statistics_department_consume_performance
100 100 /// </summary>
101 101 [SugarColumn(ColumnName = "F_IsNewStore")]
102 102 public string IsNewStore { get; set; }
  103 +
  104 + /// <summary>
  105 + /// 人头数(月度去重客户数)
  106 + /// </summary>
  107 + [SugarColumn(ColumnName = "F_HeadCount")]
  108 + public decimal HeadCount { get; set; }
  109 +
  110 + /// <summary>
  111 + /// 人次(日度去重到店数)
  112 + /// </summary>
  113 + [SugarColumn(ColumnName = "F_PersonCount")]
  114 + public decimal PersonCount { get; set; }
103 115 }
104 116 }
... ...
netcore/src/Modularity/Extend/NCC.Extend/LqHytkHytkService.cs
... ... @@ -379,6 +379,7 @@ namespace NCC.Extend.LqHytkHytk
379 379 BillingItemId = item.billingItemId,
380 380 CreateTime = DateTime.Now,
381 381 CreateUser = userInfo.userId,
  382 + Tksj = input.tksj,
382 383 DeleteMark = 0,
383 384 Px = item.px,
384 385 Pxmc = item.pxmc,
... ... @@ -475,7 +476,7 @@ namespace NCC.Extend.LqHytkHytk
475 476  
476 477 #region 删除退卡信息
477 478 /// <summary>
478   - /// 删除退卡信息
  479 + /// 删除退卡信息(逻辑删除)
479 480 /// </summary>
480 481 /// <param name="id">主键</param>
481 482 /// <returns></returns>
... ... @@ -491,6 +492,79 @@ namespace NCC.Extend.LqHytkHytk
491 492 }
492 493 #endregion
493 494  
  495 + #region 物理删除退卡信息
  496 + /// <summary>
  497 + /// 物理删除退卡信息
  498 + /// </summary>
  499 + /// <remarks>
  500 + /// 彻底删除退卡记录及其所有关联数据,包括:
  501 + /// - 退卡主表记录
  502 + /// - 退卡品项明细记录
  503 + /// - 退卡健康师业绩记录
  504 + /// - 退卡科技部老师业绩记录
  505 + ///
  506 + /// 注意:此操作不可逆,请谨慎使用
  507 + /// </remarks>
  508 + /// <param name="id">退卡记录主键ID</param>
  509 + /// <returns>删除结果</returns>
  510 + /// <response code="200">删除成功</response>
  511 + /// <response code="404">退卡记录不存在</response>
  512 + /// <response code="500">服务器内部错误</response>
  513 + [HttpDelete("physical/{id}")]
  514 + public async Task<dynamic> PhysicalDelete(string id)
  515 + {
  516 + try
  517 + {
  518 + // 检查退卡记录是否存在
  519 + var entity = await _db.Queryable<LqHytkHytkEntity>().FirstAsync(p => p.Id == id);
  520 + if (entity == null)
  521 + {
  522 + throw NCCException.Oh("退卡记录不存在");
  523 + }
  524 +
  525 + // 开启事务
  526 + _db.BeginTran();
  527 +
  528 + // 1. 删除退卡品项明细记录
  529 + await _db.Deleteable<LqHytkMxEntity>()
  530 + .Where(x => x.RefundInfoId == id)
  531 + .ExecuteCommandAsync();
  532 +
  533 + // 2. 删除退卡健康师业绩记录
  534 + await _db.Deleteable<LqHytkJksyjEntity>()
  535 + .Where(x => x.Gltkbh == id)
  536 + .ExecuteCommandAsync();
  537 +
  538 + // 3. 删除退卡科技部老师业绩记录
  539 + await _db.Deleteable<LqHytkKjbsyjEntity>()
  540 + .Where(x => x.Gltkbh == id)
  541 + .ExecuteCommandAsync();
  542 +
  543 + // 4. 删除退卡主表记录
  544 + await _db.Deleteable<LqHytkHytkEntity>()
  545 + .Where(x => x.Id == id)
  546 + .ExecuteCommandAsync();
  547 +
  548 + // 提交事务
  549 + _db.CommitTran();
  550 +
  551 + return new
  552 + {
  553 + success = true,
  554 + message = "退卡记录已彻底删除",
  555 + deletedId = id,
  556 + deletedTime = DateTime.Now
  557 + };
  558 + }
  559 + catch (Exception ex)
  560 + {
  561 + // 回滚事务
  562 + _db.RollbackTran();
  563 + throw NCCException.Oh($"物理删除退卡记录失败: {ex.Message}");
  564 + }
  565 + }
  566 + #endregion
  567 +
494 568 #region 获取退卡信息详情
495 569 /// <summary>
496 570 /// 获取退卡信息详情
... ...
netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs
... ... @@ -292,6 +292,7 @@ namespace NCC.Extend.LqKdKdjlb
292 292 {
293 293 Id = YitIdHelper.NextId().ToString(),
294 294 Glkdbh = newEntity.Id,
  295 + Yjsj = input.kdrq,
295 296 CreateTIme = DateTime.Now,
296 297 MemberId = entity.Kdhy,
297 298 IsEnabled = 0,
... ...
netcore/src/Modularity/Extend/NCC.Extend/LqKhxxService.cs
... ... @@ -85,6 +85,7 @@ namespace NCC.Extend.LqKhxx
85 85 {
86 86 var sidx = input.sidx == null ? "id" : input.sidx;
87 87 var data = await _db.Queryable<LqKhxxEntity>()
  88 + .WhereIF(!string.IsNullOrEmpty(input.keyWord), p => p.Khmc.Contains(input.keyWord) || p.Sjh.Contains(input.keyWord) || p.Dah.Contains(input.keyWord))
88 89 .WhereIF(!string.IsNullOrEmpty(input.id), p => p.Id.Contains(input.id))
89 90 .WhereIF(!string.IsNullOrEmpty(input.khmc), p => p.Khmc.Contains(input.khmc))
90 91 .WhereIF(!string.IsNullOrEmpty(input.sjh), p => p.Sjh.Contains(input.sjh))
... ...
netcore/src/Modularity/Extend/NCC.Extend/LqStatisticsService.cs
... ... @@ -1413,72 +1413,135 @@ namespace NCC.Extend.LqStatistics
1413 1413  
1414 1414 try
1415 1415 {
1416   - // 使用数据库聚合方式,直接在数据库中完成所有统计计算
1417   - // 按照开单记录统计,避免重复计算
  1416 + // 使用子查询避免重复计算,按开单记录统计业绩
1418 1417 var sql = @"
1419 1418 SELECT
1420   - jksyj.jkszh AS EmployeeId,
1421   - u.F_REALNAME AS EmployeeName,
1422   - u.F_MDID AS StoreId,
1423   - COALESCE(md.dm, '') AS StoreName,
1424   - COALESCE(jsj.F_Id, '') AS GoldTriangleId,
1425   - COALESCE(jsj.jsj, '') AS GoldTriangleName,
1426   - CASE
1427   - WHEN jsjUser.is_leader = 1 THEN '顾问'
1428   - ELSE COALESCE(u.F_GW, '')
1429   - END AS Position,
1430   - COUNT(DISTINCT jksyj.glkdbh) AS OrderCount,
1431   - COUNT(DISTINCT CASE WHEN kd.sfskdd = '是' THEN jksyj.glkdbh END) AS FirstOrderCount,
1432   - COUNT(DISTINCT CASE WHEN kd.sfskdd = '否' THEN jksyj.glkdbh END) AS UpgradeOrderCount,
1433   - SUM(CASE WHEN kd.sfskdd = '是' THEN CAST(jksyj.jksyj AS DECIMAL(18,2)) ELSE 0 END) AS FirstOrderPerformance,
1434   - SUM(CASE WHEN kd.sfskdd = '否' THEN CAST(jksyj.jksyj AS DECIMAL(18,2)) ELSE 0 END) AS UpgradeOrderPerformance,
1435   - MAX(jksyj.yjsj) AS LastOrderDate,
1436   - MIN(jksyj.yjsj) AS FirstOrderDate,
1437   - SUM(
  1419 + order_stats.EmployeeId,
  1420 + order_stats.EmployeeName,
  1421 + order_stats.StoreId,
  1422 + order_stats.StoreName,
  1423 + order_stats.GoldTriangleId,
  1424 + order_stats.GoldTriangleName,
  1425 + order_stats.Position,
  1426 + order_stats.OrderCount,
  1427 + order_stats.FirstOrderCount,
  1428 + order_stats.UpgradeOrderCount,
  1429 + order_stats.FirstOrderPerformance,
  1430 + order_stats.UpgradeOrderPerformance,
  1431 + order_stats.LastOrderDate,
  1432 + order_stats.FirstOrderDate,
  1433 + COALESCE(coop_stats.CooperationPerformance, 0) AS CooperationPerformance,
  1434 + COALESCE(base_stats.BasePerformance, 0) AS BasePerformance,
  1435 + order_stats.TotalPerformance
  1436 + FROM (
  1437 + -- 按开单记录统计基础数据,避免重复计算
  1438 + SELECT
  1439 + order_summary.jkszh AS EmployeeId,
  1440 + u.F_REALNAME AS EmployeeName,
  1441 + u.F_MDID AS StoreId,
  1442 + COALESCE(md.dm, '') AS StoreName,
  1443 + COALESCE(jsjUser.F_Id, '') AS GoldTriangleId,
  1444 + COALESCE(jsjUser.jsj, '') AS GoldTriangleName,
1438 1445 CASE
1439   - WHEN xmzl.fl3 = '合作业绩' THEN CAST(jksyj.jksyj AS DECIMAL(18,2))
1440   - ELSE 0
1441   - END
1442   - ) AS CooperationPerformance,
1443   - SUM(
1444   - CASE
1445   - WHEN xmzl.fl3 IS NULL OR xmzl.fl3 != '合作业绩' THEN CAST(jksyj.jksyj AS DECIMAL(18,2))
1446   - ELSE 0
1447   - END
1448   - ) AS BasePerformance,
1449   - SUM(CAST(jksyj.jksyj AS DECIMAL(18,2))) AS TotalPerformance
1450   - FROM lq_kd_jksyj jksyj
1451   - INNER JOIN lq_kd_pxmx pxmx ON jksyj.F_kdpxid = pxmx.F_Id AND pxmx.F_IsEffective = 1
1452   - INNER JOIN lq_kd_kdjlb kd ON jksyj.glkdbh = kd.F_Id
1453   - INNER JOIN lq_xmzl xmzl ON pxmx.px = xmzl.F_Id
1454   - INNER JOIN BASE_USER u ON jksyj.jkszh = u.F_Id
1455   - LEFT JOIN lq_mdxx md ON u.F_MDID = md.F_Id
1456   - LEFT JOIN lq_ycsd_jsj jsj ON u.F_MDID = jsj.md AND jsj.yf = @statisticsMonth
  1446 + WHEN jsjUser.is_leader = 1 THEN '顾问'
  1447 + ELSE COALESCE(u.F_GW, '')
  1448 + END AS Position,
  1449 + COUNT(*) AS OrderCount,
  1450 + COUNT(CASE WHEN order_summary.sfskdd = '是' THEN 1 END) AS FirstOrderCount,
  1451 + COUNT(CASE WHEN order_summary.sfskdd = '否' THEN 1 END) AS UpgradeOrderCount,
  1452 + SUM(CASE WHEN order_summary.sfskdd = '是' THEN order_summary.order_performance ELSE 0 END) AS FirstOrderPerformance,
  1453 + SUM(CASE WHEN order_summary.sfskdd = '否' THEN order_summary.order_performance ELSE 0 END) AS UpgradeOrderPerformance,
  1454 + MAX(order_summary.yjsj) AS LastOrderDate,
  1455 + MIN(order_summary.yjsj) AS FirstOrderDate,
  1456 + SUM(order_summary.order_performance) AS TotalPerformance
  1457 + FROM (
  1458 + -- 先按开单记录汇总业绩,避免重复计算
  1459 + SELECT
  1460 + jksyj.jkszh,
  1461 + jksyj.glkdbh,
  1462 + kd.sfskdd,
  1463 + MAX(jksyj.yjsj) as yjsj,
  1464 + SUM(CAST(jksyj.jksyj AS DECIMAL(18,2))) as order_performance
  1465 + FROM lq_kd_jksyj jksyj
  1466 + INNER JOIN lq_kd_pxmx pxmx ON jksyj.F_kdpxid = pxmx.F_Id AND pxmx.F_IsEffective = 1
  1467 + INNER JOIN lq_kd_kdjlb kd ON jksyj.glkdbh = kd.F_Id
  1468 + WHERE jksyj.yjsj IS NOT NULL
  1469 + AND jksyj.jksyj IS NOT NULL
  1470 + AND jksyj.jksyj != ''
  1471 + AND jksyj.jksyj != '0'
  1472 + AND jksyj.F_kdpxid IS NOT NULL
  1473 + AND jksyj.F_kdpxid != ''
  1474 + AND jksyj.F_IsEffective = 1
  1475 + AND YEAR(jksyj.yjsj) = @year
  1476 + AND MONTH(jksyj.yjsj) = @month
  1477 + GROUP BY jksyj.jkszh, jksyj.glkdbh, kd.sfskdd
  1478 + ) order_summary
  1479 + INNER JOIN BASE_USER u ON order_summary.jkszh = u.F_Id
  1480 + LEFT JOIN lq_mdxx md ON u.F_MDID = md.F_Id
  1481 + LEFT JOIN (
  1482 + SELECT
  1483 + jsjUser.user_id,
  1484 + MIN(jsjUser.jsj_id) as F_Id,
  1485 + MIN(jsj.jsj) as jsj,
  1486 + MIN(jsjUser.is_leader) as is_leader
  1487 + FROM lq_jinsanjiao_user jsjUser
  1488 + INNER JOIN lq_ycsd_jsj jsj ON jsjUser.jsj_id COLLATE utf8mb4_general_ci = jsj.F_Id COLLATE utf8mb4_general_ci AND jsj.yf = @statisticsMonth
  1489 + WHERE jsjUser.F_Month = @statisticsMonth
  1490 + AND jsjUser.status = 'ACTIVE'
  1491 + AND jsjUser.F_DeleteMark = 0
  1492 + GROUP BY jsjUser.user_id
  1493 + ) jsjUser ON order_summary.jkszh = jsjUser.user_id
  1494 + GROUP BY
  1495 + order_summary.jkszh,
  1496 + u.F_REALNAME,
  1497 + u.F_MDID,
  1498 + md.dm,
  1499 + jsjUser.F_Id,
  1500 + jsjUser.jsj,
  1501 + jsjUser.is_leader,
  1502 + u.F_GW
  1503 + ) order_stats
1457 1504 LEFT JOIN (
1458   - SELECT DISTINCT user_id, F_Month, MAX(is_leader) as is_leader
1459   - FROM lq_jinsanjiao_user
1460   - WHERE F_Month = @statisticsMonth
1461   - GROUP BY user_id, F_Month
1462   - ) jsjUser ON jksyj.jkszh = jsjUser.user_id
1463   - WHERE jksyj.yjsj IS NOT NULL
1464   - AND jksyj.jksyj IS NOT NULL
1465   - AND jksyj.jksyj != ''
1466   - AND jksyj.jksyj != '0'
1467   - AND jksyj.F_kdpxid IS NOT NULL
1468   - AND jksyj.F_kdpxid != ''
1469   - AND jksyj.F_IsEffective = 1
1470   - AND YEAR(jksyj.yjsj) = @year
1471   - AND MONTH(jksyj.yjsj) = @month
1472   - GROUP BY
1473   - jksyj.jkszh,
1474   - u.F_REALNAME,
1475   - u.F_MDID,
1476   - md.dm,
1477   - jsj.F_Id,
1478   - jsj.jsj,
1479   - jsjUser.is_leader,
1480   - u.F_GW
1481   - ORDER BY TotalPerformance DESC";
  1505 + -- 合作业绩统计
  1506 + SELECT
  1507 + jksyj.jkszh AS EmployeeId,
  1508 + SUM(CAST(jksyj.jksyj AS DECIMAL(18,2))) AS CooperationPerformance
  1509 + FROM lq_kd_jksyj jksyj
  1510 + INNER JOIN lq_kd_pxmx pxmx ON jksyj.F_kdpxid = pxmx.F_Id AND pxmx.F_IsEffective = 1
  1511 + INNER JOIN lq_xmzl xmzl ON pxmx.px = xmzl.F_Id
  1512 + WHERE jksyj.yjsj IS NOT NULL
  1513 + AND jksyj.jksyj IS NOT NULL
  1514 + AND jksyj.jksyj != ''
  1515 + AND jksyj.jksyj != '0'
  1516 + AND jksyj.F_kdpxid IS NOT NULL
  1517 + AND jksyj.F_kdpxid != ''
  1518 + AND jksyj.F_IsEffective = 1
  1519 + AND YEAR(jksyj.yjsj) = @year
  1520 + AND MONTH(jksyj.yjsj) = @month
  1521 + AND xmzl.fl3 = '合作业绩'
  1522 + GROUP BY jksyj.jkszh
  1523 + ) coop_stats ON order_stats.EmployeeId = coop_stats.EmployeeId
  1524 + LEFT JOIN (
  1525 + -- 基础业绩统计
  1526 + SELECT
  1527 + jksyj.jkszh AS EmployeeId,
  1528 + SUM(CAST(jksyj.jksyj AS DECIMAL(18,2))) AS BasePerformance
  1529 + FROM lq_kd_jksyj jksyj
  1530 + INNER JOIN lq_kd_pxmx pxmx ON jksyj.F_kdpxid = pxmx.F_Id AND pxmx.F_IsEffective = 1
  1531 + LEFT JOIN lq_xmzl xmzl ON pxmx.px = xmzl.F_Id
  1532 + WHERE jksyj.yjsj IS NOT NULL
  1533 + AND jksyj.jksyj IS NOT NULL
  1534 + AND jksyj.jksyj != ''
  1535 + AND jksyj.jksyj != '0'
  1536 + AND jksyj.F_kdpxid IS NOT NULL
  1537 + AND jksyj.F_kdpxid != ''
  1538 + AND jksyj.F_IsEffective = 1
  1539 + AND YEAR(jksyj.yjsj) = @year
  1540 + AND MONTH(jksyj.yjsj) = @month
  1541 + AND (xmzl.fl3 IS NULL OR xmzl.fl3 != '合作业绩')
  1542 + GROUP BY jksyj.jkszh
  1543 + ) base_stats ON order_stats.EmployeeId = base_stats.EmployeeId
  1544 + ORDER BY order_stats.TotalPerformance DESC";
1482 1545  
1483 1546 // 解析统计月份
1484 1547 var year = int.Parse(statisticsMonth.Substring(0, 4));
... ... @@ -2139,13 +2202,39 @@ namespace NCC.Extend.LqStatistics
2139 2202 @statisticsMonth as F_StatisticsMonth,
2140 2203 COALESCE(SUM(jksyj.jksyj), 0) as F_ConsumePerformance,
2141 2204 COALESCE(SUM(jksyj.F_kdpxNumber), 0) as F_ConsumeQuantity,
2142   - COALESCE(SUM(jksyj.F_LaborCost), 0) as F_ManualFee
  2205 + COALESCE(SUM(jksyj.F_LaborCost), 0) as F_ManualFee,
  2206 + COALESCE(headcount_stats.F_HeadCount, 0) as F_HeadCount,
  2207 + COALESCE(personcount_stats.F_PersonCount, 0) as F_PersonCount
2143 2208 FROM lq_xh_jksyj jksyj
2144 2209 INNER JOIN lq_xh_hyhk hyhk ON jksyj.glkdbh = hyhk.F_Id AND hyhk.F_IsEffective = 1
2145 2210 LEFT JOIN lq_mdxx md ON hyhk.md = md.F_Id
  2211 + LEFT JOIN (
  2212 + -- 人头统计:月度去重客户数
  2213 + SELECT
  2214 + jksyj.jkszh,
  2215 + hyhk.md,
  2216 + COUNT(DISTINCT hyhk.hy) as F_HeadCount
  2217 + FROM lq_xh_jksyj jksyj
  2218 + INNER JOIN lq_xh_hyhk hyhk ON jksyj.glkdbh = hyhk.F_Id AND hyhk.F_IsEffective = 1
  2219 + WHERE jksyj.F_IsEffective = 1
  2220 + AND DATE_FORMAT(hyhk.hksj, '%Y%m') = @statisticsMonth
  2221 + GROUP BY jksyj.jkszh, hyhk.md
  2222 + ) headcount_stats ON jksyj.jkszh = headcount_stats.jkszh AND hyhk.md = headcount_stats.md
  2223 + LEFT JOIN (
  2224 + -- 人次统计:日度去重到店数
  2225 + SELECT
  2226 + jksyj.jkszh,
  2227 + hyhk.md,
  2228 + COUNT(DISTINCT DATE(hyhk.hksj)) as F_PersonCount
  2229 + FROM lq_xh_jksyj jksyj
  2230 + INNER JOIN lq_xh_hyhk hyhk ON jksyj.glkdbh = hyhk.F_Id AND hyhk.F_IsEffective = 1
  2231 + WHERE jksyj.F_IsEffective = 1
  2232 + AND DATE_FORMAT(hyhk.hksj, '%Y%m') = @statisticsMonth
  2233 + GROUP BY jksyj.jkszh, hyhk.md
  2234 + ) personcount_stats ON jksyj.jkszh = personcount_stats.jkszh AND hyhk.md = personcount_stats.md
2146 2235 WHERE jksyj.F_IsEffective = 1
2147 2236 AND DATE_FORMAT(hyhk.hksj, '%Y%m') = @statisticsMonth
2148   - GROUP BY jksyj.jkszh, jksyj.jksxm, hyhk.md, md.mdbm, md.dm";
  2237 + GROUP BY jksyj.jkszh, jksyj.jksxm, hyhk.md, md.mdbm, md.dm, headcount_stats.F_HeadCount, personcount_stats.F_PersonCount";
2149 2238  
2150 2239 var healthCoachData = await _db.Ado.SqlQueryAsync<dynamic>(healthCoachSql, new { statisticsMonth });
2151 2240 foreach (var item in healthCoachData)
... ... @@ -2196,6 +2285,8 @@ namespace NCC.Extend.LqStatistics
2196 2285 ConsumeQuantity = Convert.ToDecimal(item.F_ConsumeQuantity ?? 0),
2197 2286 ManualFee = Convert.ToDecimal(item.F_ManualFee ?? 0),
2198 2287 IsNewStore = isNewStore,
  2288 + HeadCount = Convert.ToDecimal(item.F_HeadCount ?? 0),
  2289 + PersonCount = Convert.ToDecimal(item.F_PersonCount ?? 0),
2199 2290 CreateTime = DateTime.Now
2200 2291 });
2201 2292 }
... ... @@ -2213,7 +2304,9 @@ namespace NCC.Extend.LqStatistics
2213 2304 @statisticsMonth as F_StatisticsMonth,
2214 2305 COALESCE(SUM(kjbsyj.kjblsyj), 0) as F_ConsumePerformance,
2215 2306 COALESCE(SUM(kjbsyj.F_hdpxNumber), 0) as F_ConsumeQuantity,
2216   - COALESCE(SUM(kjbsyj.F_LaborCost), 0) as F_ManualFee
  2307 + COALESCE(SUM(kjbsyj.F_LaborCost), 0) as F_ManualFee,
  2308 + 0 as F_HeadCount,
  2309 + 0 as F_PersonCount
2217 2310 FROM lq_xh_kjbsyj kjbsyj
2218 2311 INNER JOIN lq_xh_hyhk hyhk ON kjbsyj.glkdbh = hyhk.F_Id AND hyhk.F_IsEffective = 1
2219 2312 LEFT JOIN lq_mdxx md ON hyhk.md = md.F_Id
... ... @@ -2270,6 +2363,8 @@ namespace NCC.Extend.LqStatistics
2270 2363 ConsumeQuantity = Convert.ToDecimal(item.F_ConsumeQuantity ?? 0),
2271 2364 ManualFee = Convert.ToDecimal(item.F_ManualFee ?? 0),
2272 2365 IsNewStore = isNewStore,
  2366 + HeadCount = Convert.ToDecimal(item.F_HeadCount ?? 0),
  2367 + PersonCount = Convert.ToDecimal(item.F_PersonCount ?? 0),
2273 2368 CreateTime = DateTime.Now
2274 2369 });
2275 2370 }
... ... @@ -2408,24 +2503,47 @@ namespace NCC.Extend.LqStatistics
2408 2503 // 统计门店总业绩数据
2409 2504 var storePerformanceSql = @"
2410 2505 SELECT
2411   - kd.djmd as F_StoreId,
2412   - md.dm as F_StoreName,
2413   - @statisticsMonth as F_StatisticsMonth,
2414   - COALESCE(SUM(kd.zdyj), 0) as F_TotalPerformance,
2415   - COALESCE(SUM(kd.qk), 0) as F_DebtAmount,
2416   - COALESCE(SUM(kd.sfyj), 0) as F_TotalOrderPerformance,
2417   - COALESCE(SUM(kd.F_DeductAmount), 0) as F_StorageDeductionAmount,
2418   - COUNT(pxmx.F_Id) as F_ItemQuantity,
2419   - COUNT(DISTINCT CASE WHEN kd.sfskdd = '是' THEN kd.F_Id END) as F_FirstOrderCount,
2420   - COUNT(DISTINCT CASE WHEN kd.sfskdd = '否' THEN kd.F_Id END) as F_UpgradeOrderCount,
2421   - SUM(CASE WHEN kd.sfskdd = '是' THEN COALESCE(kd.zdyj, 0) ELSE 0 END) as F_FirstOrderPerformance,
2422   - SUM(CASE WHEN kd.sfskdd = '否' THEN COALESCE(kd.zdyj, 0) ELSE 0 END) as F_UpgradeOrderPerformance
2423   - FROM lq_kd_kdjlb kd
2424   - LEFT JOIN lq_mdxx md ON kd.djmd = md.F_Id
2425   - LEFT JOIN lq_kd_pxmx pxmx ON kd.F_Id = pxmx.glkdbh AND pxmx.F_IsEffective = 1
2426   - WHERE kd.F_IsEffective = 1
2427   - AND DATE_FORMAT(kd.kdrq, '%Y%m') = @statisticsMonth
2428   - GROUP BY kd.djmd, md.dm";
  2506 + store_data.F_StoreId,
  2507 + store_data.F_StoreName,
  2508 + store_data.F_StatisticsMonth,
  2509 + store_data.F_TotalPerformance,
  2510 + store_data.F_DebtAmount,
  2511 + store_data.F_TotalOrderPerformance,
  2512 + store_data.F_StorageDeductionAmount,
  2513 + COALESCE(item_data.F_ItemQuantity, 0) as F_ItemQuantity,
  2514 + store_data.F_FirstOrderCount,
  2515 + store_data.F_UpgradeOrderCount,
  2516 + store_data.F_FirstOrderPerformance,
  2517 + store_data.F_UpgradeOrderPerformance
  2518 + FROM (
  2519 + SELECT
  2520 + kd.djmd as F_StoreId,
  2521 + md.dm as F_StoreName,
  2522 + @statisticsMonth as F_StatisticsMonth,
  2523 + COALESCE(SUM(kd.zdyj), 0) as F_TotalPerformance,
  2524 + COALESCE(SUM(kd.qk), 0) as F_DebtAmount,
  2525 + COALESCE(SUM(kd.sfyj), 0) as F_TotalOrderPerformance,
  2526 + COALESCE(SUM(kd.F_DeductAmount), 0) as F_StorageDeductionAmount,
  2527 + COUNT(DISTINCT CASE WHEN kd.sfskdd = '是' THEN kd.F_Id END) as F_FirstOrderCount,
  2528 + COUNT(DISTINCT CASE WHEN kd.sfskdd = '否' THEN kd.F_Id END) as F_UpgradeOrderCount,
  2529 + SUM(CASE WHEN kd.sfskdd = '是' THEN COALESCE(kd.zdyj, 0) ELSE 0 END) as F_FirstOrderPerformance,
  2530 + SUM(CASE WHEN kd.sfskdd = '否' THEN COALESCE(kd.zdyj, 0) ELSE 0 END) as F_UpgradeOrderPerformance
  2531 + FROM lq_kd_kdjlb kd
  2532 + LEFT JOIN lq_mdxx md ON kd.djmd = md.F_Id
  2533 + WHERE kd.F_IsEffective = 1
  2534 + AND DATE_FORMAT(kd.kdrq, '%Y%m') = @statisticsMonth
  2535 + GROUP BY kd.djmd, md.dm
  2536 + ) store_data
  2537 + LEFT JOIN (
  2538 + SELECT
  2539 + kd.djmd as F_StoreId,
  2540 + COUNT(pxmx.F_ProjectNumber) as F_ItemQuantity
  2541 + FROM lq_kd_kdjlb kd
  2542 + LEFT JOIN lq_kd_pxmx pxmx ON kd.F_Id = pxmx.glkdbh AND pxmx.F_IsEffective = 1
  2543 + WHERE kd.F_IsEffective = 1
  2544 + AND DATE_FORMAT(kd.kdrq, '%Y%m') = @statisticsMonth
  2545 + GROUP BY kd.djmd
  2546 + ) item_data ON store_data.F_StoreId = item_data.F_StoreId";
2429 2547  
2430 2548 var storePerformanceData = await _db.Ado.SqlQueryAsync<dynamic>(storePerformanceSql, new { statisticsMonth });
2431 2549  
... ... @@ -2664,8 +2782,8 @@ namespace NCC.Extend.LqStatistics
2664 2782 UpgradePoint = x.UpgradePoint,
2665 2783 Consumption = x.Consumption,
2666 2784 ProjectCount = x.ProjectCount,
2667   - AttendanceDays = x.CustomerCount,
2668   - StoreDays = x.WorkingDays,
  2785 + CustomerCount = x.CustomerCount,
  2786 + WorkingDays = x.WorkingDays,
2669 2787 LeaveDays = x.LeaveDays,
2670 2788 CommissionPoint = x.CommissionPoint,
2671 2789 BasePerformanceCommission = x.BasePerformanceCommission,
... ... @@ -2809,7 +2927,6 @@ namespace NCC.Extend.LqStatistics
2809 2927 s.F_TotalPerformance = p.F_TotalPerformance,
2810 2928 s.F_BasePerformance = p.F_BasePerformance,
2811 2929 s.F_CooperationPerformance = p.F_CooperationPerformance,
2812   - s.F_ProjectCount = p.F_OrderCount,
2813 2930 s.F_NewCustomerPerformance = p.F_FirstOrderPerformance,
2814 2931 s.F_UpgradePerformance = p.F_UpgradeOrderPerformance
2815 2932 WHERE s.F_StatisticsMonth = @statisticsMonth";
... ... @@ -2827,7 +2944,7 @@ namespace NCC.Extend.LqStatistics
2827 2944 ON s.F_StoreId COLLATE utf8mb4_unicode_ci = st.F_StoreId COLLATE utf8mb4_unicode_ci
2828 2945 AND s.F_StatisticsMonth = st.F_StatisticsMonth
2829 2946 SET
2830   - s.F_StoreTotalPerformance = st.F_TotalPerformance
  2947 + s.F_StoreTotalPerformance = st.F_TotalOrderPerformance
2831 2948 WHERE s.F_StatisticsMonth = @statisticsMonth";
2832 2949  
2833 2950 await _db.Ado.ExecuteCommandAsync(storePerformanceSql, new
... ... @@ -2854,9 +2971,60 @@ namespace NCC.Extend.LqStatistics
2854 2971 userId = _userManager.UserId
2855 2972 });
2856 2973  
  2974 + // 从个人消耗业绩统计表更新消耗数据
  2975 + var consumePerformanceSql = @"
  2976 + UPDATE lq_salary_statistics s
  2977 + INNER JOIN lq_statistics_department_consume_performance cp
  2978 + ON s.F_EmployeeId COLLATE utf8mb4_general_ci = cp.F_UserId COLLATE utf8mb4_general_ci
  2979 + AND s.F_StatisticsMonth COLLATE utf8mb4_general_ci = cp.F_StatisticsMonth COLLATE utf8mb4_general_ci
  2980 + SET
  2981 + s.F_Consumption = cp.F_ConsumePerformance,
  2982 + s.F_ProjectCount = cp.F_ConsumeQuantity,
  2983 + s.F_HandworkFee = cp.F_ManualFee,
  2984 + s.F_CustomerCount = cp.F_HeadCount
  2985 + WHERE s.F_StatisticsMonth = @statisticsMonth";
  2986 +
  2987 + await _db.Ado.ExecuteCommandAsync(consumePerformanceSql, new
  2988 + {
  2989 + statisticsMonth,
  2990 + userId = _userManager.UserId
  2991 + });
  2992 +
  2993 + // 计算并更新底薪
  2994 + await CalculateAndUpdateBaseSalary(statisticsMonth);
  2995 +
2857 2996 _logger.LogInformation($"从其他统计表更新工资数据完成 - 月份: {statisticsMonth}");
2858 2997 }
2859 2998  
  2999 + /// <summary>
  3000 + /// 计算并更新健康师底薪
  3001 + /// </summary>
  3002 + private async Task CalculateAndUpdateBaseSalary(string statisticsMonth)
  3003 + {
  3004 + // 健康师底薪计算
  3005 + var healthCoachSalarySql = @"
  3006 + UPDATE lq_salary_statistics s
  3007 + SET s.F_HealthCoachBaseSalary = CASE
  3008 + -- 三星:月消耗达到40000元 且 项目数达到156个 → 底薪2400元
  3009 + WHEN s.F_Consumption >= 40000 AND s.F_ProjectCount >= 156 THEN 2400
  3010 + -- 二星:月消耗达到20000元 且 项目数达到126个 → 底薪2200元
  3011 + WHEN s.F_Consumption >= 20000 AND s.F_ProjectCount >= 126 THEN 2200
  3012 + -- 一星:月消耗达到10000元 或 项目数达到96个 → 底薪2000元
  3013 + WHEN s.F_Consumption >= 10000 OR s.F_ProjectCount >= 96 THEN 2000
  3014 + -- 0星:月消耗未达到10000元 且 项目数未达到96个 → 底薪1800元
  3015 + ELSE 1800
  3016 + END
  3017 + WHERE s.F_StatisticsMonth = @statisticsMonth
  3018 + AND s.F_Position = '健康师'";
  3019 +
  3020 + await _db.Ado.ExecuteCommandAsync(healthCoachSalarySql, new
  3021 + {
  3022 + statisticsMonth
  3023 + });
  3024 +
  3025 + _logger.LogInformation($"健康师底薪计算完成 - 月份: {statisticsMonth}");
  3026 + }
  3027 +
2860 3028 #endregion
2861 3029  
2862 3030 #region 其他统计模块列表查询接口
... ... @@ -3055,7 +3223,9 @@ namespace NCC.Extend.LqStatistics
3055 3223 Position = it.DepartmentType,
3056 3224 TotalPerformance = it.ConsumePerformance, // 使用ConsumePerformance作为总业绩
3057 3225 ConsumePerformance = it.ConsumePerformance,
3058   - OrderCount = (int)it.ConsumeQuantity, // 使用ConsumeQuantity作为订单数量
  3226 + OrderCount = it.ConsumeQuantity, // 使用ConsumeQuantity作为订单数量
  3227 + HeadCount = it.HeadCount, // 人头数
  3228 + PersonCount = it.PersonCount, // 人次
3059 3229 CreateTime = it.CreateTime.HasValue ? it.CreateTime.Value : DateTime.Now
3060 3230 }).ToList();
3061 3231  
... ...
netcore/src/Modularity/Extend/NCC.Extend/LqXhHyhkService.cs
... ... @@ -346,18 +346,7 @@ namespace NCC.Extend.LqXhHyhk
346 346 // 批量插入品项明细
347 347 if (allPxmxEntities.Any())
348 348 {
349   - // 分别处理插入和更新
350   - var existingEntities = allPxmxEntities.Where(e => !string.IsNullOrEmpty(e.Id)).ToList();
351   - var newEntities = allPxmxEntities.Where(e => string.IsNullOrEmpty(e.Id)).ToList();
352   -
353   - if (existingEntities.Any())
354   - {
355   - await _db.Updateable(existingEntities).ExecuteCommandAsync();
356   - }
357   - if (newEntities.Any())
358   - {
359   - await _db.Insertable(newEntities).ExecuteCommandAsync();
360   - }
  349 + await _db.Insertable(allPxmxEntities).ExecuteCommandAsync();
361 350 }
362 351 // 批量插入健康师业绩
363 352 if (allJksyjEntities.Any())
... ...