feat: Enhance network membership and withdrawal processing with user tracking and logging

This commit is contained in:
masoodafar-web
2025-12-01 20:52:18 +03:30
parent 4aaf2247ff
commit 25fc73ae28
47 changed files with 9545 additions and 284 deletions
@@ -70,6 +70,21 @@ public class UserCommissionPayout : BaseAuditableEntity
/// </summary>
public DateTime? WithdrawnAt { get; set; }
/// <summary>
/// شناسه ادمینی که درخواست را پردازش کرد
/// </summary>
public string? ProcessedBy { get; set; }
/// <summary>
/// تاریخ پردازش توسط ادمین
/// </summary>
public DateTime? ProcessedAt { get; set; }
/// <summary>
/// دلیل رد (در صورت رد شدن)
/// </summary>
public string? RejectionReason { get; set; }
/// <summary>
/// CommissionPayoutHistory Collection Navigation Reference
/// </summary>
@@ -0,0 +1,95 @@
using CMSMicroservice.Domain.Common;
namespace CMSMicroservice.Domain.Entities.Commission;
/// <summary>
/// لاگ اجرای Worker برای مانیتورینگ
/// </summary>
public class WorkerExecutionLog : BaseAuditableEntity
{
/// <summary>
/// شناسه یکتا برای هر اجرا (Correlation ID)
/// </summary>
public Guid ExecutionId { get; set; }
/// <summary>
/// شماره هفته (مثلاً 2025-W48)
/// </summary>
public string WeekNumber { get; set; } = string.Empty;
/// <summary>
/// زمان شروع اجرا
/// </summary>
public DateTime StartedAt { get; set; }
/// <summary>
/// زمان اتمام اجرا
/// </summary>
public DateTime? CompletedAt { get; set; }
/// <summary>
/// مدت زمان اجرا (میلی‌ثانیه)
/// </summary>
public long? DurationMs { get; set; }
/// <summary>
/// وضعیت اجرا
/// </summary>
public WorkerExecutionStatus Status { get; set; }
/// <summary>
/// تعداد تراکنش‌های پردازش شده
/// </summary>
public int ProcessedCount { get; set; }
/// <summary>
/// تعداد خطاها
/// </summary>
public int ErrorCount { get; set; }
/// <summary>
/// پیام خطا (در صورت وجود)
/// </summary>
public string? ErrorMessage { get; set; }
/// <summary>
/// Stack trace خطا
/// </summary>
public string? ErrorStackTrace { get; set; }
/// <summary>
/// جزئیات اضافی (JSON)
/// </summary>
public string? Details { get; set; }
}
/// <summary>
/// وضعیت اجرای Worker
/// </summary>
public enum WorkerExecutionStatus
{
/// <summary>
/// در حال اجرا
/// </summary>
Running = 0,
/// <summary>
/// موفق
/// </summary>
Success = 1,
/// <summary>
/// با خطا مواجه شد
/// </summary>
Failed = 2,
/// <summary>
/// کنسل شد
/// </summary>
Cancelled = 3,
/// <summary>
/// موفق با هشدار
/// </summary>
SuccessWithWarnings = 4
}
@@ -21,20 +21,62 @@ public class NetworkWeeklyBalance : BaseAuditableEntity
public string WeekNumber { get; set; }
/// <summary>
/// تعداد تعادل شاخه چپ در این هفته
/// تعداد اعضای جدید شاخه چپ در این هفته
/// </summary>
public int LeftLegNewMembers { get; set; }
/// <summary>
/// تعداد اعضای جدید شاخه راست در این هفته
/// </summary>
public int RightLegNewMembers { get; set; }
/// <summary>
/// باقیمانده شاخه چپ از هفته قبل (Carryover)
/// </summary>
public int LeftLegCarryover { get; set; }
/// <summary>
/// باقیمانده شاخه راست از هفته قبل (Carryover)
/// </summary>
public int RightLegCarryover { get; set; }
/// <summary>
/// مجموع شاخه چپ: LeftLegNewMembers + LeftLegCarryover
/// </summary>
public int LeftLegTotal { get; set; }
/// <summary>
/// مجموع شاخه راست: RightLegNewMembers + RightLegCarryover
/// </summary>
public int RightLegTotal { get; set; }
/// <summary>
/// تعداد تعادل (امتیاز): MIN(LeftLegTotal, RightLegTotal)
/// </summary>
public int TotalBalances { get; set; }
/// <summary>
/// باقیمانده شاخه چپ برای هفته بعد
/// </summary>
public int LeftLegRemainder { get; set; }
/// <summary>
/// باقیمانده شاخه راست برای هفته بعد
/// </summary>
public int RightLegRemainder { get; set; }
/// <summary>
/// [DEPRECATED] تعداد تعادل شاخه چپ - استفاده نشود
/// </summary>
[Obsolete("Use LeftLegTotal instead")]
public int LeftLegBalances { get; set; }
/// <summary>
/// تعداد تعادل شاخه راست در این هفته
/// [DEPRECATED] تعداد تعادل شاخه راست - استفاده نشود
/// </summary>
[Obsolete("Use RightLegTotal instead")]
public int RightLegBalances { get; set; }
/// <summary>
/// امتیاز کاربر: MIN(LeftLegBalances, RightLegBalances)
/// </summary>
public int TotalBalances { get; set; }
/// <summary>
/// مبلغی که از این کاربر به استخر هفتگی اضافه شد (ریال)
/// </summary>