diff --git a/IRaCIS.Core.API/Controllers/Financial/FinancialController.cs b/IRaCIS.Core.API/Controllers/Financial/FinancialController.cs index 4325bcf..4161b5c 100644 --- a/IRaCIS.Core.API/Controllers/Financial/FinancialController.cs +++ b/IRaCIS.Core.API/Controllers/Financial/FinancialController.cs @@ -104,10 +104,10 @@ namespace IRaCIS.Api.Controllers } [HttpPost, Route("ExportLaborPayment")] - public FileResult ExportLaborPayment(List paymentIds) + public FileResult ExportLaborPayment(ExportLaborPaymentInDto inDto) { - Stream stream = _paymentService.ExportLaborPayment(paymentIds); ; + Stream stream = _paymentService.ExportLaborPayment(inDto); FileStreamResult actionresult = new FileStreamResult(stream, new Microsoft.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream")); actionresult.FileDownloadName = "Payroll.zip"; return actionresult; diff --git a/IRaCIS.Core.Application.Contracts/Financial/DTO/PaymentViewModel.cs b/IRaCIS.Core.Application.Contracts/Financial/DTO/PaymentViewModel.cs index dbcf2fc..fcca0fc 100644 --- a/IRaCIS.Core.Application.Contracts/Financial/DTO/PaymentViewModel.cs +++ b/IRaCIS.Core.Application.Contracts/Financial/DTO/PaymentViewModel.cs @@ -117,6 +117,13 @@ namespace IRaCIS.Application.ViewModels } } + public class ExportLaborPaymentInDto + { + public List PaymentIds { get; set; } + + public string YearMonth { get; set; } + } + public class ChangePaymentMethodInDto { public Guid Id { get; set; } diff --git a/IRaCIS.Core.Application.Contracts/Financial/IPaymentService.cs b/IRaCIS.Core.Application.Contracts/Financial/IPaymentService.cs index 5258f30..10a7284 100644 --- a/IRaCIS.Core.Application.Contracts/Financial/IPaymentService.cs +++ b/IRaCIS.Core.Application.Contracts/Financial/IPaymentService.cs @@ -25,7 +25,7 @@ namespace IRaCIS.Application.Interfaces List GetReviewerAnalysisList(AnalysisQueryDTO param); - Stream ExportLaborPayment(List paymentIds); + Stream ExportLaborPayment(ExportLaborPaymentInDto inDto); void ChangePaymentMethod(ChangePaymentMethodInDto inDto); diff --git a/IRaCIS.Core.Application/Financial/FinancialService.cs b/IRaCIS.Core.Application/Financial/FinancialService.cs index ff550a9..c036d13 100644 --- a/IRaCIS.Core.Application/Financial/FinancialService.cs +++ b/IRaCIS.Core.Application/Financial/FinancialService.cs @@ -272,7 +272,7 @@ namespace IRaCIS.Application.Services }); - returnModel.DetailList = detailList; + returnModel.DetailList = detailList.OrderBy(x=>x.ShowCodeOrder).ThenBy(x=>x.ShowTypeOrder).ToList(); @@ -1206,7 +1206,7 @@ namespace IRaCIS.Application.Services _paymentRepository.SaveChanges(); } - public Stream ExportLaborPayment(List paymentIds) + public Stream ExportLaborPayment(ExportLaborPaymentInDto inDto) { #region 创建文件夹 if (!System.IO.Directory.Exists("./file")) @@ -1233,7 +1233,7 @@ namespace IRaCIS.Application.Services #endregion - List laborPaymentList = GetLaborPaymentList(paymentIds); + List laborPaymentList = GetLaborPaymentList(inDto.PaymentIds); //报酬 var remunerationList = laborPaymentList.Where(x => x.PaymentMethod == PaymentMethod.Remuneration).ToList(); @@ -1299,7 +1299,7 @@ namespace IRaCIS.Application.Services var path = Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\Template\paystub(Direct).xlsx"); // 导入excel - MiniExcel.SaveAsByTemplate($"./file/Direct/{item.ChineseName}_paystub_{item.YearMonth}(Direct).xlsx", path, remunerationSingle); + MiniExcel.SaveAsByTemplate($"./file/Direct/{item.ChineseName}_paystub_{inDto.YearMonth}(Direct).xlsx", path, remunerationSingle); } @@ -1323,17 +1323,17 @@ namespace IRaCIS.Application.Services }; cloudPaymentInfo.Rows.Add(cloudPaymentSingle); var path = Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\Template\paystub(云账户).xlsx"); - MiniExcel.SaveAsByTemplate($"./file/云账户/{item.ChineseName}_paystub_{item.YearMonth}(云账户).xlsx", path, cloudPaymentSingle); + MiniExcel.SaveAsByTemplate($"./file/云账户/{item.ChineseName}_paystub_{inDto.YearMonth}(云账户).xlsx", path, cloudPaymentSingle); } - - + remunerationInfo.YearMonth = inDto.YearMonth; + cloudPaymentInfo.YearMonth = inDto.YearMonth; var remunerationPath = Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\Template\Payroll Summary_(Direct).xlsx"); - MiniExcel.SaveAsByTemplate($"./file/Direct/Payroll Summary_{remunerationInfo.YearMonth}(Direct).xlsx", remunerationPath, remunerationInfo); + MiniExcel.SaveAsByTemplate($"./file/Direct/Payroll Summary_{inDto.YearMonth}(Direct).xlsx", remunerationPath, remunerationInfo); var cloudPaymentPath = Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\Template\Payroll Summary_(云账户).xlsx"); - MiniExcel.SaveAsByTemplate($"./file/云账户/Payroll Summary_{cloudPaymentInfo.YearMonth}(云账户).xlsx", cloudPaymentPath, cloudPaymentInfo); + MiniExcel.SaveAsByTemplate($"./file/云账户/Payroll Summary_{inDto.YearMonth}(云账户).xlsx", cloudPaymentPath, cloudPaymentInfo); ZipFile.CreateFromDirectory("./file", "Zip/Payroll.zip");