Эх сурвалжийг харах

Merge branch 'feature/snapshot' into dev

qinchaoyue 2 сар өмнө
parent
commit
89d850e9a4

+ 31 - 2
src/Hotline.Api/Controllers/Snapshot/BiSnapshotController.cs

@@ -1,6 +1,10 @@
 using Hotline.Application.Snapshot;
+using Hotline.Share.Dtos;
 using Hotline.Share.Dtos.Snapshot;
 using Microsoft.AspNetCore.Mvc;
+using Hotline.Repository.SqlSugar.Extensions;
+using Hotline.Share.Tools;
+using Hotline.Snapshot.Interfaces;
 
 namespace Hotline.Api.Controllers.Snapshot;
 
@@ -10,10 +14,25 @@ namespace Hotline.Api.Controllers.Snapshot;
 public class BiSnapshotController : BaseController
 {
     private readonly IBiSnapshotApplication _biSnapshotApplication;
+    private readonly IIndustryRepository _industryRepository;
 
-    public BiSnapshotController(IBiSnapshotApplication biSnapshotApplication)
+    public BiSnapshotController(IBiSnapshotApplication biSnapshotApplication, IIndustryRepository industryRepository)
     {
         _biSnapshotApplication = biSnapshotApplication;
+        _industryRepository = industryRepository;
+    }
+
+    /// <summary>
+    /// 随手拍统计基础数据
+    /// </summary>
+    /// <returns></returns>
+    [HttpGet("statistics/basedata")]
+    public async Task<Dictionary<string, object>> GetSnapshotStatisticsBaseDataAsync()
+    {
+        return new Dictionary<string, object>()
+        {
+            { "industry", await _industryRepository.GetDataBaseAsync() }
+        };
     }
 
     /// <summary>
@@ -21,7 +40,17 @@ public class BiSnapshotController : BaseController
     /// </summary>
     /// <returns></returns>
     [HttpGet("statistics")]
-    public async Task<SnapshotStatisticsOutDto> GetSnapshotStatisticsAsync([FromBody] SnapshotStatisticsInDto dto)
+    public async Task<SnapshotStatisticsOutDto> GetSnapshotStatisticsAsync([FromQuery] SnapshotStatisticsInDto dto)
         =>  await _biSnapshotApplication.GetSnapshotStatisticsAsync(dto, HttpContext.RequestAborted);
 
+    /// <summary>
+    /// 随手拍统计详情集合
+    /// </summary>
+    /// <param name="dto"></param>
+    /// <returns></returns>
+    [HttpGet("statistics/details")]
+    public async Task<PagedDto<SnapshotStatisticsDetailOutDto>> GetSnapshotStatisticsDetailAsync([FromQuery] SnapshotStatisticsDetailInDto dto)
+        => (await _biSnapshotApplication.GetSnapshotStatisticsDetail(dto, HttpContext.RequestAborted).ToPagedListAsync(dto)).ToPaged();
+    
+
 }

+ 75 - 3
src/Hotline.Application/Snapshot/BiSnapshotApplication.cs

