|
@@ -16,13 +16,15 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
private readonly IOrderRepository _orderRepository;
|
|
|
private readonly ISnapshotSMSTemplateRepository _snapshotSMSTemplateRepository;
|
|
|
private readonly IIndustryRepository _industryRepository;
|
|
|
+ private readonly IRedPackAuditRepository _redPackAuditRepository;
|
|
|
|
|
|
- public RedPackApplication(IOrderSnapshotRepository orderSnapshotRepository, ISnapshotSMSTemplateRepository snapshotSMSTemplateRepository, IOrderRepository orderRepository, IIndustryRepository industryRepository)
|
|
|
+ public RedPackApplication(IOrderSnapshotRepository orderSnapshotRepository, ISnapshotSMSTemplateRepository snapshotSMSTemplateRepository, IOrderRepository orderRepository, IIndustryRepository industryRepository, IRedPackAuditRepository redPackAuditRepository)
|
|
|
{
|
|
|
_orderSnapshotRepository = orderSnapshotRepository;
|
|
|
_snapshotSMSTemplateRepository = snapshotSMSTemplateRepository;
|
|
|
_orderRepository = orderRepository;
|
|
|
_industryRepository = industryRepository;
|
|
|
+ _redPackAuditRepository = redPackAuditRepository;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -44,62 +46,62 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
|
|
|
public ISugarQueryable<SnapshotOrderAuditItemsOutDto> GetRedPackAuditItemsAsync(SnapshotOrderAuditItemsInDto dto)
|
|
|
{
|
|
|
- var query = _orderSnapshotRepository.Queryable(includeDeleted: true)
|
|
|
- .LeftJoin<Order>((s, o) => s.Id == o.Id)
|
|
|
- .LeftJoin<RedPackAudit>((s, o, r) => s.Id == r.OrderId)
|
|
|
- .LeftJoin<RedPackRecord>((s, o, r, j) => s.Id == j.OrderId)
|
|
|
- .LeftJoin<Industry>((s, o, r, j, i) => s.IndustryId == i.Id)
|
|
|
- .Where((s, o, r, j, i) => o.Status == EOrderStatus.Filed)
|
|
|
- .WhereIF(dto.No.NotNullOrEmpty(), (s, o, r, j) => o.No.Contains(dto.No))
|
|
|
- .WhereIF(dto.Title.NotNullOrEmpty(), (s, o, r, j) => o.Title.Contains(dto.Title))
|
|
|
- .WhereIF(dto.FromPhone.NotNullOrEmpty(), (s, o, r, j) => o.FromPhone.Contains(dto.FromPhone))
|
|
|
- .WhereIF(dto.BeginCreationTime.HasValue && dto.EndCreationTime.HasValue, (s, o, r, j) => o.CreationTime <= dto.EndCreationTime && o.CreationTime >= dto.BeginCreationTime)
|
|
|
- .WhereIF(dto.IsDeal.HasValue, (s, o, r, j) => s.IsDeal == dto.IsDeal)
|
|
|
- .WhereIF(dto.IsTruth.HasValue, (s, o, r, j) => s.IsTruth == dto.IsTruth)
|
|
|
- .WhereIF(dto.BeginAuditTime.HasValue && dto.EndAuditTime.HasValue, (s, o, r, j) => r.AuditTime <= dto.EndAuditTime && r.AuditTime >= dto.BeginAuditTime)
|
|
|
- .WhereIF(dto.IsIssued.HasValue, (s, o, r, j)=> r.IsIssued == dto.IsIssued)
|
|
|
- .WhereIF(dto.IndustryId.NotNullOrEmpty(), (s, o, r, j) => s.IndustryId == dto.IndustryId)
|
|
|
- .WhereIF(dto.ConfigAmount.HasValue, (s, o, r, j, i) => i.CitizenReadPackAmount == dto.ConfigAmount)
|
|
|
- .WhereIF(dto.AcutalAmount.HasValue, (s, o, r, j) => r.AcutalAmount == dto.AcutalAmount)
|
|
|
- .WhereIF(dto.ApprovedAmount.HasValue, (s, o, r, j) => r.ApprovedAmount == dto.ApprovedAmount)
|
|
|
- .WhereIF(dto.IsDanger.HasValue, (s, o, r, j) => s.IsDanger == dto.IsDanger)
|
|
|
- .WhereIF(dto.Status.HasValue, (s, o, r, j) => r.Status == dto.Status)
|
|
|
- .Select((s, o, r, j) => new SnapshotOrderAuditItemsOutDto
|
|
|
+ var query = _redPackAuditRepository.Queryable(includeDeleted: true)
|
|
|
+ .LeftJoin<Order>((redPackAudit, order) => redPackAudit.OrderId == order.Id)
|
|
|
+ .LeftJoin<OrderSnapshot>((redPackAudit, order, snapshot) => redPackAudit.OrderId == snapshot.Id)
|
|
|
+ .LeftJoin<RedPackRecord>((redPackAudit, order, snapshot, record) => redPackAudit.Id == record.OrderId)
|
|
|
+ .LeftJoin<Industry>((redPackAudit, order, snapshot, record, industry) => snapshot.IndustryId == industry.Id)
|
|
|
+ .Where((redPackAudit, order, snapshot, record, industry) => order.Status == EOrderStatus.Filed)
|
|
|
+ .WhereIF(dto.No.NotNullOrEmpty(), (redPackAudit, order, snapshot, record, industry) => order.No.Contains(dto.No))
|
|
|
+ .WhereIF(dto.Title.NotNullOrEmpty(), (redPackAudit, order, snapshot, record, industry) => order.Title.Contains(dto.Title))
|
|
|
+ .WhereIF(dto.FromPhone.NotNullOrEmpty(), (redPackAudit, order, snapshot, record, industry) => order.FromPhone.Contains(dto.FromPhone))
|
|
|
+ .WhereIF(dto.BeginCreationTime.HasValue && dto.EndCreationTime.HasValue, (redPackAudit, order, snapshot, record, industry) => order.CreationTime <= dto.EndCreationTime && order.CreationTime >= dto.BeginCreationTime)
|
|
|
+ .WhereIF(dto.IsDeal.HasValue, (redPackAudit, order, snapshot, record, industry) => snapshot.IsDeal == dto.IsDeal)
|
|
|
+ .WhereIF(dto.IsTruth.HasValue, (redPackAudit, order, snapshot, record, industry) => snapshot.IsTruth == dto.IsTruth)
|
|
|
+ .WhereIF(dto.BeginAuditTime.HasValue && dto.EndAuditTime.HasValue, (redPackAudit, order, snapshot, record, industry) => redPackAudit.AuditTime <= dto.EndAuditTime && redPackAudit.AuditTime >= dto.BeginAuditTime)
|
|
|
+ .WhereIF(dto.IsIssued.HasValue, (redPackAudit, order, snapshot, record, industry) => redPackAudit.IsIssued == dto.IsIssued)
|
|
|
+ .WhereIF(dto.IndustryId.NotNullOrEmpty(), (redPackAudit, order, snapshot, record, industry) => snapshot.IndustryId == dto.IndustryId)
|
|
|
+ .WhereIF(dto.ConfigAmount.HasValue, (redPackAudit, order, snapshot, record, industry) => industry.CitizenReadPackAmount == dto.ConfigAmount)
|
|
|
+ .WhereIF(dto.AcutalAmount.HasValue, (redPackAudit, order, snapshot, record, industry) => redPackAudit.AcutalAmount == dto.AcutalAmount)
|
|
|
+ .WhereIF(dto.ApprovedAmount.HasValue, (redPackAudit, order, snapshot, record, industry) => redPackAudit.ApprovedAmount == dto.ApprovedAmount)
|
|
|
+ .WhereIF(dto.IsDanger.HasValue, (redPackAudit, order, snapshot, record, industry) => snapshot.IsDanger == dto.IsDanger)
|
|
|
+ .WhereIF(dto.Status.HasValue, (redPackAudit, order, snapshot, record, industry) => redPackAudit.Status == dto.Status)
|
|
|
+ .Select((redPackAudit, order, snapshot, record, industry) => new SnapshotOrderAuditItemsOutDto
|
|
|
{
|
|
|
- Id = r.Id,
|
|
|
- RedPackAuditId = r.Id,
|
|
|
- OrderId = s.Id,
|
|
|
- No = o.No,
|
|
|
- Title = o.Title,
|
|
|
- IndustryName = s.IndustryName,
|
|
|
- IndustryId = s.IndustryId,
|
|
|
- SourceChannel = o.SourceChannel,
|
|
|
- SourceChannelCode = o.SourceChannelCode,
|
|
|
- Status = o.Status,
|
|
|
- IsDanger = s.IsDanger,
|
|
|
- FromPhone = o.FromPhone,
|
|
|
- FromName = o.FromName,
|
|
|
- AuditTime = r.AuditTime,
|
|
|
- ApprovedAmount = r.ApprovedAmount,
|
|
|
- AcutalAmount = r.AcutalAmount,
|
|
|
- IsIssued = r.IsIssued,
|
|
|
- RecordRemark = j.Remark,
|
|
|
- County = o.County,
|
|
|
+ Id = redPackAudit.Id,
|
|
|
+ RedPackAuditId = redPackAudit.Id,
|
|
|
+ OrderId = order.Id,
|
|
|
+ No = order.No,
|
|
|
+ Title = order.Title,
|
|
|
+ IndustryName = industry.Name,
|
|
|
+ IndustryId = industry.Id,
|
|
|
+ SourceChannel = order.SourceChannel,
|
|
|
+ SourceChannelCode = order.SourceChannelCode,
|
|
|
+ Status = order.Status,
|
|
|
+ IsDanger = snapshot.IsDanger,
|
|
|
+ FromPhone = order.FromPhone,
|
|
|
+ FromName = order.FromName,
|
|
|
+ AuditTime = redPackAudit.AuditTime,
|
|
|
+ ApprovedAmount = redPackAudit.ApprovedAmount,
|
|
|
+ AcutalAmount = redPackAudit.AcutalAmount,
|
|
|
+ IsIssued = redPackAudit.IsIssued,
|
|
|
+ RecordRemark = record.Remark,
|
|
|
+ County = order.County,
|
|
|
// IsRectify = s.IsRepetition
|
|
|
- IsDeal = s.IsDeal,
|
|
|
- NetworkENumber = s.NetworkENumber,
|
|
|
- IsTruth = s.IsTruth,
|
|
|
- IsRepetition = s.IsRepetition,
|
|
|
- CreationTime = o.CreationTime,
|
|
|
- OrgLevelOneCode = o.OrgLevelOneCode,
|
|
|
- OrgLevelOneName = o.OrgLevelOneName,
|
|
|
- AuditId = r.AuditId,
|
|
|
- AuditName = r.AuditName,
|
|
|
- AuditOrgId = r.AuditOrgId,
|
|
|
- AuditOrgName = r.AuditOrgName,
|
|
|
- AuditRemark = r.AuditRemark,
|
|
|
- BankCardNo = j.BankCardNo,
|
|
|
- OpenBank = j.OpenBank,
|
|
|
+ IsDeal = snapshot.IsDeal,
|
|
|
+ NetworkENumber = snapshot.NetworkENumber,
|
|
|
+ IsTruth = snapshot.IsTruth,
|
|
|
+ IsRepetition = snapshot.IsRepetition,
|
|
|
+ CreationTime = order.CreationTime,
|
|
|
+ OrgLevelOneCode = order.OrgLevelOneCode,
|
|
|
+ OrgLevelOneName = order.OrgLevelOneName,
|
|
|
+ AuditId = redPackAudit.AuditId,
|
|
|
+ AuditName = redPackAudit.AuditName,
|
|
|
+ AuditOrgId = redPackAudit.AuditOrgId,
|
|
|
+ AuditOrgName = redPackAudit.AuditOrgName,
|
|
|
+ AuditRemark = redPackAudit.AuditRemark,
|
|
|
+ BankCardNo = record.BankCardNo,
|
|
|
+ OpenBank = record.OpenBank,
|
|
|
});
|
|
|
return query;
|
|
|
}
|