All checks were successful
Build and Deploy / deploy (push) Successful in 1m18s
为老板看板提供服务端区间汇总(总览、排行/漏斗与导出),应收应付列表带上 AgentId 供财务分析代理维使用。 Co-authored-by: Cursor <cursoragent@cursor.com>
119 lines
5.1 KiB
C#
119 lines
5.1 KiB
C#
using Fake.Domain.Repositories;
|
||
using Oms.Domain.MarketingAggregate.Entities;
|
||
using Oms.Domain.MarketingAggregate.Enums;
|
||
|
||
namespace Oms.Domain.MarketingAggregate.Repositories;
|
||
|
||
public interface ICustomerReferralCodeRepository : IRepository<CustomerReferralCode>
|
||
{
|
||
Task<CustomerReferralCode?> GetByCustomerIdAsync(int customerId, CancellationToken cancellationToken = default);
|
||
|
||
Task<CustomerReferralCode?> GetByInviteCodeAsync(string inviteCode, CancellationToken cancellationToken = default);
|
||
|
||
Task<bool> ExistsInviteCodeAsync(string inviteCode, int? excludeId = null, CancellationToken cancellationToken = default);
|
||
}
|
||
|
||
public interface IMemberPointsRuleRepository : IRepository<MemberPointsRule>
|
||
{
|
||
Task<MemberPointsRule?> GetActiveRuleAsync(CancellationToken cancellationToken = default);
|
||
}
|
||
|
||
public interface ICustomerPointsAccountRepository : IRepository<CustomerPointsAccount>
|
||
{
|
||
Task<CustomerPointsAccount?> GetByCustomerIdAsync(int customerId, CancellationToken cancellationToken = default);
|
||
}
|
||
|
||
public interface ICustomerPointsFlowRepository : IRepository<CustomerPointsFlow>
|
||
{
|
||
Task<bool> ExistsEarnForOrderAsync(int customerId, int orderId, CancellationToken cancellationToken = default);
|
||
|
||
Task<bool> ExistsClawbackForOrderAsync(int customerId, int orderId, CancellationToken cancellationToken = default);
|
||
|
||
Task<int> GetEarnPointsForOrderAsync(int customerId, int orderId, CancellationToken cancellationToken = default);
|
||
|
||
Task<int> SumPointsSinceAsync(int customerId, DateTime since, CancellationToken cancellationToken = default);
|
||
}
|
||
|
||
public interface ICouponTemplateRepository : IRepository<CouponTemplate>
|
||
{
|
||
Task<bool> ExistsTemplateCodeAsync(string templateCode, int? excludeId = null, CancellationToken cancellationToken = default);
|
||
}
|
||
|
||
public interface ICouponInstanceRepository : IRepository<CouponInstance>
|
||
{
|
||
Task<int> CountByTemplateAndCustomerAsync(int templateId, int customerId, CancellationToken cancellationToken = default);
|
||
|
||
Task<List<CouponInstance>> GetAvailableByCustomerAsync(int customerId, CancellationToken cancellationToken = default);
|
||
|
||
Task<List<CouponInstance>> GetPendingUnlockByCustomerAsync(int customerId, CancellationToken cancellationToken = default);
|
||
|
||
Task<List<CouponInstance>> GetExpiredLocksAsync(DateTime now, int take, CancellationToken cancellationToken = default);
|
||
|
||
Task<List<CouponInstance>> GetExpiredAvailableAsync(DateTime now, int take, CancellationToken cancellationToken = default);
|
||
|
||
Task<List<CouponInstance>> GetExpiringAvailableAsync(DateTime from, DateTime to, int take, CancellationToken cancellationToken = default);
|
||
|
||
/// <summary>
|
||
/// 当前可用券张数(时点负债)。
|
||
/// </summary>
|
||
Task<int> CountAvailableAsync(CancellationToken cancellationToken = default);
|
||
|
||
/// <summary>
|
||
/// 区间内发出的券(ReceiveTime)。
|
||
/// </summary>
|
||
Task<List<CouponInstance>> ListReceivedInRangeAsync(
|
||
DateTime startInclusive,
|
||
DateTime endExclusive,
|
||
CancellationToken cancellationToken = default);
|
||
|
||
/// <summary>
|
||
/// 区间内核销的券(UseTime + Used)。
|
||
/// </summary>
|
||
Task<List<CouponInstance>> ListUsedInRangeAsync(
|
||
DateTime startInclusive,
|
||
DateTime endExclusive,
|
||
CancellationToken cancellationToken = default);
|
||
|
||
/// <summary>
|
||
/// 区间内过期的券(Expired + ValidEndTime)。
|
||
/// </summary>
|
||
Task<List<CouponInstance>> ListExpiredInRangeAsync(
|
||
DateTime startInclusive,
|
||
DateTime endExclusive,
|
||
CancellationToken cancellationToken = default);
|
||
}
|
||
|
||
public interface IReferralCommissionRuleRepository : IRepository<ReferralCommissionRule>
|
||
{
|
||
Task<ReferralCommissionRule?> GetActiveRuleAsync(CancellationToken cancellationToken = default);
|
||
}
|
||
|
||
public interface IReferralCommissionDetailRepository : IRepository<ReferralCommissionDetail>
|
||
{
|
||
Task<ReferralCommissionDetail?> GetByOrderAndReferrerAsync(int orderId, int referrerCustomerId, CancellationToken cancellationToken = default);
|
||
|
||
Task<ReferralCommissionDetail?> GetByOrderIdAsync(int orderId, CancellationToken cancellationToken = default);
|
||
|
||
Task<decimal> SumByReferrerAsync(int referrerCustomerId, CommissionStatus status, CancellationToken cancellationToken = default);
|
||
|
||
Task<decimal> SumSettledCommissionInMonthAsync(int referrerCustomerId, int year, int month, CancellationToken cancellationToken = default);
|
||
|
||
Task<List<ReferralCommissionDetail>> GetPendingSettleAsync(DateTime now, int take, CancellationToken cancellationToken = default);
|
||
|
||
Task<List<ReferralCommissionDetail>> ListByReferrerAndRefereesAsync(
|
||
int referrerCustomerId,
|
||
int[] refereeIds,
|
||
CancellationToken cancellationToken = default);
|
||
}
|
||
|
||
public interface ICommissionWithdrawRequestRepository : IRepository<CommissionWithdrawRequest>
|
||
{
|
||
Task<bool> ExistsPendingByCustomerAsync(int customerId, CancellationToken cancellationToken = default);
|
||
|
||
Task<bool> ExistsSerialNumberAsync(string serialNumber, CancellationToken cancellationToken = default);
|
||
}
|
||
|
||
public interface IMarketingAuditLogRepository : IRepository<MarketingAuditLog>
|
||
{
|
||
}
|