Commit 1c95eff1ebffb1ac25bdfc219b34980644110ec7
1 parent
b36af804
更新工资相关服务类和DTO类
- 更新工资服务类和相关DTO输出类 - 涉及店助、总监、事业部经理、大项目总监、大项目老师、健康师、门店、技术总经理、科学老师等工资相关服务
Showing
18 changed files
with
176 additions
and
39 deletions
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqAssistantSalary/AssistantSalaryOutput.cs
| @@ -188,6 +188,11 @@ namespace NCC.Extend.Entitys.Dto.LqAssistantSalary | @@ -188,6 +188,11 @@ namespace NCC.Extend.Entitys.Dto.LqAssistantSalary | ||
| 188 | public int IsLocked { get; set; } | 188 | public int IsLocked { get; set; } |
| 189 | 189 | ||
| 190 | /// <summary> | 190 | /// <summary> |
| 191 | + /// 员工确认状态(0=未确认,1=已确认) | ||
| 192 | + /// </summary> | ||
| 193 | + public int EmployeeConfirmStatus { get; set; } | ||
| 194 | + | ||
| 195 | + /// <summary> | ||
| 191 | /// 更新时间 | 196 | /// 更新时间 |
| 192 | /// </summary> | 197 | /// </summary> |
| 193 | public DateTime UpdateTime { get; set; } | 198 | public DateTime UpdateTime { get; set; } |
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqBusinessUnitManagerSalary/BusinessUnitManagerSalaryOutput.cs
| @@ -233,6 +233,11 @@ namespace NCC.Extend.Entitys.Dto.LqBusinessUnitManagerSalary | @@ -233,6 +233,11 @@ namespace NCC.Extend.Entitys.Dto.LqBusinessUnitManagerSalary | ||
| 233 | public int IsLocked { get; set; } | 233 | public int IsLocked { get; set; } |
| 234 | 234 | ||
| 235 | /// <summary> | 235 | /// <summary> |
| 236 | + /// 员工确认状态(0=未确认,1=已确认) | ||
| 237 | + /// </summary> | ||
| 238 | + public int EmployeeConfirmStatus { get; set; } | ||
| 239 | + | ||
| 240 | + /// <summary> | ||
| 236 | /// 更新时间 | 241 | /// 更新时间 |
| 237 | /// </summary> | 242 | /// </summary> |
| 238 | public DateTime UpdateTime { get; set; } | 243 | public DateTime UpdateTime { get; set; } |
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqDirectorSalary/DirectorSalaryOutput.cs
| @@ -208,6 +208,11 @@ namespace NCC.Extend.Entitys.Dto.LqDirectorSalary | @@ -208,6 +208,11 @@ namespace NCC.Extend.Entitys.Dto.LqDirectorSalary | ||
| 208 | public int IsLocked { get; set; } | 208 | public int IsLocked { get; set; } |
| 209 | 209 | ||
| 210 | /// <summary> | 210 | /// <summary> |
| 211 | + /// 员工确认状态(0=未确认,1=已确认) | ||
| 212 | + /// </summary> | ||
| 213 | + public int EmployeeConfirmStatus { get; set; } | ||
| 214 | + | ||
| 215 | + /// <summary> | ||
| 211 | /// 更新时间 | 216 | /// 更新时间 |
| 212 | /// </summary> | 217 | /// </summary> |
| 213 | public DateTime UpdateTime { get; set; } | 218 | public DateTime UpdateTime { get; set; } |
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqMajorProjectDirectorSalary/MajorProjectDirectorSalaryOutput.cs
| @@ -218,6 +218,11 @@ namespace NCC.Extend.Entitys.Dto.LqMajorProjectDirectorSalary | @@ -218,6 +218,11 @@ namespace NCC.Extend.Entitys.Dto.LqMajorProjectDirectorSalary | ||
| 218 | public int IsLocked { get; set; } | 218 | public int IsLocked { get; set; } |
| 219 | 219 | ||
| 220 | /// <summary> | 220 | /// <summary> |
| 221 | + /// 员工确认状态(0=未确认,1=已确认) | ||
| 222 | + /// </summary> | ||
| 223 | + public int EmployeeConfirmStatus { get; set; } | ||
| 224 | + | ||
| 225 | + /// <summary> | ||
| 221 | /// 更新时间 | 226 | /// 更新时间 |
| 222 | /// </summary> | 227 | /// </summary> |
| 223 | public DateTime UpdateTime { get; set; } | 228 | public DateTime UpdateTime { get; set; } |
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqMajorProjectTeacherSalary/MajorProjectTeacherSalaryOutput.cs
| @@ -268,6 +268,11 @@ namespace NCC.Extend.Entitys.Dto.LqMajorProjectTeacherSalary | @@ -268,6 +268,11 @@ namespace NCC.Extend.Entitys.Dto.LqMajorProjectTeacherSalary | ||
| 268 | public int IsLocked { get; set; } | 268 | public int IsLocked { get; set; } |
| 269 | 269 | ||
| 270 | /// <summary> | 270 | /// <summary> |
| 271 | + /// 员工确认状态(0=未确认,1=已确认) | ||
| 272 | + /// </summary> | ||
| 273 | + public int EmployeeConfirmStatus { get; set; } | ||
| 274 | + | ||
| 275 | + /// <summary> | ||
| 271 | /// 是否离职 | 276 | /// 是否离职 |
| 272 | /// </summary> | 277 | /// </summary> |
| 273 | public int IsTerminated { get; set; } | 278 | public int IsTerminated { get; set; } |
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqSalary/HealthCoachSalaryOutput.cs
| @@ -108,6 +108,11 @@ namespace NCC.Extend.Entitys.Dto.LqSalary | @@ -108,6 +108,11 @@ namespace NCC.Extend.Entitys.Dto.LqSalary | ||
| 108 | public int IsLocked { get; set; } | 108 | public int IsLocked { get; set; } |
| 109 | 109 | ||
| 110 | /// <summary> | 110 | /// <summary> |
| 111 | + /// 员工确认状态(0=未确认,1=已确认) | ||
| 112 | + /// </summary> | ||
| 113 | + public int EmployeeConfirmStatus { get; set; } | ||
| 114 | + | ||
| 115 | + /// <summary> | ||
| 111 | /// 更新时间 | 116 | /// 更新时间 |
| 112 | /// </summary> | 117 | /// </summary> |
| 113 | public DateTime UpdateTime { get; set; } | 118 | public DateTime UpdateTime { get; set; } |
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStoreManagerSalary/StoreManagerSalaryOutput.cs
| @@ -208,6 +208,11 @@ namespace NCC.Extend.Entitys.Dto.LqStoreManagerSalary | @@ -208,6 +208,11 @@ namespace NCC.Extend.Entitys.Dto.LqStoreManagerSalary | ||
| 208 | public int IsLocked { get; set; } | 208 | public int IsLocked { get; set; } |
| 209 | 209 | ||
| 210 | /// <summary> | 210 | /// <summary> |
| 211 | + /// 员工确认状态(0=未确认,1=已确认) | ||
| 212 | + /// </summary> | ||
| 213 | + public int EmployeeConfirmStatus { get; set; } | ||
| 214 | + | ||
| 215 | + /// <summary> | ||
| 211 | /// 门店类型 | 216 | /// 门店类型 |
| 212 | /// </summary> | 217 | /// </summary> |
| 213 | public int? StoreType { get; set; } | 218 | public int? StoreType { get; set; } |
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqTechGeneralManagerSalary/TechGeneralManagerSalaryOutput.cs
| @@ -228,6 +228,11 @@ namespace NCC.Extend.Entitys.Dto.LqTechGeneralManagerSalary | @@ -228,6 +228,11 @@ namespace NCC.Extend.Entitys.Dto.LqTechGeneralManagerSalary | ||
| 228 | public int IsLocked { get; set; } | 228 | public int IsLocked { get; set; } |
| 229 | 229 | ||
| 230 | /// <summary> | 230 | /// <summary> |
| 231 | + /// 员工确认状态(0=未确认,1=已确认) | ||
| 232 | + /// </summary> | ||
| 233 | + public int EmployeeConfirmStatus { get; set; } | ||
| 234 | + | ||
| 235 | + /// <summary> | ||
| 231 | /// 更新时间 | 236 | /// 更新时间 |
| 232 | /// </summary> | 237 | /// </summary> |
| 233 | public DateTime UpdateTime { get; set; } | 238 | public DateTime UpdateTime { get; set; } |
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqTechTeacherSalary/TechTeacherSalaryOutput.cs
| @@ -288,6 +288,11 @@ namespace NCC.Extend.Entitys.Dto.LqTechTeacherSalary | @@ -288,6 +288,11 @@ namespace NCC.Extend.Entitys.Dto.LqTechTeacherSalary | ||
| 288 | public int IsLocked { get; set; } | 288 | public int IsLocked { get; set; } |
| 289 | 289 | ||
| 290 | /// <summary> | 290 | /// <summary> |
| 291 | + /// 员工确认状态(0=未确认,1=已确认) | ||
| 292 | + /// </summary> | ||
| 293 | + public int EmployeeConfirmStatus { get; set; } | ||
| 294 | + | ||
| 295 | + /// <summary> | ||
| 291 | /// 是否离职 | 296 | /// 是否离职 |
| 292 | /// </summary> | 297 | /// </summary> |
| 293 | public int IsTerminated { get; set; } | 298 | public int IsTerminated { get; set; } |
netcore/src/Modularity/Extend/NCC.Extend/LqAssistantSalaryService.cs
| @@ -111,6 +111,7 @@ namespace NCC.Extend | @@ -111,6 +111,7 @@ namespace NCC.Extend | ||
| 111 | LastMonthSupplement = x.LastMonthSupplement, | 111 | LastMonthSupplement = x.LastMonthSupplement, |
| 112 | MonthlyTotalPayment = x.MonthlyTotalPayment, | 112 | MonthlyTotalPayment = x.MonthlyTotalPayment, |
| 113 | IsLocked = x.IsLocked, | 113 | IsLocked = x.IsLocked, |
| 114 | + EmployeeConfirmStatus = x.EmployeeConfirmStatus, | ||
| 114 | UpdateTime = x.UpdateTime, | 115 | UpdateTime = x.UpdateTime, |
| 115 | StoreType = x.StoreType, | 116 | StoreType = x.StoreType, |
| 116 | StoreCategory = x.StoreCategory, | 117 | StoreCategory = x.StoreCategory, |
| @@ -123,7 +124,7 @@ namespace NCC.Extend | @@ -123,7 +124,7 @@ namespace NCC.Extend | ||
| 123 | } | 124 | } |
| 124 | 125 | ||
| 125 | /// <summary> | 126 | /// <summary> |
| 126 | - /// 通过月份和员工ID查询工资 | 127 | + /// 通过月份和员工ID查询工资(仅查询已锁定的工资) |
| 127 | /// </summary> | 128 | /// </summary> |
| 128 | [HttpGet("query-by-employee")] | 129 | [HttpGet("query-by-employee")] |
| 129 | public async Task<AssistantSalaryOutput> GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) | 130 | public async Task<AssistantSalaryOutput> GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) |
| @@ -134,7 +135,7 @@ namespace NCC.Extend | @@ -134,7 +135,7 @@ namespace NCC.Extend | ||
| 134 | throw NCCException.Oh("员工ID不能为空"); | 135 | throw NCCException.Oh("员工ID不能为空"); |
| 135 | var monthStr = $"{input.Year}{input.Month:D2}"; | 136 | var monthStr = $"{input.Year}{input.Month:D2}"; |
| 136 | var salary = await _db.Queryable<LqAssistantSalaryStatisticsEntity>() | 137 | var salary = await _db.Queryable<LqAssistantSalaryStatisticsEntity>() |
| 137 | - .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId) | 138 | + .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId && x.IsLocked == 1) |
| 138 | .Select(x => new AssistantSalaryOutput | 139 | .Select(x => new AssistantSalaryOutput |
| 139 | { | 140 | { |
| 140 | Id = x.Id, | 141 | Id = x.Id, |
| @@ -173,6 +174,7 @@ namespace NCC.Extend | @@ -173,6 +174,7 @@ namespace NCC.Extend | ||
| 173 | LastMonthSupplement = x.LastMonthSupplement, | 174 | LastMonthSupplement = x.LastMonthSupplement, |
| 174 | MonthlyTotalPayment = x.MonthlyTotalPayment, | 175 | MonthlyTotalPayment = x.MonthlyTotalPayment, |
| 175 | IsLocked = x.IsLocked, | 176 | IsLocked = x.IsLocked, |
| 177 | + EmployeeConfirmStatus = x.EmployeeConfirmStatus, | ||
| 176 | UpdateTime = x.UpdateTime, | 178 | UpdateTime = x.UpdateTime, |
| 177 | StoreType = x.StoreType, | 179 | StoreType = x.StoreType, |
| 178 | StoreCategory = x.StoreCategory, | 180 | StoreCategory = x.StoreCategory, |
| @@ -1071,7 +1073,9 @@ namespace NCC.Extend | @@ -1071,7 +1073,9 @@ namespace NCC.Extend | ||
| 1071 | return int.TryParse(cleaned, out int result) ? result : 0; | 1073 | return int.TryParse(cleaned, out int result) ? result : 0; |
| 1072 | }; | 1074 | }; |
| 1073 | 1075 | ||
| 1074 | - for (int i = 1; i < dataTable.Rows.Count; i++) | 1076 | + // ExcelImportHelper.ToDataTable(filePath, 0, 0)会将第一行作为标题行,数据从第二行开始 |
| 1077 | + // 所以DataTable.Rows[0]是Excel的第一条数据行,应该从i=0开始循环 | ||
| 1078 | + for (int i = 0; i < dataTable.Rows.Count; i++) | ||
| 1075 | { | 1079 | { |
| 1076 | try | 1080 | try |
| 1077 | { | 1081 | { |
| @@ -1248,7 +1252,14 @@ namespace NCC.Extend | @@ -1248,7 +1252,14 @@ namespace NCC.Extend | ||
| 1248 | } | 1252 | } |
| 1249 | 1253 | ||
| 1250 | if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); | 1254 | if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); |
| 1251 | - if (recordsToUpdate.Any()) await _db.Updateable(recordsToUpdate).ExecuteCommandAsync(); | 1255 | + if (recordsToUpdate.Any()) |
| 1256 | + { | ||
| 1257 | + // 使用IgnoreColumns排除CreateTime和CreateUser,确保其他所有字段都被更新 | ||
| 1258 | + await _db.Updateable(recordsToUpdate) | ||
| 1259 | + .IgnoreColumns(x => x.CreateTime) | ||
| 1260 | + .IgnoreColumns(x => x.CreateUser) | ||
| 1261 | + .ExecuteCommandAsync(); | ||
| 1262 | + } | ||
| 1252 | 1263 | ||
| 1253 | return new | 1264 | return new |
| 1254 | { | 1265 | { |
netcore/src/Modularity/Extend/NCC.Extend/LqBusinessUnitManagerSalaryService.cs
| @@ -123,6 +123,7 @@ namespace NCC.Extend | @@ -123,6 +123,7 @@ namespace NCC.Extend | ||
| 123 | LastMonthSupplement = x.LastMonthSupplement, | 123 | LastMonthSupplement = x.LastMonthSupplement, |
| 124 | MonthlyTotalPayment = x.MonthlyTotalPayment, | 124 | MonthlyTotalPayment = x.MonthlyTotalPayment, |
| 125 | IsLocked = x.IsLocked, | 125 | IsLocked = x.IsLocked, |
| 126 | + EmployeeConfirmStatus = x.EmployeeConfirmStatus, | ||
| 126 | UpdateTime = x.UpdateTime | 127 | UpdateTime = x.UpdateTime |
| 127 | }) | 128 | }) |
| 128 | .ToPagedListAsync(input.currentPage, input.pageSize); | 129 | .ToPagedListAsync(input.currentPage, input.pageSize); |
| @@ -131,7 +132,7 @@ namespace NCC.Extend | @@ -131,7 +132,7 @@ namespace NCC.Extend | ||
| 131 | } | 132 | } |
| 132 | 133 | ||
| 133 | /// <summary> | 134 | /// <summary> |
| 134 | - /// 通过月份和员工ID查询工资 | 135 | + /// 通过月份和员工ID查询工资(仅查询已锁定的工资) |
| 135 | /// </summary> | 136 | /// </summary> |
| 136 | [HttpGet("query-by-employee")] | 137 | [HttpGet("query-by-employee")] |
| 137 | public async Task<BusinessUnitManagerSalaryOutput> GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) | 138 | public async Task<BusinessUnitManagerSalaryOutput> GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) |
| @@ -142,7 +143,7 @@ namespace NCC.Extend | @@ -142,7 +143,7 @@ namespace NCC.Extend | ||
| 142 | throw NCCException.Oh("员工ID不能为空"); | 143 | throw NCCException.Oh("员工ID不能为空"); |
| 143 | var monthStr = $"{input.Year}{input.Month:D2}"; | 144 | var monthStr = $"{input.Year}{input.Month:D2}"; |
| 144 | var salary = await _db.Queryable<LqBusinessUnitManagerSalaryStatisticsEntity>() | 145 | var salary = await _db.Queryable<LqBusinessUnitManagerSalaryStatisticsEntity>() |
| 145 | - .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId) | 146 | + .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId && x.IsLocked == 1) |
| 146 | .Select(x => new BusinessUnitManagerSalaryOutput | 147 | .Select(x => new BusinessUnitManagerSalaryOutput |
| 147 | { | 148 | { |
| 148 | Id = x.Id, | 149 | Id = x.Id, |
| @@ -190,6 +191,7 @@ namespace NCC.Extend | @@ -190,6 +191,7 @@ namespace NCC.Extend | ||
| 190 | LastMonthSupplement = x.LastMonthSupplement, | 191 | LastMonthSupplement = x.LastMonthSupplement, |
| 191 | MonthlyTotalPayment = x.MonthlyTotalPayment, | 192 | MonthlyTotalPayment = x.MonthlyTotalPayment, |
| 192 | IsLocked = x.IsLocked, | 193 | IsLocked = x.IsLocked, |
| 194 | + EmployeeConfirmStatus = x.EmployeeConfirmStatus, | ||
| 193 | UpdateTime = x.UpdateTime | 195 | UpdateTime = x.UpdateTime |
| 194 | }) | 196 | }) |
| 195 | .FirstAsync(); | 197 | .FirstAsync(); |
| @@ -952,7 +954,9 @@ namespace NCC.Extend | @@ -952,7 +954,9 @@ namespace NCC.Extend | ||
| 952 | return int.TryParse(cleaned, out int result) ? result : 0; | 954 | return int.TryParse(cleaned, out int result) ? result : 0; |
| 953 | }; | 955 | }; |
| 954 | 956 | ||
| 955 | - for (int i = 1; i < dataTable.Rows.Count; i++) | 957 | + // ExcelImportHelper.ToDataTable(filePath, 0, 0)会将第一行作为标题行,数据从第二行开始 |
| 958 | + // 所以DataTable.Rows[0]是Excel的第一条数据行,应该从i=0开始循环 | ||
| 959 | + for (int i = 0; i < dataTable.Rows.Count; i++) | ||
| 956 | { | 960 | { |
| 957 | try | 961 | try |
| 958 | { | 962 | { |
| @@ -1082,7 +1086,14 @@ namespace NCC.Extend | @@ -1082,7 +1086,14 @@ namespace NCC.Extend | ||
| 1082 | } | 1086 | } |
| 1083 | 1087 | ||
| 1084 | if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); | 1088 | if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); |
| 1085 | - if (recordsToUpdate.Any()) await _db.Updateable(recordsToUpdate).ExecuteCommandAsync(); | 1089 | + if (recordsToUpdate.Any()) |
| 1090 | + { | ||
| 1091 | + // 使用IgnoreColumns排除CreateTime和CreateUser,确保其他所有字段都被更新 | ||
| 1092 | + await _db.Updateable(recordsToUpdate) | ||
| 1093 | + .IgnoreColumns(x => x.CreateTime) | ||
| 1094 | + .IgnoreColumns(x => x.CreateUser) | ||
| 1095 | + .ExecuteCommandAsync(); | ||
| 1096 | + } | ||
| 1086 | 1097 | ||
| 1087 | return new | 1098 | return new |
| 1088 | { | 1099 | { |
netcore/src/Modularity/Extend/NCC.Extend/LqDirectorSalaryService.cs
| @@ -119,6 +119,7 @@ namespace NCC.Extend | @@ -119,6 +119,7 @@ namespace NCC.Extend | ||
| 119 | LastMonthSupplement = x.LastMonthSupplement, | 119 | LastMonthSupplement = x.LastMonthSupplement, |
| 120 | MonthlyTotalPayment = x.MonthlyTotalPayment, | 120 | MonthlyTotalPayment = x.MonthlyTotalPayment, |
| 121 | IsLocked = x.IsLocked, | 121 | IsLocked = x.IsLocked, |
| 122 | + EmployeeConfirmStatus = x.EmployeeConfirmStatus, | ||
| 122 | UpdateTime = x.UpdateTime, | 123 | UpdateTime = x.UpdateTime, |
| 123 | StoreType = x.StoreType, | 124 | StoreType = x.StoreType, |
| 124 | StoreCategory = x.StoreCategory, | 125 | StoreCategory = x.StoreCategory, |
| @@ -131,7 +132,7 @@ namespace NCC.Extend | @@ -131,7 +132,7 @@ namespace NCC.Extend | ||
| 131 | } | 132 | } |
| 132 | 133 | ||
| 133 | /// <summary> | 134 | /// <summary> |
| 134 | - /// 通过月份和员工ID查询工资 | 135 | + /// 通过月份和员工ID查询工资(仅查询已锁定的工资) |
| 135 | /// </summary> | 136 | /// </summary> |
| 136 | [HttpGet("query-by-employee")] | 137 | [HttpGet("query-by-employee")] |
| 137 | public async Task<DirectorSalaryOutput> GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) | 138 | public async Task<DirectorSalaryOutput> GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) |
| @@ -142,7 +143,7 @@ namespace NCC.Extend | @@ -142,7 +143,7 @@ namespace NCC.Extend | ||
| 142 | throw NCCException.Oh("员工ID不能为空"); | 143 | throw NCCException.Oh("员工ID不能为空"); |
| 143 | var monthStr = $"{input.Year}{input.Month:D2}"; | 144 | var monthStr = $"{input.Year}{input.Month:D2}"; |
| 144 | var salary = await _db.Queryable<LqDirectorSalaryStatisticsEntity>() | 145 | var salary = await _db.Queryable<LqDirectorSalaryStatisticsEntity>() |
| 145 | - .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId) | 146 | + .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId && x.IsLocked == 1) |
| 146 | .Select(x => new DirectorSalaryOutput | 147 | .Select(x => new DirectorSalaryOutput |
| 147 | { | 148 | { |
| 148 | Id = x.Id, | 149 | Id = x.Id, |
| @@ -171,6 +172,7 @@ namespace NCC.Extend | @@ -171,6 +172,7 @@ namespace NCC.Extend | ||
| 171 | PaidAmount = x.PaidAmount, | 172 | PaidAmount = x.PaidAmount, |
| 172 | PendingAmount = x.PendingAmount, | 173 | PendingAmount = x.PendingAmount, |
| 173 | IsLocked = x.IsLocked, | 174 | IsLocked = x.IsLocked, |
| 175 | + EmployeeConfirmStatus = x.EmployeeConfirmStatus, | ||
| 174 | StoreType = x.StoreType, | 176 | StoreType = x.StoreType, |
| 175 | StoreCategory = x.StoreCategory, | 177 | StoreCategory = x.StoreCategory, |
| 176 | IsNewStore = x.IsNewStore, | 178 | IsNewStore = x.IsNewStore, |
| @@ -992,7 +994,9 @@ namespace NCC.Extend | @@ -992,7 +994,9 @@ namespace NCC.Extend | ||
| 992 | return int.TryParse(cleaned, out int result) ? result : 0; | 994 | return int.TryParse(cleaned, out int result) ? result : 0; |
| 993 | }; | 995 | }; |
| 994 | 996 | ||
| 995 | - for (int i = 1; i < dataTable.Rows.Count; i++) | 997 | + // ExcelImportHelper.ToDataTable(filePath, 0, 0)会将第一行作为标题行,数据从第二行开始 |
| 998 | + // 所以DataTable.Rows[0]是Excel的第一条数据行,应该从i=0开始循环 | ||
| 999 | + for (int i = 0; i < dataTable.Rows.Count; i++) | ||
| 996 | { | 1000 | { |
| 997 | try | 1001 | try |
| 998 | { | 1002 | { |
| @@ -1153,7 +1157,14 @@ namespace NCC.Extend | @@ -1153,7 +1157,14 @@ namespace NCC.Extend | ||
| 1153 | } | 1157 | } |
| 1154 | 1158 | ||
| 1155 | if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); | 1159 | if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); |
| 1156 | - if (recordsToUpdate.Any()) await _db.Updateable(recordsToUpdate).ExecuteCommandAsync(); | 1160 | + if (recordsToUpdate.Any()) |
| 1161 | + { | ||
| 1162 | + // 使用IgnoreColumns排除CreateTime和CreateUser,确保其他所有字段都被更新 | ||
| 1163 | + await _db.Updateable(recordsToUpdate) | ||
| 1164 | + .IgnoreColumns(x => x.CreateTime) | ||
| 1165 | + .IgnoreColumns(x => x.CreateUser) | ||
| 1166 | + .ExecuteCommandAsync(); | ||
| 1167 | + } | ||
| 1157 | 1168 | ||
| 1158 | return new | 1169 | return new |
| 1159 | { | 1170 | { |
netcore/src/Modularity/Extend/NCC.Extend/LqMajorProjectDirectorSalaryService.cs
| @@ -118,6 +118,7 @@ namespace NCC.Extend | @@ -118,6 +118,7 @@ namespace NCC.Extend | ||
| 118 | LastMonthSupplement = x.LastMonthSupplement, | 118 | LastMonthSupplement = x.LastMonthSupplement, |
| 119 | MonthlyTotalPayment = x.MonthlyTotalPayment, | 119 | MonthlyTotalPayment = x.MonthlyTotalPayment, |
| 120 | IsLocked = x.IsLocked, | 120 | IsLocked = x.IsLocked, |
| 121 | + EmployeeConfirmStatus = x.EmployeeConfirmStatus, | ||
| 121 | UpdateTime = x.UpdateTime | 122 | UpdateTime = x.UpdateTime |
| 122 | }) | 123 | }) |
| 123 | .ToPagedListAsync(input.currentPage, input.pageSize); | 124 | .ToPagedListAsync(input.currentPage, input.pageSize); |
| @@ -126,7 +127,7 @@ namespace NCC.Extend | @@ -126,7 +127,7 @@ namespace NCC.Extend | ||
| 126 | } | 127 | } |
| 127 | 128 | ||
| 128 | /// <summary> | 129 | /// <summary> |
| 129 | - /// 通过月份和员工ID查询工资 | 130 | + /// 通过月份和员工ID查询工资(仅查询已锁定的工资) |
| 130 | /// </summary> | 131 | /// </summary> |
| 131 | [HttpGet("query-by-employee")] | 132 | [HttpGet("query-by-employee")] |
| 132 | public async Task<MajorProjectDirectorSalaryOutput> GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) | 133 | public async Task<MajorProjectDirectorSalaryOutput> GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) |
| @@ -137,7 +138,7 @@ namespace NCC.Extend | @@ -137,7 +138,7 @@ namespace NCC.Extend | ||
| 137 | throw NCCException.Oh("员工ID不能为空"); | 138 | throw NCCException.Oh("员工ID不能为空"); |
| 138 | var monthStr = $"{input.Year}{input.Month:D2}"; | 139 | var monthStr = $"{input.Year}{input.Month:D2}"; |
| 139 | var salary = await _db.Queryable<LqMajorProjectDirectorSalaryStatisticsEntity>() | 140 | var salary = await _db.Queryable<LqMajorProjectDirectorSalaryStatisticsEntity>() |
| 140 | - .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId) | 141 | + .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId && x.IsLocked == 1) |
| 141 | .Select(x => new MajorProjectDirectorSalaryOutput | 142 | .Select(x => new MajorProjectDirectorSalaryOutput |
| 142 | { | 143 | { |
| 143 | Id = x.Id, | 144 | Id = x.Id, |
| @@ -182,6 +183,7 @@ namespace NCC.Extend | @@ -182,6 +183,7 @@ namespace NCC.Extend | ||
| 182 | LastMonthSupplement = x.LastMonthSupplement, | 183 | LastMonthSupplement = x.LastMonthSupplement, |
| 183 | MonthlyTotalPayment = x.MonthlyTotalPayment, | 184 | MonthlyTotalPayment = x.MonthlyTotalPayment, |
| 184 | IsLocked = x.IsLocked, | 185 | IsLocked = x.IsLocked, |
| 186 | + EmployeeConfirmStatus = x.EmployeeConfirmStatus, | ||
| 185 | UpdateTime = x.UpdateTime | 187 | UpdateTime = x.UpdateTime |
| 186 | }) | 188 | }) |
| 187 | .FirstAsync(); | 189 | .FirstAsync(); |
| @@ -796,7 +798,9 @@ namespace NCC.Extend | @@ -796,7 +798,9 @@ namespace NCC.Extend | ||
| 796 | return int.TryParse(cleaned, out int result) ? result : 0; | 798 | return int.TryParse(cleaned, out int result) ? result : 0; |
| 797 | }; | 799 | }; |
| 798 | 800 | ||
| 799 | - for (int i = 1; i < dataTable.Rows.Count; i++) | 801 | + // ExcelImportHelper.ToDataTable(filePath, 0, 0)会将第一行作为标题行,数据从第二行开始 |
| 802 | + // 所以DataTable.Rows[0]是Excel的第一条数据行,应该从i=0开始循环 | ||
| 803 | + for (int i = 0; i < dataTable.Rows.Count; i++) | ||
| 800 | { | 804 | { |
| 801 | try | 805 | try |
| 802 | { | 806 | { |
| @@ -929,7 +933,14 @@ namespace NCC.Extend | @@ -929,7 +933,14 @@ namespace NCC.Extend | ||
| 929 | } | 933 | } |
| 930 | 934 | ||
| 931 | if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); | 935 | if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); |
| 932 | - if (recordsToUpdate.Any()) await _db.Updateable(recordsToUpdate).ExecuteCommandAsync(); | 936 | + if (recordsToUpdate.Any()) |
| 937 | + { | ||
| 938 | + // 使用IgnoreColumns排除CreateTime和CreateUser,确保其他所有字段都被更新 | ||
| 939 | + await _db.Updateable(recordsToUpdate) | ||
| 940 | + .IgnoreColumns(x => x.CreateTime) | ||
| 941 | + .IgnoreColumns(x => x.CreateUser) | ||
| 942 | + .ExecuteCommandAsync(); | ||
| 943 | + } | ||
| 933 | 944 | ||
| 934 | return new | 945 | return new |
| 935 | { | 946 | { |
netcore/src/Modularity/Extend/NCC.Extend/LqMajorProjectTeacherSalaryService.cs
| @@ -128,6 +128,7 @@ namespace NCC.Extend | @@ -128,6 +128,7 @@ namespace NCC.Extend | ||
| 128 | LastMonthSupplement = x.LastMonthSupplement, | 128 | LastMonthSupplement = x.LastMonthSupplement, |
| 129 | MonthlyTotalPayment = x.MonthlyTotalPayment, | 129 | MonthlyTotalPayment = x.MonthlyTotalPayment, |
| 130 | IsLocked = x.IsLocked, | 130 | IsLocked = x.IsLocked, |
| 131 | + EmployeeConfirmStatus = x.EmployeeConfirmStatus, | ||
| 131 | IsTerminated = x.IsTerminated, | 132 | IsTerminated = x.IsTerminated, |
| 132 | UpdateTime = x.UpdateTime, | 133 | UpdateTime = x.UpdateTime, |
| 133 | StoreType = x.StoreType, | 134 | StoreType = x.StoreType, |
| @@ -141,7 +142,7 @@ namespace NCC.Extend | @@ -141,7 +142,7 @@ namespace NCC.Extend | ||
| 141 | } | 142 | } |
| 142 | 143 | ||
| 143 | /// <summary> | 144 | /// <summary> |
| 144 | - /// 通过月份和员工ID查询工资 | 145 | + /// 通过月份和员工ID查询工资(仅查询已锁定的工资) |
| 145 | /// </summary> | 146 | /// </summary> |
| 146 | [HttpGet("query-by-employee")] | 147 | [HttpGet("query-by-employee")] |
| 147 | public async Task<MajorProjectTeacherSalaryOutput> GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) | 148 | public async Task<MajorProjectTeacherSalaryOutput> GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) |
| @@ -152,7 +153,7 @@ namespace NCC.Extend | @@ -152,7 +153,7 @@ namespace NCC.Extend | ||
| 152 | throw NCCException.Oh("员工ID不能为空"); | 153 | throw NCCException.Oh("员工ID不能为空"); |
| 153 | var monthStr = $"{input.Year}{input.Month:D2}"; | 154 | var monthStr = $"{input.Year}{input.Month:D2}"; |
| 154 | var salary = await _db.Queryable<LqMajorProjectTeacherSalaryStatisticsEntity>() | 155 | var salary = await _db.Queryable<LqMajorProjectTeacherSalaryStatisticsEntity>() |
| 155 | - .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId) | 156 | + .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId && x.IsLocked == 1) |
| 156 | .Select(x => new MajorProjectTeacherSalaryOutput | 157 | .Select(x => new MajorProjectTeacherSalaryOutput |
| 157 | { | 158 | { |
| 158 | Id = x.Id, | 159 | Id = x.Id, |
| @@ -207,6 +208,7 @@ namespace NCC.Extend | @@ -207,6 +208,7 @@ namespace NCC.Extend | ||
| 207 | LastMonthSupplement = x.LastMonthSupplement, | 208 | LastMonthSupplement = x.LastMonthSupplement, |
| 208 | MonthlyTotalPayment = x.MonthlyTotalPayment, | 209 | MonthlyTotalPayment = x.MonthlyTotalPayment, |
| 209 | IsLocked = x.IsLocked, | 210 | IsLocked = x.IsLocked, |
| 211 | + EmployeeConfirmStatus = x.EmployeeConfirmStatus, | ||
| 210 | IsTerminated = x.IsTerminated, | 212 | IsTerminated = x.IsTerminated, |
| 211 | UpdateTime = x.UpdateTime, | 213 | UpdateTime = x.UpdateTime, |
| 212 | StoreType = x.StoreType, | 214 | StoreType = x.StoreType, |
| @@ -819,7 +821,9 @@ namespace NCC.Extend | @@ -819,7 +821,9 @@ namespace NCC.Extend | ||
| 819 | return int.TryParse(cleaned, out int result) ? result : 0; | 821 | return int.TryParse(cleaned, out int result) ? result : 0; |
| 820 | }; | 822 | }; |
| 821 | 823 | ||
| 822 | - for (int i = 1; i < dataTable.Rows.Count; i++) | 824 | + // ExcelImportHelper.ToDataTable(filePath, 0, 0)会将第一行作为标题行,数据从第二行开始 |
| 825 | + // 所以DataTable.Rows[0]是Excel的第一条数据行,应该从i=0开始循环 | ||
| 826 | + for (int i = 0; i < dataTable.Rows.Count; i++) | ||
| 823 | { | 827 | { |
| 824 | try | 828 | try |
| 825 | { | 829 | { |
| @@ -977,7 +981,14 @@ namespace NCC.Extend | @@ -977,7 +981,14 @@ namespace NCC.Extend | ||
| 977 | } | 981 | } |
| 978 | 982 | ||
| 979 | if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); | 983 | if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); |
| 980 | - if (recordsToUpdate.Any()) await _db.Updateable(recordsToUpdate).ExecuteCommandAsync(); | 984 | + if (recordsToUpdate.Any()) |
| 985 | + { | ||
| 986 | + // 使用IgnoreColumns排除CreateTime和CreateUser,确保其他所有字段都被更新 | ||
| 987 | + await _db.Updateable(recordsToUpdate) | ||
| 988 | + .IgnoreColumns(x => x.CreateTime) | ||
| 989 | + .IgnoreColumns(x => x.CreateUser) | ||
| 990 | + .ExecuteCommandAsync(); | ||
| 991 | + } | ||
| 981 | 992 | ||
| 982 | return new | 993 | return new |
| 983 | { | 994 | { |
netcore/src/Modularity/Extend/NCC.Extend/LqSalaryService.cs
| @@ -156,6 +156,7 @@ namespace NCC.Extend | @@ -156,6 +156,7 @@ namespace NCC.Extend | ||
| 156 | MonthlyTotalPayment = x.MonthlyTotalPayment, | 156 | MonthlyTotalPayment = x.MonthlyTotalPayment, |
| 157 | StatisticsMonth = x.StatisticsMonth, | 157 | StatisticsMonth = x.StatisticsMonth, |
| 158 | IsLocked = x.IsLocked, | 158 | IsLocked = x.IsLocked, |
| 159 | + EmployeeConfirmStatus = x.EmployeeConfirmStatus, | ||
| 159 | CreateTime = x.CreateTime, | 160 | CreateTime = x.CreateTime, |
| 160 | CreateUser = x.CreateUser, | 161 | CreateUser = x.CreateUser, |
| 161 | UpdateTime = x.UpdateTime, | 162 | UpdateTime = x.UpdateTime, |
| @@ -174,11 +175,13 @@ namespace NCC.Extend | @@ -174,11 +175,13 @@ namespace NCC.Extend | ||
| 174 | } | 175 | } |
| 175 | 176 | ||
| 176 | /// <summary> | 177 | /// <summary> |
| 177 | - /// 通过月份和员工ID查询工资 | 178 | + /// 通过月份和员工ID查询工资(仅查询已锁定的工资) |
| 178 | /// </summary> | 179 | /// </summary> |
| 179 | /// <remarks> | 180 | /// <remarks> |
| 180 | /// 根据年份、月份和员工ID查询对应员工的工资记录 | 181 | /// 根据年份、月份和员工ID查询对应员工的工资记录 |
| 181 | /// | 182 | /// |
| 183 | + /// **重要**:此接口只能查询已锁定(IsLocked=1)的工资记录 | ||
| 184 | + /// | ||
| 182 | /// 示例请求: | 185 | /// 示例请求: |
| 183 | /// ``` | 186 | /// ``` |
| 184 | /// GET /api/Extend/lqsalary/query-by-employee?Year=2026&Month=1&EmployeeId=员工ID | 187 | /// GET /api/Extend/lqsalary/query-by-employee?Year=2026&Month=1&EmployeeId=员工ID |
| @@ -209,7 +212,7 @@ namespace NCC.Extend | @@ -209,7 +212,7 @@ namespace NCC.Extend | ||
| 209 | var monthStr = $"{input.Year}{input.Month:D2}"; | 212 | var monthStr = $"{input.Year}{input.Month:D2}"; |
| 210 | 213 | ||
| 211 | var salary = await _db.Queryable<LqSalaryStatisticsEntity>() | 214 | var salary = await _db.Queryable<LqSalaryStatisticsEntity>() |
| 212 | - .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId) | 215 | + .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId && x.IsLocked == 1) |
| 213 | .Select(x => new HealthCoachSalaryOutput | 216 | .Select(x => new HealthCoachSalaryOutput |
| 214 | { | 217 | { |
| 215 | Id = x.Id, | 218 | Id = x.Id, |
| @@ -289,6 +292,7 @@ namespace NCC.Extend | @@ -289,6 +292,7 @@ namespace NCC.Extend | ||
| 289 | MonthlyTotalPayment = x.MonthlyTotalPayment, | 292 | MonthlyTotalPayment = x.MonthlyTotalPayment, |
| 290 | StatisticsMonth = x.StatisticsMonth, | 293 | StatisticsMonth = x.StatisticsMonth, |
| 291 | IsLocked = x.IsLocked, | 294 | IsLocked = x.IsLocked, |
| 295 | + EmployeeConfirmStatus = x.EmployeeConfirmStatus, | ||
| 292 | CreateTime = x.CreateTime, | 296 | CreateTime = x.CreateTime, |
| 293 | CreateUser = x.CreateUser, | 297 | CreateUser = x.CreateUser, |
| 294 | UpdateTime = x.UpdateTime, | 298 | UpdateTime = x.UpdateTime, |
| @@ -1332,9 +1336,9 @@ namespace NCC.Extend | @@ -1332,9 +1336,9 @@ namespace NCC.Extend | ||
| 1332 | throw NCCException.Oh("Excel文件中没有数据行"); | 1336 | throw NCCException.Oh("Excel文件中没有数据行"); |
| 1333 | } | 1337 | } |
| 1334 | 1338 | ||
| 1335 | - // Excel第一列是ID,第二列开始是业务字段 | ||
| 1336 | - // 从第1行开始读取数据(跳过标题行) | ||
| 1337 | - for (int i = 1; i < dataTable.Rows.Count; i++) | 1339 | + // ExcelImportHelper.ToDataTable(filePath, 0, 0)会将第一行作为标题行,数据从第二行开始 |
| 1340 | + // 所以DataTable.Rows[0]是Excel的第一条数据行,应该从i=0开始循环 | ||
| 1341 | + for (int i = 0; i < dataTable.Rows.Count; i++) | ||
| 1338 | { | 1342 | { |
| 1339 | try | 1343 | try |
| 1340 | { | 1344 | { |
| @@ -1666,7 +1670,11 @@ namespace NCC.Extend | @@ -1666,7 +1670,11 @@ namespace NCC.Extend | ||
| 1666 | // 批量更新现有记录 | 1670 | // 批量更新现有记录 |
| 1667 | if (recordsToUpdate.Any()) | 1671 | if (recordsToUpdate.Any()) |
| 1668 | { | 1672 | { |
| 1669 | - await _db.Updateable(recordsToUpdate).ExecuteCommandAsync(); | 1673 | + // 使用IgnoreColumns排除CreateTime和CreateUser,确保其他所有字段都被更新 |
| 1674 | + await _db.Updateable(recordsToUpdate) | ||
| 1675 | + .IgnoreColumns(x => x.CreateTime) | ||
| 1676 | + .IgnoreColumns(x => x.CreateUser) | ||
| 1677 | + .ExecuteCommandAsync(); | ||
| 1670 | } | 1678 | } |
| 1671 | 1679 | ||
| 1672 | return new | 1680 | return new |
netcore/src/Modularity/Extend/NCC.Extend/LqStoreManagerSalaryService.cs
| @@ -120,6 +120,7 @@ namespace NCC.Extend | @@ -120,6 +120,7 @@ namespace NCC.Extend | ||
| 120 | PaidAmount = x.PaidAmount, | 120 | PaidAmount = x.PaidAmount, |
| 121 | PendingAmount = x.PendingAmount, | 121 | PendingAmount = x.PendingAmount, |
| 122 | IsLocked = x.IsLocked, | 122 | IsLocked = x.IsLocked, |
| 123 | + EmployeeConfirmStatus = x.EmployeeConfirmStatus, | ||
| 123 | StoreType = x.StoreType, | 124 | StoreType = x.StoreType, |
| 124 | StoreCategory = x.StoreCategory, | 125 | StoreCategory = x.StoreCategory, |
| 125 | IsNewStore = x.IsNewStore, | 126 | IsNewStore = x.IsNewStore, |
| @@ -132,7 +133,7 @@ namespace NCC.Extend | @@ -132,7 +133,7 @@ namespace NCC.Extend | ||
| 132 | } | 133 | } |
| 133 | 134 | ||
| 134 | /// <summary> | 135 | /// <summary> |
| 135 | - /// 通过月份和员工ID查询工资 | 136 | + /// 通过月份和员工ID查询工资(仅查询已锁定的工资) |
| 136 | /// </summary> | 137 | /// </summary> |
| 137 | [HttpGet("query-by-employee")] | 138 | [HttpGet("query-by-employee")] |
| 138 | public async Task<StoreManagerSalaryOutput> GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) | 139 | public async Task<StoreManagerSalaryOutput> GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) |
| @@ -143,7 +144,7 @@ namespace NCC.Extend | @@ -143,7 +144,7 @@ namespace NCC.Extend | ||
| 143 | throw NCCException.Oh("员工ID不能为空"); | 144 | throw NCCException.Oh("员工ID不能为空"); |
| 144 | var monthStr = $"{input.Year}{input.Month:D2}"; | 145 | var monthStr = $"{input.Year}{input.Month:D2}"; |
| 145 | var salary = await _db.Queryable<LqStoreManagerSalaryStatisticsEntity>() | 146 | var salary = await _db.Queryable<LqStoreManagerSalaryStatisticsEntity>() |
| 146 | - .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId) | 147 | + .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId && x.IsLocked == 1) |
| 147 | .Select(x => new StoreManagerSalaryOutput | 148 | .Select(x => new StoreManagerSalaryOutput |
| 148 | { | 149 | { |
| 149 | Id = x.Id, | 150 | Id = x.Id, |
| @@ -186,6 +187,7 @@ namespace NCC.Extend | @@ -186,6 +187,7 @@ namespace NCC.Extend | ||
| 186 | PaidAmount = x.PaidAmount, | 187 | PaidAmount = x.PaidAmount, |
| 187 | PendingAmount = x.PendingAmount, | 188 | PendingAmount = x.PendingAmount, |
| 188 | IsLocked = x.IsLocked, | 189 | IsLocked = x.IsLocked, |
| 190 | + EmployeeConfirmStatus = x.EmployeeConfirmStatus, | ||
| 189 | StoreType = x.StoreType, | 191 | StoreType = x.StoreType, |
| 190 | StoreCategory = x.StoreCategory, | 192 | StoreCategory = x.StoreCategory, |
| 191 | IsNewStore = x.IsNewStore, | 193 | IsNewStore = x.IsNewStore, |
| @@ -1041,7 +1043,9 @@ namespace NCC.Extend | @@ -1041,7 +1043,9 @@ namespace NCC.Extend | ||
| 1041 | return int.TryParse(cleaned, out int result) ? result : 0; | 1043 | return int.TryParse(cleaned, out int result) ? result : 0; |
| 1042 | }; | 1044 | }; |
| 1043 | 1045 | ||
| 1044 | - for (int i = 1; i < dataTable.Rows.Count; i++) | 1046 | + // ExcelImportHelper.ToDataTable(filePath, 0, 0)会将第一行作为标题行,数据从第二行开始 |
| 1047 | + // 所以DataTable.Rows[0]是Excel的第一条数据行,应该从i=0开始循环 | ||
| 1048 | + for (int i = 0; i < dataTable.Rows.Count; i++) | ||
| 1045 | { | 1049 | { |
| 1046 | try | 1050 | try |
| 1047 | { | 1051 | { |
| @@ -1213,7 +1217,14 @@ namespace NCC.Extend | @@ -1213,7 +1217,14 @@ namespace NCC.Extend | ||
| 1213 | } | 1217 | } |
| 1214 | 1218 | ||
| 1215 | if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); | 1219 | if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); |
| 1216 | - if (recordsToUpdate.Any()) await _db.Updateable(recordsToUpdate).ExecuteCommandAsync(); | 1220 | + if (recordsToUpdate.Any()) |
| 1221 | + { | ||
| 1222 | + // 使用IgnoreColumns排除CreateTime和CreateUser,确保其他所有字段都被更新 | ||
| 1223 | + await _db.Updateable(recordsToUpdate) | ||
| 1224 | + .IgnoreColumns(x => x.CreateTime) | ||
| 1225 | + .IgnoreColumns(x => x.CreateUser) | ||
| 1226 | + .ExecuteCommandAsync(); | ||
| 1227 | + } | ||
| 1217 | 1228 | ||
| 1218 | return new | 1229 | return new |
| 1219 | { | 1230 | { |
netcore/src/Modularity/Extend/NCC.Extend/LqTechGeneralManagerSalaryService.cs
| @@ -122,6 +122,7 @@ namespace NCC.Extend | @@ -122,6 +122,7 @@ namespace NCC.Extend | ||
| 122 | LastMonthSupplement = x.LastMonthSupplement, | 122 | LastMonthSupplement = x.LastMonthSupplement, |
| 123 | MonthlyTotalPayment = x.MonthlyTotalPayment, | 123 | MonthlyTotalPayment = x.MonthlyTotalPayment, |
| 124 | IsLocked = x.IsLocked, | 124 | IsLocked = x.IsLocked, |
| 125 | + EmployeeConfirmStatus = x.EmployeeConfirmStatus, | ||
| 125 | UpdateTime = x.UpdateTime | 126 | UpdateTime = x.UpdateTime |
| 126 | }) | 127 | }) |
| 127 | .ToPagedListAsync(input.currentPage, input.pageSize); | 128 | .ToPagedListAsync(input.currentPage, input.pageSize); |
| @@ -130,7 +131,7 @@ namespace NCC.Extend | @@ -130,7 +131,7 @@ namespace NCC.Extend | ||
| 130 | } | 131 | } |
| 131 | 132 | ||
| 132 | /// <summary> | 133 | /// <summary> |
| 133 | - /// 通过月份和员工ID查询工资 | 134 | + /// 通过月份和员工ID查询工资(仅查询已锁定的工资) |
| 134 | /// </summary> | 135 | /// </summary> |
| 135 | [HttpGet("query-by-employee")] | 136 | [HttpGet("query-by-employee")] |
| 136 | public async Task<TechGeneralManagerSalaryOutput> GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) | 137 | public async Task<TechGeneralManagerSalaryOutput> GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) |
| @@ -141,7 +142,7 @@ namespace NCC.Extend | @@ -141,7 +142,7 @@ namespace NCC.Extend | ||
| 141 | throw NCCException.Oh("员工ID不能为空"); | 142 | throw NCCException.Oh("员工ID不能为空"); |
| 142 | var monthStr = $"{input.Year}{input.Month:D2}"; | 143 | var monthStr = $"{input.Year}{input.Month:D2}"; |
| 143 | var salary = await _db.Queryable<LqTechGeneralManagerSalaryStatisticsEntity>() | 144 | var salary = await _db.Queryable<LqTechGeneralManagerSalaryStatisticsEntity>() |
| 144 | - .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId) | 145 | + .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId && x.IsLocked == 1) |
| 145 | .Select(x => new TechGeneralManagerSalaryOutput | 146 | .Select(x => new TechGeneralManagerSalaryOutput |
| 146 | { | 147 | { |
| 147 | Id = x.Id, | 148 | Id = x.Id, |
| @@ -188,6 +189,7 @@ namespace NCC.Extend | @@ -188,6 +189,7 @@ namespace NCC.Extend | ||
| 188 | LastMonthSupplement = x.LastMonthSupplement, | 189 | LastMonthSupplement = x.LastMonthSupplement, |
| 189 | MonthlyTotalPayment = x.MonthlyTotalPayment, | 190 | MonthlyTotalPayment = x.MonthlyTotalPayment, |
| 190 | IsLocked = x.IsLocked, | 191 | IsLocked = x.IsLocked, |
| 192 | + EmployeeConfirmStatus = x.EmployeeConfirmStatus, | ||
| 191 | UpdateTime = x.UpdateTime | 193 | UpdateTime = x.UpdateTime |
| 192 | }) | 194 | }) |
| 193 | .FirstAsync(); | 195 | .FirstAsync(); |
| @@ -888,7 +890,9 @@ namespace NCC.Extend | @@ -888,7 +890,9 @@ namespace NCC.Extend | ||
| 888 | return int.TryParse(cleaned, out int result) ? result : 0; | 890 | return int.TryParse(cleaned, out int result) ? result : 0; |
| 889 | }; | 891 | }; |
| 890 | 892 | ||
| 891 | - for (int i = 1; i < dataTable.Rows.Count; i++) | 893 | + // ExcelImportHelper.ToDataTable(filePath, 0, 0)会将第一行作为标题行,数据从第二行开始 |
| 894 | + // 所以DataTable.Rows[0]是Excel的第一条数据行,应该从i=0开始循环 | ||
| 895 | + for (int i = 0; i < dataTable.Rows.Count; i++) | ||
| 892 | { | 896 | { |
| 893 | try | 897 | try |
| 894 | { | 898 | { |
| @@ -1023,7 +1027,14 @@ namespace NCC.Extend | @@ -1023,7 +1027,14 @@ namespace NCC.Extend | ||
| 1023 | } | 1027 | } |
| 1024 | 1028 | ||
| 1025 | if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); | 1029 | if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); |
| 1026 | - if (recordsToUpdate.Any()) await _db.Updateable(recordsToUpdate).ExecuteCommandAsync(); | 1030 | + if (recordsToUpdate.Any()) |
| 1031 | + { | ||
| 1032 | + // 使用IgnoreColumns排除CreateTime和CreateUser,确保其他所有字段都被更新 | ||
| 1033 | + await _db.Updateable(recordsToUpdate) | ||
| 1034 | + .IgnoreColumns(x => x.CreateTime) | ||
| 1035 | + .IgnoreColumns(x => x.CreateUser) | ||
| 1036 | + .ExecuteCommandAsync(); | ||
| 1037 | + } | ||
| 1027 | 1038 | ||
| 1028 | return new | 1039 | return new |
| 1029 | { | 1040 | { |
netcore/src/Modularity/Extend/NCC.Extend/LqTechTeacherSalaryService.cs
| @@ -131,6 +131,7 @@ namespace NCC.Extend | @@ -131,6 +131,7 @@ namespace NCC.Extend | ||
| 131 | LastMonthSupplement = x.LastMonthSupplement, | 131 | LastMonthSupplement = x.LastMonthSupplement, |
| 132 | MonthlyTotalPayment = x.MonthlyTotalPayment, | 132 | MonthlyTotalPayment = x.MonthlyTotalPayment, |
| 133 | IsLocked = x.IsLocked, | 133 | IsLocked = x.IsLocked, |
| 134 | + EmployeeConfirmStatus = x.EmployeeConfirmStatus, | ||
| 134 | IsTerminated = x.IsTerminated, | 135 | IsTerminated = x.IsTerminated, |
| 135 | UpdateTime = x.UpdateTime, | 136 | UpdateTime = x.UpdateTime, |
| 136 | StoreType = x.StoreType, | 137 | StoreType = x.StoreType, |
| @@ -144,7 +145,7 @@ namespace NCC.Extend | @@ -144,7 +145,7 @@ namespace NCC.Extend | ||
| 144 | } | 145 | } |
| 145 | 146 | ||
| 146 | /// <summary> | 147 | /// <summary> |
| 147 | - /// 通过月份和员工ID查询工资 | 148 | + /// 通过月份和员工ID查询工资(仅查询已锁定的工资) |
| 148 | /// </summary> | 149 | /// </summary> |
| 149 | [HttpGet("query-by-employee")] | 150 | [HttpGet("query-by-employee")] |
| 150 | public async Task<TechTeacherSalaryOutput> GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) | 151 | public async Task<TechTeacherSalaryOutput> GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) |
| @@ -155,7 +156,7 @@ namespace NCC.Extend | @@ -155,7 +156,7 @@ namespace NCC.Extend | ||
| 155 | throw NCCException.Oh("员工ID不能为空"); | 156 | throw NCCException.Oh("员工ID不能为空"); |
| 156 | var monthStr = $"{input.Year}{input.Month:D2}"; | 157 | var monthStr = $"{input.Year}{input.Month:D2}"; |
| 157 | var salary = await _db.Queryable<LqTechTeacherSalaryStatisticsEntity>() | 158 | var salary = await _db.Queryable<LqTechTeacherSalaryStatisticsEntity>() |
| 158 | - .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId) | 159 | + .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId && x.IsLocked == 1) |
| 159 | .Select(x => new TechTeacherSalaryOutput | 160 | .Select(x => new TechTeacherSalaryOutput |
| 160 | { | 161 | { |
| 161 | Id = x.Id, | 162 | Id = x.Id, |
| @@ -214,6 +215,7 @@ namespace NCC.Extend | @@ -214,6 +215,7 @@ namespace NCC.Extend | ||
| 214 | LastMonthSupplement = x.LastMonthSupplement, | 215 | LastMonthSupplement = x.LastMonthSupplement, |
| 215 | MonthlyTotalPayment = x.MonthlyTotalPayment, | 216 | MonthlyTotalPayment = x.MonthlyTotalPayment, |
| 216 | IsLocked = x.IsLocked, | 217 | IsLocked = x.IsLocked, |
| 218 | + EmployeeConfirmStatus = x.EmployeeConfirmStatus, | ||
| 217 | IsTerminated = x.IsTerminated, | 219 | IsTerminated = x.IsTerminated, |
| 218 | UpdateTime = x.UpdateTime, | 220 | UpdateTime = x.UpdateTime, |
| 219 | StoreType = x.StoreType, | 221 | StoreType = x.StoreType, |
| @@ -1223,8 +1225,9 @@ namespace NCC.Extend | @@ -1223,8 +1225,9 @@ namespace NCC.Extend | ||
| 1223 | throw NCCException.Oh("Excel文件中没有数据行"); | 1225 | throw NCCException.Oh("Excel文件中没有数据行"); |
| 1224 | } | 1226 | } |
| 1225 | 1227 | ||
| 1226 | - // Excel第一列是ID,第二列开始是业务字段 | ||
| 1227 | - for (int i = 1; i < dataTable.Rows.Count; i++) | 1228 | + // ExcelImportHelper.ToDataTable(filePath, 0, 0)会将第一行作为标题行,数据从第二行开始 |
| 1229 | + // 所以DataTable.Rows[0]是Excel的第一条数据行,应该从i=0开始循环 | ||
| 1230 | + for (int i = 0; i < dataTable.Rows.Count; i++) | ||
| 1228 | { | 1231 | { |
| 1229 | try | 1232 | try |
| 1230 | { | 1233 | { |
| @@ -1517,7 +1520,11 @@ namespace NCC.Extend | @@ -1517,7 +1520,11 @@ namespace NCC.Extend | ||
| 1517 | // 批量更新现有记录 | 1520 | // 批量更新现有记录 |
| 1518 | if (recordsToUpdate.Any()) | 1521 | if (recordsToUpdate.Any()) |
| 1519 | { | 1522 | { |
| 1520 | - await _db.Updateable(recordsToUpdate).ExecuteCommandAsync(); | 1523 | + // 使用IgnoreColumns排除CreateTime和CreateUser,确保其他所有字段都被更新 |
| 1524 | + await _db.Updateable(recordsToUpdate) | ||
| 1525 | + .IgnoreColumns(x => x.CreateTime) | ||
| 1526 | + .IgnoreColumns(x => x.CreateUser) | ||
| 1527 | + .ExecuteCommandAsync(); | ||
| 1521 | } | 1528 | } |
| 1522 | 1529 | ||
| 1523 | return new | 1530 | return new |