!3733 添加功能

Merge pull request !3733 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2025-07-08 10:31:47 +00:00
committed by Gitee
@@ -372,7 +372,8 @@ class AppletAttendance(Controller):
包含假期和调休信息的字典
"""
# 从start_date中提取年份
current_year = start_date.year
target_year = start_date.year
target_month = start_date.month
domain = [("calendar_id", "=", "行政考勤工作日")]
if start_date and end_date:
# 将date对象转换为datetime对象
@@ -401,17 +402,25 @@ class AppletAttendance(Controller):
start_date_obj = datetime.strptime(date_from, '%Y-%m-%d').date()
end_date_obj = datetime.strptime(date_to, '%Y-%m-%d').date()
delta = end_date_obj - start_date_obj
for i in range(delta.days + 1):
day = start_date_obj + timedelta(days=i)
holidays_list.append(day.isoformat())
# 只添加年份和月份匹配的日期
if day.year == target_year and day.month == target_month:
holidays_list.append(day.isoformat())
# 处理调班补班
if leaves.shift_replacement_day:
day_strings = leaves.shift_replacement_day.split(',')
for day_str in day_strings:
month_str, day_str = day_str.strip().replace('日', '').split('月')
formatted_date = f"{current_year}-{int(month_str):02d}-{int(day_str):02d}"
shift_days_list.append(formatted_date)
month = int(month_str)
day = int(day_str)
# 只添加月份匹配的日期
if month == target_month:
formatted_date = f"{target_year}-{month:02d}-{day:02d}"
shift_days_list.append(formatted_date)
return {
"holiday_list": holidays_list,