chat聊天OA请假优化

This commit is contained in:
runny committed 2026-05-16 16:55:23 +08:00
1 parent 3b31867319
commit 05abffc5f0
5 files changed
+67 -25

No files matched your search

+7
View File
@@ -24,6 +24,13 @@ RUN set -eux; \
libxext6 \
libreoffice \
fonts-noto-cjk \
curl \
gnupg2 \
unixodbc-dev \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/12/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql18 \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
+16 -16
View File
@@ -198,22 +198,14 @@ WHERE c002001 = ?
return str(datetime.now().year)
@classmethod
def _render_section(cls, title: str, record: dict | None, requested_year: int | None) -> str:
def _render_table_row(cls, index: int, title: str, record: dict | None, requested_year: int | None) -> str:
response_year = cls._resolve_response_year(record, requested_year)
if not record:
return (
f"### {title}\n\n"
f"暂未查询到您 {response_year} 年度的{title}记录。"
)
remaining = cls._format_quota(record.get("remaining_hours"))
return (
f"### {title}\n\n"
f"您当前{title}剩余额度为 {remaining}。\n"
f"- 年度:{response_year}\n"
f"- 年度可休:{cls._format_quota(record.get('total_hours'))}\n"
f"- 已休:{cls._format_quota(record.get('used_hours'))}\n"
f"- 当前剩余:{remaining}"
)
return f"| {index} | {title} | {response_year} | 暂无数据 | 暂无数据 | 暂无数据 |"
total = cls._format_quota(record.get('total_hours'))
used = cls._format_quota(record.get('used_hours'))
remaining = cls._format_quota(record.get('remaining_hours'))
return f"| {index} | {title} | {response_year} | {total} | {used} | {remaining} |"
@classmethod
def _build_result_text(cls, leave_type: str, requested_year: int | None, annual_result, childcare_result):
@@ -235,11 +227,19 @@ WHERE c002001 = ?
)
sections = [
f"您好,已为您查询到 {intro_year} 年度假期情况:",
"",
"| 序号 | 假别 | 年度 | 可休 | 已休 | 当前剩余 |",
"| :---: | :---: | :---: | :---: | :---: | :---: |",
]
index = 1
if leave_type in ("annual", "all"):
sections.extend(["", cls._render_section("年假", annual_record, requested_year)])
sections.append(cls._render_table_row(index, "年假", annual_record, requested_year))
index += 1
if leave_type in ("childcare", "all"):
sections.extend(["", cls._render_section("育儿假", childcare_record, requested_year)])
sections.append(cls._render_table_row(index, "育儿假", childcare_record, requested_year))
index += 1
sections.extend(
[
"",
+10 -3
View File
@@ -214,6 +214,13 @@ class OALeaveWorkflowService:
if show_node is None:
show_node = ET.SubElement(field, f'{{{WORKFLOW_NS}}}fieldShowValue')
show_node.text = str(show_value)
# 强制将字段设为可编辑和可见,防止OA流程节点中被配置为只读导致无法写入
for tag in ['edit', 'view']:
node = field.find(f'wf:{tag}', NS)
if node is None:
node = ET.SubElement(field, f'{{{WORKFLOW_NS}}}{tag}')
node.text = 'true'
@classmethod
def _set_text(cls, parent: ET.Element, xpath: str, value: str) -> None:
@@ -290,11 +297,11 @@ class OALeaveWorkflowService:
cls._set_text(request_info, './/wf:workflowBaseInfo/wf:workflowId', workflow_id)
cls._set_field(request_info, 'requestname', value=request_name, show_value=request_name)
cls._set_field(request_info, 'tdrgh', value=filler['employee_id'], show_value=filler['employee_id'])
cls._set_field(request_info, 'sqrgh', value=applicant['employee_id'], show_value=applicant['employee_id'])
cls._set_field(request_info, 'tdrgh', value=filler['employee_id'])
cls._set_field(request_info, 'sqrgh', value=applicant['employee_id'])
cls._set_field(request_info, 'tdrxm', value=filler['user_id'], show_value=filler['name'])
cls._set_field(request_info, 'sqrxm', value=applicant['user_id'], show_value=applicant['name'])
cls._set_field(request_info, 'dlrgh', value=agent['employee_id'], show_value=agent['employee_id'])
cls._set_field(request_info, 'dlrgh', value=agent['employee_id'])
cls._set_field(request_info, 'dlrxm', value=agent['user_id'], show_value=agent['name'])
cls._set_field(request_info, 'dlrlogid', value=agent['user_id'], show_value=agent['user_id'])
cls._set_field(request_info, 'jb', value=leave_type_code, show_value=leave_type_label)
+2 -1
View File
@@ -18,7 +18,8 @@ cryptography
oracledb
jaydebeapi
JPype1
pyodbc
pyodbc>=5.1.0
zeep>=4.2.1
pywin32; sys_platform == "win32"
# File Parsing & edkb_system dependencies from xinxin2