diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqAssistantSalary/AssistantSalaryOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqAssistantSalary/AssistantSalaryOutput.cs index ab75df1..e8d0aef 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqAssistantSalary/AssistantSalaryOutput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqAssistantSalary/AssistantSalaryOutput.cs @@ -188,6 +188,11 @@ namespace NCC.Extend.Entitys.Dto.LqAssistantSalary public int IsLocked { get; set; } /// + /// 员工确认状态(0=未确认,1=已确认) + /// + public int EmployeeConfirmStatus { get; set; } + + /// /// 更新时间 /// public DateTime UpdateTime { get; set; } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqBusinessUnitManagerSalary/BusinessUnitManagerSalaryOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqBusinessUnitManagerSalary/BusinessUnitManagerSalaryOutput.cs index 89fec7a..86d56fb 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqBusinessUnitManagerSalary/BusinessUnitManagerSalaryOutput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqBusinessUnitManagerSalary/BusinessUnitManagerSalaryOutput.cs @@ -233,6 +233,11 @@ namespace NCC.Extend.Entitys.Dto.LqBusinessUnitManagerSalary public int IsLocked { get; set; } /// + /// 员工确认状态(0=未确认,1=已确认) + /// + public int EmployeeConfirmStatus { get; set; } + + /// /// 更新时间 /// public DateTime UpdateTime { get; set; } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqDirectorSalary/DirectorSalaryOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqDirectorSalary/DirectorSalaryOutput.cs index a6a8ca1..b661810 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqDirectorSalary/DirectorSalaryOutput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqDirectorSalary/DirectorSalaryOutput.cs @@ -208,6 +208,11 @@ namespace NCC.Extend.Entitys.Dto.LqDirectorSalary public int IsLocked { get; set; } /// + /// 员工确认状态(0=未确认,1=已确认) + /// + public int EmployeeConfirmStatus { get; set; } + + /// /// 更新时间 /// public DateTime UpdateTime { get; set; } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqMajorProjectDirectorSalary/MajorProjectDirectorSalaryOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqMajorProjectDirectorSalary/MajorProjectDirectorSalaryOutput.cs index 789e39a..964d0d7 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqMajorProjectDirectorSalary/MajorProjectDirectorSalaryOutput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqMajorProjectDirectorSalary/MajorProjectDirectorSalaryOutput.cs @@ -218,6 +218,11 @@ namespace NCC.Extend.Entitys.Dto.LqMajorProjectDirectorSalary public int IsLocked { get; set; } /// + /// 员工确认状态(0=未确认,1=已确认) + /// + public int EmployeeConfirmStatus { get; set; } + + /// /// 更新时间 /// public DateTime UpdateTime { get; set; } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqMajorProjectTeacherSalary/MajorProjectTeacherSalaryOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqMajorProjectTeacherSalary/MajorProjectTeacherSalaryOutput.cs index dcedd21..c4515a8 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqMajorProjectTeacherSalary/MajorProjectTeacherSalaryOutput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqMajorProjectTeacherSalary/MajorProjectTeacherSalaryOutput.cs @@ -268,6 +268,11 @@ namespace NCC.Extend.Entitys.Dto.LqMajorProjectTeacherSalary public int IsLocked { get; set; } /// + /// 员工确认状态(0=未确认,1=已确认) + /// + public int EmployeeConfirmStatus { get; set; } + + /// /// 是否离职 /// public int IsTerminated { get; set; } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqSalary/HealthCoachSalaryOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqSalary/HealthCoachSalaryOutput.cs index aadbbbb..6b717b8 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqSalary/HealthCoachSalaryOutput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqSalary/HealthCoachSalaryOutput.cs @@ -108,6 +108,11 @@ namespace NCC.Extend.Entitys.Dto.LqSalary public int IsLocked { get; set; } /// + /// 员工确认状态(0=未确认,1=已确认) + /// + public int EmployeeConfirmStatus { get; set; } + + /// /// 更新时间 /// public DateTime UpdateTime { get; set; } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStoreManagerSalary/StoreManagerSalaryOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStoreManagerSalary/StoreManagerSalaryOutput.cs index 5d77b43..aa8dec6 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStoreManagerSalary/StoreManagerSalaryOutput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStoreManagerSalary/StoreManagerSalaryOutput.cs @@ -208,6 +208,11 @@ namespace NCC.Extend.Entitys.Dto.LqStoreManagerSalary public int IsLocked { get; set; } /// + /// 员工确认状态(0=未确认,1=已确认) + /// + public int EmployeeConfirmStatus { get; set; } + + /// /// 门店类型 /// public int? StoreType { get; set; } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqTechGeneralManagerSalary/TechGeneralManagerSalaryOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqTechGeneralManagerSalary/TechGeneralManagerSalaryOutput.cs index 1249885..7588c02 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqTechGeneralManagerSalary/TechGeneralManagerSalaryOutput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqTechGeneralManagerSalary/TechGeneralManagerSalaryOutput.cs @@ -228,6 +228,11 @@ namespace NCC.Extend.Entitys.Dto.LqTechGeneralManagerSalary public int IsLocked { get; set; } /// + /// 员工确认状态(0=未确认,1=已确认) + /// + public int EmployeeConfirmStatus { get; set; } + + /// /// 更新时间 /// public DateTime UpdateTime { get; set; } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqTechTeacherSalary/TechTeacherSalaryOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqTechTeacherSalary/TechTeacherSalaryOutput.cs index f3e0765..63bf450 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqTechTeacherSalary/TechTeacherSalaryOutput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqTechTeacherSalary/TechTeacherSalaryOutput.cs @@ -288,6 +288,11 @@ namespace NCC.Extend.Entitys.Dto.LqTechTeacherSalary public int IsLocked { get; set; } /// + /// 员工确认状态(0=未确认,1=已确认) + /// + public int EmployeeConfirmStatus { get; set; } + + /// /// 是否离职 /// public int IsTerminated { get; set; } diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqAssistantSalaryService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqAssistantSalaryService.cs index 3578b5f..8f05181 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqAssistantSalaryService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqAssistantSalaryService.cs @@ -111,6 +111,7 @@ namespace NCC.Extend LastMonthSupplement = x.LastMonthSupplement, MonthlyTotalPayment = x.MonthlyTotalPayment, IsLocked = x.IsLocked, + EmployeeConfirmStatus = x.EmployeeConfirmStatus, UpdateTime = x.UpdateTime, StoreType = x.StoreType, StoreCategory = x.StoreCategory, @@ -123,7 +124,7 @@ namespace NCC.Extend } /// - /// 通过月份和员工ID查询工资 + /// 通过月份和员工ID查询工资(仅查询已锁定的工资) /// [HttpGet("query-by-employee")] public async Task GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) @@ -134,7 +135,7 @@ namespace NCC.Extend throw NCCException.Oh("员工ID不能为空"); var monthStr = $"{input.Year}{input.Month:D2}"; var salary = await _db.Queryable() - .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId) + .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId && x.IsLocked == 1) .Select(x => new AssistantSalaryOutput { Id = x.Id, @@ -173,6 +174,7 @@ namespace NCC.Extend LastMonthSupplement = x.LastMonthSupplement, MonthlyTotalPayment = x.MonthlyTotalPayment, IsLocked = x.IsLocked, + EmployeeConfirmStatus = x.EmployeeConfirmStatus, UpdateTime = x.UpdateTime, StoreType = x.StoreType, StoreCategory = x.StoreCategory, @@ -1071,7 +1073,9 @@ namespace NCC.Extend return int.TryParse(cleaned, out int result) ? result : 0; }; - for (int i = 1; i < dataTable.Rows.Count; i++) + // ExcelImportHelper.ToDataTable(filePath, 0, 0)会将第一行作为标题行,数据从第二行开始 + // 所以DataTable.Rows[0]是Excel的第一条数据行,应该从i=0开始循环 + for (int i = 0; i < dataTable.Rows.Count; i++) { try { @@ -1248,7 +1252,14 @@ namespace NCC.Extend } if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); - if (recordsToUpdate.Any()) await _db.Updateable(recordsToUpdate).ExecuteCommandAsync(); + if (recordsToUpdate.Any()) + { + // 使用IgnoreColumns排除CreateTime和CreateUser,确保其他所有字段都被更新 + await _db.Updateable(recordsToUpdate) + .IgnoreColumns(x => x.CreateTime) + .IgnoreColumns(x => x.CreateUser) + .ExecuteCommandAsync(); + } return new { diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqBusinessUnitManagerSalaryService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqBusinessUnitManagerSalaryService.cs index 5053aac..417824c 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqBusinessUnitManagerSalaryService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqBusinessUnitManagerSalaryService.cs @@ -123,6 +123,7 @@ namespace NCC.Extend LastMonthSupplement = x.LastMonthSupplement, MonthlyTotalPayment = x.MonthlyTotalPayment, IsLocked = x.IsLocked, + EmployeeConfirmStatus = x.EmployeeConfirmStatus, UpdateTime = x.UpdateTime }) .ToPagedListAsync(input.currentPage, input.pageSize); @@ -131,7 +132,7 @@ namespace NCC.Extend } /// - /// 通过月份和员工ID查询工资 + /// 通过月份和员工ID查询工资(仅查询已锁定的工资) /// [HttpGet("query-by-employee")] public async Task GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) @@ -142,7 +143,7 @@ namespace NCC.Extend throw NCCException.Oh("员工ID不能为空"); var monthStr = $"{input.Year}{input.Month:D2}"; var salary = await _db.Queryable() - .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId) + .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId && x.IsLocked == 1) .Select(x => new BusinessUnitManagerSalaryOutput { Id = x.Id, @@ -190,6 +191,7 @@ namespace NCC.Extend LastMonthSupplement = x.LastMonthSupplement, MonthlyTotalPayment = x.MonthlyTotalPayment, IsLocked = x.IsLocked, + EmployeeConfirmStatus = x.EmployeeConfirmStatus, UpdateTime = x.UpdateTime }) .FirstAsync(); @@ -952,7 +954,9 @@ namespace NCC.Extend return int.TryParse(cleaned, out int result) ? result : 0; }; - for (int i = 1; i < dataTable.Rows.Count; i++) + // ExcelImportHelper.ToDataTable(filePath, 0, 0)会将第一行作为标题行,数据从第二行开始 + // 所以DataTable.Rows[0]是Excel的第一条数据行,应该从i=0开始循环 + for (int i = 0; i < dataTable.Rows.Count; i++) { try { @@ -1082,7 +1086,14 @@ namespace NCC.Extend } if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); - if (recordsToUpdate.Any()) await _db.Updateable(recordsToUpdate).ExecuteCommandAsync(); + if (recordsToUpdate.Any()) + { + // 使用IgnoreColumns排除CreateTime和CreateUser,确保其他所有字段都被更新 + await _db.Updateable(recordsToUpdate) + .IgnoreColumns(x => x.CreateTime) + .IgnoreColumns(x => x.CreateUser) + .ExecuteCommandAsync(); + } return new { diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqDirectorSalaryService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqDirectorSalaryService.cs index 75aaac8..09e3973 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqDirectorSalaryService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqDirectorSalaryService.cs @@ -119,6 +119,7 @@ namespace NCC.Extend LastMonthSupplement = x.LastMonthSupplement, MonthlyTotalPayment = x.MonthlyTotalPayment, IsLocked = x.IsLocked, + EmployeeConfirmStatus = x.EmployeeConfirmStatus, UpdateTime = x.UpdateTime, StoreType = x.StoreType, StoreCategory = x.StoreCategory, @@ -131,7 +132,7 @@ namespace NCC.Extend } /// - /// 通过月份和员工ID查询工资 + /// 通过月份和员工ID查询工资(仅查询已锁定的工资) /// [HttpGet("query-by-employee")] public async Task GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) @@ -142,7 +143,7 @@ namespace NCC.Extend throw NCCException.Oh("员工ID不能为空"); var monthStr = $"{input.Year}{input.Month:D2}"; var salary = await _db.Queryable() - .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId) + .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId && x.IsLocked == 1) .Select(x => new DirectorSalaryOutput { Id = x.Id, @@ -171,6 +172,7 @@ namespace NCC.Extend PaidAmount = x.PaidAmount, PendingAmount = x.PendingAmount, IsLocked = x.IsLocked, + EmployeeConfirmStatus = x.EmployeeConfirmStatus, StoreType = x.StoreType, StoreCategory = x.StoreCategory, IsNewStore = x.IsNewStore, @@ -992,7 +994,9 @@ namespace NCC.Extend return int.TryParse(cleaned, out int result) ? result : 0; }; - for (int i = 1; i < dataTable.Rows.Count; i++) + // ExcelImportHelper.ToDataTable(filePath, 0, 0)会将第一行作为标题行,数据从第二行开始 + // 所以DataTable.Rows[0]是Excel的第一条数据行,应该从i=0开始循环 + for (int i = 0; i < dataTable.Rows.Count; i++) { try { @@ -1153,7 +1157,14 @@ namespace NCC.Extend } if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); - if (recordsToUpdate.Any()) await _db.Updateable(recordsToUpdate).ExecuteCommandAsync(); + if (recordsToUpdate.Any()) + { + // 使用IgnoreColumns排除CreateTime和CreateUser,确保其他所有字段都被更新 + await _db.Updateable(recordsToUpdate) + .IgnoreColumns(x => x.CreateTime) + .IgnoreColumns(x => x.CreateUser) + .ExecuteCommandAsync(); + } return new { diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqMajorProjectDirectorSalaryService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqMajorProjectDirectorSalaryService.cs index a40efff..440c4c1 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqMajorProjectDirectorSalaryService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqMajorProjectDirectorSalaryService.cs @@ -118,6 +118,7 @@ namespace NCC.Extend LastMonthSupplement = x.LastMonthSupplement, MonthlyTotalPayment = x.MonthlyTotalPayment, IsLocked = x.IsLocked, + EmployeeConfirmStatus = x.EmployeeConfirmStatus, UpdateTime = x.UpdateTime }) .ToPagedListAsync(input.currentPage, input.pageSize); @@ -126,7 +127,7 @@ namespace NCC.Extend } /// - /// 通过月份和员工ID查询工资 + /// 通过月份和员工ID查询工资(仅查询已锁定的工资) /// [HttpGet("query-by-employee")] public async Task GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) @@ -137,7 +138,7 @@ namespace NCC.Extend throw NCCException.Oh("员工ID不能为空"); var monthStr = $"{input.Year}{input.Month:D2}"; var salary = await _db.Queryable() - .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId) + .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId && x.IsLocked == 1) .Select(x => new MajorProjectDirectorSalaryOutput { Id = x.Id, @@ -182,6 +183,7 @@ namespace NCC.Extend LastMonthSupplement = x.LastMonthSupplement, MonthlyTotalPayment = x.MonthlyTotalPayment, IsLocked = x.IsLocked, + EmployeeConfirmStatus = x.EmployeeConfirmStatus, UpdateTime = x.UpdateTime }) .FirstAsync(); @@ -796,7 +798,9 @@ namespace NCC.Extend return int.TryParse(cleaned, out int result) ? result : 0; }; - for (int i = 1; i < dataTable.Rows.Count; i++) + // ExcelImportHelper.ToDataTable(filePath, 0, 0)会将第一行作为标题行,数据从第二行开始 + // 所以DataTable.Rows[0]是Excel的第一条数据行,应该从i=0开始循环 + for (int i = 0; i < dataTable.Rows.Count; i++) { try { @@ -929,7 +933,14 @@ namespace NCC.Extend } if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); - if (recordsToUpdate.Any()) await _db.Updateable(recordsToUpdate).ExecuteCommandAsync(); + if (recordsToUpdate.Any()) + { + // 使用IgnoreColumns排除CreateTime和CreateUser,确保其他所有字段都被更新 + await _db.Updateable(recordsToUpdate) + .IgnoreColumns(x => x.CreateTime) + .IgnoreColumns(x => x.CreateUser) + .ExecuteCommandAsync(); + } return new { diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqMajorProjectTeacherSalaryService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqMajorProjectTeacherSalaryService.cs index a2bb0dc..8433524 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqMajorProjectTeacherSalaryService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqMajorProjectTeacherSalaryService.cs @@ -128,6 +128,7 @@ namespace NCC.Extend LastMonthSupplement = x.LastMonthSupplement, MonthlyTotalPayment = x.MonthlyTotalPayment, IsLocked = x.IsLocked, + EmployeeConfirmStatus = x.EmployeeConfirmStatus, IsTerminated = x.IsTerminated, UpdateTime = x.UpdateTime, StoreType = x.StoreType, @@ -141,7 +142,7 @@ namespace NCC.Extend } /// - /// 通过月份和员工ID查询工资 + /// 通过月份和员工ID查询工资(仅查询已锁定的工资) /// [HttpGet("query-by-employee")] public async Task GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) @@ -152,7 +153,7 @@ namespace NCC.Extend throw NCCException.Oh("员工ID不能为空"); var monthStr = $"{input.Year}{input.Month:D2}"; var salary = await _db.Queryable() - .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId) + .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId && x.IsLocked == 1) .Select(x => new MajorProjectTeacherSalaryOutput { Id = x.Id, @@ -207,6 +208,7 @@ namespace NCC.Extend LastMonthSupplement = x.LastMonthSupplement, MonthlyTotalPayment = x.MonthlyTotalPayment, IsLocked = x.IsLocked, + EmployeeConfirmStatus = x.EmployeeConfirmStatus, IsTerminated = x.IsTerminated, UpdateTime = x.UpdateTime, StoreType = x.StoreType, @@ -819,7 +821,9 @@ namespace NCC.Extend return int.TryParse(cleaned, out int result) ? result : 0; }; - for (int i = 1; i < dataTable.Rows.Count; i++) + // ExcelImportHelper.ToDataTable(filePath, 0, 0)会将第一行作为标题行,数据从第二行开始 + // 所以DataTable.Rows[0]是Excel的第一条数据行,应该从i=0开始循环 + for (int i = 0; i < dataTable.Rows.Count; i++) { try { @@ -977,7 +981,14 @@ namespace NCC.Extend } if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); - if (recordsToUpdate.Any()) await _db.Updateable(recordsToUpdate).ExecuteCommandAsync(); + if (recordsToUpdate.Any()) + { + // 使用IgnoreColumns排除CreateTime和CreateUser,确保其他所有字段都被更新 + await _db.Updateable(recordsToUpdate) + .IgnoreColumns(x => x.CreateTime) + .IgnoreColumns(x => x.CreateUser) + .ExecuteCommandAsync(); + } return new { diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqSalaryService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqSalaryService.cs index 44f0635..e612030 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqSalaryService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqSalaryService.cs @@ -156,6 +156,7 @@ namespace NCC.Extend MonthlyTotalPayment = x.MonthlyTotalPayment, StatisticsMonth = x.StatisticsMonth, IsLocked = x.IsLocked, + EmployeeConfirmStatus = x.EmployeeConfirmStatus, CreateTime = x.CreateTime, CreateUser = x.CreateUser, UpdateTime = x.UpdateTime, @@ -174,11 +175,13 @@ namespace NCC.Extend } /// - /// 通过月份和员工ID查询工资 + /// 通过月份和员工ID查询工资(仅查询已锁定的工资) /// /// /// 根据年份、月份和员工ID查询对应员工的工资记录 /// + /// **重要**:此接口只能查询已锁定(IsLocked=1)的工资记录 + /// /// 示例请求: /// ``` /// GET /api/Extend/lqsalary/query-by-employee?Year=2026&Month=1&EmployeeId=员工ID @@ -209,7 +212,7 @@ namespace NCC.Extend var monthStr = $"{input.Year}{input.Month:D2}"; var salary = await _db.Queryable() - .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId) + .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId && x.IsLocked == 1) .Select(x => new HealthCoachSalaryOutput { Id = x.Id, @@ -289,6 +292,7 @@ namespace NCC.Extend MonthlyTotalPayment = x.MonthlyTotalPayment, StatisticsMonth = x.StatisticsMonth, IsLocked = x.IsLocked, + EmployeeConfirmStatus = x.EmployeeConfirmStatus, CreateTime = x.CreateTime, CreateUser = x.CreateUser, UpdateTime = x.UpdateTime, @@ -1332,9 +1336,9 @@ namespace NCC.Extend throw NCCException.Oh("Excel文件中没有数据行"); } - // Excel第一列是ID,第二列开始是业务字段 - // 从第1行开始读取数据(跳过标题行) - for (int i = 1; i < dataTable.Rows.Count; i++) + // ExcelImportHelper.ToDataTable(filePath, 0, 0)会将第一行作为标题行,数据从第二行开始 + // 所以DataTable.Rows[0]是Excel的第一条数据行,应该从i=0开始循环 + for (int i = 0; i < dataTable.Rows.Count; i++) { try { @@ -1666,7 +1670,11 @@ namespace NCC.Extend // 批量更新现有记录 if (recordsToUpdate.Any()) { - await _db.Updateable(recordsToUpdate).ExecuteCommandAsync(); + // 使用IgnoreColumns排除CreateTime和CreateUser,确保其他所有字段都被更新 + await _db.Updateable(recordsToUpdate) + .IgnoreColumns(x => x.CreateTime) + .IgnoreColumns(x => x.CreateUser) + .ExecuteCommandAsync(); } return new diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqStoreManagerSalaryService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqStoreManagerSalaryService.cs index 7f62b4c..0316ea8 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqStoreManagerSalaryService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqStoreManagerSalaryService.cs @@ -120,6 +120,7 @@ namespace NCC.Extend PaidAmount = x.PaidAmount, PendingAmount = x.PendingAmount, IsLocked = x.IsLocked, + EmployeeConfirmStatus = x.EmployeeConfirmStatus, StoreType = x.StoreType, StoreCategory = x.StoreCategory, IsNewStore = x.IsNewStore, @@ -132,7 +133,7 @@ namespace NCC.Extend } /// - /// 通过月份和员工ID查询工资 + /// 通过月份和员工ID查询工资(仅查询已锁定的工资) /// [HttpGet("query-by-employee")] public async Task GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) @@ -143,7 +144,7 @@ namespace NCC.Extend throw NCCException.Oh("员工ID不能为空"); var monthStr = $"{input.Year}{input.Month:D2}"; var salary = await _db.Queryable() - .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId) + .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId && x.IsLocked == 1) .Select(x => new StoreManagerSalaryOutput { Id = x.Id, @@ -186,6 +187,7 @@ namespace NCC.Extend PaidAmount = x.PaidAmount, PendingAmount = x.PendingAmount, IsLocked = x.IsLocked, + EmployeeConfirmStatus = x.EmployeeConfirmStatus, StoreType = x.StoreType, StoreCategory = x.StoreCategory, IsNewStore = x.IsNewStore, @@ -1041,7 +1043,9 @@ namespace NCC.Extend return int.TryParse(cleaned, out int result) ? result : 0; }; - for (int i = 1; i < dataTable.Rows.Count; i++) + // ExcelImportHelper.ToDataTable(filePath, 0, 0)会将第一行作为标题行,数据从第二行开始 + // 所以DataTable.Rows[0]是Excel的第一条数据行,应该从i=0开始循环 + for (int i = 0; i < dataTable.Rows.Count; i++) { try { @@ -1213,7 +1217,14 @@ namespace NCC.Extend } if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); - if (recordsToUpdate.Any()) await _db.Updateable(recordsToUpdate).ExecuteCommandAsync(); + if (recordsToUpdate.Any()) + { + // 使用IgnoreColumns排除CreateTime和CreateUser,确保其他所有字段都被更新 + await _db.Updateable(recordsToUpdate) + .IgnoreColumns(x => x.CreateTime) + .IgnoreColumns(x => x.CreateUser) + .ExecuteCommandAsync(); + } return new { diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqTechGeneralManagerSalaryService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqTechGeneralManagerSalaryService.cs index e62c8b0..cb2905f 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqTechGeneralManagerSalaryService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqTechGeneralManagerSalaryService.cs @@ -122,6 +122,7 @@ namespace NCC.Extend LastMonthSupplement = x.LastMonthSupplement, MonthlyTotalPayment = x.MonthlyTotalPayment, IsLocked = x.IsLocked, + EmployeeConfirmStatus = x.EmployeeConfirmStatus, UpdateTime = x.UpdateTime }) .ToPagedListAsync(input.currentPage, input.pageSize); @@ -130,7 +131,7 @@ namespace NCC.Extend } /// - /// 通过月份和员工ID查询工资 + /// 通过月份和员工ID查询工资(仅查询已锁定的工资) /// [HttpGet("query-by-employee")] public async Task GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) @@ -141,7 +142,7 @@ namespace NCC.Extend throw NCCException.Oh("员工ID不能为空"); var monthStr = $"{input.Year}{input.Month:D2}"; var salary = await _db.Queryable() - .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId) + .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId && x.IsLocked == 1) .Select(x => new TechGeneralManagerSalaryOutput { Id = x.Id, @@ -188,6 +189,7 @@ namespace NCC.Extend LastMonthSupplement = x.LastMonthSupplement, MonthlyTotalPayment = x.MonthlyTotalPayment, IsLocked = x.IsLocked, + EmployeeConfirmStatus = x.EmployeeConfirmStatus, UpdateTime = x.UpdateTime }) .FirstAsync(); @@ -888,7 +890,9 @@ namespace NCC.Extend return int.TryParse(cleaned, out int result) ? result : 0; }; - for (int i = 1; i < dataTable.Rows.Count; i++) + // ExcelImportHelper.ToDataTable(filePath, 0, 0)会将第一行作为标题行,数据从第二行开始 + // 所以DataTable.Rows[0]是Excel的第一条数据行,应该从i=0开始循环 + for (int i = 0; i < dataTable.Rows.Count; i++) { try { @@ -1023,7 +1027,14 @@ namespace NCC.Extend } if (recordsToInsert.Any()) await _db.Insertable(recordsToInsert).ExecuteCommandAsync(); - if (recordsToUpdate.Any()) await _db.Updateable(recordsToUpdate).ExecuteCommandAsync(); + if (recordsToUpdate.Any()) + { + // 使用IgnoreColumns排除CreateTime和CreateUser,确保其他所有字段都被更新 + await _db.Updateable(recordsToUpdate) + .IgnoreColumns(x => x.CreateTime) + .IgnoreColumns(x => x.CreateUser) + .ExecuteCommandAsync(); + } return new { diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqTechTeacherSalaryService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqTechTeacherSalaryService.cs index 5deeff5..46e158f 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqTechTeacherSalaryService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqTechTeacherSalaryService.cs @@ -131,6 +131,7 @@ namespace NCC.Extend LastMonthSupplement = x.LastMonthSupplement, MonthlyTotalPayment = x.MonthlyTotalPayment, IsLocked = x.IsLocked, + EmployeeConfirmStatus = x.EmployeeConfirmStatus, IsTerminated = x.IsTerminated, UpdateTime = x.UpdateTime, StoreType = x.StoreType, @@ -144,7 +145,7 @@ namespace NCC.Extend } /// - /// 通过月份和员工ID查询工资 + /// 通过月份和员工ID查询工资(仅查询已锁定的工资) /// [HttpGet("query-by-employee")] public async Task GetSalaryByEmployee([FromQuery] SalaryQueryByEmployeeInput input) @@ -155,7 +156,7 @@ namespace NCC.Extend throw NCCException.Oh("员工ID不能为空"); var monthStr = $"{input.Year}{input.Month:D2}"; var salary = await _db.Queryable() - .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId) + .Where(x => x.StatisticsMonth == monthStr && x.EmployeeId == input.EmployeeId && x.IsLocked == 1) .Select(x => new TechTeacherSalaryOutput { Id = x.Id, @@ -214,6 +215,7 @@ namespace NCC.Extend LastMonthSupplement = x.LastMonthSupplement, MonthlyTotalPayment = x.MonthlyTotalPayment, IsLocked = x.IsLocked, + EmployeeConfirmStatus = x.EmployeeConfirmStatus, IsTerminated = x.IsTerminated, UpdateTime = x.UpdateTime, StoreType = x.StoreType, @@ -1223,8 +1225,9 @@ namespace NCC.Extend throw NCCException.Oh("Excel文件中没有数据行"); } - // Excel第一列是ID,第二列开始是业务字段 - for (int i = 1; i < dataTable.Rows.Count; i++) + // ExcelImportHelper.ToDataTable(filePath, 0, 0)会将第一行作为标题行,数据从第二行开始 + // 所以DataTable.Rows[0]是Excel的第一条数据行,应该从i=0开始循环 + for (int i = 0; i < dataTable.Rows.Count; i++) { try { @@ -1517,7 +1520,11 @@ namespace NCC.Extend // 批量更新现有记录 if (recordsToUpdate.Any()) { - await _db.Updateable(recordsToUpdate).ExecuteCommandAsync(); + // 使用IgnoreColumns排除CreateTime和CreateUser,确保其他所有字段都被更新 + await _db.Updateable(recordsToUpdate) + .IgnoreColumns(x => x.CreateTime) + .IgnoreColumns(x => x.CreateUser) + .ExecuteCommandAsync(); } return new