master
he 2022-09-13 15:05:56 +08:00
parent 0759bddd2e
commit dd6965d129
4 changed files with 19 additions and 12 deletions

View File

@ -104,10 +104,10 @@ namespace IRaCIS.Api.Controllers
} }
[HttpPost, Route("ExportLaborPayment")] [HttpPost, Route("ExportLaborPayment")]
public FileResult ExportLaborPayment(List<Guid> 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")); FileStreamResult actionresult = new FileStreamResult(stream, new Microsoft.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream"));
actionresult.FileDownloadName = "Payroll.zip"; actionresult.FileDownloadName = "Payroll.zip";
return actionresult; return actionresult;

View File

@ -117,6 +117,13 @@ namespace IRaCIS.Application.ViewModels
} }
} }
public class ExportLaborPaymentInDto
{
public List<Guid> PaymentIds { get; set; }
public string YearMonth { get; set; }
}
public class ChangePaymentMethodInDto public class ChangePaymentMethodInDto
{ {
public Guid Id { get; set; } public Guid Id { get; set; }

View File

@ -25,7 +25,7 @@ namespace IRaCIS.Application.Interfaces
List<ReviewerAnalysisDTO> GetReviewerAnalysisList(AnalysisQueryDTO param); List<ReviewerAnalysisDTO> GetReviewerAnalysisList(AnalysisQueryDTO param);
Stream ExportLaborPayment(List<Guid> paymentIds); Stream ExportLaborPayment(ExportLaborPaymentInDto inDto);
void ChangePaymentMethod(ChangePaymentMethodInDto inDto); void ChangePaymentMethod(ChangePaymentMethodInDto inDto);

View File

@ -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(); _paymentRepository.SaveChanges();
} }
public Stream ExportLaborPayment(List<Guid> paymentIds) public Stream ExportLaborPayment(ExportLaborPaymentInDto inDto)
{ {
#region 创建文件夹 #region 创建文件夹
if (!System.IO.Directory.Exists("./file")) if (!System.IO.Directory.Exists("./file"))
@ -1233,7 +1233,7 @@ namespace IRaCIS.Application.Services
#endregion #endregion
List<LaborPayment> laborPaymentList = GetLaborPaymentList(paymentIds); List<LaborPayment> laborPaymentList = GetLaborPaymentList(inDto.PaymentIds);
//报酬 //报酬
var remunerationList = laborPaymentList.Where(x => x.PaymentMethod == PaymentMethod.Remuneration).ToList(); 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"); var path = Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\Template\paystub(Direct).xlsx");
// 导入excel // 导入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); cloudPaymentInfo.Rows.Add(cloudPaymentSingle);
var path = Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\Template\paystub(云账户).xlsx"); 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"); 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"); 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"); ZipFile.CreateFromDirectory("./file", "Zip/Payroll.zip");