fix
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 4m27s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 4m27s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
This commit is contained in:
35
Application/HolidayApplication.cs
Normal file
35
Application/HolidayApplication.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
namespace Application;
|
||||
|
||||
/// <summary>
|
||||
/// 节假日应用服务
|
||||
/// </summary>
|
||||
public class HolidayApplication(IHolidayService holidayService)
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取指定年月的节假日数据
|
||||
/// </summary>
|
||||
public async Task<List<HolidayDto>> GetMonthHolidaysAsync(int year, int month)
|
||||
{
|
||||
var startDate = new DateTime(year, month, 1).ToString("yyyy-MM-dd");
|
||||
var endDate = new DateTime(year, month, DateTime.DaysInMonth(year, month)).ToString("yyyy-MM-dd");
|
||||
|
||||
var holidays = await holidayService.GetHolidaysByDateRangeAsync(startDate, endDate);
|
||||
|
||||
return holidays.Select(h => new HolidayDto
|
||||
{
|
||||
Date = h.Date,
|
||||
HolidayName = h.HolidayName,
|
||||
DayType = h.DayType,
|
||||
Rest = h.Rest,
|
||||
WeekDescCn = h.WeekDescCn
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 手动触发同步节假日数据
|
||||
/// </summary>
|
||||
public async Task<bool> SyncHolidaysAsync(int year)
|
||||
{
|
||||
return await holidayService.FetchAndCacheHolidaysAsync(year);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user