@@ -1,4 +1,7 @@
-using Hotline.Share.Dtos.Snapshot;
+using FluentValidation.Results;
+using Hotline.Share.Dtos.Snapshot;
+using Hotline.Snapshot.Interfaces;
+using SqlSugar;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -9,8 +12,77 @@ using XF.Domain.Dependency;
 namespace Hotline.Application.Snapshot;
 public class BiSnapshotApplication : IBiSnapshotApplication, IScopeDependency
 {
-    public Task<SnapshotStatisticsOutDto> GetSnapshotStatisticsAsync(SnapshotStatisticsInDto dto, CancellationToken token)
+    public readonly IOrderSnapshotRepository _orderSnapshotRepository;
+
+    public BiSnapshotApplication(IOrderSnapshotRepository orderSnapshotRepository)
+    {
+        _orderSnapshotRepository = orderSnapshotRepository;
+    }
+
+    public async Task<SnapshotStatisticsOutDto> GetSnapshotStatisticsAsync(SnapshotStatisticsInDto dto, CancellationToken token)
+    {
+        var query = _orderSnapshotRepository.Queryable()
+            .Where((order) => order.CreationTime >= dto.StartTime && order.CreationTime <= dto.EndTime)
+            .Select((order) => new SnapshotStatisticsOutDto
+            {
+                WZSLFWNJS = 0, // 未在受理范围内件数,
+                SSPZ12345JS =0, // 随手拍转12345件数,
+                SLFWNZJS = 0, // 受理范围内总件数,
+                SLFWNPGWGYSXSNHFJS = 0, // 受理范围内派给网格员四小时内回复件数,
+                SLFWNPGWGYCGSXSHFJS = 0, // 受理范围内派给网格员超过四小时回复件数
+                SLFWNPGWGYWHFJS = 0, // 受理范围内派给网格员未回复件数
+                SLFWNA12345ZPGGBMJS = 0, //受理范围内按12345直派给各部门件数,
+                SLFWNA12345ZPGGQXJS = 0, //受理范围内按12345直派给各区县件数
+                ZXYB = 0, // 中心已办
+                BMYB = 0, // 部门已办
+                SLFWMYD = 0, //受理范围满意度
+                MYL = 0, // 满意量
+                BMYL = 0, // 不满意量
+                SPBTYHBGS = 0, // 审批不同意红包个数
+                SPTYHBGS = 0, // 审批同意红包个数
+                TSHBSP = 0, //特殊红包审批统计
+                SPTYGS = 0, //审批同意个数
+                YFJE = 0, // 已发金额
+                JSHFFWGJLGS = 0, //局审核发放网格员奖励个数
+                SPTYWGYHBGS = 0, //审批同意(网格员)红包个数
+                SPBTYWGYHBGS = 0,  //审批不同意(网格员)红包个数
+                SMJLZE = 0, // 市民奖励总额
+                SMYFFJLZE = 0,  // 市民已发放奖励总额
+                SMDFFJLZE = 0,  // 市民待发奖励总额
+                YFG = 0, //已发(个)
+                WFLXG = 0, // 无法联系(个)
+                WJHBG = 0,  // 婉拒红包(个)
+                WGYYFJLJE = 0, //网格员应发奖励金额
+                WGYYFFJLZE = 0, // 网格员已发放奖励总额
+                WGYDFFJLZE = 0, // 网格员待发放奖励总额
+                WGYKKZEYF = 0, // 网格员扣款总额(已发)
+                WGYKKZEDF = 0, // 网格员扣款总额(待发)
+                SLFWNDBMHQJJS = 0, // 受理范围内多部门会签件件数
+                SLFWNRXZXGDJS = 0, // 受理范围内热线中心归档件数
+                RXZXFQHQJJS = 0, // 热线中心发起会签件件数
+                AQYH = 0, // 安全隐患
+                YWCAQYHZG = 0, // 已完成安全隐患整改
+                SQYQGDJS = 0, // 申请延期工单件数
+                SQYQGDCS = 0, // 申请延期工单次数
+                CQJ = 0, // 超期件
+                ECBLJSTHBM = 0, // 二次办理件数 - 退回部门
+                ECBLJSHFBMYCB = 0, // 二次办理件数-回访不满意重办
+                ECBLJSTTDYYJBM = 0, // 二次办理件数-特提到原一级部门
+                ECBLGDMYL = 0, // 二次办理工单满意率
+                ECBLGDMYLTHBM = 0, // 二次办理工单满意率-退回部门
+                ECBLGDMYLHFBMYCB = 0, // 二次办理工单满意率-回访不满意重办
+                TTDYYJBMJS = 0, // 特提到原一级部门件数
+                TTDPDZJS = 0, // 特提到派单组件数
+                QTTTJS = 0, // 其他特提件数
+            });
+        return await query.FirstAsync();
+    }
+
+    public ISugarQueryable<SnapshotStatisticsDetailOutDto> GetSnapshotStatisticsDetail(SnapshotStatisticsDetailInDto dto, CancellationToken requestAborted)
     {
-        throw new NotImplementedException();
+        var query = _orderSnapshotRepository.Queryable()
+            .Where((order) => order.CreationTime >= dto.StartTime && order.CreationTime <= dto.EndTime)
+            .Select((order) => new SnapshotStatisticsDetailOutDto());
+        return query;
     }
 }

+ 4 - 1
src/Hotline.Application/Snapshot/IBiSnapshotApplication.cs

@@ -1,5 +1,7 @@
-using Hotline.Share.Dtos.Snapshot;
+using Hotline.Share.Dtos;
+using Hotline.Share.Dtos.Snapshot;
 using Microsoft.AspNetCore.Http;
