Merge branch 'dev' into test
This commit is contained in:
commit
d7e69e02fb
7 files changed
+71
-27
No files matched your search
@@ -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
|
||||
|
||||
@@ -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(
|
||||
[
|
||||
"",
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -15,7 +15,8 @@ worker_class = "gevent"
|
||||
|
||||
# 进程数
|
||||
# 公式: 2 * CPU核心数 + 1
|
||||
workers = multiprocessing.cpu_count() * 2 + 1
|
||||
# workers = multiprocessing.cpu_count() * 2 + 1
|
||||
min(int(os.getenv("GUNICORN_WORKERS", "9")), multiprocessing.cpu_count() * 2 + 1)
|
||||
|
||||
# 每个 Worker 的最大并发连接数
|
||||
worker_connections = 1000
|
||||
|
||||
@@ -4,6 +4,7 @@ backend/gunicorn_config.py
|
||||
生产环境 Gunicorn 配置 (支持高并发)
|
||||
"""
|
||||
import multiprocessing
|
||||
import os
|
||||
|
||||
# 绑定地址
|
||||
bind = "0.0.0.0:8000"
|
||||
@@ -12,7 +13,7 @@ bind = "0.0.0.0:8000"
|
||||
worker_class = "gevent"
|
||||
|
||||
# Worker 数量:通常 CPU 核数 * 2 + 1
|
||||
workers = multiprocessing.cpu_count() * 2 + 1
|
||||
workers = min(int(os.getenv("GUNICORN_WORKERS", "9")), multiprocessing.cpu_count() * 2 + 1)
|
||||
|
||||
# 核心:每个 Worker 最大并发连接数
|
||||
# Gevent 下这个值可以设置得很高,支持海量 SSE 连接
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -666,11 +666,38 @@ const formatDurationLabel = (hours: number) => {
|
||||
return `${hours} 小时`;
|
||||
};
|
||||
|
||||
const createLeaveFormData = (): LeaveRequestFormData => {
|
||||
const extractLeaveTypeFromIntent = (content: string) => {
|
||||
if (!content) return '';
|
||||
const map: Record<string, string> = {
|
||||
'事假': '005',
|
||||
'病假': '006',
|
||||
'丧假': '007',
|
||||
'年假': '010',
|
||||
'因公出差': '021',
|
||||
'出差': '021',
|
||||
'调休': '025',
|
||||
'产假': '401',
|
||||
'陪产假': '402',
|
||||
'婚假': '403',
|
||||
'住院': '405',
|
||||
'工伤': '406',
|
||||
'育儿假': '408',
|
||||
'返乡': 'ZZ01',
|
||||
};
|
||||
for (const [key, val] of Object.entries(map)) {
|
||||
if (content.includes(key)) {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
const createLeaveFormData = (content?: string): LeaveRequestFormData => {
|
||||
const now = new Date();
|
||||
const oneHourLater = new Date(now.getTime() + 60 * 60 * 1000);
|
||||
const startTime = formatDateTime(now);
|
||||
const endTime = formatDateTime(oneHourLater);
|
||||
const initialLeaveType = extractLeaveTypeFromIntent(content || '');
|
||||
return {
|
||||
applicantName: currentUserDisplayName.value,
|
||||
employeeId: currentUserEmployeeId.value,
|
||||
@@ -680,7 +707,7 @@ const createLeaveFormData = (): LeaveRequestFormData => {
|
||||
agentUid: '',
|
||||
agentEmployeeId: '',
|
||||
agentName: '',
|
||||
leaveType: '',
|
||||
leaveType: initialLeaveType,
|
||||
startTime,
|
||||
endTime,
|
||||
durationHours: calculateDurationHours(startTime, endTime),
|
||||
@@ -705,8 +732,8 @@ const isStrongLeaveIntent = (content: string) => {
|
||||
// 弱意图(咨询流程/步骤)应走正常问答,不触发表单分流。
|
||||
const weakConsultationIntent = /(请假流程|请假怎么走|请假步骤|请假如何申请|请假如何走流程|请假怎么办|请假需要什么|请假规定)/;
|
||||
if (weakConsultationIntent.test(normalized)) return false;
|
||||
if (/^(请假|休假)$/.test(normalized)) return true;
|
||||
return /(我要请假|申请请假|发起请假|请假申请|我要休假|申请休假|我要请个假|想请假|帮我请假|代我请假|提交请假)/.test(normalized);
|
||||
if (/^(请假|休假|年假|事假|病假|调休)$/.test(normalized)) return true;
|
||||
return /(我要请|申请请|发起请|请假申请|我要休|申请休|想请|帮我请|代我请|提交请)/.test(normalized);
|
||||
};
|
||||
|
||||
const saveLocalMessageToBackend = async (msg: any, userQuery: string = '') => {
|
||||
@@ -744,7 +771,7 @@ const startLocalLeaveFlow = async (content: string) => {
|
||||
const formId = newLocalMessageId('leave-form');
|
||||
const payload: LeaveFormPayload = {
|
||||
formId,
|
||||
form: createLeaveFormData(),
|
||||
form: createLeaveFormData(content),
|
||||
submitting: false,
|
||||
confirmationGenerated: false,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user