fix(fulfillment): 支持先分配后补角色或撞锁时的同角色自动合并改挂
This commit is contained in:
@@ -60,16 +60,13 @@ def _apply_customer_profile(
|
||||
if not keys.intersection(snapshot):
|
||||
return
|
||||
task.customer_role_name = str(
|
||||
_snapshot_value(snapshot, "customerRoleName", "customer_role_name")
|
||||
or ""
|
||||
_snapshot_value(snapshot, "customerRoleName", "customer_role_name") or ""
|
||||
)[:128]
|
||||
task.customer_platform = str(
|
||||
_snapshot_value(snapshot, "customerPlatform", "customer_platform")
|
||||
or ""
|
||||
_snapshot_value(snapshot, "customerPlatform", "customer_platform") or ""
|
||||
)[:16]
|
||||
task.customer_system = str(
|
||||
_snapshot_value(snapshot, "customerSystem", "customer_system")
|
||||
or ""
|
||||
_snapshot_value(snapshot, "customerSystem", "customer_system") or ""
|
||||
)[:16]
|
||||
raw_images = _snapshot_value(
|
||||
snapshot,
|
||||
@@ -83,7 +80,9 @@ def _apply_customer_profile(
|
||||
if isinstance(item, str):
|
||||
url = item.strip()
|
||||
if url:
|
||||
images.append({"url": url[:2048], "thumbnailUrl": url[:2048], "objectKey": ""})
|
||||
images.append(
|
||||
{"url": url[:2048], "thumbnailUrl": url[:2048], "objectKey": ""}
|
||||
)
|
||||
continue
|
||||
if not isinstance(item, dict):
|
||||
continue
|
||||
@@ -114,6 +113,24 @@ def _apply_customer_profile(
|
||||
from .binding import sync_customer_role_to_bind_task
|
||||
|
||||
sync_customer_role_to_bind_task(db, task)
|
||||
if (
|
||||
db is not None
|
||||
and task.id is not None
|
||||
and task.account_id is not None
|
||||
and task.customer_role_name
|
||||
and task.binding_status != "bound"
|
||||
):
|
||||
from .allocation import try_reallocate_task_to_same_role
|
||||
from .repository import _integration_actor
|
||||
|
||||
try_reallocate_task_to_same_role(
|
||||
db,
|
||||
task=task,
|
||||
current=_integration_actor(db),
|
||||
role_name=task.customer_role_name,
|
||||
trigger="order_snapshot_sync",
|
||||
commit=False,
|
||||
)
|
||||
|
||||
|
||||
def _upsert_order_snapshot(
|
||||
|
||||
Reference in New Issue
Block a user