|
@@ -34,6 +34,17 @@ using Tr.Sdk;
|
|
|
using Hotline.Configurations;
|
|
|
using Hotline.FlowEngine.Workflows;
|
|
|
using Hotline.Share.Dtos.FlowEngine.Workflow;
|
|
|
+using Senparc.Weixin.WxOpen.AdvancedAPIs.WxApp.WxAppJson;
|
|
|
+using Hotline.Application.CallCenter;
|
|
|
+using Hotline.Repository.SqlSugar.Extensions;
|
|
|
+using DocumentFormat.OpenXml.Spreadsheet;
|
|
|
+using Hotline.Share.Dtos.IndustryClassification;
|
|
|
+using Hotline.Share.Dtos.Order;
|
|
|
+using Hotline.Tools;
|
|
|
+using Hotline.Caching.Services;
|
|
|
+using Hotline.Repository.SqlSugar.System;
|
|
|
+using Hotline.Settings.TimeLimits;
|
|
|
+using Hotline.Share.Enums.Order;
|
|
|
|
|
|
namespace Hotline.Api.Controllers
|
|
|
{
|
|
@@ -68,6 +79,8 @@ namespace Hotline.Api.Controllers
|
|
|
private readonly IWexTelGroupRepository _wexTelGroupRepository;
|
|
|
private readonly IOptionsSnapshot<CallCenterConfiguration> _options;
|
|
|
private readonly ISystemDicDataCacheManager _systemDicDataCacheManager;
|
|
|
+ private readonly IRepository<TelRestApply> _telRestApplyRepository;
|
|
|
+ private readonly IPbxApplication _pbxApplication;
|
|
|
|
|
|
|
|
|
public PbxController(
|
|
@@ -97,7 +110,9 @@ namespace Hotline.Api.Controllers
|
|
|
IWexTelGroupRepository wexTelGroupRepository,
|
|
|
IOptionsSnapshot<AppConfiguration> appOptions,
|
|
|
IOptionsSnapshot<CallCenterConfiguration> options,
|
|
|
- ISystemDicDataCacheManager systemDicDataCacheManager)
|
|
|
+ ISystemDicDataCacheManager systemDicDataCacheManager,
|
|
|
+ IRepository<TelRestApply> telRestApplyRepository,
|
|
|
+ IPbxApplication pbxApplication)
|
|
|
{
|
|
|
_telRepository = telRepository;
|
|
|
_telRestRepository = telRestRepository;
|
|
@@ -128,15 +143,12 @@ namespace Hotline.Api.Controllers
|
|
|
{
|
|
|
_newRockDeviceManager = serviceProvider.GetRequiredService<INewRockDeviceManager>();
|
|
|
}
|
|
|
+ _telRestApplyRepository = telRestApplyRepository;
|
|
|
+ _pbxApplication = pbxApplication;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
#region 话机
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 根据设备自动同步分机数据到数据库
|
|
|
/// </summary>
|
|
@@ -305,8 +317,8 @@ namespace Hotline.Api.Controllers
|
|
|
startWorkflowDto.DefinitionModuleCode = WorkflowModuleConsts.TelRestApply;
|
|
|
startWorkflowDto.Opinion = dto.Reason;
|
|
|
startWorkflowDto.Title = "分机休息申请流程";
|
|
|
- // await _workflowApplication.StartWorkflowAsync(startWorkflowDto, telRest.Id, cancellationToken: HttpContext.RequestAborted);
|
|
|
- //await _workflowDomainService.StartAsync(startWorkflowDto, telRest.Id, cancellationToken: HttpContext.RequestAborted);
|
|
|
+ // await _workflowApplication.StartWorkflowAsync(startWorkflowDto, telRest.Id, cancellationToken: HttpContext.RequestAborted);
|
|
|
+ //await _workflowDomainService.StartAsync(startWorkflowDto, telRest.Id, cancellationToken: HttpContext.RequestAborted);
|
|
|
await _workflowDomainService.StartToFirstStepAsync(startWorkflowDto, telRest.Id, cancellationToken: HttpContext.RequestAborted);
|
|
|
}
|
|
|
}
|
|
@@ -343,8 +355,8 @@ namespace Hotline.Api.Controllers
|
|
|
startWorkflowDto.DefinitionModuleCode = WorkflowModuleConsts.TelRestApply;
|
|
|
startWorkflowDto.Opinion = dto.Reason;
|
|
|
startWorkflowDto.Title = "分机休息申请流程";
|
|
|
- // await _workflowApplication.StartWorkflowAsync(startWorkflowDto, telRest.Id, cancellationToken: HttpContext.RequestAborted);
|
|
|
- //await _workflowDomainService.StartAsync(startWorkflowDto, telRest.Id, cancellationToken: HttpContext.RequestAborted);
|
|
|
+ // await _workflowApplication.StartWorkflowAsync(startWorkflowDto, telRest.Id, cancellationToken: HttpContext.RequestAborted);
|
|
|
+ //await _workflowDomainService.StartAsync(startWorkflowDto, telRest.Id, cancellationToken: HttpContext.RequestAborted);
|
|
|
await _workflowDomainService.StartToFirstStepAsync(startWorkflowDto, telRest.Id, cancellationToken: HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
@@ -1090,6 +1102,128 @@ namespace Hotline.Api.Controllers
|
|
|
return telGroup;
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 小休审批
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 列表页面基础数据
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("base-data")]
|
|
|
+ public async Task<object> BaseData()
|
|
|
+ {
|
|
|
+ var rsp = new
|
|
|
+ {
|
|
|
+ RestReason = _systemDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.RestReason),
|
|
|
+ AuditStatus = EnumExts.GetDescriptions<ETelRestAuditStatus>()
|
|
|
+ };
|
|
|
+ return rsp;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 小休申请
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ [HttpPost("addtelrest")]
|
|
|
+ public async Task AddTelRest([FromBody] TelRestApplyAddDto dto)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(dto.TelNo))
|
|
|
+ throw new UserFriendlyException("分机号不能为空!");
|
|
|
+ if (dto.Reason == null)
|
|
|
+ throw new UserFriendlyException("小休原因不能为空!");
|
|
|
+
|
|
|
+ var data = await _telRestApplyRepository.GetAsync(p => p.TelNo == dto.TelNo && p.CreatorId == _sessionContext.RequiredUserId &&
|
|
|
+ p.AuditStatus == ETelRestAuditStatus.NoAudit, HttpContext.RequestAborted);
|
|
|
+ if (data != null)
|
|
|
+ throw new UserFriendlyException("小休申请审批中,暂时无法操作!");
|
|
|
+
|
|
|
+ TelRestApply telRestApply = new()
|
|
|
+ {
|
|
|
+ TelNo = dto.TelNo,
|
|
|
+ Reason = dto.Reason.Value,
|
|
|
+ ReasonId = dto.Reason.Key,
|
|
|
+ StaffNo = _sessionContext.StaffNo,
|
|
|
+ AuditStatus = ETelRestAuditStatus.NoAudit
|
|
|
+ };
|
|
|
+ await _telRestApplyRepository.AddAsync(telRestApply, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 小休审批
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="UserFriendlyException"></exception>
|
|
|
+ [HttpPost("telrest_apply_audit")]
|
|
|
+ public async Task TelRestApplyAudit([FromBody] TelRestApplyAuditDto dto)
|
|
|
+ {
|
|
|
+ if (dto.IsPass == false && string.IsNullOrEmpty(dto.AuditOpinion))
|
|
|
+ throw new UserFriendlyException("审批原因不能为空!");
|
|
|
+ var data = await _telRestApplyRepository.GetAsync(dto.Id, HttpContext.RequestAborted);
|
|
|
+ if (data == null)
|
|
|
+ throw new UserFriendlyException("审批数据查询失败!");
|
|
|
+ data.AuditUserName = _sessionContext.UserName;
|
|
|
+ data.AuditUserId = _sessionContext.RequiredUserId;
|
|
|
+ data.AuditOrgId = _sessionContext.RequiredOrgId;
|
|
|
+ data.AuditOrgName = _sessionContext.OrgName;
|
|
|
+ data.AuditTime = DateTime.Now;
|
|
|
+ data.AuditOpinion = dto.AuditOpinion;
|
|
|
+ data.AuditStatus = dto.IsPass == true ? ETelRestAuditStatus.Pass : ETelRestAuditStatus.NoPass;
|
|
|
+ await _telRestApplyRepository.UpdateAsync(data, HttpContext.RequestAborted);
|
|
|
+ if (dto.IsPass)
|
|
|
+ {
|
|
|
+ //审批通过发送通知给前端
|
|
|
+ await _telDomainService.TelRestApplyPassAsync(data.CreatorId, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 小修申请记录
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("get_restapply_list")]
|
|
|
+ public async Task<PagedDto<TelRestApplyListDto>> GetRestApplyList([FromQuery] TelRestApplyRequestDto dto)
|
|
|
+ {
|
|
|
+ var (total, items) = await _pbxApplication.GetRestApplyList(dto).ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ return new PagedDto<TelRestApplyListDto>(total, items);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 小修申请记录--导出
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("get_restapply_list_export")]
|
|
|
+ public async Task<FileStreamResult> GetRestApplyListExport([FromBody] ExportExcelDto<TelRestApplyRequestDto> dto)
|
|
|
+ {
|
|
|
+ var query = _pbxApplication.GetRestApplyList(dto.QueryDto);
|
|
|
+
|
|
|
+ List<TelRestApplyListDto> data;
|
|
|
+ if (dto.IsExportAll)
|
|
|
+ {
|
|
|
+ data = await query.ToListAsync(HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var (_, items) = await query.ToPagedListAsync(dto.QueryDto, HttpContext.RequestAborted);
|
|
|
+ data = items;
|
|
|
+ }
|
|
|
+ dynamic? dynamicClass = DynamicClassHelper.CreateDynamicClass(dto.ColumnInfos);
|
|
|
+ var dtos = data
|
|
|
+ .Select(stu => _mapper.Map(stu, typeof(TelRestApplyListDto), dynamicClass))
|
|
|
+ .Cast<object>()
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ var stream = ExcelHelper.CreateStream(dtos);
|
|
|
+ return ExcelStreamResult(stream, "小修申请记录数据");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
#endregion
|
|
|
}
|
|
|
}
|