From c847fadd067c5ebf4887b7f4972f5ed1159faf18 Mon Sep 17 00:00:00 2001 From: zzh <1368735060@qq.com> Date: Mon, 9 Nov 2026 09:40:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20sync-status=20=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E5=8F=91=E5=B8=83=E6=98=AF=E5=90=A6=E9=9C=80?= =?UTF-8?q?=E5=AE=A1=E6=89=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 供前端发布弹窗按 ApprovalRequired 切换提交文案。 Co-authored-by: Cursor --- .../Channels/SalesProductPublishSyncStatusOutput.cs | 3 +++ .../Services/Channels/SalesProductService.cs | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Oms.Application/Dtos/Channels/SalesProductPublishSyncStatusOutput.cs b/src/Oms.Application/Dtos/Channels/SalesProductPublishSyncStatusOutput.cs index a5043d2..2fb18b4 100644 --- a/src/Oms.Application/Dtos/Channels/SalesProductPublishSyncStatusOutput.cs +++ b/src/Oms.Application/Dtos/Channels/SalesProductPublishSyncStatusOutput.cs @@ -20,6 +20,9 @@ public class SalesProductPublishSyncStatusOutput /// 线上快照内容哈希。 public string? OnlineContentHash { get; set; } + /// 是否已启用价格发布审批定义(前端发布弹窗文案切换用)。 + public bool ApprovalRequired { get; set; } + /// 是否存在在途价格审批(Pending)。 public bool ApprovalPending { get; set; } diff --git a/src/Oms.Application/Services/Channels/SalesProductService.cs b/src/Oms.Application/Services/Channels/SalesProductService.cs index e4fc840..f923a0d 100644 --- a/src/Oms.Application/Services/Channels/SalesProductService.cs +++ b/src/Oms.Application/Services/Channels/SalesProductService.cs @@ -38,6 +38,8 @@ public partial class SalesProductService : ApplicationService LazyServiceProvider.GetRequiredService(); private IApprovalTaskRepository ApprovalTaskRepository => LazyServiceProvider.GetRequiredService(); + private IApprovalDefinitionRepository ApprovalDefinitionRepository => + LazyServiceProvider.GetRequiredService(); /// /// 查询销售产品列表。 @@ -438,7 +440,8 @@ public partial class SalesProductService : ApplicationService ? OmsDocHelper.HashSalesProductPriceSnapshotForSync(currentSnapshot) : OmsDocHelper.HashSalesProductRulesSnapshotForSync(currentSnapshot)); - // 价格:在途审批,或最近一次失败终态(驳回/撤回/执行失败)供重新提交引导 + // 价格:是否启用审批定义 + 在途/失败终态 + var approvalRequired = false; var approvalPending = false; var approvalFailed = false; int? approvalInstanceId = null; @@ -447,6 +450,10 @@ public partial class SalesProductService : ApplicationService string? approvalComment = null; if (normalized == PriceOperatorType) { + var enabledDef = await ApprovalDefinitionRepository.FirstOrDefaultAsync(x => + x.OperationCode == ApprovalCodes.SalesProductPublishPrice && x.IsEnabled); + approvalRequired = enabledDef != null; + var approvalState = await ResolvePricePublishApprovalStateAsync(salesProductId); approvalPending = approvalState.Pending; approvalFailed = approvalState.Failed; @@ -501,6 +508,7 @@ public partial class SalesProductService : ApplicationService OnlinePublishTime = onlinePublishTime, PendingContentHash = currentHash, OnlineContentHash = onlineContentHash, + ApprovalRequired = approvalRequired, ApprovalPending = approvalPending, ApprovalFailed = approvalFailed, ApprovalInstanceId = approvalInstanceId,