|
@@ -1,7 +1,9 @@
|
|
|
-using Hotline.Application.Bulletin;
|
|
|
+using DocumentFormat.OpenXml.Spreadsheet;
|
|
|
+using Hotline.Application.Bulletin;
|
|
|
using Hotline.Application.Orders;
|
|
|
using Hotline.Article;
|
|
|
using Hotline.Caching.Interfaces;
|
|
|
+using Hotline.KnowledgeBase;
|
|
|
using Hotline.Orders;
|
|
|
using Hotline.Push.Notifies;
|
|
|
using Hotline.Repository.SqlSugar.Extensions;
|
|
@@ -10,11 +12,13 @@ using Hotline.Settings.Hotspots;
|
|
|
using Hotline.Share.Dtos;
|
|
|
using Hotline.Share.Dtos.DataSharing.PusherHotlineDto;
|
|
|
using Hotline.Share.Dtos.Order;
|
|
|
+using Hotline.Share.Dtos.Schedulings;
|
|
|
using Hotline.Share.Dtos.WebPortal;
|
|
|
using Hotline.Share.Enums.Order;
|
|
|
using Hotline.Share.Enums.Push;
|
|
|
using Hotline.WebPortal;
|
|
|
using MapsterMapper;
|
|
|
+using MathNet.Numerics;
|
|
|
using MediatR;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
@@ -45,24 +49,32 @@ namespace Hotline.Api.Controllers
|
|
|
private readonly IRepository<OrderVisitDetail> _orderVisitDetailRepository;
|
|
|
private readonly IBulletinApplication _bulletinApplication;
|
|
|
private readonly IRepository<OldPublicData> _oldPublicDataRepository;
|
|
|
+ private readonly IRepository<KnowledgeRelationType> _knowledgeRelationTypeRepository;
|
|
|
+ private readonly IRepository<KnowledgeType> _knowledgeTypeRepository;
|
|
|
+ private readonly IRepository<Knowledge> _knowledgeRepository;
|
|
|
+ private readonly ISystemDicDataCacheManager _systemDicDataCacheManager;
|
|
|
|
|
|
public WebPortalController(IMapper mapper,
|
|
|
IMediator mediator,
|
|
|
IRepository<Bulletin> bulletinRepository,
|
|
|
- IRepository<WebUserRegister> webUserRegisterRepository,
|
|
|
+ IRepository<WebUserRegister> webUserRegisterRepository,
|
|
|
IRepository<WebUserAuth> webUserAuthRepository,
|
|
|
IRepository<WebFlowAccept> webFlowAcceptRepository,
|
|
|
- ITypedCache<WriteLettersSendSmsDto> writeLettersSendSms,
|
|
|
- IRepository<Hotspot> hotspotRepository,
|
|
|
- ISystemSettingCacheManager systemSettingCacheManager,
|
|
|
- IRepository<OrderPublish> orderPublishRepository,
|
|
|
- IOrderRepository orderRepository,
|
|
|
- IRepository<OrderVisit> orderVisitRepository,
|
|
|
- IOrderApplication orderApplication,
|
|
|
- ISessionContext sessionContext,
|
|
|
+ ITypedCache<WriteLettersSendSmsDto> writeLettersSendSms,
|
|
|
+ IRepository<Hotspot> hotspotRepository,
|
|
|
+ ISystemSettingCacheManager systemSettingCacheManager,
|
|
|
+ IRepository<OrderPublish> orderPublishRepository,
|
|
|
+ IOrderRepository orderRepository,
|
|
|
+ IRepository<OrderVisit> orderVisitRepository,
|
|
|
+ IOrderApplication orderApplication,
|
|
|
+ ISessionContext sessionContext,
|
|
|
IRepository<OrderVisitDetail> orderVisitDetailRepository,
|
|
|
IBulletinApplication bulletinApplication,
|
|
|
- IRepository<OldPublicData> oldPublicDataRepository
|
|
|
+ IRepository<OldPublicData> oldPublicDataRepository,
|
|
|
+ IRepository<KnowledgeRelationType> knowledgeRelationTypeRepository,
|
|
|
+ IRepository<KnowledgeType> knowledgeTypeRepository,
|
|
|
+ IRepository<Knowledge> knowledgeRepository,
|
|
|
+ ISystemDicDataCacheManager systemDicDataCacheManager
|
|
|
)
|
|
|
{
|
|
|
_mapper = mapper;
|
|
@@ -82,6 +94,10 @@ namespace Hotline.Api.Controllers
|
|
|
_orderVisitDetailRepository = orderVisitDetailRepository;
|
|
|
_bulletinApplication = bulletinApplication;
|
|
|
_oldPublicDataRepository = oldPublicDataRepository;
|
|
|
+ _knowledgeRelationTypeRepository = knowledgeRelationTypeRepository;
|
|
|
+ _knowledgeTypeRepository = knowledgeTypeRepository;
|
|
|
+ _knowledgeRepository = knowledgeRepository;
|
|
|
+ _systemDicDataCacheManager = systemDicDataCacheManager;
|
|
|
}
|
|
|
|
|
|
#region 通知
|
|
@@ -921,24 +937,49 @@ namespace Hotline.Api.Controllers
|
|
|
})
|
|
|
.ToListAsync();
|
|
|
|
|
|
- //数据查询-查询总数前5的数据
|
|
|
- var listHot = await _orderRepository.Queryable()
|
|
|
- .Where(p => p.StartTime >= startDate && p.StartTime <= endDate && p.Status > EOrderStatus.WaitForAccept)
|
|
|
- .Select(it => new
|
|
|
- {
|
|
|
- it.HotspotId,
|
|
|
- it.HotspotName
|
|
|
- })
|
|
|
- .MergeTable()//将查询出来的结果合并成一个新表
|
|
|
- .GroupBy(it => new { it.HotspotId, it.HotspotName })//对新表进行分组
|
|
|
+ var listHot = await _orderRepository.Queryable()
|
|
|
+ .Where(it => it.StartTime >= startDate && it.StartTime <= endDate && it.Status > EOrderStatus.WaitForAccept)
|
|
|
.Select(it => new
|
|
|
{
|
|
|
- typeName = it.HotspotName,
|
|
|
+ HotspotId = it.HotspotId.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("2")),
|
|
|
+ })
|
|
|
+ .MergeTable()
|
|
|
+ .GroupBy(it => it.HotspotId)//对新表进行分组
|
|
|
+ .Select(it => new
|
|
|
+ {
|
|
|
+ HotspotId = it.HotspotId,
|
|
|
num = SqlFunc.AggregateCount(it.HotspotId)
|
|
|
})
|
|
|
- .OrderByDescending(it => it.num)
|
|
|
+ .OrderByDescending(it => it.num)
|
|
|
.Take(5)
|
|
|
- .ToListAsync();
|
|
|
+ .MergeTable()
|
|
|
+ .LeftJoin<Hotspot>((it, h) => it.HotspotId == h.Id)
|
|
|
+ .Select((it, h) => new
|
|
|
+ {
|
|
|
+ typeName = h.HotSpotName,
|
|
|
+ num = it.num
|
|
|
+ }).ToListAsync();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ////数据查询-查询总数前5的数据
|
|
|
+ //var listHot = await _orderRepository.Queryable()
|
|
|
+ // .Where(p => p.StartTime >= startDate && p.StartTime <= endDate && p.Status > EOrderStatus.WaitForAccept)
|
|
|
+ // .Select(it => new
|
|
|
+ // {
|
|
|
+ // it.HotspotId,
|
|
|
+ // it.HotspotName
|
|
|
+ // })
|
|
|
+ // .MergeTable()//将查询出来的结果合并成一个新表
|
|
|
+ // .GroupBy(it => new { it.HotspotId, it.HotspotName })//对新表进行分组
|
|
|
+ // .Select(it => new
|
|
|
+ // {
|
|
|
+ // typeName = it.HotspotName,
|
|
|
+ // num = SqlFunc.AggregateCount(it.HotspotId)
|
|
|
+ // })
|
|
|
+ // .OrderByDescending(it => it.num)
|
|
|
+ // .Take(5)
|
|
|
+ // .ToListAsync();
|
|
|
|
|
|
GetChartDataDto dataDto = new()
|
|
|
{
|
|
@@ -972,7 +1013,7 @@ namespace Hotline.Api.Controllers
|
|
|
AllCount = SqlFunc.AggregateSum(SqlFunc.IIF(p.Status > EOrderStatus.WaitForAccept, 1, 0)),
|
|
|
AllTrandCount = SqlFunc.AggregateSum(SqlFunc.IIF(p.Status >= EOrderStatus.Filed, 1, 0)),
|
|
|
DayCount = SqlFunc.AggregateSum(SqlFunc.IIF(p.StartTime >= startDate && p.StartTime <= endDate && p.Status > EOrderStatus.WaitForAccept, 1, 0)),
|
|
|
- DayTrandCount = SqlFunc.AggregateSum(SqlFunc.IIF(p.ActualHandleTime >= startDate && p.ActualHandleTime <= endDate && p.Status >= EOrderStatus.Filed, 1, 0)),
|
|
|
+ DayTrandCount = SqlFunc.AggregateSum(SqlFunc.IIF(p.FiledTime >= startDate && p.FiledTime <= endDate && p.Status >= EOrderStatus.Filed, 1, 0)),
|
|
|
})
|
|
|
.FirstAsync();
|
|
|
return OpenResponse.Ok(WebPortalDeResponse<GetStatistDto>.Success(getStatistDto));
|
|
@@ -1063,5 +1104,65 @@ namespace Hotline.Api.Controllers
|
|
|
return OpenResponse.Ok(WebPortalDeResponse<string>.Success("1"));
|
|
|
}
|
|
|
#endregion
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取知识库分类
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("getknowledgetype")]
|
|
|
+ [AllowAnonymous]
|
|
|
+ public async Task<OpenResponse> GetKnowledgeType()
|
|
|
+ {
|
|
|
+ //查询知识分类
|
|
|
+ var item = await _knowledgeTypeRepository.Queryable()
|
|
|
+ .Where(p => p.ParentId == null || p.ParentId == "")
|
|
|
+ .Select(p => new
|
|
|
+ {
|
|
|
+ SDICT_ID = p.Id,
|
|
|
+ SDICT_Name = p.Name
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ //查询知识标签
|
|
|
+ var list = _systemDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.KnowledgeBaseTags).Select(p => new
|
|
|
+ {
|
|
|
+ SDICT_Name = p.DicDataName,
|
|
|
+ SDICT_ID = p.DicDataValue
|
|
|
+ }).ToList();
|
|
|
+
|
|
|
+ var rsp = new
|
|
|
+ {
|
|
|
+ KnowledgeType = item,
|
|
|
+ KnowledgeBaseTags = item,
|
|
|
+ };
|
|
|
+ return OpenResponse.Ok(WebPortalDeResponse<object>.Success(rsp));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 知识库查询
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("getknowledgelist")]
|
|
|
+ [AllowAnonymous]
|
|
|
+ public async Task<OpenResponse> GetKnowledgeList([FromBody] QueryKnowledgeList dto)
|
|
|
+ {
|
|
|
+ var typeSpliceName = string.Empty;
|
|
|
+ if (!string.IsNullOrEmpty(dto.KnowledgeTypeId))
|
|
|
+ {
|
|
|
+ var type = await _knowledgeTypeRepository.GetAsync(x => x.Id == dto.KnowledgeTypeId);
|
|
|
+ typeSpliceName = type?.SpliceName;
|
|
|
+ }
|
|
|
+
|
|
|
+ var (total, items) = await _knowledgeRepository.Queryable()
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Title), p => p.Title.Contains(dto.Title))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.KnowledgeBaseTags), p => p.KnowledgeType.Any(t => t.KnowledgeTypeSpliceName.EndsWith(dto.KnowledgeBaseTags)))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(typeSpliceName), x => x.KnowledgeType.Any(t => t.KnowledgeTypeSpliceName.EndsWith(typeSpliceName)))
|
|
|
+ .OrderByDescending(p => p.CreationTime)
|
|
|
+ .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ var data = new PagedDto<KnowledgeInfoDto>(total, _mapper.Map<IReadOnlyList<KnowledgeInfoDto>>(items));
|
|
|
+ return OpenResponse.Ok(WebPortalDeResponse<PagedDto<KnowledgeInfoDto>>.Success(data));
|
|
|
+ }
|
|
|
}
|
|
|
}
|