fix(kb): 处理excel清洗问题

(cherry picked from commit 1a0ceebc3340848171e2cc14d0a7b04c2dda4748)
This commit is contained in:
sophie committed 2026-08-20 15:01:23 +08:00
1 parent 7736a6991e
commit 87ac58c394
4 files changed
+166 -75

No files matched your search

+1 -18
View File
@@ -34,10 +34,7 @@ class OALeaveWorkflowError(RuntimeError):
class OALeaveWorkflowService:
WORKFLOW_ID = '879'
OA_USER_MAP = {
'26030025': {'user_id': '21784', 'name': '梁春艳'},
'26040006': {'user_id': '21823', 'name': '刘义亮'},
}
# Keep backend leave labels aligned with the chat form options so OA browser
# fields always receive the expected showValue instead of a raw code.
LEAVE_TYPE_LABELS = {
@@ -131,20 +128,6 @@ class OALeaveWorkflowService:
raise OALeaveWorkflowError('OA WorkflowService 返回了无法解析的 XML。') from exc
raise OALeaveWorkflowError(f'OA WorkflowService 请求失败(重试{max_retries}次后仍出错):{last_exc}') from last_exc
@classmethod
def resolve_oa_user(cls, employee_id: str | None, real_name: str | None = None) -> dict[str, str]:
employee_id = (employee_id or '').strip()
if not employee_id:
raise OALeaveWorkflowError('缺少员工工号,无法匹配 OA 用户。')
matched = cls.OA_USER_MAP.get(employee_id)
if not matched:
raise OALeaveWorkflowError(f'工号 {employee_id} 暂未配置 OA userid 映射。')
return {
'employee_id': employee_id,
'user_id': matched['user_id'],
'name': (real_name or matched.get('name') or '').strip() or matched['name'],
}
@classmethod
def resolve_creator_oa_user(cls, employee_id: str | None, real_name: str | None = None) -> dict[str, str]:
return cls._resolve_runtime_oa_user(employee_id, real_name, role_label='请假人')