+using SqlSugar;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -10,4 +12,5 @@ namespace Hotline.Application.Snapshot;
 public interface IBiSnapshotApplication
 {
     Task<SnapshotStatisticsOutDto> GetSnapshotStatisticsAsync(SnapshotStatisticsInDto dto, CancellationToken token);
+    ISugarQueryable<SnapshotStatisticsDetailOutDto> GetSnapshotStatisticsDetail(SnapshotStatisticsDetailInDto dto, CancellationToken requestAborted);
 }

+ 370 - 10
src/Hotline.Share/Dtos/Snapshot/StatisticsDto.cs

@@ -1,9 +1,12 @@
-using System;
+using Hotline.Share.Enums.Order;
+using Hotline.Share.Requests;
+using System;
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using XF.Utility.EnumExtensions;
 
 namespace Hotline.Share.Dtos.Snapshot;
 
@@ -11,11 +14,11 @@ namespace Hotline.Share.Dtos.Snapshot;
 /// 随手拍统计输出Dto
 /// </summary>
 public class SnapshotStatisticsOutDto
-{ 
+{
     /// <summary>
     /// 随手拍来件数
     /// </summary>
-    public int SSPLJS { get; set; }
+    public int SSPLJS => WZSLFWNJS + SSPZ12345JS + SLFWNZJS;
 
     /// <summary>
     /// 未在受理范围内件数
@@ -35,7 +38,7 @@ public class SnapshotStatisticsOutDto
     /// <summary>
     /// 受理范围内派给各网格员件数
     /// </summary>
-    public int SLFWNPGGWGYJS { get; set; }
+    public int SLFWNPGGWGYJS => SLFWNPGWGYSXSNHFJS + SLFWNPGWGYCGSXSHFJS + SLFWNPGWGYWHFJS;
 
     /// <summary>
     /// 受理范围内派给网格员四小时内回复件数
@@ -50,12 +53,12 @@ public class SnapshotStatisticsOutDto
     /// <summary>
     /// 受理范围内派给网格员未回复件数
     /// </summary>
-    public int SLFWNPGWGWHRJS { get; set; }
+    public int SLFWNPGWGYWHFJS { get; set; }
 
     /// <summary>
     /// 受理范围内按12345直派给各区县或部门件数
     /// </summary>
-    public int SLFWNA12345ZPGGQXHBMJS { get; set; }
+    public int SLFWNA12345ZPGGQXHBMJS => SLFWNA12345ZPGGBMJS + SLFWNA12345ZPGGQXJS;
 
     /// <summary>
     /// 受理范围内按12345直派给各部门件数
@@ -70,7 +73,7 @@ public class SnapshotStatisticsOutDto
     /// <summary>
     /// 受理范围内已办信件
     /// </summary>
-    public int SLFWNYBXJ { get; set; }
+    public int SLFWNYBXJ => ZXYB + BMYB;
 
     /// <summary>
     /// 中心已办
@@ -90,7 +93,7 @@ public class SnapshotStatisticsOutDto
     /// <summary>
     /// 受理范围满意度
     /// </summary>
-    public string SLFWMYDTxt { get; set; }
+    public string SLFWMYDTxt => SLFWMYD.ToString("f4");
 
     /// <summary>
     /// 满意量
@@ -105,7 +108,7 @@ public class SnapshotStatisticsOutDto
     /// <summary>
     /// 审核发放奖励个数
     /// </summary>
-    public int SHFFJLGS { get; set; }
+    public int SHFFJLGS => SPBTYHBGS + SPTYHBGS;
 
     /// <summary>
     /// 审批不同意红包个数
@@ -140,7 +143,162 @@ public class SnapshotStatisticsOutDto
     /// <summary>
     /// 审批同意(网格员)红包个数
     /// </summary>
-    public float SPTYWGYHBGS { get; set; }
+    public int SPTYWGYHBGS { get; set; }
+
+    /// <summary>
+    /// 审批不同意(网格员)红包个数
+    /// </summary>
+    public int SPBTYWGYHBGS { get; set; }
+
+    /// <summary>
+    /// 市民奖励总额
+    /// </summary>
+    public double SMJLZE { get; set; }
+
+    /// <summary>
+    /// 市民已发放奖励总额
+    /// </summary>
+    public double SMYFFJLZE { get; set; }
+
+    /// <summary>
+    /// 市民待发奖励总额
+    /// </summary>
+    public double SMDFFJLZE { get; set; }
+
+    /// <summary>
+    /// 已发(个)
+    /// </summary>
+    public int YFG { get; set; }
+
+    /// <summary>
+    /// 无法联系(个)
+    /// </summary>
+    public int WFLXG { get; set; }
+
+    /// <summary>
+    /// 婉拒红包(个)
+    /// </summary>
+    public int WJHBG { get; set; }
+
+    /// <summary>
+    /// 网格员应发奖励金额
+    /// </summary>
+    public float WGYYFJLJE { get; set; }
+
+    /// <summary>
+    /// 网格员已发放奖励总额
+    /// </summary>
+    public float WGYYFFJLZE { get; set; }
+
+    /// <summary>
+    /// 网格员待发放奖励总额
+    /// </summary>
+    public float WGYDFFJLZE { get; set; }
+
+    /// <summary>
+    /// 网格员扣款总额(已发)
+    /// </summary>
+    public float WGYKKZEYF { get; set; }
+
+    /// <summary>
+    /// 网格员扣款总额(待发)
+    /// </summary>
+    public float WGYKKZEDF { get; set; }
+
+    /// <summary>
+    /// 受理范围内多部门会签件件数
+    /// </summary>
+    public int SLFWNDBMHQJJS { get; set; }
+
+    /// <summary>
+    /// 受理范围内热线中心归档件数
+    /// </summary>
+    public int SLFWNRXZXGDJS { get; set; }
+
+    /// <summary>
+    /// 热线中心发起会签件件数
+    /// </summary>
+    public int RXZXFQHQJJS { get; set; }
+
+    /// <summary>
+    /// 安全隐患
+    /// </summary>
+    public int AQYH { get; set; }
+
+    /// <summary>
+    /// 已完成安全隐患整改
+    /// </summary>
+    public int YWCAQYHZG { get; set; }
+
+    /// <summary>
+    /// 申请延期工单件数
+    /// </summary>
+    public int SQYQGDJS { get; set; }
+
+    /// <summary>
+    /// 申请延期工单次数
+    /// </summary>
+    public int SQYQGDCS { get; set; }
+
+    /// <summary>
+    /// 超期件
+    /// </summary>
+    public int CQJ { get; set; }
+
+    /// <summary>
+    /// 二次办理件数
+    /// </summary>
+    public int ECBLJS => ECBLJSTHBM + ECBLJSHFBMYCB + ECBLJSTTDYYJBM;
+
+    /// <summary>
+    /// 二次办理件数-退回部门
+    /// </summary>
+    public int ECBLJSTHBM { get; set; }
+
+    /// <summary>
+    /// 二次办理件数-回访不满意重办
+    /// </summary>
+    public int ECBLJSHFBMYCB { get; set; }
+
+    /// <summary>
+    /// 二次办理件数-特提到原一级部门
+    /// </summary>
+    public int ECBLJSTTDYYJBM { get; set; }
+
+    /// <summary>
+    /// 二次办理工单满意率
+    /// </summary>
+    public double ECBLGDMYL { get; set; }
+
+    /// <summary>
+    /// 二次办理工单满意率-退回部门
+    /// </summary>
+    public double ECBLGDMYLTHBM { get; set; }
+
+    /// <summary>
+    /// 二次办理工单满意率-回访不满意重办
+    /// </summary>
+    public double ECBLGDMYLHFBMYCB { get; set; }
+
+    /// <summary>
+    /// 特提件数
+    /// </summary>
+    public int TTJS => TTDYYJBMJS + TTDPDZJS + QTTTJS;
+
+    /// <summary>
+    /// 特提到原一级部门件数
+    /// </summary>
+    public int TTDYYJBMJS { get; set; }
+
+    /// <summary>
+    /// 特提到派单组件数
+    /// </summary>
+    public int TTDPDZJS { get; set; }
+
+    /// <summary>
+    /// 其他特提件数
+    /// </summary>
+    public int QTTTJS { get; set; }
 }
 
 /// <summary>
@@ -159,6 +317,208 @@ public class SnapshotStatisticsInDto
     /// </summary>
     [Required]
     public DateTime EndTime { get; set; }
+
+    /// <summary>
+    /// 行业Id
+    /// </summary>
+    public string? IndustryId { get; set; }
+}
+
+public record SnapshotStatisticsDetailInDto : PagedRequest
+{
+    /// <summary>
+    /// 开始时间
+    /// </summary>
+    [Required]
+    public DateTime StartTime { get; set; }
+
+    /// <summary>
+    /// 结束时间
+    /// </summary>
+    [Required]
+    public DateTime EndTime { get; set; }
+
+    /// <summary>
+    /// 字段名称
+    /// </summary>
+    [Required]
+    public string FieldName { get; set; }
+}
+
+public class SnapshotStatisticsDetailOutDto
+{
+    /// <summary>
+    /// Id
+    /// </summary>
+    public string Id { get; set; }
+
+    /// <summary>
+    /// 过期状态
+    /// </summary>
+    public EExpiredStatus ExpiredStatus { get; set; }
+
+    /// <summary>
+    /// 过期状态
+    /// </summary>
+    public string ExpiredStatusText => ExpiredStatus.GetDescription();
+
+    /// <summary>
+    /// 受理编号
+    /// </summary>
+    public string No { get; set; }
+
+    /// <summary>
+    /// 信件状态
+    /// </summary>
+    public EOrderStatus Status { get; set; }
+
+    /// <summary>
+    /// 信件状态
+    /// </summary>
+    public string StatusTxt => Status.GetDescription();
+
+    /// <summary>
+    /// 来源
+    /// </summary>
+    public string SourceChannel { get; set; }
+
+    /// <summary>
+    /// 当前节点
+    /// </summary>
+    public string CurrentStepName { get; set; }
+
+    /// <summary>
+    /// 重办次数
+    /// </summary>
+    public int ReTransactNum { get; set; }
+
+    /// <summary>
+    /// 是否紧急
+    /// </summary>
+    public bool IsUrgent { get; set; }
+
+    /// <summary>
+    /// 是否紧急
+    /// </summary>
+    public string IsUrgentTxt => IsUrgent ? "紧急" : "-";
+
+    /// <summary>
+    /// 期满时间
+    /// </summary>
+    public DateTime? ExpiredTime { get; set; }
+
+    /// <summary>
+    /// 是否超期
+    /// </summary>
+    public bool IsExpired
+    {
+        get
+        {
+            if (ExpiredTime.HasValue)
+                return DateTime.Now > ExpiredTime.Value;
+            return false;
+        }
+    }
+
+    /// <summary>
+    /// 受理时间
+    /// </summary>
+    public DateTime CreationTime { get; set; }
+
+    /// <summary>
+    /// 标题
+    /// </summary>
+    public string Title { get; set; }
+
+    /// <summary>
+    /// 行业
+    /// </summary>
+    public string IndustryName { get; set; }
+
+    /// <summary>
+    /// 办理时长
+    /// </summary>
+    public double CreationTimeHandleDuration { get; set; }
+
+    /// <summary>
+    /// 区域
+    /// </summary>
+    public string County { get; set; }
+
+    /// <summary>
+    /// 电话
+    /// </summary>
+    public string Contact { get; set; }
+
+    /// <summary>
+    /// 网格员名称
+    /// </summary>
+    public string MemberName { get; set; }
+
+    /// <summary>
+    /// 网格员电话
+    /// </summary>
+    public string MemberMobile { get; set; }
+
+    /// <summary>
+    /// 网格员回复
+    /// </summary>
+    public string NetworkRemark { get; set; }
+
+    /// <summary>
+    /// 网格E通编号
+    /// </summary>
+    public string? NetworkENumber { get; set; }
+
+    /// <summary>
+    /// 受理期满时间
+    /// </summary>
+    public DateTime? AcceptExpiredTime { get; set; }
+
+    /// <summary>
+    /// 一级部门
+    /// </summary>
+    public string OrgLevelOneCode { get; set; }
+
+    /// <summary>
+    /// 接办部门
+    /// </summary>
+    public string ActualHandleOrgName { get; set; }
+
+    /// <summary>
+    /// 接办时间
+    /// </summary>
+    public DateTime? StartTime { get; set; }
+
+    /// <summary>
+    /// 办结时间
+    /// </summary>
+    public DateTime? CenterToOrgTime { get; set; }
+
+    /// <summary>
+    /// 受理类型
+    /// </summary>
+    public string AcceptType { get; set; }
+
+    /// <summary>
+    /// 热点类型
+    /// </summary>
+    public string HotspotName { get; set; }
+
+    /// <summary>
+    /// 受理人
+    /// </summary>
+    public string AcceptorName { get; set; }
+
+    /// <summary>
+    /// 受理内容
+    /// </summary>
+    public string Content { get; set; }
+
+    /// <summary>
+    /// 办理结果
+    /// </summary>
+    public string FileOpinion { get; set; }
 }
 public class StatisticsDto
 {