Browse Source

Merge branch 'feature/snapshot' into dev

qinchaoyue 4 tháng trước cách đây
mục cha
commit
c1241bec88

+ 9 - 0
src/Hotline.Api/Controllers/Snapshot/RedPackController.cs

@@ -34,6 +34,15 @@ public class RedPackController : BaseController
     public async Task<PagedDto<SnapshotOrderAuditItemsOutDto>> GetRedPackAuditItemsAsync([FromQuery] SnapshotOrderAuditItemsInDto dto)
         => (await _redPackApplication.GetRedPackAuditItemsAsync(dto).ToPagedListAsync(dto)).ToPaged();
 
+    /// <summary>
+    /// 获取审核详情
+    /// </summary>
+    /// <param name="id">工单Id</param>
+    /// <returns></returns>
+    [HttpGet("audit/{id}")]
+    public async Task<SnapshotOrderAuditDetailOutDto> GetRedPackAuditDetailAsync([FromQuery]string id)
+        => await _redPackApplication.GetRedPackAuditDetailAsync(id);
+
     /// <summary>
     /// 获取审核短信模板
     /// </summary>

+ 7 - 0
src/Hotline.Application/Snapshot/IRedPackApplication.cs

@@ -9,6 +9,13 @@ using System.Threading.Tasks;
 namespace Hotline.Application.Snapshot;
 public interface IRedPackApplication
 {
+    /// <summary>
+    /// 获取审核详情
+    /// </summary>
+    /// <param name="id">工单Id</param>
+    /// <returns></returns>
+    Task<SnapshotOrderAuditDetailOutDto> GetRedPackAuditDetailAsync(string id);
+
     /// <summary>
     /// 获取市民红包审批列表
     /// </summary>

+ 27 - 2
src/Hotline.Application/Snapshot/RedPackApplication.cs

@@ -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,

+ 141 - 1
src/Hotline.Share/Dtos/Snapshot/OrderDto.cs

@@ -223,10 +223,20 @@ public record SnapshotOrderAuditItemsInDto(string? No, string? Title,
 public class SnapshotOrderAuditItemsOutDto
 {
     /// <summary>
-    /// Id
+    /// 红包审核Id
     /// </summary>
     public string Id { get; set; }
 
+    /// <summary>
+    /// 红包审核Id
+    /// </summary>
+    public string RedPackAuditId { get; set; }
+
+    /// <summary>
+    /// OrderId
+    /// </summary>
+    public string OrderId { get; set; }
+
     /// <summary>
     /// No
     /// </summary>
@@ -436,3 +446,133 @@ public class GetRedPackAuditSMSTemplateInDto
     /// </summary>
     public ERedPackAuditStatus Status { get; set; }
 }
+
+public class SnapshotOrderAuditDetailOutDto
+{
+    /// <summary>
+    /// 工单信息
+    /// </summary>
+    public SnapshotOrderAuditOrderDetailOutDto Order { get; set; }
+
+    /// <summary>
+    /// 市民红包金额
+    /// </summary>
+    public double Amount { get; set; }
+}
+
+public class SnapshotOrderAuditOrderDetailOutDto
+{
+    /// <summary>
+    /// 受理人id
+    /// </summary>
+    public string? AcceptorId { get; set; }
+
+    /// <summary>
+    /// 受理人名称
+    /// </summary>
+    public string? AcceptorName { get; set; }
+
+    /// <summary>
+    /// 受理时间
+    /// </summary>
+    public DateTime CreationTime { get; set; }
+
+    /// <summary>
+    /// No
+    /// </summary>
+    public string No { get; set; }
+
+    /// <summary>
+    /// 所属区域
+    /// </summary>
+    public string County { get; set; }
+
+    /// <summary>
+    /// 来源方式
+    /// </summary>
+    public string SourceChannel { get; set; }
+
+    /// <summary>
+    /// 来源渠道代码
+    /// </summary>
+    public string? SourceChannelCode { get; set; }
+
+    /// <summary>
+    /// 受理类型
+    /// </summary>
+    public string? AcceptType { get; set; }
+
+    /// <summary>
+    /// 受理类型代码
+    /// </summary>
+    public string? AcceptTypeCode { get; set; }
+
+    /// <summary>
+    /// 热点分类类目名称
+    /// </summary>
+    public string? HotspotSpliceName { get; set; }
+
+    /// <summary>
+    /// 来电人
+    /// </summary>
+    public string FromPhone { get; set; }
+
+    /// <summary>
+    /// 来电/信人姓名
+    /// </summary>
+    public string? FromName { get; set; }
+
+
+    private bool _isSecret;
+    /// <summary>
+    /// 是否保密
+    /// </summary>
+    public bool IsSecret
+    {
+        get
+        {
+            if (_isSecret == true)
+            {
+                FullAddress = "*";
+                WorkUnit = "*";
+                LicenceNo = "*";
+                FromName = "*";
+                FromPhone = "*";
+            }
+            return _isSecret;
+        }
+        set { _isSecret = value; }
+    }
+
+    /// <summary>
+    /// 性别
+    /// </summary>
+    public string FromGenderTxt
+    {
+        get
+        {
+            if (_isSecret == true)
+                return "*";
+            return FromGender.GetDescription();
+        }
+    }
+    /// <summary>
+    /// 来电/信人性别
+    /// </summary>
+    public EGender FromGender { get; set; }
+
+    /// <summary>
+    /// 地址
+    /// </summary>
+    public string FullAddress { get; set; }
+
+    /// <summary>
+    /// 工作单位
+    /// </summary>
+    public string WorkUnit { get; set; }
+
+    /// <summary>
+    /// 证件号码
+    /// </summary>
+    public string LicenceNo { get; set; }
+}