|
@@ -28,8 +28,9 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
private readonly ISessionContext _sessionContext;
|
|
|
private readonly IRedPackGuiderAuditRepository _redPackGuiderAuditRepository;
|
|
|
private readonly IThirdAccountRepository _thirdAccountRepository;
|
|
|
+ private readonly ISupplementRecordRepository _supplementRecordRepository;
|
|
|
|
|
|
- public RedPackApplication(IOrderSnapshotRepository orderSnapshotRepository, ISnapshotSMSTemplateRepository snapshotSMSTemplateRepository, IOrderRepository orderRepository, IIndustryRepository industryRepository, IRedPackAuditRepository redPackAuditRepository, IRedPackRecordRepository redPackRecordRepository, IRepository<OrderSpecial> orderSpecialRepository, ISessionContext sessionContext, IRedPackGuiderAuditRepository redPackGuiderAuditRepository, IThirdAccountRepository thirdAccountRepository)
|
|
|
+ public RedPackApplication(IOrderSnapshotRepository orderSnapshotRepository, ISnapshotSMSTemplateRepository snapshotSMSTemplateRepository, IOrderRepository orderRepository, IIndustryRepository industryRepository, IRedPackAuditRepository redPackAuditRepository, IRedPackRecordRepository redPackRecordRepository, IRepository<OrderSpecial> orderSpecialRepository, ISessionContext sessionContext, IRedPackGuiderAuditRepository redPackGuiderAuditRepository, IThirdAccountRepository thirdAccountRepository, ISupplementRecordRepository supplementRecordRepository)
|
|
|
{
|
|
|
_orderSnapshotRepository = orderSnapshotRepository;
|
|
|
_snapshotSMSTemplateRepository = snapshotSMSTemplateRepository;
|
|
@@ -41,6 +42,7 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
_sessionContext = sessionContext;
|
|
|
_redPackGuiderAuditRepository = redPackGuiderAuditRepository;
|
|
|
_thirdAccountRepository = thirdAccountRepository;
|
|
|
+ _supplementRecordRepository = supplementRecordRepository;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -394,12 +396,22 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
.FirstAsync() ?? throw UserFriendlyException.SameMessage("审核记录不存在");
|
|
|
var audit = await _redPackAuditRepository.GetAsync(dto.RedPackAuditId) ?? throw UserFriendlyException.SameMessage("审核记录不存在");
|
|
|
|
|
|
- dto.Adapt(record);
|
|
|
- await _redPackRecordRepository.UpdateAsync(record);
|
|
|
-
|
|
|
dto.Adapt(audit);
|
|
|
await _redPackAuditRepository.UpdateAsync(audit);
|
|
|
|
|
|
+ var entity = dto.Adapt<SupplementRecord>();
|
|
|
+ var industryName = await _orderSnapshotRepository.Queryable()
|
|
|
+ .Where(m => m.Id == record.OrderId)
|
|
|
+ .Select(m => new { m.IndustryName, m.IndustryId })
|
|
|
+ .FirstAsync();
|
|
|
+ entity.OrderId = record.OrderId;
|
|
|
+ entity.RedPackRecordId = record.Id;
|
|
|
+ entity.RedPackAuditId = audit.Id;
|
|
|
+ entity.No = record.No;
|
|
|
+ entity.IndustryName = industryName.IndustryName;
|
|
|
+ entity.IndustryId = industryName.IndustryId;
|
|
|
+ await _supplementRecordRepository.AddAsync(entity);
|
|
|
+
|
|
|
if (dto.IsSendSMS)
|
|
|
{
|
|
|
// TODO: 发送短信
|
|
@@ -495,9 +507,17 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
return query;
|
|
|
}
|
|
|
|
|
|
- public Task<PagedDto<SnapshotRedPackRecordSupplementItemsOutDto>> GetRedPackRecordSupplementItemsAsync(SnapshotRedPackRecordSupplementItemsInDto dto)
|
|
|
+ public ISugarQueryable<SnapshotRedPackRecordSupplementItemsOutDto> GetRedPackRecordSupplementItemsAsync(SnapshotRedPackRecordSupplementItemsInDto dto)
|
|
|
{
|
|
|
- throw new NotImplementedException();
|
|
|
+ var query = _supplementRecordRepository.Queryable()
|
|
|
+ .LeftJoin<Order>((supp, order) => supp.OrderId == order.Id)
|
|
|
+ .WhereIF(dto.No.NotNullOrEmpty(), (supp, order) => order.No.Contains(dto.No))
|
|
|
+ .WhereIF(dto.FromPhone.NotNullOrEmpty(), (supp, order) => order.FromPhone.Contains(dto.FromPhone))
|
|
|
+ .WhereIF(dto.Title.NotNullOrEmpty(), (supp, order) => order.Title.Contains(dto.Title))
|
|
|
+ .WhereIF(dto.IndustryId.NotNullOrEmpty(), (supp, order) => supp.IndustryId == dto.IndustryId)
|
|
|
+ .WhereIF(dto.BeginCreationTime.HasValue && dto.EndCreationTime.HasValue, (supp, order) => supp.CreationTime >= dto.BeginCreationTime && supp.CreationTime <= dto.EndCreationTime)
|
|
|
+ .Select<SnapshotRedPackRecordSupplementItemsOutDto>();
|
|
|
+ return query;
|
|
|
}
|
|
|
|
|
|
|