update
This commit is contained in:
parent
233713db59
commit
ce93879fe9
|
|
@ -4,6 +4,7 @@ import json
|
|||
import logging
|
||||
import re
|
||||
import time
|
||||
from calendar import monthrange
|
||||
from datetime import date, datetime
|
||||
from decimal import Decimal, InvalidOperation
|
||||
from typing import Any
|
||||
|
|
@ -201,9 +202,20 @@ class SyncEhrLeavesToOaMonthJob(BaseJob):
|
|||
raise ValueError("public_cfg.oa_login_name is required")
|
||||
|
||||
oa_template_code = str(params.get("oa_template_code") or oa_form_code).strip()
|
||||
run_date = _to_date(params.get("run_date"))
|
||||
month_start = run_date.replace(day=1)
|
||||
month_end = run_date
|
||||
sync_month = str(params.get("sync_month") or "").strip()
|
||||
if sync_month:
|
||||
if not re.match(r"^\d{4}-\d{2}$", sync_month):
|
||||
raise ValueError("public_cfg.sync_month must be in format YYYY-MM, e.g. 2022-02")
|
||||
year = int(sync_month[:4])
|
||||
month = int(sync_month[5:7])
|
||||
if month < 1 or month > 12:
|
||||
raise ValueError("public_cfg.sync_month month must be in range 01-12")
|
||||
month_start = date(year, month, 1)
|
||||
month_end = date(year, month, monthrange(year, month)[1])
|
||||
else:
|
||||
run_date = _to_date(params.get("run_date"))
|
||||
month_start = run_date.replace(day=1)
|
||||
month_end = run_date
|
||||
|
||||
display_job_no = str(params.get("oa_display_job_no") or "工号").strip()
|
||||
display_leave_date = str(params.get("oa_display_leave_date") or "请假日期").strip()
|
||||
|
|
|
|||
Loading…
Reference in New Issue