增加了项目侧关于steps的处理。允许保存和提取steps信息。

This commit is contained in:
strepsiades
2026-03-11 10:34:49 +08:00
parent 291aa0b4b7
commit 1f68bd5ca8
22 changed files with 759 additions and 142 deletions
+47 -8
View File
@@ -111,10 +111,19 @@ class LarApiHandler(BaseApiHandler):
origin_data = node.get_origin_data() or {}
node_updated = False
force_steps_update = self._steps_changed(node)
steps_payload = self._get_request_steps(node)
steps_sent = False
allow_force_steps = True
for schema, api_func in update_configs:
# 获取过滤后的更新数据
update_data = self._filter_update_data(node_data, origin_data, schema)
update_data = self._filter_update_data(
node_data,
origin_data,
schema,
force_full_schema=force_steps_update and allow_force_steps,
)
if update_data:
# 验证并转换为 Pydantic model
try:
@@ -131,8 +140,17 @@ class LarApiHandler(BaseApiHandler):
break
try:
await api_func(self.api_client, update_model, push_id, biz_id)
await api_func(
self.api_client,
update_model,
push_id,
biz_id,
steps=steps_payload if not steps_sent else [],
)
node_updated = True
steps_sent = steps_sent or bool(steps_payload)
allow_force_steps = False
self._mark_approval_snapshot_synced(node)
except Exception as e:
results.append(TaskResult.failed(node_id=node.node_id, error=str(e)))
break
@@ -170,7 +188,14 @@ class LarApiHandler(BaseApiHandler):
# ========== 静态 API 函数 ==========
async def api_update_lar_main(client, data: LarMainInfoUpdateSchema, push_id: str, biz_id: str) -> None:
async def api_update_lar_main(
client,
data: LarMainInfoUpdateSchema,
push_id: str,
biz_id: str,
*,
steps: List[Dict[str, Any]] | None = None,
) -> None:
"""
PUT /lar/main - 更新主数据
@@ -180,13 +205,20 @@ async def api_update_lar_main(client, data: LarMainInfoUpdateSchema, push_id: st
push_id: 推送ID
biz_id: 业务ID
"""
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data.model_dump(exclude_unset=True)}
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data.model_dump(exclude_unset=True), "steps": steps or []}
response = await client.request(method="PUT", endpoint="/lar/main", data=request_data)
if response.get("code") != 200:
raise Exception(f"API error: {response.get('message', 'Unknown error')}")
async def api_update_lar_resettlement(client, data: LarResettlementSchema, push_id: str, biz_id: str) -> None:
async def api_update_lar_resettlement(
client,
data: LarResettlementSchema,
push_id: str,
biz_id: str,
*,
steps: List[Dict[str, Any]] | None = None,
) -> None:
"""
PUT /lar/resettlement - 更新搬迁信息
@@ -196,13 +228,20 @@ async def api_update_lar_resettlement(client, data: LarResettlementSchema, push_
push_id: 推送ID
biz_id: 业务ID
"""
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data.model_dump(exclude_unset=True)}
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data.model_dump(exclude_unset=True), "steps": steps or []}
response = await client.request(method="PUT", endpoint="/lar/resettlement", data=request_data)
if response.get("code") != 200:
raise Exception(f"API error: {response.get('message', 'Unknown error')}")
async def api_update_lar_investment(client, data: LarInvestmentSchema, push_id: str, biz_id: str) -> None:
async def api_update_lar_investment(
client,
data: LarInvestmentSchema,
push_id: str,
biz_id: str,
*,
steps: List[Dict[str, Any]] | None = None,
) -> None:
"""
PUT /lar/investment - 更新投资信息
@@ -212,7 +251,7 @@ async def api_update_lar_investment(client, data: LarInvestmentSchema, push_id:
push_id: 推送ID
biz_id: 业务ID
"""
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data.model_dump(exclude_unset=True)}
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data.model_dump(exclude_unset=True), "steps": steps or []}
response = await client.request(method="PUT", endpoint="/lar/investment", data=request_data)
if response.get("code") != 200:
raise Exception(f"API error: {response.get('message', 'Unknown error')}")