|
@@ -4,19 +4,42 @@ using Hotline.Share.Enums.Order;
|
|
|
using Hotline.Share.Tools;
|
|
|
using Hotline.Snapshot;
|
|
|
using Hotline.Snapshot.Interfaces;
|
|
|
+using Mapster;
|
|
|
using SqlSugar;
|
|
|
using XF.Domain.Dependency;
|
|
|
+using XF.Domain.Exceptions;
|
|
|
|
|
|
namespace Hotline.Application.Snapshot;
|
|
|
public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
{
|
|
|
private readonly IOrderSnapshotRepository _orderSnapshotRepository;
|
|
|
+ private readonly IOrderRepository _orderRepository;
|
|
|
private readonly ISnapshotSMSTemplateRepository _snapshotSMSTemplateRepository;
|
|
|
+ private readonly IIndustryRepository _industryRepository;
|
|
|
|
|
|
- public RedPackApplication(IOrderSnapshotRepository orderSnapshotRepository, ISnapshotSMSTemplateRepository snapshotSMSTemplateRepository)
|
|
|
+ public RedPackApplication(IOrderSnapshotRepository orderSnapshotRepository, ISnapshotSMSTemplateRepository snapshotSMSTemplateRepository, IOrderRepository orderRepository, IIndustryRepository industryRepository)
|
|
|
{
|
|
|
_orderSnapshotRepository = orderSnapshotRepository;
|
|
|
_snapshotSMSTemplateRepository = snapshotSMSTemplateRepository;
|
|
|
+ _orderRepository = orderRepository;
|
|
|
+ _industryRepository = industryRepository;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取审核详情
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id">工单Id</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<SnapshotOrderAuditDetailOutDto> GetRedPackAuditDetailAsync(string id)
|
|
|
+ {
|
|
|
+ var order = await _orderRepository.GetAsync(id) ?? throw UserFriendlyException.SameMessage("工单不存在");
|
|
|
+ var outDto = new SnapshotOrderAuditDetailOutDto { Order = order.Adapt<SnapshotOrderAuditOrderDetailOutDto>() };
|
|
|
+ var industry = await _industryRepository.Queryable(includeDeleted: true)
|
|
|
+ .LeftJoin<OrderSnapshot>((i, o) => i.Id == o.IndustryId)
|
|
|
+ .Select((i, o) => new { i.Id, i.CitizenReadPackAmount })
|
|
|
+ .FirstAsync();
|
|
|
+ outDto.Amount = industry.CitizenReadPackAmount;
|
|
|
+ return outDto;
|
|
|
}
|
|
|
|
|
|
public ISugarQueryable<SnapshotOrderAuditItemsOutDto> GetRedPackAuditItemsAsync(SnapshotOrderAuditItemsInDto dto)
|
|
@@ -43,7 +66,9 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
.WhereIF(dto.Status.HasValue, (s, o, r, j) => r.Status == dto.Status)
|
|
|
.Select((s, o, r, j) => new SnapshotOrderAuditItemsOutDto
|
|
|
{
|
|
|
- Id = s.Id,
|
|
|
+ Id = r.Id,
|
|
|
+ RedPackAuditId = r.Id,
|
|
|
+ OrderId = s.Id,
|
|
|
No = o.No,
|
|
|
Title = o.Title,
|
|
|
IndustryName = s.IndustryName,
|