|
@@ -7,8 +7,10 @@ using Hotline.Snapshot;
|
|
|
using Hotline.Snapshot.Interfaces;
|
|
|
using Mapster;
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
+using Senparc.Weixin.MP;
|
|
|
using SqlSugar;
|
|
|
using SqlSugar.Extensions;
|
|
|
+using XF.Domain.Authentications;
|
|
|
using XF.Domain.Dependency;
|
|
|
using XF.Domain.Exceptions;
|
|
|
using XF.Domain.Repository;
|
|
@@ -24,8 +26,10 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
private readonly IRedPackAuditRepository _redPackAuditRepository;
|
|
|
private readonly IRedPackRecordRepository _redPackRecordRepository;
|
|
|
private readonly IRepository<OrderSpecial> _orderSpecialRepository;
|
|
|
+ private readonly ISessionContext _sessionContext;
|
|
|
+ private readonly IRedPackGuiderAuditRepository _redPackGuiderAuditRepository;
|
|
|
|
|
|
- public RedPackApplication(IOrderSnapshotRepository orderSnapshotRepository, ISnapshotSMSTemplateRepository snapshotSMSTemplateRepository, IOrderRepository orderRepository, IIndustryRepository industryRepository, IRedPackAuditRepository redPackAuditRepository, IRedPackRecordRepository redPackRecordRepository, IRepository<OrderSpecial> orderSpecialRepository)
|
|
|
+ public RedPackApplication(IOrderSnapshotRepository orderSnapshotRepository, ISnapshotSMSTemplateRepository snapshotSMSTemplateRepository, IOrderRepository orderRepository, IIndustryRepository industryRepository, IRedPackAuditRepository redPackAuditRepository, IRedPackRecordRepository redPackRecordRepository, IRepository<OrderSpecial> orderSpecialRepository, ISessionContext sessionContext, IRedPackGuiderAuditRepository redPackGuiderAuditRepository)
|
|
|
{
|
|
|
_orderSnapshotRepository = orderSnapshotRepository;
|
|
|
_snapshotSMSTemplateRepository = snapshotSMSTemplateRepository;
|
|
@@ -34,6 +38,8 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
_redPackAuditRepository = redPackAuditRepository;
|
|
|
_redPackRecordRepository = redPackRecordRepository;
|
|
|
_orderSpecialRepository = orderSpecialRepository;
|
|
|
+ _sessionContext = sessionContext;
|
|
|
+ _redPackGuiderAuditRepository = redPackGuiderAuditRepository;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -106,6 +112,11 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
return outDto;
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 红包审核集合
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
public ISugarQueryable<SnapshotOrderAuditItemsOutDto> GetRedPackAuditItemsAsync(SnapshotOrderAuditItemsInDto dto)
|
|
|
{
|
|
|
ERedPackAuditStatus? status = null;
|
|
@@ -281,5 +292,74 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
return order;
|
|
|
}
|
|
|
|
|
|
+ public ISugarQueryable<SnapshotOrderGuiderAuditItemsOutDto> GetRedPackGuiderAuditItemsAsync(SnapshotOrderGuiderAuditItemsInDto dto)
|
|
|
+ {
|
|
|
+ var areaCode = _sessionContext.OrgAreaCode;
|
|
|
+ ERedPackAuditStatus? status = null;
|
|
|
+ if (dto.Status != -1 && Enum.TryParse<ERedPackAuditStatus>(dto.Status.ToString(), out var statusParse))
|
|
|
+ {
|
|
|
+ status = statusParse;
|
|
|
+ }
|
|
|
+
|
|
|
+ var query = _redPackGuiderAuditRepository.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.BeginFiledTime.HasValue && dto.EndFiledTime.HasValue, (redPackAudit, order, snapshot, record, industry) => order.FiledTime <= dto.EndFiledTime && order.FiledTime >= dto.BeginFiledTime)
|
|
|
+ .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.IsTruthDepartment.HasValue, (redPackAudit, order, snapshot, record, industry) => snapshot.IsTruthDepartment == dto.IsTruthDepartment)
|
|
|
+ .WhereIF(dto.BeginAuditTime.HasValue && dto.EndAuditTime.HasValue, (redPackAudit, order, snapshot, record, industry) => redPackAudit.LevelOneAuditTime <= dto.EndAuditTime && redPackAudit.LevelOneAuditTime >= 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(status.HasValue, (redPackAudit, order, snapshot, record, industry) => redPackAudit.LevelOneStatus == status)
|
|
|
+ .Where((redPackAudit, order, snapshot, record, industry) => order.AreaCode == areaCode)
|
|
|
+ .Select((redPackAudit, order, snapshot, record, industry) => new SnapshotOrderGuiderAuditItemsOutDto
|
|
|
+ {
|
|
|
+ Id = redPackAudit.Id,
|
|
|
+ RedPackAuditId = redPackAudit.Id,
|
|
|
+ OrderId = order.Id,
|
|
|
+ No = order.No,
|
|
|
+ Title = order.Title,
|
|
|
+ SourceChannel = order.SourceChannel,
|
|
|
+ SourceChannelCode = order.SourceChannelCode,
|
|
|
+ Status = order.Status,
|
|
|
+ FromPhone = order.FromPhone,
|
|
|
+ FromName = order.FromName,
|
|
|
+ AuditTime = redPackAudit.LevelOneAuditTime,
|
|
|
+ ApprovedAmount = redPackAudit.ApprovedAmount,
|
|
|
+ IsIssued = redPackAudit.IsIssued,
|
|
|
+ County = order.County,
|
|
|
+ // IsRectify = s.IsRepetition
|
|
|
+ IsDeal = snapshot.IsDeal,
|
|
|
+ NetworkENumber = snapshot.NetworkENumber,
|
|
|
+ IsTruth = snapshot.IsTruth,
|
|
|
+ IsTruthDepartment = snapshot.IsTruthDepartment,
|
|
|
+ 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;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
#endregion
|
|
|
}
|