feat: restore source parity and harden agent runtime
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
抄送节点处理器
|
||||
处理抄送任务的创建
|
||||
"""
|
||||
import logging
|
||||
from typing import Dict, TYPE_CHECKING
|
||||
|
||||
from online_dev.workflow.engine.handlers.base_handler import BaseNodeHandler
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from online_dev.workflow.engine.base import ExecutionContext
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class CopyHandler(BaseNodeHandler):
|
||||
"""
|
||||
抄送节点处理器
|
||||
|
||||
抄送节点创建抄送任务后自动推进到下一节点
|
||||
"""
|
||||
|
||||
async def execute(self, context: 'ExecutionContext', node: Dict) -> None:
|
||||
"""
|
||||
执行抄送节点:创建抄送任务并继续推进
|
||||
"""
|
||||
from online_dev.workflow.engine.assignee_resolver import assignee_resolver
|
||||
|
||||
node_config = self.get_node_config(node)
|
||||
|
||||
# 解析抄送人
|
||||
assignee_ids = await assignee_resolver.resolve(
|
||||
context.db,
|
||||
node_config,
|
||||
context.instance,
|
||||
context.form_data,
|
||||
)
|
||||
|
||||
logger.info(f"创建抄送任务 - 节点: {self.get_node_id(node)}, 抄送人数: {len(assignee_ids)}")
|
||||
|
||||
# 创建抄送任务
|
||||
for assignee_id in assignee_ids:
|
||||
await self.create_task(context, node, assignee_id, 'copy')
|
||||
|
||||
# 记录抄送日志(系统自动执行,不关联用户)
|
||||
await self.create_log(
|
||||
context, node, 'copy',
|
||||
comment=f'抄送给 {len(assignee_ids)} 人',
|
||||
extra_data={
|
||||
'assignee_ids': assignee_ids,
|
||||
},
|
||||
operator_id='',
|
||||
)
|
||||
|
||||
# 抄送后继续推进(不等待)
|
||||
await self.advance_to_next(context, node)
|
||||
Reference in New Issue
Block a user