fix(plugin): XQ0004 1.2.0 当天加班单跳过不审核,待打卡齐全后再次处理
This commit is contained in:
@@ -526,6 +526,21 @@ def _is_review_period_exempt(post_name):
|
||||
return bool(name) and any(kw in name for kw in OT_REVIEW_EXEMPT_POST_KEYWORDS)
|
||||
|
||||
|
||||
def _is_same_day_ot(ot_date, today=None):
|
||||
"""加班日期是否为当天。
|
||||
|
||||
当天发起当天加班时下班卡还没打,打卡校验必然不通过,本次直接跳过不审核,
|
||||
等次日打卡齐全后再由后续运行审核。
|
||||
"""
|
||||
if not ot_date:
|
||||
return False
|
||||
try:
|
||||
ot_day = datetime.strptime(str(ot_date).strip()[:10], "%Y-%m-%d").date()
|
||||
except (TypeError, ValueError):
|
||||
return False
|
||||
return ot_day == (today or datetime.now()).date()
|
||||
|
||||
|
||||
def check_review_period(ot_date, post_name=None, today=None):
|
||||
"""
|
||||
加班日期有效性前置校验,返回 (是否可审核, 原因)。
|
||||
@@ -581,6 +596,19 @@ def validate_doc(doc, session):
|
||||
staff_id = overtime_info.get("加班人员ID")
|
||||
ot_date = overtime_info.get("加班日期")
|
||||
|
||||
# 当天发起当天的加班:下班卡尚未打,打卡校验必然不通过;
|
||||
# 本次直接跳过不审核(不提交、不推送),等次日打卡齐全后再由后续运行审核
|
||||
if _is_same_day_ot(ot_date):
|
||||
return {
|
||||
"title": doc.get("title", ""),
|
||||
"creator": doc.get("creator", ""),
|
||||
"time": doc.get("time", ""),
|
||||
"detail_url": doc.get("detail_url", ""),
|
||||
"decision": "跳过",
|
||||
"note": f"加班日期({ot_date})为当天,本次跳过审核,待打卡完成后再次审核",
|
||||
"overtime_info": overtime_info,
|
||||
}
|
||||
|
||||
attendance_info = _check_attendance(session, staff_id, ot_date)
|
||||
punch_info = _check_punch_records(session, staff_id, ot_date)
|
||||
overtime_info.update(attendance_info)
|
||||
|
||||
Reference in New Issue
Block a user