|
@@ -1,6 +1,7 @@
|
|
|
using Hotline.Application.CallCenter;
|
|
|
using Hotline.Article;
|
|
|
using Hotline.Caching.Interfaces;
|
|
|
+using Hotline.Caching.Services;
|
|
|
using Hotline.CallCenter.Tels;
|
|
|
using Hotline.Realtimes;
|
|
|
using Hotline.Repository.SqlSugar.Extensions;
|
|
@@ -14,6 +15,7 @@ using Hotline.Share.Enums.CallCenter;
|
|
|
using Hotline.Tools;
|
|
|
using MapsterMapper;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
+using System.Reflection.Metadata.Ecma335;
|
|
|
using System.Threading;
|
|
|
using XF.Domain.Authentications;
|
|
|
using XF.Domain.Exceptions;
|
|
@@ -32,6 +34,7 @@ namespace Hotline.Api.Controllers
|
|
|
private readonly IMapper _mapper;
|
|
|
private readonly IRealtimeService _realtimeService;
|
|
|
private readonly ICircularRecordDomainService _circularRecordDomainService;
|
|
|
+ private readonly ISystemSettingCacheManager _systemSettingCacheManager;
|
|
|
|
|
|
public TelRestController(ISystemDicDataCacheManager systemDicDataCacheManager,
|
|
|
IRepository<TelRestApply> telRestApplyRepository,
|
|
@@ -40,7 +43,8 @@ namespace Hotline.Api.Controllers
|
|
|
ITelDomainService telDomainService,
|
|
|
IMapper mapper,
|
|
|
IRealtimeService realtimeService,
|
|
|
- ICircularRecordDomainService circularRecordDomainService)
|
|
|
+ ICircularRecordDomainService circularRecordDomainService,
|
|
|
+ ISystemSettingCacheManager systemSettingCacheManager)
|
|
|
{
|
|
|
_systemDicDataCacheManager = systemDicDataCacheManager;
|
|
|
_telRestApplyRepository = telRestApplyRepository;
|
|
@@ -50,6 +54,7 @@ namespace Hotline.Api.Controllers
|
|
|
_mapper = mapper;
|
|
|
_realtimeService = realtimeService;
|
|
|
_circularRecordDomainService = circularRecordDomainService;
|
|
|
+ _systemSettingCacheManager = systemSettingCacheManager;
|
|
|
}
|
|
|
|
|
|
#region 小休审批
|
|
@@ -69,6 +74,44 @@ namespace Hotline.Api.Controllers
|
|
|
return rsp;
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 查询是否需要小休审批
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<bool> IsCheckAudit()
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ //首先验证是否开启,如果开启需要审批进行下一步判断
|
|
|
+ //未开启则不用审批
|
|
|
+ var isRestApproval = bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.IsRestApproval).SettingValue[0]);
|
|
|
+ if (isRestApproval)
|
|
|
+ {
|
|
|
+ var restAuditTime = _systemSettingCacheManager.GetSetting(SettingConstants.IsRestAuditTime).SettingValue;
|
|
|
+ if (restAuditTime == null || restAuditTime.Count == 0)
|
|
|
+ return false;
|
|
|
+ foreach (var item in restAuditTime)
|
|
|
+ {
|
|
|
+ // 1-2
|
|
|
+ var time = item.Split('-');
|
|
|
+ var nowTime = DateTime.Now;
|
|
|
+ var starTime = Convert.ToDateTime(nowTime.ToString("yyyy-MM-dd") + time[0]);
|
|
|
+ var endTime = Convert.ToDateTime(nowTime.ToString("yyyy-MM-dd") + time[1]);
|
|
|
+ if (starTime < nowTime && endTime > nowTime)
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 小休申请
|
|
|
/// </summary>
|