feat(shipping-notice): 增强订单抽取功能,添加进度事件和诊断运行管理,优化数据模型和访问控制
This commit is contained in:
1 parent
ce26d6d0c4
commit
c4095b08da
175 files changed
+13064
-1814
No files matched your search
@@ -218,10 +218,9 @@ def save_definition(data: dict[str, Any], *, actor_id: int | None, request_id: s
|
||||
'Referenced identity definition binding is immutable',
|
||||
code='SHIPPING.IDENTITY_DEFINITION_CONFLICT',
|
||||
)
|
||||
source = field_config.get('context_source') if isinstance(field_config.get('context_source'), dict) else {}
|
||||
automation = 'conditional' if source.get('option_key') in {'from_email', 'from_domain'} and target == 'customer' else 'none'
|
||||
requested_automation = clean_text(data.get('max_automation')).lower() if 'max_automation' in data else automation
|
||||
if requested_automation not in {'none', automation}:
|
||||
# 自动化上限由管理员显式授权,任何字段都不会因来源被默认开启自动确认。
|
||||
requested_automation = clean_text(data.get('max_automation')).lower() if 'max_automation' in data else 'none'
|
||||
if requested_automation not in {'none', 'conditional'}:
|
||||
raise ValidationError('Identity definition automation is invalid', code='SHIPPING.IDENTITY_AUTOMATION_FORBIDDEN')
|
||||
before = _definition_payload(row) if row else None
|
||||
try:
|
||||
@@ -233,7 +232,7 @@ def save_definition(data: dict[str, Any], *, actor_id: int | None, request_id: s
|
||||
row = row or ShippingIdentityDefinition(
|
||||
definition_code=code, display_name=display_name, description=description, evidence_label=evidence_label,
|
||||
target_type=target, context_field_id=field.id,
|
||||
default_weight=weight, max_automation=automation,
|
||||
default_weight=weight, max_automation=requested_automation,
|
||||
created_by_id=actor_id,
|
||||
)
|
||||
row.definition_code = code
|
||||
@@ -243,7 +242,7 @@ def save_definition(data: dict[str, Any], *, actor_id: int | None, request_id: s
|
||||
row.target_type = target
|
||||
row.context_field_id = field.id
|
||||
row.default_weight = weight
|
||||
row.max_automation = automation
|
||||
row.max_automation = requested_automation
|
||||
row.updated_by_id = actor_id
|
||||
if row.id is None:
|
||||
db.session.add(row)
|
||||
|
||||
Reference in new issue
Block a user