|
@@ -0,0 +1,81 @@
|
|
|
+using Hotline.Orders;
|
|
|
+using Hotline.Share.Dtos.Snapshot;
|
|
|
+using Hotline.Share.Enums.Order;
|
|
|
+using Hotline.Share.Tools;
|
|
|
+using Hotline.Snapshot;
|
|
|
+using Hotline.Snapshot.Interfaces;
|
|
|
+using SqlSugar;
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using XF.Domain.Dependency;
|
|
|
+
|
|
|
+namespace Hotline.Application.Snapshot;
|
|
|
+public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
+{
|
|
|
+ private readonly IOrderSnapshotRepository _orderSnapshotRepository;
|
|
|
+
|
|
|
+ public RedPackApplication(IOrderSnapshotRepository orderSnapshotRepository)
|
|
|
+ {
|
|
|
+ _orderSnapshotRepository = orderSnapshotRepository;
|
|
|
+ }
|
|
|
+
|
|
|
+ public ISugarQueryable<SnapshotOrderAuditItemsOutDto> GetRedPackAuditItemsAsync(SnapshotOrderAuditItemsInDto dto)
|
|
|
+ {
|
|
|
+ var query = _orderSnapshotRepository.Queryable()
|
|
|
+ .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)
|
|
|
+ .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)
|
|
|
+ .Select((s, o, r, j) => new SnapshotOrderAuditItemsOutDto
|
|
|
+ {
|
|
|
+ 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,
|
|
|
+ // 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,
|
|
|
+ });
|
|
|
+ return query;
|
|
|
+ }
|
|
|
+}
|