|
@@ -1,25 +1,21 @@
|
|
|
-using Hotline.Application.StatisticalReport;
|
|
|
+using Hotline.Application.ExportExcel;
|
|
|
+using Hotline.Application.StatisticalReport;
|
|
|
+using Hotline.Application.Systems;
|
|
|
using Hotline.Caching.Interfaces;
|
|
|
using Hotline.CallCenter.Calls;
|
|
|
using Hotline.CallCenter.Tels;
|
|
|
-using Hotline.Repository.SqlSugar.Extensions;
|
|
|
-using Hotline.Settings;
|
|
|
using Hotline.Share.Dtos;
|
|
|
using Hotline.Share.Dtos.CallCenter;
|
|
|
using Hotline.Share.Dtos.Order;
|
|
|
using Hotline.Share.Dtos.TrCallCenter;
|
|
|
-using Hotline.Share.Enums.CallCenter;
|
|
|
-using Hotline.Share.Enums.User;
|
|
|
using Hotline.Share.Requests;
|
|
|
using Hotline.Tools;
|
|
|
using Hotline.Users;
|
|
|
using MapsterMapper;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
-using NPOI.SS.Formula.Functions;
|
|
|
using SqlSugar;
|
|
|
using System.Data;
|
|
|
-using XF.Domain.Exceptions;
|
|
|
using XF.Domain.Repository;
|
|
|
|
|
|
namespace Hotline.Api.Controllers.Bi;
|
|
@@ -30,6 +26,7 @@ namespace Hotline.Api.Controllers.Bi;
|
|
|
public class BiCallController : BaseController
|
|
|
{
|
|
|
private readonly IRepository<TrCallRecord> _trCallRecordRepository;
|
|
|
+ private readonly BaseDataApplication _baseDataApplication;
|
|
|
private readonly IRepository<User> _userRepository;
|
|
|
private readonly IRepository<TelRest> _telRestRepository;
|
|
|
private readonly IMapper _mapper;
|
|
@@ -50,7 +47,8 @@ public class BiCallController : BaseController
|
|
|
ISystemDicDataCacheManager sysDicDataCacheManager,
|
|
|
IRepository<Work> workRepository,
|
|
|
ICallReportApplication callReportApplication,
|
|
|
- IExportApplication exportApplication)
|
|
|
+ IExportApplication exportApplication,
|
|
|
+ BaseDataApplication baseDataApplication)
|
|
|
{
|
|
|
_trCallRecordRepository = trCallRecordRepository;
|
|
|
_userRepository = userRepository;
|
|
@@ -61,6 +59,7 @@ public class BiCallController : BaseController
|
|
|
_sysDicDataCacheManager = sysDicDataCacheManager;
|
|
|
_callReportApplication = callReportApplication;
|
|
|
_exportApplication = exportApplication;
|
|
|
+ _baseDataApplication = baseDataApplication;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -71,7 +70,7 @@ public class BiCallController : BaseController
|
|
|
[HttpGet("calls")]
|
|
|
[AllowAnonymous]
|
|
|
public async Task<List<BiCallDto>> QueryCallsAsync([FromQuery] BiQueryCallsDto dto)
|
|
|
- => await _callReportApplication.QueryCallsAsync(dto, HttpContext.RequestAborted);
|
|
|
+ => await _callReportApplication.QueryCallsAsync(dto, HttpContext.RequestAborted);
|
|
|
|
|
|
/// <summary>
|
|
|
/// 话务统计分析---导出
|
|
@@ -85,7 +84,7 @@ public class BiCallController : BaseController
|
|
|
await _exportApplication.FittingAsync(
|
|
|
dto,
|
|
|
await _callReportApplication.QueryCallsAsync(dto.QueryDto, HttpContext.RequestAborted),
|
|
|
- list =>
|
|
|
+ list =>
|
|
|
{
|
|
|
list.Add(new BiCallDto()
|
|
|
{
|
|
@@ -142,7 +141,8 @@ public class BiCallController : BaseController
|
|
|
await _exportApplication.FittingAsync(
|
|
|
dto,
|
|
|
await _callReportApplication.QueryCallsDetailAsync(dto.QueryDto),
|
|
|
- items => {
|
|
|
+ items =>
|
|
|
+ {
|
|
|
var total = new QueryCallsDetailDto
|
|
|
{
|
|
|
Date = "合计",
|
|
@@ -161,7 +161,7 @@ public class BiCallController : BaseController
|
|
|
OutConnectionQuantity = items.Sum(p => p.OutConnectionQuantity)
|
|
|
};
|
|
|
items.Add(total);
|
|
|
- }
|
|
|
+ }
|
|
|
)
|
|
|
, "话务日期明细数据");
|
|
|
|
|
@@ -214,9 +214,9 @@ public class BiCallController : BaseController
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet("query_calls_hour_detail_list")]
|
|
|
- public async Task<TotalDataList<QueryCallsDetailDto>> QueryCallsHourDetailListAsync([FromQuery] BiQueryCallsDto dto)
|
|
|
+ public async Task<TotalList<QueryCallsDetailDto>> QueryCallsHourDetailListAsync([FromQuery] BiQueryCallsDto dto)
|
|
|
{
|
|
|
- var items = await _callReportApplication.QueryCallsHourDetailAsync(dto, HttpContext.RequestAborted);
|
|
|
+ var items = await _callReportApplication.QueryCallsHourDetailAsync(dto, HttpContext.RequestAborted);
|
|
|
var total = new QueryCallsDetailDto
|
|
|
{
|
|
|
Date = "",
|
|
@@ -235,7 +235,7 @@ public class BiCallController : BaseController
|
|
|
OutConnectionQuantity = items.Sum(p => p.OutConnectionQuantity)
|
|
|
};
|
|
|
|
|
|
- return new TotalDataList<QueryCallsDetailDto>(items, total);
|
|
|
+ return new TotalList<QueryCallsDetailDto>(items, total);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -248,10 +248,10 @@ public class BiCallController : BaseController
|
|
|
public async Task<FileStreamResult> QueryCallsHourDetailListExportAsync([FromBody] ExportExcelDto<BiQueryCallsDto> dto)
|
|
|
=> ExcelStreamResult(
|
|
|
await _exportApplication.FittingAsync(
|
|
|
- dto,
|
|
|
+ dto,
|
|
|
await _callReportApplication.QueryCallsHourDetailAsync(dto.QueryDto, HttpContext.RequestAborted),
|
|
|
- items =>
|
|
|
- {
|
|
|
+ items =>
|
|
|
+ {
|
|
|
var total = new QueryCallsDetailDto
|
|
|
{
|
|
|
Date = "",
|
|
@@ -286,14 +286,14 @@ public class BiCallController : BaseController
|
|
|
await _exportApplication.FittingAsync(
|
|
|
dto,
|
|
|
await _callReportApplication.QuerySeatCallAsync(dto.QueryDto, HttpContext.RequestAborted),
|
|
|
- list =>
|
|
|
+ list =>
|
|
|
{
|
|
|
list.Add(new BiSeatCallsDto()
|
|
|
{
|
|
|
Name = "合计",
|
|
|
InTotal = list.Sum(p => p.InTotal),
|
|
|
InAnswered = list.Sum(p => p.InAnswered),
|
|
|
- InHangupImmediate = list.Sum(p => p.InHangupImmediate),
|
|
|
+ InHangupImmediate = list.Sum(p => p.InHangupImmediate),
|
|
|
InHanguped = list.Sum(m => m.InHanguped),
|
|
|
OutDurationAvg = list.Sum(m => m.OutDurationAvg),
|
|
|
InAvailableAnswer = list.Sum(m => m.InAvailableAnswer),
|
|
@@ -380,7 +380,7 @@ public class BiCallController : BaseController
|
|
|
await _exportApplication.FittingAsync(
|
|
|
dto,
|
|
|
await _callReportApplication.GetCallHourListAsync(dto.QueryDto, HttpContext.RequestAborted),
|
|
|
- list =>
|
|
|
+ list =>
|
|
|
{
|
|
|
list.Add(new TrCallHourDto()
|
|
|
{
|
|
@@ -400,17 +400,8 @@ public class BiCallController : BaseController
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet("hourcall_list")]
|
|
|
- public async Task<object> QueryCallList([FromQuery] DateTime StartTime, DateTime? EndTime, string type, string source, TimeSpan? startHourTo, int pageIndex, int pageSize)
|
|
|
- {
|
|
|
- if(!EndTime.HasValue)
|
|
|
- throw UserFriendlyException.SameMessage("请选择时间!");
|
|
|
- //获取配置
|
|
|
- int noConnectByeTimes = int.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.NoConnectByeTimes)?.SettingValue[0]);
|
|
|
- int effectiveTimes = int.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.EffectiveTimes)?.SettingValue[0]);
|
|
|
- int connectByeTimes = int.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.ConnectByeTimes)?.SettingValue[0]);
|
|
|
- var list = await _trCallRecordRepositoryEx.GetCallList(StartTime, EndTime, noConnectByeTimes, effectiveTimes, connectByeTimes, type, source, startHourTo, pageIndex, pageSize);
|
|
|
- return list;
|
|
|
- }
|
|
|
+ public async Task<object> QueryCallList([FromQuery] QueryCallListDto dto)
|
|
|
+ => await _callReportApplication.GetCallListAsync(dto, HttpContext.RequestAborted);
|
|
|
|
|
|
/// <summary>
|
|
|
/// 通话时段统计明细获取基本信息
|
|
@@ -419,14 +410,10 @@ public class BiCallController : BaseController
|
|
|
/// <returns></returns>
|
|
|
[HttpGet("hourcall_list_base")]
|
|
|
public async Task<object> ReTransactBaseData()
|
|
|
- {
|
|
|
- var rsp = new
|
|
|
- {
|
|
|
- CallForwardingSource = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.CallForwardingSource),
|
|
|
- CallForwardingType = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.CallForwardingType),
|
|
|
- };
|
|
|
- return rsp;
|
|
|
- }
|
|
|
+ => _baseDataApplication
|
|
|
+ .CallForwardingType()
|
|
|
+ .CallForwardingSource()
|
|
|
+ .Build();
|
|
|
|
|
|
/// <summary>
|
|
|
/// 热线号码统计
|
|
@@ -437,15 +424,7 @@ public class BiCallController : BaseController
|
|
|
[AllowAnonymous]
|
|
|
[HttpGet("gateway-query")]
|
|
|
public async Task<List<CallHotLineDto>> QueryGateWay([FromQuery] BiQueryGateWayDto dto)
|
|
|
- {
|
|
|
- //获取配置
|
|
|
- int noConnectByeTimes = int.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.NoConnectByeTimes)?.SettingValue[0]);
|
|
|
- int effectiveTimes = int.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.EffectiveTimes)?.SettingValue[0]);
|
|
|
- int connectByeTimes = int.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.ConnectByeTimes)?.SettingValue[0]);
|
|
|
- int ringTims = int.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.RingTims)?.SettingValue[0]);
|
|
|
- var list = await _trCallRecordRepositoryEx.GetCallHotLineList(dto.StartTime, dto.EndTime, dto.gateway, noConnectByeTimes, effectiveTimes, connectByeTimes, ringTims);
|
|
|
- return list;
|
|
|
- }
|
|
|
+ => await _callReportApplication.GetCallHotLineListAsync(dto, HttpContext.RequestAborted);
|
|
|
|
|
|
/// <summary>
|
|
|
/// 热线号码统计导出
|
|
@@ -454,23 +433,10 @@ public class BiCallController : BaseController
|
|
|
/// <returns></returns>
|
|
|
[HttpPost("gateway-query/export")]
|
|
|
public async Task<FileStreamResult> ExportQueryGatetWay(ExportExcelDto<BiQueryGateWayDto> dto)
|
|
|
- {
|
|
|
- //获取配置
|
|
|
- int noConnectByeTimes = int.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.NoConnectByeTimes)?.SettingValue[0]);
|
|
|
- int effectiveTimes = int.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.EffectiveTimes)?.SettingValue[0]);
|
|
|
- int connectByeTimes = int.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.ConnectByeTimes)?.SettingValue[0]);
|
|
|
- int ringTims = int.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.RingTims)?.SettingValue[0]);
|
|
|
- var list = await _trCallRecordRepositoryEx.GetCallHotLineList(dto.QueryDto.StartTime, dto.QueryDto.EndTime, dto.QueryDto.gateway, noConnectByeTimes, effectiveTimes, connectByeTimes, ringTims);
|
|
|
-
|
|
|
- dynamic? dynamicClass = DynamicClassHelper.CreateDynamicClass(dto.ColumnInfos);
|
|
|
-
|
|
|
- var dtos = list
|
|
|
- .Select(stu => _mapper.Map(stu, typeof(CallHotLineDto), dynamicClass))
|
|
|
- .Cast<object>()
|
|
|
- .ToList();
|
|
|
-
|
|
|
- var stream = ExcelHelper.CreateStream(dtos);
|
|
|
-
|
|
|
- return ExcelStreamResult(stream, "热线号码统计");
|
|
|
- }
|
|
|
+ => ExcelStreamResult(
|
|
|
+ await _exportApplication.FittingAsync(
|
|
|
+ dto,
|
|
|
+ await _callReportApplication.GetCallHotLineListAsync(dto.QueryDto, HttpContext.RequestAborted)
|
|
|
+ )
|
|
|
+ , "热线号码统计");
|
|
|
}
|