|
@@ -1,18 +1,23 @@
|
|
|
using Hotline.Caching.Interfaces;
|
|
|
using Hotline.Caching.Services;
|
|
|
using Hotline.CallCenter.Manage;
|
|
|
+using Hotline.Orders;
|
|
|
using Hotline.Permissions;
|
|
|
using Hotline.Repository.SqlSugar.Extensions;
|
|
|
+using Hotline.Repository.SqlSugar.Ts;
|
|
|
using Hotline.Settings;
|
|
|
using Hotline.Settings.TimeLimits;
|
|
|
using Hotline.Share.Dtos;
|
|
|
+using Hotline.Share.Dtos.File;
|
|
|
using Hotline.Share.Dtos.Order;
|
|
|
+using Hotline.Share.Dtos.Settings;
|
|
|
using Hotline.Share.Requests;
|
|
|
using MapsterMapper;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using MongoDB.Bson;
|
|
|
using MongoDB.Driver;
|
|
|
+using XF.Domain.Authentications;
|
|
|
using XF.Domain.Exceptions;
|
|
|
using XF.Domain.Repository;
|
|
|
|
|
@@ -28,15 +33,28 @@ namespace Hotline.Api.Controllers
|
|
|
private readonly ISystemSettingCacheManager _systemSettingCacheManager;
|
|
|
private readonly IDaySettingRepository _daysettingRepository;
|
|
|
private readonly IMapper _mapper;
|
|
|
+ private readonly IRepository<BusinessTag> _businessTag;
|
|
|
+ private readonly IRepositoryTextSearch<OrderTs> _repositoryts;
|
|
|
|
|
|
- public SettingController(IVoiceFileDomainService voiceFileDomainService, IRepository<SystemSetting> systemSettingsRepository, ISystemSettingCacheManager systemSettingCacheManager,IDaySettingRepository daySettingRepository, IMapper mapper)
|
|
|
+ public SettingController(
|
|
|
+ IVoiceFileDomainService voiceFileDomainService,
|
|
|
+ IRepository<SystemSetting> systemSettingsRepository,
|
|
|
+ ISystemSettingCacheManager systemSettingCacheManager,
|
|
|
+ IDaySettingRepository daySettingRepository,
|
|
|
+ IMapper mapper,
|
|
|
+ IRepository<BusinessTag> businessTag,
|
|
|
+ IRepositoryTextSearch<OrderTs> repositoryts
|
|
|
+ )
|
|
|
{
|
|
|
_voiceFileDomainService = voiceFileDomainService;
|
|
|
_systemSettingsRepository = systemSettingsRepository;
|
|
|
_systemSettingCacheManager = systemSettingCacheManager;
|
|
|
_daysettingRepository = daySettingRepository;
|
|
|
_mapper = mapper;
|
|
|
- }
|
|
|
+ _businessTag = businessTag;
|
|
|
+ _repositoryts = repositoryts;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 查询语音文件
|
|
@@ -173,7 +191,85 @@ namespace Hotline.Api.Controllers
|
|
|
await _daysettingRepository.AddRangeAsync(daysettings);
|
|
|
}
|
|
|
|
|
|
- #endregion
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 标签
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 业务标签列表
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("businessTag")]
|
|
|
+ public async Task<PagedDto<BusinessTag>> SuperviseList([FromQuery] BusinessTagListDto dto)
|
|
|
+ {
|
|
|
+ var (total, items) = await _businessTag.Queryable()
|
|
|
+ .WhereIF(dto.Type > 0, d => d.Type >= dto.Type)
|
|
|
+ .WhereIF(dto.BusinessType > 0, d => d.BusinessType <= dto.BusinessType)
|
|
|
+ .OrderByDescending(x => x.CreationTime)
|
|
|
+ .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
+ return new PagedDto<BusinessTag>(total, items);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 新增标签(支持批量)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("businessTag")]
|
|
|
+ public async Task Add([FromBody] List<BusinessTagDto> dtos)
|
|
|
+ {
|
|
|
+ List<BusinessTag> tags = new List<BusinessTag>();
|
|
|
+ foreach (var dto in tags)
|
|
|
+ {
|
|
|
+ var model = _mapper.Map<BusinessTag>(dto);
|
|
|
+ tags.Add(model);
|
|
|
+ }
|
|
|
+ await _businessTag.AddRangeAsync(tags, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 删除标签
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpDelete("businessTag")]
|
|
|
+ public async Task Delete([FromBody] DeleteBusinessTagDto dto)
|
|
|
+ {
|
|
|
+ foreach (var Id in dto.Ids)
|
|
|
+ {
|
|
|
+ await _businessTag.RemoveAsync(x => x.Id == Id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 更新标签
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPut("businessTag")]
|
|
|
+ public async Task Update([FromBody] UpdateBusinessTagDto dto)
|
|
|
+ {
|
|
|
+ //验证工单是否可以申请
|
|
|
+ var file = await _businessTag.GetAsync(dto.Id, HttpContext.RequestAborted);
|
|
|
+ if (file is null)
|
|
|
+ throw UserFriendlyException.SameMessage("无效标签");
|
|
|
+ _mapper.Map(dto, file);
|
|
|
+ await _businessTag.UpdateAsync(file, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取标签实体
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("businessTag/{id}")]
|
|
|
+ public async Task<BusinessTag> Entity(string id)
|
|
|
+ {
|
|
|
+ return await _businessTag.Queryable()
|
|
|
+ .FirstAsync(x => x.Id == id);
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
}
|