feat(oa): 新增审批异常状态的统计与通知

1. 为请假、加班审批流程新增异常状态分类统计和专属报告清单
2. 完善审批提交弹窗选择兼容逻辑,适配多类型确认弹窗
3. 提交失败时自动将单据标记为异常状态并记录原始结论
4. 推送摘要中新增异常审批条目展示
This commit is contained in:
2026-08-20 21:45:44 +08:00
parent 250cfc5eb7
commit cfb4c935da
5 changed files with 63 additions and 374 deletions
+1 -367
View File
@@ -1,368 +1,2 @@
treecode=cq37du&user_id=178b0efa-8a65-11f1-a7d9-000c296f9469&sqlId=kq_count_SelectBanci&commonQuery=&commonQueryStr=&staff_ids=&person_status=1%2C4&post_no=&post_type=1&post_level=&identity=&showType=1&dateType=2&begin=2026-08-01&end=2026-08-31&bc_date=2026-08-20&base_code=37023054&staff_name=&start=0&sortType=&sortName=&pageNo=1&pageSize=15
{
"attributeMap": null,
"count": 1,
"datas": [
{
"staff_id": "45f17664-cf31-4c5f-8fe1-474b4a733f15",
"work_day": "2026-08-01",
"paiban_type": "-2",
"priority": "0",
"team_id": "355945ef0e894881a21980b79b7dfbf1",
"bc_id": "4",
"sb_type": null,
"xb_type": null,
"begin_time": null,
"end_time": null,
"yq_total_min": 0,
"change_value_day": 0.0,
"remark": "",
"team_name": "集团本部职能",
"STAFF_ID": "45f17664-cf31-4c5f-8fe1-474b4a733f15",
"STAFF_NAME": "金友梅",
"base_code": "37023054",
"join_date": "2024-04-22",
"leaveOffice_date": null,
"Regular_Time": "2024-07-22",
"person_status": "1",
"staff_status": "1",
"identity": "1",
"idCard": "500236********6942",
"STRU_ID": "ec310d1b-0055-11ef-b449-000c296f9469",
"dept_one": null,
"dept_two": null,
"POST_LEVEL_ID": "8fdd248a-648d-11ec-b526-822ff8ed5b28",
"POST_LEVEL_NAME": "高级专员",
"DEPT_ORG_ONE": "监察审计部",
"DEPT_ORG_TWO": "审计组",
"DEPT_ORG_THREE": null,
"DEPT_ORG_FOUR": null,
"DEPT_ORG_FIVE": null,
"POST_ALIAS": "高级审计专员",
"POST_ORG_NAME": "高级审计专员",
"BELONG_UNIT_STRU_ID": "f1a6c12a-cef4-11ee-b449-000c296f9469",
"BELONG_UNIT_ORG_NAME": "集团管理中心",
"DEPT_STRU_ID": "92d72a82-29c5-41c9-9d70-59d7962ff5f7",
"DEPT_ORG_NAME": "审计组",
"POST_NO": "419",
"POST_ALIAS_NAME": "高级审计专员",
"ORG_FULL_PATH": "集团-集团管理中心-监察审计部-审计组",
"hrext_hsb_ext_speciality": null,
"hrext_ext_technician_code": "",
"hrext_ext_cal_person2": "",
"hrext_ext_call_phone2": "",
"hrext_ext_star_level": "正式",
"hrext_ext_rehiring_reason_type": "",
"hrext_ext_staff_type": "职能职员",
"hrext_ext_insurance_type": "社会保险",
"hrext_ext_recruit_way": "BOSS直聘",
"hrext_ext_call_relationship2": "",
"hrext_ext_is_CRBT_open": "",
"hrext_ext_dept_principal": "",
"hrext_ext_yb_pay_year": "",
"hrext_ext_Have_worked": "否",
"hrext_ext_family_join": "否",
"hrext_ext_criminal_record": "否",
"hrext_ext_infectious_disease": "否",
"hrext_ext_References": "",
"hrext_ext_References_phone": "",
"hrext_ext_References_outside": "",
"hrext_ext_outside_References_phone": "",
"hrext_ext_is_dormitory": "",
"hrext_ext_process_approval_status": "",
"hrext_ext_trans_type": "其他",
"2026-08-01_bc_id": "4",
"2026-08-01_bc_name": "休息",
"2026-08-01_bc_time": "",
"2026-08-01_paiban_type": "-2",
"2026-08-01_remark": "",
"2026-08-01_team_name": "集团本部职能",
"2026-08-01_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-01_sb_type": "",
"2026-08-01_xb_type": "",
"2026-08-02_bc_id": "4",
"2026-08-02_bc_name": "休息",
"2026-08-02_bc_time": "",
"2026-08-02_paiban_type": "-2",
"2026-08-02_remark": "",
"2026-08-02_team_name": "集团本部职能",
"2026-08-02_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-02_sb_type": "",
"2026-08-02_xb_type": "",
"2026-08-03_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-03_bc_name": "职能正班A",
"2026-08-03_bc_time": "09:00 ~ 18:00",
"2026-08-03_paiban_type": "-2",
"2026-08-03_remark": "",
"2026-08-03_team_name": "集团本部职能",
"2026-08-03_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-03_sb_type": 0,
"2026-08-03_xb_type": 0,
"2026-08-04_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-04_bc_name": "职能正班A",
"2026-08-04_bc_time": "09:00 ~ 18:00",
"2026-08-04_paiban_type": "-2",
"2026-08-04_remark": "",
"2026-08-04_team_name": "集团本部职能",
"2026-08-04_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-04_sb_type": 0,
"2026-08-04_xb_type": 0,
"2026-08-05_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-05_bc_name": "职能正班A",
"2026-08-05_bc_time": "09:00 ~ 18:00",
"2026-08-05_paiban_type": "-2",
"2026-08-05_remark": "",
"2026-08-05_team_name": "集团本部职能",
"2026-08-05_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-05_sb_type": 0,
"2026-08-05_xb_type": 0,
"2026-08-06_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-06_bc_name": "职能正班A",
"2026-08-06_bc_time": "09:00 ~ 18:00",
"2026-08-06_paiban_type": "-2",
"2026-08-06_remark": "",
"2026-08-06_team_name": "集团本部职能",
"2026-08-06_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-06_sb_type": 0,
"2026-08-06_xb_type": 0,
"2026-08-07_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-07_bc_name": "职能正班A",
"2026-08-07_bc_time": "09:00 ~ 18:00",
"2026-08-07_paiban_type": "-2",
"2026-08-07_remark": "",
"2026-08-07_team_name": "集团本部职能",
"2026-08-07_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-07_sb_type": 0,
"2026-08-07_xb_type": 0,
"2026-08-08_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-08_bc_name": "职能正班A",
"2026-08-08_bc_time": "09:00 ~ 18:00",
"2026-08-08_paiban_type": "-2",
"2026-08-08_remark": "",
"2026-08-08_team_name": "集团本部职能",
"2026-08-08_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-08_sb_type": 0,
"2026-08-08_xb_type": 0,
"2026-08-09_bc_id": "4",
"2026-08-09_bc_name": "休息",
"2026-08-09_bc_time": "",
"2026-08-09_paiban_type": "-2",
"2026-08-09_remark": "",
"2026-08-09_team_name": "集团本部职能",
"2026-08-09_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-09_sb_type": "",
"2026-08-09_xb_type": "",
"2026-08-10_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-10_bc_name": "职能正班A",
"2026-08-10_bc_time": "09:00 ~ 18:00",
"2026-08-10_paiban_type": "-2",
"2026-08-10_remark": "",
"2026-08-10_team_name": "集团本部职能",
"2026-08-10_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-10_sb_type": 0,
"2026-08-10_xb_type": 0,
"2026-08-11_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-11_bc_name": "职能正班A",
"2026-08-11_bc_time": "09:00 ~ 18:00",
"2026-08-11_paiban_type": "-2",
"2026-08-11_remark": "",
"2026-08-11_team_name": "集团本部职能",
"2026-08-11_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-11_sb_type": 0,
"2026-08-11_xb_type": 0,
"2026-08-12_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-12_bc_name": "职能正班A",
"2026-08-12_bc_time": "09:00 ~ 18:00",
"2026-08-12_paiban_type": "-2",
"2026-08-12_remark": "",
"2026-08-12_team_name": "集团本部职能",
"2026-08-12_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-12_sb_type": 0,
"2026-08-12_xb_type": 0,
"2026-08-13_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-13_bc_name": "职能正班A",
"2026-08-13_bc_time": "09:00 ~ 18:00",
"2026-08-13_paiban_type": "-2",
"2026-08-13_remark": "",
"2026-08-13_team_name": "集团本部职能",
"2026-08-13_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-13_sb_type": 0,
"2026-08-13_xb_type": 0,
"2026-08-14_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-14_bc_name": "职能正班A",
"2026-08-14_bc_time": "09:00 ~ 18:00",
"2026-08-14_paiban_type": "-2",
"2026-08-14_remark": "",
"2026-08-14_team_name": "集团本部职能",
"2026-08-14_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-14_sb_type": 0,
"2026-08-14_xb_type": 0,
"2026-08-15_bc_id": "4",
"2026-08-15_bc_name": "休息",
"2026-08-15_bc_time": "",
"2026-08-15_paiban_type": "-2",
"2026-08-15_remark": "",
"2026-08-15_team_name": "集团本部职能",
"2026-08-15_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-15_sb_type": "",
"2026-08-15_xb_type": "",
"2026-08-16_bc_id": "4",
"2026-08-16_bc_name": "休息",
"2026-08-16_bc_time": "",
"2026-08-16_paiban_type": "-2",
"2026-08-16_remark": "",
"2026-08-16_team_name": "集团本部职能",
"2026-08-16_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-16_sb_type": "",
"2026-08-16_xb_type": "",
"2026-08-17_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-17_bc_name": "职能正班A",
"2026-08-17_bc_time": "09:00 ~ 18:00",
"2026-08-17_paiban_type": "-2",
"2026-08-17_remark": "",
"2026-08-17_team_name": "集团本部职能",
"2026-08-17_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-17_sb_type": 0,
"2026-08-17_xb_type": 0,
"2026-08-18_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-18_bc_name": "职能正班A",
"2026-08-18_bc_time": "09:00 ~ 18:00",
"2026-08-18_paiban_type": "-2",
"2026-08-18_remark": "",
"2026-08-18_team_name": "集团本部职能",
"2026-08-18_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-18_sb_type": 0,
"2026-08-18_xb_type": 0,
"2026-08-19_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-19_bc_name": "职能正班A",
"2026-08-19_bc_time": "09:00 ~ 18:00",
"2026-08-19_paiban_type": "-2",
"2026-08-19_remark": "",
"2026-08-19_team_name": "集团本部职能",
"2026-08-19_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-19_sb_type": 0,
"2026-08-19_xb_type": 0,
"2026-08-20_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-20_bc_name": "职能正班A",
"2026-08-20_bc_time": "09:00 ~ 18:00",
"2026-08-20_paiban_type": "-2",
"2026-08-20_remark": "",
"2026-08-20_team_name": "集团本部职能",
"2026-08-20_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-20_sb_type": 0,
"2026-08-20_xb_type": 0,
"2026-08-21_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-21_bc_name": "职能正班A",
"2026-08-21_bc_time": "09:00 ~ 18:00",
"2026-08-21_paiban_type": "0",
"2026-08-21_remark": "",
"2026-08-21_team_name": "集团本部职能",
"2026-08-21_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-21_sb_type": 0,
"2026-08-21_xb_type": 0,
"2026-08-22_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-22_bc_name": "职能正班A",
"2026-08-22_bc_time": "09:00 ~ 18:00",
"2026-08-22_paiban_type": "0",
"2026-08-22_remark": "",
"2026-08-22_team_name": "集团本部职能",
"2026-08-22_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-22_sb_type": 0,
"2026-08-22_xb_type": 0,
"2026-08-23_bc_id": "4",
"2026-08-23_bc_name": "休息",
"2026-08-23_bc_time": "",
"2026-08-23_paiban_type": "0",
"2026-08-23_remark": "",
"2026-08-23_team_name": "集团本部职能",
"2026-08-23_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-23_sb_type": "",
"2026-08-23_xb_type": "",
"2026-08-24_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-24_bc_name": "职能正班A",
"2026-08-24_bc_time": "09:00 ~ 18:00",
"2026-08-24_paiban_type": "-3",
"2026-08-24_remark": "由于【请假】,提前生成考勤日报,可能存在与最新考勤排班不一致的情况。如需按照最新考勤排班,请进行【销假】或【销差】处理。",
"2026-08-24_team_name": "集团本部职能",
"2026-08-24_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-24_sb_type": 0,
"2026-08-24_xb_type": 0,
"2026-08-25_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-25_bc_name": "职能正班A",
"2026-08-25_bc_time": "09:00 ~ 18:00",
"2026-08-25_paiban_type": "0",
"2026-08-25_remark": "",
"2026-08-25_team_name": "集团本部职能",
"2026-08-25_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-25_sb_type": 0,
"2026-08-25_xb_type": 0,
"2026-08-26_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-26_bc_name": "职能正班A",
"2026-08-26_bc_time": "09:00 ~ 18:00",
"2026-08-26_paiban_type": "0",
"2026-08-26_remark": "",
"2026-08-26_team_name": "集团本部职能",
"2026-08-26_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-26_sb_type": 0,
"2026-08-26_xb_type": 0,
"2026-08-27_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-27_bc_name": "职能正班A",
"2026-08-27_bc_time": "09:00 ~ 18:00",
"2026-08-27_paiban_type": "0",
"2026-08-27_remark": "",
"2026-08-27_team_name": "集团本部职能",
"2026-08-27_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-27_sb_type": 0,
"2026-08-27_xb_type": 0,
"2026-08-28_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-28_bc_name": "职能正班A",
"2026-08-28_bc_time": "09:00 ~ 18:00",
"2026-08-28_paiban_type": "0",
"2026-08-28_remark": "",
"2026-08-28_team_name": "集团本部职能",
"2026-08-28_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-28_sb_type": 0,
"2026-08-28_xb_type": 0,
"2026-08-29_bc_id": "4",
"2026-08-29_bc_name": "休息",
"2026-08-29_bc_time": "",
"2026-08-29_paiban_type": "0",
"2026-08-29_remark": "",
"2026-08-29_team_name": "集团本部职能",
"2026-08-29_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-29_sb_type": "",
"2026-08-29_xb_type": "",
"2026-08-30_bc_id": "4",
"2026-08-30_bc_name": "休息",
"2026-08-30_bc_time": "",
"2026-08-30_paiban_type": "0",
"2026-08-30_remark": "",
"2026-08-30_team_name": "集团本部职能",
"2026-08-30_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-30_sb_type": "",
"2026-08-30_xb_type": "",
"2026-08-31_bc_id": "de1daf426e7f4fa6916f3012434e8973",
"2026-08-31_bc_name": "职能正班A",
"2026-08-31_bc_time": "09:00 ~ 18:00",
"2026-08-31_paiban_type": "0",
"2026-08-31_remark": "",
"2026-08-31_team_name": "集团本部职能",
"2026-08-31_team_id": "355945ef0e894881a21980b79b7dfbf1",
"2026-08-31_sb_type": 0,
"2026-08-31_xb_type": 0,
"total_hours": 184.0,
"total_day": 23
}
],
"pageSize": 15,
"start": 0,
"pageNo": 1,
"pageCount": 1,
"allDatas": null,
"url": null,
"state": "1",
"meg": "",
"des": "",
"viewMapper": null
}
<div class="wf-select-people"><div class="modal-header" style="height: 46px; padding: 12px; background: rgb(248, 248, 248); color: rgb(51, 51, 51);"><button type="button" class="close" style="opacity: 1;">×</button> <!----> <h4 class="modal-title" style="font-size: 16px;"> 经营中心负责人 </h4></div> <div style="max-height: 300px; overflow: auto;"><div><div class="wf-select-people-body"><div><div class="activity-content"><div class="activity-item" style="margin: 5px 0px 5px 15px;"><label style="display: none;"></label></div> <!----></div></div> <div class="people-content" style="clear: both; padding-bottom: 0px; overflow: inherit;"><div class="people-item" style="height: auto;"><input type="radio" struid="47564779-7a9f-11ec-b449-000c296f9469" class="people-input" value="348627b7-14ea-4a25-a99f-cf898a0ce048"> <div class="people-display" style="position: unset;"><div class="people-display-div"><div class="people-img"><img src="/RedseaPlatform/skins/images/48nosex.png"></div></div> <div class="people-display-div-border"></div> <div class="userName" style="text-align: center; color: rgb(112, 128, 144); font-size: 12px; margin-top: 80px;"> 张亮 </div> <div class="ok-circle"><i class="glyphicon glyphicon-ok-sign"></i></div> <!----> <div class="_top"></div></div></div> <!----> <div class="clearfix" style="clear: both;"></div></div></div></div></div> <div style="height: 12px;"></div> <div class="modal-footer" style="padding: 8px 15px 5px;"><button class="btn btn-default btn-sm">取消</button> <button class="btn btn-primary btn-sm">确定</button></div></div>
+26 -5
View File
@@ -103,10 +103,23 @@ def submit_approval(browser, decision: str) -> Dict[str, str]:
return {"action": label, "ok": "false", "message": msg}
logger.info("点击审批按钮: %s(%s)", selector, label)
btn.click()
# 点击弹出的确认框"确定"按钮(同意/驳回共用同一确认框,仅标题不同)
confirm = _find_button(browser, "#custom-confirm-modal-ok", timeout=3)
# 点击同意/退回后,弹出的弹窗结构不固定,需兼容两类"确定"按钮:
# 1) #custom-confirm-modal-ok(普通确认框);
# 2) tag:button@@class:btn-primary@@onclick:confirmSelect(选择人员弹窗,如加班
# "选择中心负责人",人员由系统自动选中,确定按钮 onclick=confirmSelect()
# 为弹窗独有,用多属性与匹配(@@)+包含匹配(:)精确咬住,避免误点页面其它
# modal-footer 里的同类确定按钮)
# 确认框由点击审批按钮后动态生成(modal 渐入动画),轮询等待其出现。
confirm = None
for _ in range(10):
confirm = _find_button(browser, "#custom-confirm-modal-ok", timeout=1)
if confirm is None:
confirm = _find_button(browser, "tag:button@@class:btn-primary@@onclick:confirmSelect", timeout=1)
if confirm:
break
time.sleep(0.5)
if confirm is None:
msg = "未找到确认框确定按钮 #custom-confirm-modal-ok,审批未提交"
msg = "未找到确认框确定按钮(#custom-confirm-modal-ok 或 .modal-footer .btn.btn-primary),审批未提交"
logger.error(msg)
return {"action": label, "ok": "false", "message": msg}
confirm.click()
@@ -224,9 +237,17 @@ def run_flow(
result = validate_doc(doc_detail, session)
# 真实审批提交:仅当 overtime_approve_enabled=true 时执行(默认关闭)
if _approve_enabled():
submit = submit_approval(browser, result.get("decision"))
orig_decision = result.get("decision")
submit = submit_approval(browser, orig_decision)
result["审批动作"] = submit["action"]
result["审批结果"] = f"{'成功' if submit['ok'] == 'true' else '失败'},{submit['message']}"
# 提交失败兜底:单据在 OA 中状态未变,不能仍标为通过/驳回,
# 归为「异常」并附机器结论,交由人工跟进
if submit["ok"] == "false":
result["decision"] = "异常"
result["note"] = (
f"机器结论[{orig_decision}]但审批提交失败:{submit['message']}"
)
result["审批结果"] = f"{submit['message']}"
logger.info("审批提交: %s %s", submit["action"], result["审批结果"])
results.append(result)
logger.info(
+8 -2
View File
@@ -102,9 +102,10 @@ def build_push_summary(results: list, subject: str = "") -> str:
rejected = [r for r in results if r.get("decision") == "驳回"]
review = [r for r in results if r.get("decision") == "人工复核"]
overdue = [r for r in results if r.get("decision") == "超期"]
abnormal = [r for r in results if r.get("decision") == "异常"]
failed = [r for r in results if r.get("decision") == "失败"]
if not passed and not rejected and not review and not overdue:
if not passed and not rejected and not review and not overdue and not abnormal:
return ""
def _item(r):
@@ -114,7 +115,7 @@ def build_push_summary(results: list, subject: str = "") -> str:
vtype = info.get("假期类型") or info.get("加班类型") or ""
return f"{title}-{vtype}" if vtype else title
all_pass = (not rejected and not review and not overdue and not failed)
all_pass = (not rejected and not review and not overdue and not abnormal and not failed)
lines = []
if all_pass:
@@ -147,6 +148,11 @@ def build_push_summary(results: list, subject: str = "") -> str:
for r in overdue:
lines.append(_item(r))
lines.append(f"处理原因:{r.get('note') or r.get('error') or '未知'}")
if abnormal:
lines.append(f"审批异常 {len(abnormal)} 条,分别是:")
for r in abnormal:
lines.append(_item(r))
lines.append(f"详情页:{r.get('detail_url') or '无'}")
if failed:
lines.append(f"另有处理失败 {len(failed)} 条,请查看日志。")
+14
View File
@@ -63,9 +63,12 @@ def generate_report(results: List[Dict[str, Any]]) -> str:
passed = [r for r in results if r.get("decision") == "通过"]
rejected = [r for r in results if r.get("decision") == "驳回"]
review = [r for r in results if r.get("decision") == "人工复核"]
abnormal = [r for r in results if r.get("decision") == "异常"]
failed = [r for r in results if r.get("decision") == "失败"]
summary = f"共 {len(results)} 单:通过 {len(passed)},校验不通过未处理 {len(rejected)},人工复核 {len(review)}"
if abnormal:
summary += f",审批异常 {len(abnormal)}"
if failed:
summary += f",处理失败 {len(failed)}"
@@ -117,4 +120,15 @@ def generate_report(results: List[Dict[str, Any]]) -> str:
lines.append(f"{i}. {_name(r)} | {r.get('title', '')} | 错误: {r.get('error', '')}")
lines.append("")
# ----- 审批异常(审批提交失败,需人工跟进) -----
if abnormal:
lines.append("《请假审批异常待人工确认清单》")
lines.append("(机器已出结论但审批提交未成功,OA 中状态未变,待人工跟进处理)")
for i, r in enumerate(abnormal, 1):
reason = r.get("note") or r.get("error") or ""
url = r.get("detail_url") or "无"
action = r.get("审批动作") or "-"
lines.append(f"{i}. 员工姓名: {_name(r)} | 假期类型: {_vtype(r)} | 审批动作: {action} | 原因: {reason} | 详情页链接: {url}")
lines.append("")
return "\n".join(lines)
@@ -80,11 +80,14 @@ def generate_report(results: List[Dict[str, Any]]) -> str:
rejected = [r for r in results if r.get("decision") == "驳回"]
review = [r for r in results if r.get("decision") == "人工复核"]
overdue = [r for r in results if r.get("decision") == "超期"]
abnormal = [r for r in results if r.get("decision") == "异常"]
failed = [r for r in results if r.get("decision") == "失败"]
summary = f"共 {len(results)} 单:通过 {len(passed)},校验不通过未处理 {len(rejected)},人工复核 {len(review)}"
if overdue:
summary += f",超期待人资处理 {len(overdue)}"
if abnormal:
summary += f",审批异常 {len(abnormal)}"
if failed:
summary += f",处理失败 {len(failed)}"
@@ -145,4 +148,15 @@ def generate_report(results: List[Dict[str, Any]]) -> str:
lines.append(f"{i}. {_name(r)} | {r.get('title', '')} | 错误: {r.get('error', '')}")
lines.append("")
# ----- 审批异常(审批提交失败,需人工跟进) -----
if abnormal:
lines.append("《加班审批异常待人工确认清单》")
lines.append("(机器已出结论但审批提交未成功,OA 中状态未变,待人工跟进处理)")
for i, r in enumerate(abnormal, 1):
reason = r.get("note") or r.get("error") or ""
url = r.get("detail_url") or "无"
action = r.get("审批动作") or "-"
lines.append(f"{i}. 员工姓名: {_name(r)} | 加班类型: {_otype(r)} | 审批动作: {action} | 原因: {reason} | 详情页链接: {url}")
lines.append("")
return "\n".join(lines)