|
@@ -1,5 +1,6 @@
|
|
|
using Hotline.Caching.Interfaces;
|
|
|
using Hotline.CallCenter.Calls;
|
|
|
+using Hotline.Configurations;
|
|
|
using Hotline.FlowEngine.WorkflowModules;
|
|
|
using Hotline.FlowEngine.Workflows;
|
|
|
using Hotline.Identity.Accounts;
|
|
@@ -23,6 +24,7 @@ using Hotline.Tools;
|
|
|
using Hotline.Users;
|
|
|
using MapsterMapper;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
+using Microsoft.Extensions.Options;
|
|
|
using Quartz.Simpl;
|
|
|
using SqlSugar;
|
|
|
using System.Data;
|
|
@@ -52,28 +54,29 @@ namespace Hotline.Application.StatisticalReport
|
|
|
private readonly IRepository<SystemOrganize> _systemOrganizerepository;
|
|
|
private readonly IRepository<OrderSpecial> _orderSpecialRepository;
|
|
|
private readonly IRepository<OrderSendBackAudit> _orderSendBackAuditRepository;
|
|
|
- private readonly IRepository<Hotspot> _hotspotTypeRepository;
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- ///
|
|
|
- /// </summary>
|
|
|
- /// <param name="orderRepository"></param>
|
|
|
- /// <param name="orderVisitDetailRepository"></param>
|
|
|
- /// <param name="orderDelayRepository"></param>
|
|
|
- /// <param name="mapper"></param>
|
|
|
- /// <param name="orderPublishRepository"></param>
|
|
|
- /// <param name="sessionContext"></param>
|
|
|
- /// <param name="workflowTraceRepository"></param>
|
|
|
- /// <param name="orderScreenRepository"></param>
|
|
|
- /// <param name="sysDicDataCacheManager"></param>
|
|
|
- /// <param name="trCallRecordRepository"></param>
|
|
|
- /// <param name="systemSettingCacheManager"></param>
|
|
|
- /// <param name="userRepository"></param>
|
|
|
- /// <param name="accountRepository"></param>
|
|
|
- /// <param name="statisticsDepartRepository"></param>
|
|
|
- /// <param name="systemOrganizerepository"></param>
|
|
|
- /// <param name="orderSpecialRepository"></param>
|
|
|
- public OrderReportApplication(
|
|
|
+ private readonly IRepository<Hotspot> _hotspotTypeRepository;
|
|
|
+ private readonly IOptionsSnapshot<AppConfiguration> _appOptions;
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ ///
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="orderRepository"></param>
|
|
|
+ /// <param name="orderVisitDetailRepository"></param>
|
|
|
+ /// <param name="orderDelayRepository"></param>
|
|
|
+ /// <param name="mapper"></param>
|
|
|
+ /// <param name="orderPublishRepository"></param>
|
|
|
+ /// <param name="sessionContext"></param>
|
|
|
+ /// <param name="workflowTraceRepository"></param>
|
|
|
+ /// <param name="orderScreenRepository"></param>
|
|
|
+ /// <param name="sysDicDataCacheManager"></param>
|
|
|
+ /// <param name="trCallRecordRepository"></param>
|
|
|
+ /// <param name="systemSettingCacheManager"></param>
|
|
|
+ /// <param name="userRepository"></param>
|
|
|
+ /// <param name="accountRepository"></param>
|
|
|
+ /// <param name="statisticsDepartRepository"></param>
|
|
|
+ /// <param name="systemOrganizerepository"></param>
|
|
|
+ /// <param name="orderSpecialRepository"></param>
|
|
|
+ public OrderReportApplication(
|
|
|
IOrderRepository orderRepository,
|
|
|
IRepository<OrderVisitDetail> orderVisitDetailRepository,
|
|
|
IRepository<OrderDelay> orderDelayRepository,
|
|
@@ -91,8 +94,9 @@ namespace Hotline.Application.StatisticalReport
|
|
|
IRepository<SystemOrganize> systemOrganizerepository,
|
|
|
IRepository<OrderSpecial> orderSpecialRepository,
|
|
|
IRepository<OrderSendBackAudit> orderSendBackAuditRepository,
|
|
|
- IRepository<Hotspot> hotspotTypeRepository
|
|
|
- )
|
|
|
+ IRepository<Hotspot> hotspotTypeRepository,
|
|
|
+ IOptionsSnapshot<AppConfiguration> appOptions
|
|
|
+ )
|
|
|
{
|
|
|
_orderRepository = orderRepository;
|
|
|
_orderVisitDetailRepository = orderVisitDetailRepository;
|
|
@@ -112,8 +116,10 @@ namespace Hotline.Application.StatisticalReport
|
|
|
_orderSpecialRepository = orderSpecialRepository;
|
|
|
_orderSendBackAuditRepository = orderSendBackAuditRepository;
|
|
|
_hotspotTypeRepository = hotspotTypeRepository;
|
|
|
+ _appOptions = appOptions;
|
|
|
|
|
|
- }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
#region 宜宾、自贡
|
|
|
/// <summary>
|
|
@@ -2693,6 +2699,7 @@ namespace Hotline.Application.StatisticalReport
|
|
|
.LeftJoin<WorkflowStep>((o, w) => o.Id == w.ExternalId)
|
|
|
.Where((o, w) => o.CreationTime >= dto.StartTime && o.CreationTime <= dto.EndTime && w.ModuleCode == WorkflowModuleConsts.OrderHandle
|
|
|
&& w.Status == EWorkflowStepStatus.WaitForAccept && w.CountersignPosition == ECountersignPosition.None)
|
|
|
+ .WhereIF(_appOptions.Value.IsZiGong, (o, w) => o.Status < EOrderStatus.Filed)//自贡需要排除已办理完成的
|
|
|
.WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (o, w) => o.Source == ESource.ProvinceStraight)
|
|
|
.WhereIF(dto.TypeId != null && dto.TypeId == 1, (o, w) => o.IdentityType == EIdentityType.Citizen)
|
|
|
.WhereIF(dto.TypeId != null && dto.TypeId == 2, (o, w) => o.IdentityType == EIdentityType.Enterprise)
|
|
@@ -2721,6 +2728,7 @@ namespace Hotline.Application.StatisticalReport
|
|
|
.LeftJoin<WorkflowStep>((o, w) => o.Id == w.ExternalId)
|
|
|
.Where((o, w) => w.CreationTime >= dto.StartTime && w.CreationTime <= dto.EndTime && w.ModuleCode == WorkflowModuleConsts.OrderHandle
|
|
|
&& w.Status == EWorkflowStepStatus.WaitForAccept && w.CountersignPosition > ECountersignPosition.None)
|
|
|
+ .WhereIF(_appOptions.Value.IsZiGong, (o, w) => o.Status < EOrderStatus.Filed)//自贡需要排除已办理完成的
|
|
|
.WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (o, w) => o.Source == ESource.ProvinceStraight)
|
|
|
.WhereIF(dto.TypeId != null && dto.TypeId == 1, (o, w) => o.IdentityType == EIdentityType.Citizen)
|
|
|
.WhereIF(dto.TypeId != null && dto.TypeId == 2, (o, w) => o.IdentityType == EIdentityType.Enterprise)
|
|
@@ -2773,6 +2781,7 @@ namespace Hotline.Application.StatisticalReport
|
|
|
.LeftJoin<WorkflowStep>((o, w) => o.Id == w.ExternalId)
|
|
|
.Where((o, w) => w.CreationTime >= dto.StartTime && w.CreationTime <= dto.EndTime && w.ModuleCode == WorkflowModuleConsts.OrderHandle
|
|
|
&& w.Status == EWorkflowStepStatus.WaitForAccept && w.CountersignPosition > ECountersignPosition.None)
|
|
|
+ .WhereIF(_appOptions.Value.IsZiGong, (o, w) => o.Status < EOrderStatus.Filed)//自贡需要排除已办理完成的
|
|
|
.WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (o, w) => o.Source == ESource.ProvinceStraight)
|
|
|
.WhereIF(dto.TypeId != null && dto.TypeId == 1, (o, w) => o.IdentityType == EIdentityType.Citizen)
|
|
|
.WhereIF(dto.TypeId != null && dto.TypeId == 2, (o, w) => o.IdentityType == EIdentityType.Enterprise)
|
|
@@ -2787,6 +2796,7 @@ namespace Hotline.Application.StatisticalReport
|
|
|
.LeftJoin<WorkflowStep>((o, w) => o.Id == w.ExternalId)
|
|
|
.Where((o, w) => o.CreationTime >= dto.StartTime && o.CreationTime <= dto.EndTime && w.ModuleCode == WorkflowModuleConsts.OrderHandle
|
|
|
&& w.Status == EWorkflowStepStatus.WaitForAccept && w.CountersignPosition == ECountersignPosition.None)
|
|
|
+ .WhereIF(_appOptions.Value.IsZiGong, (o, w) => o.Status < EOrderStatus.Filed)//自贡需要排除已办理完成的
|
|
|
.WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (o, w) => o.Source == ESource.ProvinceStraight)
|
|
|
.WhereIF(dto.TypeId != null && dto.TypeId == 1, (o, w) => o.IdentityType == EIdentityType.Citizen)
|
|
|
.WhereIF(dto.TypeId != null && dto.TypeId == 2, (o, w) => o.IdentityType == EIdentityType.Enterprise)
|
|
@@ -3003,43 +3013,43 @@ namespace Hotline.Application.StatisticalReport
|
|
|
return query;
|
|
|
}
|
|
|
|
|
|
- public async Task<DataTable> HotspotStatisticsExprot_LZ(ExportExcelDto<HotspotStatisticsRep> dto)
|
|
|
- {
|
|
|
- var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
- DataTable data = new DataTable();
|
|
|
-
|
|
|
- data = await _hotspotTypeRepository.Queryable()
|
|
|
- .LeftJoin<Order>((it, o) => o.HotspotId.StartsWith(it.Id))
|
|
|
- .Where((it, o) => o.CreationTime >= dto.QueryDto.StartTime && o.CreationTime <= dto.QueryDto.EndTime && o.Id != null)
|
|
|
- .WhereIF(dto.QueryDto.TypeId == 1, (it, o) => o.IdentityType == EIdentityType.Citizen)
|
|
|
- .WhereIF(dto.QueryDto.TypeId == 2, (it, o) => o.IdentityType == EIdentityType.Enterprise)
|
|
|
- .WhereIF(IsCenter == false, (it, o) => o.ActualHandleOrgCode.StartsWith(_sessionContext.RequiredOrgId))
|
|
|
+ public async Task<DataTable> HotspotStatisticsExprot_LZ(ExportExcelDto<HotspotStatisticsRep> dto)
|
|
|
+ {
|
|
|
+ var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
+ DataTable data = new DataTable();
|
|
|
+
|
|
|
+ data = await _hotspotTypeRepository.Queryable()
|
|
|
+ .LeftJoin<Order>((it, o) => o.HotspotId.StartsWith(it.Id))
|
|
|
+ .Where((it, o) => o.CreationTime >= dto.QueryDto.StartTime && o.CreationTime <= dto.QueryDto.EndTime && o.Id != null)
|
|
|
+ .WhereIF(dto.QueryDto.TypeId == 1, (it, o) => o.IdentityType == EIdentityType.Citizen)
|
|
|
+ .WhereIF(dto.QueryDto.TypeId == 2, (it, o) => o.IdentityType == EIdentityType.Enterprise)
|
|
|
+ .WhereIF(IsCenter == false, (it, o) => o.ActualHandleOrgCode.StartsWith(_sessionContext.RequiredOrgId))
|
|
|
.GroupBy((it, o) => it.Id)
|
|
|
- .OrderBy((it, o) => new { it.Id }, OrderByType.Asc)
|
|
|
- .Select((it, o) => new
|
|
|
- {
|
|
|
- HotspotName = it.HotSpotName,
|
|
|
- HotSpotFullName = it.HotSpotFullName,
|
|
|
- SumCount = SqlFunc.AggregateSum(SqlFunc.IIF(o.HotspotId.StartsWith(it.Id), 1, 0))
|
|
|
- })
|
|
|
- .ToDataTableAsync();
|
|
|
-
|
|
|
- data.Columns["HotspotName"].SetOrdinal(0);
|
|
|
- data.Columns["HotSpotFullName"].SetOrdinal(1);
|
|
|
- data.Columns["SumCount"].ColumnName = "分类统计";
|
|
|
- data.Columns["HotspotName"].ColumnName = "热点名称";
|
|
|
- data.Columns["HotSpotFullName"].ColumnName = "热点分级";
|
|
|
- //合计
|
|
|
- DataRow sumRow = data.NewRow();
|
|
|
- sumRow["热点名称"] = "合计";
|
|
|
- decimal totalAmount = 0;
|
|
|
- foreach (DataRow row in data.Rows)
|
|
|
- {
|
|
|
- totalAmount += Convert.ToDecimal(row["分类统计"]);
|
|
|
- }
|
|
|
- sumRow["分类统计"] = totalAmount;
|
|
|
- data.Rows.Add(sumRow);
|
|
|
+ .OrderBy((it, o) => new { it.Id }, OrderByType.Asc)
|
|
|
+ .Select((it, o) => new
|
|
|
+ {
|
|
|
+ HotspotName = it.HotSpotName,
|
|
|
+ HotSpotFullName = it.HotSpotFullName,
|
|
|
+ SumCount = SqlFunc.AggregateSum(SqlFunc.IIF(o.HotspotId.StartsWith(it.Id), 1, 0))
|
|
|
+ })
|
|
|
+ .ToDataTableAsync();
|
|
|
+
|
|
|
+ data.Columns["HotspotName"].SetOrdinal(0);
|
|
|
+ data.Columns["HotSpotFullName"].SetOrdinal(1);
|
|
|
+ data.Columns["SumCount"].ColumnName = "分类统计";
|
|
|
+ data.Columns["HotspotName"].ColumnName = "热点名称";
|
|
|
+ data.Columns["HotSpotFullName"].ColumnName = "热点分级";
|
|
|
+ //合计
|
|
|
+ DataRow sumRow = data.NewRow();
|
|
|
+ sumRow["热点名称"] = "合计";
|
|
|
+ decimal totalAmount = 0;
|
|
|
+ foreach (DataRow row in data.Rows)
|
|
|
+ {
|
|
|
+ totalAmount += Convert.ToDecimal(row["分类统计"]);
|
|
|
+ }
|
|
|
+ sumRow["分类统计"] = totalAmount;
|
|
|
+ data.Rows.Add(sumRow);
|
|
|
return data;
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|