feat: sync-status 返回价格发布是否需审批
All checks were successful
Build and Deploy / deploy (push) Successful in 1m15s
All checks were successful
Build and Deploy / deploy (push) Successful in 1m15s
供前端发布弹窗按 ApprovalRequired 切换提交文案。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
6e061323e9
commit
c847fadd06
@ -20,6 +20,9 @@ public class SalesProductPublishSyncStatusOutput
|
||||
/// <summary>线上快照内容哈希。</summary>
|
||||
public string? OnlineContentHash { get; set; }
|
||||
|
||||
/// <summary>是否已启用价格发布审批定义(前端发布弹窗文案切换用)。</summary>
|
||||
public bool ApprovalRequired { get; set; }
|
||||
|
||||
/// <summary>是否存在在途价格审批(Pending)。</summary>
|
||||
public bool ApprovalPending { get; set; }
|
||||
|
||||
|
||||
@ -38,6 +38,8 @@ public partial class SalesProductService : ApplicationService
|
||||
LazyServiceProvider.GetRequiredService<IApprovalInstanceRepository>();
|
||||
private IApprovalTaskRepository ApprovalTaskRepository =>
|
||||
LazyServiceProvider.GetRequiredService<IApprovalTaskRepository>();
|
||||
private IApprovalDefinitionRepository ApprovalDefinitionRepository =>
|
||||
LazyServiceProvider.GetRequiredService<IApprovalDefinitionRepository>();
|
||||
|
||||
/// <summary>
|
||||
/// 查询销售产品列表。
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user