|
@@ -11,7 +11,9 @@ using Hotline.Share.Dtos.Bigscreen;
|
|
|
using Hotline.Share.Dtos.CallCenter;
|
|
|
using Hotline.Share.Dtos.Order;
|
|
|
using Hotline.Share.Enums.CallCenter;
|
|
|
+using Hotline.Share.Enums.FlowEngine;
|
|
|
using Hotline.Share.Enums.Order;
|
|
|
+using Hotline.Share.Enums.Settings;
|
|
|
using Hotline.Share.Requests;
|
|
|
using MapsterMapper;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
@@ -21,6 +23,7 @@ using XF.Domain.Authentications;
|
|
|
using XF.Domain.Constants;
|
|
|
using XF.Domain.Exceptions;
|
|
|
using XF.Domain.Repository;
|
|
|
+using XF.Utility.EnumExtensions;
|
|
|
|
|
|
namespace Hotline.Api.Controllers.Bi
|
|
|
{
|
|
@@ -41,9 +44,9 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
private readonly IRepository<AiOrderVisitDetail> _aiOrderVisitDetailRepository;
|
|
|
private readonly ISessionContext _sessionContext;
|
|
|
private readonly ISystemSettingCacheManager _systemSettingCacheManager;
|
|
|
+ private readonly IRepository<OrderSpecialDetail> _orderSpecialDetailRepository;
|
|
|
|
|
|
-
|
|
|
- public BiOrderController(
|
|
|
+ public BiOrderController(
|
|
|
IOrderRepository orderRepository,
|
|
|
IRepository<Hotspot> hotspotTypeRepository,
|
|
|
ISystemDicDataCacheManager sysDicDataCacheManager,
|
|
@@ -58,8 +61,9 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
IRepository<SystemOrganize> systemOrganizeRepository,
|
|
|
IRepository<AiOrderVisitDetail> aiOrderVisitDetailRepository,
|
|
|
ISessionContext sessionContext,
|
|
|
- ISystemSettingCacheManager systemSettingCacheManager
|
|
|
- )
|
|
|
+ ISystemSettingCacheManager systemSettingCacheManager,
|
|
|
+ IRepository<OrderSpecialDetail> orderSpecialDetailRepository
|
|
|
+ )
|
|
|
{
|
|
|
_orderRepository = orderRepository;
|
|
|
_hotspotTypeRepository = hotspotTypeRepository;
|
|
@@ -76,7 +80,9 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
_aiOrderVisitDetailRepository = aiOrderVisitDetailRepository;
|
|
|
_sessionContext = sessionContext;
|
|
|
_systemSettingCacheManager = systemSettingCacheManager;
|
|
|
- }
|
|
|
+ _orderSpecialDetailRepository = orderSpecialDetailRepository;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
//public async Task OrgDataListDetail([FromQuery] OrgDataListDetailRequest dto)
|
|
|
//{
|
|
@@ -534,9 +540,11 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
dto.PageIndex = 1;
|
|
|
dto.PageSize = 10;
|
|
|
+ var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
var query = _orderRepository.Queryable(false, false, false)
|
|
|
.WhereIF(dto.StartTime.HasValue, x => x.CreationTime >= dto.StartTime)
|
|
|
.WhereIF(dto.EndTime.HasValue, x => x.CreationTime <= dto.EndTime)
|
|
|
+ .WhereIF(IsCenter == false, x => x.ActualHandleOrgCode.StartsWith(_sessionContext.RequiredOrgId))
|
|
|
.Select(x => new
|
|
|
{
|
|
|
AcceptType = x.AcceptType,
|
|
@@ -742,16 +750,20 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
|
|
|
var list = await _orderVisitDetailRepository.Queryable()
|
|
|
.Where(x => x.OrderVisit.VisitTime >= StartDate && x.OrderVisit.VisitTime <= EndDate && x.VisitTarget == EVisitTarget.Org && x.OrderVisit.VisitState == EVisitState.Visited && !string.IsNullOrEmpty(x.VisitOrgCode))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(OrgName), x => x.VisitOrgName.Contains(OrgName))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(LineNum), x => x.OrderVisit.Order.CallRecord.Gateway.Contains(LineNum))
|
|
|
+ .WhereIF(string.IsNullOrEmpty(OrgName)==false, x => x.VisitOrgName.Contains(OrgName))
|
|
|
+ .WhereIF(string.IsNullOrEmpty(LineNum)==false, x => x.OrderVisit.Order.CallRecord.Gateway.Contains(LineNum))
|
|
|
.WhereIF(IsCenter == false, x => x.VisitOrgCode.StartsWith(_sessionContext.OrgId))
|
|
|
- .GroupBy(x => new
|
|
|
+ .GroupByIF(IsCenter,x => new
|
|
|
{
|
|
|
VisitOrgCode = x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6"))
|
|
|
})
|
|
|
+ .GroupByIF(IsCenter == false, x => new
|
|
|
+ {
|
|
|
+ VisitOrgCode = x.VisitOrgCode
|
|
|
+ })
|
|
|
.Select(x => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
{
|
|
|
- OrgCode = x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")),
|
|
|
+ OrgCode = SqlFunc.IIF(IsCenter,x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")), x.VisitOrgCode),
|
|
|
TotalSumCount = SqlFunc.AggregateCount(x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6"))),
|
|
|
VerySatisfiedCount = SqlFunc.IIF(TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "5", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "5", 1, 0))),//非常满意数
|
|
|
SatisfiedCount = SqlFunc.IIF(TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "4", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "4", 1, 0))), //满意数
|
|
@@ -847,11 +859,11 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
.WhereIF(IsCenter == false, (x, it) => it.VisitOrgCode.StartsWith(_sessionContext.OrgId))
|
|
|
.GroupBy((x, it) => new
|
|
|
{
|
|
|
- VisitOrgCode = it.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("9"))
|
|
|
+ VisitOrgCode = it.VisitOrgCode
|
|
|
})
|
|
|
.Select((x, it) => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
{
|
|
|
- OrgCode = it.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("9")),
|
|
|
+ OrgCode = it.VisitOrgCode,
|
|
|
TotalSumCount = SqlFunc.AggregateCount(it.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("9"))),
|
|
|
VerySatisfiedCount = SqlFunc.IIF(TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgProcessingResults, "Key") == "5", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgHandledAttitude, "Key") == "5", 1, 0))),//非常满意数
|
|
|
SatisfiedCount = SqlFunc.IIF(TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgProcessingResults, "Key") == "4", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(it.OrgHandledAttitude, "Key") == "4", 1, 0))), //满意数
|
|
@@ -1186,21 +1198,33 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
|
|
|
var orderData = await _orderRepository.Queryable()
|
|
|
- .LeftJoin<SystemOrganize>((it, o) => it.OrgLevelOneCode == o.Id)
|
|
|
- .Where((it, o) => it.CreationTime >= StartDate && it.CreationTime <= EndDate && (int)it.Status >= 300)
|
|
|
- .WhereIF(TypeCode == 1, (it, o) => it.OrgLevelOneCode == "001")
|
|
|
- .WhereIF(TypeCode == 2, (it, o) => it.OrgLevelOneCode != "001")
|
|
|
- .WhereIF(IsCenter == false, (it, o) => it.OrgLevelOneCode.StartsWith(_sessionContext.RequiredOrgId))
|
|
|
+ // .LeftJoin<SystemOrganize>((it, o) => it.OrgLevelOneCode == o.Id)
|
|
|
+ .Where(it => it.CreationTime >= StartDate && it.CreationTime <= EndDate && it.Status >= EOrderStatus.Filed)
|
|
|
+
|
|
|
+ .Select(it => new
|
|
|
+ {
|
|
|
+ OrgCode = IsCenter == true ? it.OrgLevelOneCode : it.ActualHandleOrgCode.Substring(0, _sessionContext.RequiredOrgId.Length + 3),
|
|
|
+ it.AcceptTypeCode,
|
|
|
+ it.FileDurationWorkday,
|
|
|
+ it.AllDuration
|
|
|
+ })
|
|
|
+ .MergeTable()
|
|
|
+ .LeftJoin<SystemOrganize>((it, o) => it.OrgCode == o.Id)
|
|
|
+
|
|
|
+ .WhereIF(TypeCode == 1, (it, o) => it.OrgCode == "001")
|
|
|
+ .WhereIF(TypeCode == 2, (it, o) => it.OrgCode != "001")
|
|
|
+ .WhereIF(IsCenter == false, (it, o) => it.OrgCode.StartsWith(_sessionContext.RequiredOrgId))
|
|
|
+
|
|
|
.GroupBy((it, o) => new
|
|
|
{
|
|
|
- it.OrgLevelOneCode,
|
|
|
+ it.OrgCode,
|
|
|
o.Name,
|
|
|
o.OrgType
|
|
|
})
|
|
|
.Select((it, o) => new DepartmentAcceptanceTypeStatisticsDto
|
|
|
{
|
|
|
- OrgName = it.OrgLevelOneCode == "001" ? "热线中心" : o.Name,
|
|
|
- OrgCode = it.OrgLevelOneCode,
|
|
|
+ OrgName = it.OrgCode == "001" ? "热线中心" : o.Name,
|
|
|
+ OrgCode = it.OrgCode,
|
|
|
OrgType = (int)o.OrgType == 2 ? "区县部门" : "市直部门",
|
|
|
ZxAllCount = SqlFunc.AggregateSum(SqlFunc.IIF(it.AcceptTypeCode == "10", 1, 0)),
|
|
|
ZxAllTimes = SqlFunc.AggregateSum(SqlFunc.IIF(it.AcceptTypeCode == "10" && it.AllDuration != null, it.AllDuration, 0)),
|
|
@@ -1245,9 +1269,12 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
{
|
|
|
dto.EndDate = dto.EndDate.AddDays(1).AddSeconds(-1);
|
|
|
var (total, items) = await _orderRepository.Queryable()
|
|
|
- .Where(p => p.CreationTime >= dto.StartDate && p.CreationTime <= dto.EndDate && (int)p.Status >= 300)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgLevelOneCode), p => p.OrgLevelOneCode == dto.OrgLevelOneCode)
|
|
|
+ .Where(p => p.CreationTime >= dto.StartDate && p.CreationTime <= dto.EndDate && p.Status >= EOrderStatus.Filed)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgLevelOneCode) && dto.OrgLevelOneCode == "001", p => p.OrgLevelOneCode == dto.OrgLevelOneCode)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgLevelOneCode) && dto.OrgLevelOneCode != "001", p => p.ActualHandleOrgCode.StartsWith(dto.OrgLevelOneCode))
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.AcceptTypeCode), p => p.AcceptTypeCode == dto.AcceptTypeCode)
|
|
|
+ .WhereIF(dto.TypeCode == 1, p => p.OrgLevelOneCode == "001")
|
|
|
+ .WhereIF(dto.TypeCode == 2, p => p.OrgLevelOneCode != "001")
|
|
|
.OrderByDescending(d => d.CreationTime)
|
|
|
.ToPagedListAsync(dto, HttpContext.RequestAborted);
|
|
|
|
|
@@ -1552,5 +1579,74 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
return new PagedDto<OrderDto>(total, _mapper.Map<IReadOnlyList<OrderDto>>(items));
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
+ /// <summary>
|
|
|
+ /// 回退错件
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("reTransact")]
|
|
|
+ public async Task<PagedDto<OrderReTransactVo>> OrderReTransact([FromQuery] QueryOrderReTransactRequest dto)
|
|
|
+ {
|
|
|
+ if (!dto.StartTime.HasValue || !dto.EndTime.HasValue)
|
|
|
+ throw UserFriendlyException.SameMessage("请选择时间!");
|
|
|
+ dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
+ var (total, items) = await _orderSpecialDetailRepository.Queryable()
|
|
|
+ .Includes(x=>x.OrderSpecial)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgName), x => x.OrgName.Contains(dto.OrgName!))
|
|
|
+ .Where(x => x.OrderSpecial.ESpecialType == ESpecialType.ReTransact)
|
|
|
+ .Where(x => x.OrderSpecial.CreationTime >= dto.StartTime)
|
|
|
+ .Where(x => x.OrderSpecial.CreationTime <= dto.EndTime)
|
|
|
+ .GroupBy(x => new { Time = x.OrderSpecial.CreationTime.ToString("yyyy-MM-dd"), x.OrgId, x.OrgName })
|
|
|
+ .Select(x => new OrderReTransactVo
|
|
|
+ {
|
|
|
+ Time = x.OrderSpecial.CreationTime.ToString("yyyy-MM-dd"),
|
|
|
+ OrgId = x.OrgId,
|
|
|
+ OrgName = x.OrgName,
|
|
|
+ Num = SqlFunc.AggregateCount(1)
|
|
|
+ }).MergeTable()
|
|
|
+ .OrderByIF(dto.SortRule == 0, x => x.Num, OrderByType.Asc)
|
|
|
+ .OrderByIF(dto.SortRule == 1, x => x.Num, OrderByType.Desc)
|
|
|
+ .ToPagedListAsync(dto, HttpContext.RequestAborted);
|
|
|
+ return new PagedDto<OrderReTransactVo>(total, _mapper.Map<IReadOnlyList<OrderReTransactVo>>(items));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 回退错件明细
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("reTransact_detail")]
|
|
|
+ public async Task<PagedDto<OrderSpecialDetailDto>> OrderReTransactDetail([FromQuery] QueryOrderReTransactDetailRequest dto)
|
|
|
+ {
|
|
|
+ if (!dto.StartTime.HasValue || !dto.EndTime.HasValue)
|
|
|
+ throw UserFriendlyException.SameMessage("请选择时间!");
|
|
|
+ dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
+ var (total, items) = await _orderSpecialDetailRepository.Queryable()
|
|
|
+ .Includes(x => x.OrderSpecial,s=>s.Order)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgName),x=>x.OrgName.Contains(dto.OrgName!))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.ErrorName), x => x.ErrorName.Contains(dto.ErrorName!))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.No), x => x.OrderSpecial!.Order!.No!.Contains(dto.No!))
|
|
|
+ .Where(x => x.OrderSpecial.ESpecialType == ESpecialType.ReTransact)
|
|
|
+ .Where(x => x.OrderSpecial.CreationTime >= dto.StartTime)
|
|
|
+ .Where(x => x.OrderSpecial.CreationTime <= dto.EndTime)
|
|
|
+ .ToPagedListAsync(dto, HttpContext.RequestAborted);
|
|
|
+ return new PagedDto<OrderSpecialDetailDto>(total, _mapper.Map<IReadOnlyList<OrderSpecialDetailDto>>(items));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取基本信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("reTransact_base")]
|
|
|
+ public async Task<object> ReTransactBaseData()
|
|
|
+ {
|
|
|
+ var rsp = new
|
|
|
+ {
|
|
|
+ ReTransactErrorType = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.ReTransactErrorType),
|
|
|
+ };
|
|
|
+ return rsp;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|