using DataSharing.Province.SendTask.ProvinceOther;
using DataSharing.RawData;
using DataSharing.SendTask;
using DataSharing.Share.Dtos.Province;
using DataSharing.Share.Enums;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Quartz;
using System.Net;
using XF.Domain.Repository;

namespace DataSharing.Province.SendTask
{
    /// <summary>
    /// 
    /// </summary>
    public class TaskProvinceOtherJob : IJob, IDisposable
    {
        private readonly ILogger<TaskProvinceOtherJob> _logger;
        private readonly IRepository<DsSendTaskProvinceOther> _sendTaskProvinceOtherRepository;
        private readonly IRepository<DsWaitSendTaskProvinceOther> _waitSendTaskProvinceOtherRepository;
        private readonly IChannelConfigurationManager _channelConfigurationManager;
        private readonly HuiJuClient _huiJuClient;
        private readonly XieTongClient _xieTongClient;
        private readonly IRepository<DsSendTaskDetailInfo> _sendTaskDetailInfoRepository;
        private readonly IHttpClientFactory _httpClientFactory;
        private readonly IRepository<DsOrderVisitSend> _dsOrderVisitSendRepository;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="logger"></param>
        /// <param name="sendTaskProvinceOtherRepository"></param>
        /// <param name="waitSendTaskProvinceOtherRepository"></param>
        /// <param name="channelConfigurationManager"></param>
        /// <param name="huiJuClient"></param>
        /// <param name="xieTongClient"></param>
        /// <param name="sendTaskDetailInfoRepository"></param>
        /// <param name="httpClientFactory"></param>
        /// <param name="dsOrderVisitSendRepository"></param>
        public TaskProvinceOtherJob(ILogger<TaskProvinceOtherJob> logger,
            IRepository<DsSendTaskProvinceOther> sendTaskProvinceOtherRepository,
            IRepository<DsWaitSendTaskProvinceOther> waitSendTaskProvinceOtherRepository,
            IChannelConfigurationManager channelConfigurationManager,
            HuiJuClient huiJuClient,
            XieTongClient xieTongClient,
           IRepository<DsSendTaskDetailInfo> sendTaskDetailInfoRepository,
           IHttpClientFactory httpClientFactory,
           IRepository<DsOrderVisitSend> dsOrderVisitSendRepository)
        {
            _logger = logger;
            _sendTaskProvinceOtherRepository = sendTaskProvinceOtherRepository;
            _waitSendTaskProvinceOtherRepository = waitSendTaskProvinceOtherRepository;
            _channelConfigurationManager = channelConfigurationManager;
            _huiJuClient = huiJuClient;
            _xieTongClient = xieTongClient;
            _sendTaskDetailInfoRepository = sendTaskDetailInfoRepository;
            _httpClientFactory = httpClientFactory;
            _dsOrderVisitSendRepository = dsOrderVisitSendRepository;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public async Task Execute(IJobExecutionContext context)
        {
            List<string> listOldData = new()
            {
            "RGDH9951150024050100003",
"RGDH9951150024050100002",
"RGDH9951150024050400002",
"RGDH9951150024050400004",
"RGDH9951150024050400005",
"RGDH9951150024050400009",
"RGDH9951150024050400010",
"RGDH9951150024050400011",
"RGDH9951150024050400008",
"RGDH9951150024050500001",
"RGDH9951150024050500005",
"RGDH9951150024050500009",
"RGDH9951150024050500004",
"RGDH9951150024050600001",
"RGDH9951150024050600002",
"RGDH9951150024050600006",
"RGDH9951150024050600005",
"RGDH9951150024050600008",
"RGDH9951150024050600004",
"RGDH9951150024050600010",
"RGDH9951150024050600010",
"RGDH9951150024050600011",
"RGDH9951150024050700001",
"RGDH9951150024050800001",
"RGDH9951150024050800005",
"RGDH9951150024050800009",
"RGDH9951150024050800008",
"RGDH9951150024050800012",
"RGDH9951150024050800013",
"RGDH9951150024050800007",
"RGDH9951150024050900002",
"RGDH9951150024050900001",
"RGDH9951150024050900006",
"RGDH9951150024050900009",
"RGDH9951150024050900007",
"RGDH9951150024051000001",
"RGDH9951150024051100001",
"RGDH9951150024050100001",
"RGDH9951150024051100004",
"RGDH9951150024051100006",
"RGDH9951150024051200002",
"RGDH9951150024051200004",
"RGDH9951150024051300002",
"RGDH9951150024051300001",
"RGDH9951150024051400001",
"RGDH9951150024051500001",
"RGDH9951150024051500002",
"RGDH9951150024051500006",
"RGDH9951150024051500003",
"RGDH9951150024041200003",
"RGDH9951150024041200004",
"RGDH9951150024041200005",
"RGDH9951150024041300001",
"RGDH9951150024041300005",
"RGDH9951150024041300006",
"RGDH9951150024041300014",
"RGDH9951150024041300019",
"RGDH9951150024041300011",
"RGDH9951150024041300018",
"RGDH9951150024041300021",
"RGDH9951150024041300022",
"RGDH9951150024041300024",
"RGDH9951150024041400001",
"RGDH9951150024041400002",
"RGDH9951150024041400003",
"RGDH9951150024041400006",
"RGDH9951150024041500004",
"RGDH9951150024041500001",
"RGDH9951150024041500007",
"RGDH9951150024041500009",
"RGDH9951150024041500008",
"RGDH9951150024041500010",
"RGDH9951150024041500006",
"RGDH9951150024041600001",
"RGDH9951150024041700002",
"RGDH9951150024041700006",
"RGDH9951150024041700003",
"RGDH9951150024041700001",
"RGDH9951150024041700005",
"RGDH9951150024041800003",
"RGDH9951150024041800005",
"RGDH9951150024041800002",
"RGDH9951150024041800001",
"RGDH9951150024041800015",
"RGDH9951150024041800008",
"RGDH9951150024041800018",
"RGDH9951150024041800022",
"RGDH9951150024041800031",
"RGDH9951150024041800030",
"RGDH9951150024032900004",
"RGDH9951150024032900001",
"RGDH9951150024032900002",
"RGDH9951150024032900003",
"RGDH9951150024032900008",
"RGDH9951150024032900010",
"RGDH9951150024032900012",
"RGDH9951150024032900015",
"RGDH9951150024032900014",
"RGDH9951150024032900019",
"RGDH9951150024032900018",
"RGDH9951150024032900017",
"RGDH9951150024032900013",
"RGDH9951150024032900022",
"RGDH9951150024032900023",
"RGDH9951150024032900025",
"RGDH9951150024033000002",
"RGDH9951150024033000004",
"RGDH9951150024033000003",
"RGDH9951150024033000005",
"RGDH9951150024033100006",
"RGDH9951150024033100005",
"RGDH9951150024033100003",
"RGDH9951150024033100004",
"RGDH9951150024033100009",
"RGDH9951150024033100002",
"RGDH9951150024033100013",
"RGDH9951150024033100011",
"RGDH9951150024033100014",
"RGDH9951150024033100015",
"RGDH9951150024033100017",
"QT9951150024040100006",
"RGDH9951150024040100007",
"RGDH9951150024040100003",
"RGDH9951150024040100009",
"RGDH9951150024040100002",
"RGDH9951150024040100010",
"RGDH9951150024040100014",
"RGDH9951150024040100012",
"RGDH9951150024040100017",
"RGDH9951150024040100015",
"RGDH9951150024040200001",
"RGDH9951150024040200006",
"RGDH9951150024040200004",
"RGDH9951150024040200007",
"RGDH9951150024040200009",
"RGDH9951150024040200012",
"RGDH9951150024040200015",
"RGDH9951150024040200014",
"RGDH9951150024040200019",
"RGDH9951150024041900001",
"RGDH9951150024041900003",
"RGDH9951150024041900009",
"RGDH9951150024042000001",
"RGDH9951150024042100002",
"RGDH9951150024042100003",
"RGDH9951150024042100004",
"RGDH9951150024042200002",
"RGDH9951150024042200005",
"RGDH9951150024042200003",
"RGDH9951150024042200008",
"RGDH9951150024042200006",
"RGDH9951150024042200011",
"RGDH9951150024042200012",
"RGDH9951150024042200015",
"RGDH9951150024042200016",
"RGDH9951150024042200014",
"RGDH9951150024042200021",
"RGDH9951150024042200023",
"RGDH9951150024042200025",
"RGDH9951150024040200018",
"RGDH9951150024040200022",
"RGDH9951150024040200023",
"RGDH9951150024040300001",
"RGDH9951150024040300003",
"RGDH9951150024042200027",
"RGDH9951150024042300002",
"RGDH9951150024042300001",
"RGDH9951150024042300004",
"RGDH9951150024042300006",
"RGDH9951150024040300007",
"RGDH9951150024040300009",
"RGDH9951150024040300010",
"RGDH9951150024040300012",
"RGDH9951150024040400001",
"RGDH9951150024042300007",
"RGDH9951150024042400001",
"RGDH9951150024042400005",
"RGDH9951150024042400011",
"RGDH9951150024042400013",
"RGDH9951150024040500002",
"RGDH9951150024040500001",
"RGDH9951150024040600001",
"RGDH9951150024040600002",
"RGDH9951150024040600005",
"RGDH9951150024040600004",
"RGDH9951150024040700001",
"RGDH9951150024040700002",
"RGDH9951150024040700006",
"RGDH9951150024040700005",
"RGDH9951150024040700007",
"RGDH9951150024040700009",
"RGDH9951150024040700008",
"RGDH9951150024040700011",
"RGDH9951150024040700012",
"RGDH9951150024040700014",
"RGDH9951150024040700015",
"RGDH9951150024040700019",
"RGDH9951150024040700017",
"RGDH9951150024040700020",
"RGDH9951150024040700025",
"RGDH9951150024042400015",
"RGDH9951150024042400014",
"RGDH9951150024042500002",
"RGDH9951150024042500003",
"RGDH9951150024042600002",
"RGDH9951150024040700026",
"RGDH9951150024040700023",
"RGDH9951150024040800001",
"RGDH9951150024040800003",
"RGDH9951150024040800005",
"RGDH9951150024040800008",
"RGDH9951150024040800010",
"RGDH9951150024040800011",
"RGDH9951150024040800012",
"RGDH9951150024040800014",
"RGDH9951150024040900001",
"RGDH9951150024040900002",
"QT9951150024040900006",
"RGDH9951150024040900009",
"RGDH9951150024040900008",
"RGDH9951150024042600003",
"RGDH9951150024042600006",
"RGDH9951150024042800001",
"RGDH9951150024042800003",
"RGDH9951150024042800005",
"RGDH9951150024041000005",
"RGDH9951150024041000007",
"RGDH9951150024041000006",
"RGDH9951150024041000010",
"RGDH9951150024041000004",
"RGDH9951150024042800009",
"RGDH9951150024042800006",
"RGDH9951150024042800008",
"RGDH9951150024042800012",
"RGDH9951150024042900002",
"RGDH9951150024042900001",
"RGDH9951150024042900005",
"RGDH9951150024043000005",
"RGDH9951150024043000007",
"RGDH9951150024043000008",
"RGDH9951150024041100001",
"RGDH9951150024041100006",
"RGDH9951150024041100004",
"RGDH9951150024062450001",
"RGDH9951150024062450002",
"RGDH9951150024062450007",
"RGDH9951150024062450008",
"RGDH9951150024062450009",
"RGDH9951150024062450011",
"RGDH9951150024062450012",
"RGDH9951150024062450013",
"RGDH9951150024062450014",
"RGDH9951150024062450016",
"RGDH9951150024062450017",
"RGDH9951150024062450018",
"RGDH9951150024062450019",
"RGDH9951150024062450020",
"RGDH9951150024062450022",
"RGDH9951150024062450023",
"RGDH9951150024062450024",
"RGDH9951150024062450025",
"RGDH9951150024062450026",
"RGDH9951150024062450027",
"RGDH9951150024062450028",
"RGDH9951150024062450029",
"RGDH9951150024062450030",
"RGDH9951150024062450031",
"RGDH9951150024062450033",
"RGDH9951150024062450034",
"RGDH9951150024062450035",
"RGDH9951150024062450036",
"RGDH9951150024062450037",
"RGDH9951150024062450038",
"RGDH9951150024062450039",
"RGDH9951150024062450040",
"RGDH9951150024062450041",
"RGDH9951150024062450042",
"RGDH9951150024062450043",
"RGDH9951150024062450044",
"RGDH9951150024062450045",
"RGDH9951150024062450046",
"RGDH9951150024062450047",
"RGDH9951150024062450048",
"RGDH9951150024062450049",
"RGDH9951150024062450050",
"RGDH9951150024062450051",
"RGDH9951150024062450052",
"RGDH9951150024062450021",
"RGDH9951150024062450053",
"RGDH9951150024062450054",
"RGDH9951150024062450055",
"RGDH9951150024062450056",
"RGDH9951150024062450060",
"RGDH9951150024062450062",
"RGDH9951150024062450064",
"RGDH9951150024062450065",
"RGDH9951150024062450066",
"RGDH9951150024062450067",
"RGDH9951150024062450068",
"RGDH9951150024062450069",
"RGDH9951150024062450070",
"RGDH9951150024062450071",
"RGDH9951150024062450072",
"RGDH9951150024062450073",
"RGDH9951150024062450074",
"RGDH9951150024062450076",
"RGDH9951150024062450077",
"RGDH9951150024062450078",
"RGDH9951150024062450079",
"RGDH9951150024062450080",
"RGDH9951150024062450081",
"RGDH9951150024062450058",
"RGDH9951150024062450082",
"RGDH9951150024062450084",
"RGDH9951150024062450085",
"RGDH9951150024062450086",
"RGDH9951150024062450087",
"RGDH9951150024062450057",
"RGDH9951150024062450088",
"RGDH9951150024062450089",
"RGDH9951150024062450090",
"RGDH9951150024062450091",
"RGDH9951150024062450093",
"RGDH9951150024062450094",
"RGDH9951150024062450095",
"RGDH9951150024062450096",
"RGDH9951150024062450097",
"RGDH9951150024062450098",
"RGDH9951150024062450099",
"RGDH9951150024062450100",
"RGDH9951150024062450101",
"RGDH9951150024062450102",
"RGDH9951150024062450103",
"RGDH9951150024062450104",
"RGDH9951150024062450105",
"RGDH9951150024062450106",
"RGDH9951150024062450107",
"RGDH9951150024062450108",
"RGDH9951150024062450109",
"RGDH9951150024062450110",
"RGDH9951150024062450111",
"RGDH9951150024062450112",
"RGDH9951150024062450113",
"RGDH9951150024062450114",
"RGDH9951150024062450118",
"RGDH9951150024062450116",
"RGDH9951150024062450119",
"RGDH9951150024062450120",
"RGDH9951150024062450121",
"RGDH9951150024062450122",
"RGDH9951150024062450123",
"RGDH9951150024062550160"
        };
            var configProvince = _channelConfigurationManager.GetConfigurationProvince();
            //加载数据
            var tasks = await _waitSendTaskProvinceOtherRepository.Queryable()
           .Where(d => d.State == EWaitSendTaskState.WaitPush && d.SendTimes <= 6 && d.TaskType != "SubmitVisitInfo")
           .OrderBy(d => d.CreationTime)
           .Take(10)
           .ToListAsync(context.CancellationToken);

            if (tasks.Count != 0)
            {
                //处理推送数据
                foreach (var sendTask in tasks)
                {
                    //状态更改为推送中
                    sendTask.State = EWaitSendTaskState.Pushing;
                    //使用乐观锁，控制数据
                    if (await _waitSendTaskProvinceOtherRepository.Updateable(sendTask).ExecuteCommandWithOptLockAsync() > 0)
                    {
                        if (listOldData.Contains(sendTask.ProvinceNo))
                        {
                            //移除待同步表数据
                            await _waitSendTaskProvinceOtherRepository.RemoveAsync(sendTask, cancellationToken: context.CancellationToken);
                            #region 处理推送任务表
                            var sendTaskData = await _sendTaskProvinceOtherRepository.GetAsync(p => p.Id == sendTask.Id, context.CancellationToken);
                            if (sendTaskData != null)
                            {
                                //处理推送时间
                                sendTaskData.LastTime = DateTime.Now;
                                sendTaskData.SendTimes = sendTaskData.SendTimes + 1;

                                if (sendTaskData.FirstTime is null)
                                    sendTaskData.FirstTime = DateTime.Now;

                                sendTaskData.IsSuccess = ESendTaskState.PushSuccess;
                                await _sendTaskProvinceOtherRepository.UpdateAsync(sendTaskData, context.CancellationToken);
                            }
                            #endregion
                        }
                        else
                        {
                            var name = GetName(sendTask.Path);

                            _logger.LogInformation("省请求参数：" + "--------------" + sendTask.Request);
                            ProvinceResponse result = new();
                            string error = "";
                            if (sendTask.PathType == EPathType.HuiJu) //汇聚推送
                            {
                                try
                                {
                                    result = await _huiJuClient.RequestAsync<ProvinceResponse>(configProvince.HuiJu + sendTask.Path, sendTask.HttpMethod, sendTask.Request, context.CancellationToken);
                                }
                                catch (Exception ex)
                                {
                                    error = ex.Message;
                                }
                            }
                            else if (sendTask.PathType == EPathType.XieTong)//协同推送
                            {
                                try
                                {
                                    result = await _xieTongClient.RequestAsync<ProvinceResponse>(configProvince.XieTong + sendTask.Path, sendTask.HttpMethod, sendTask.Request, context.CancellationToken);
                                }
                                catch (Exception ex)
                                {
                                    error = ex.Message;
                                }
                            }
                            else if (sendTask.PathType == EPathType.File)  //附件
                            {
                                try
                                {
                                    if (sendTask != null && sendTask.FileJson != null && sendTask.FileJson.Count > 0)
                                    {
                                        var itemFile = sendTask.FileJson[0];
                                        result = await SendFileData(sendTask.Request, itemFile.FileId, itemFile.FileId, context.CancellationToken);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    error = ex.Message;
                                }
                            }
                            _logger.LogInformation("省接口返回：" + name + "--------------" + System.Text.RegularExpressions.Regex.Unescape(System.Text.Json.JsonSerializer.Serialize(result)));

                            //写入明细表
                            DsSendTaskDetailInfo dsSendTaskInfo = new()
                            {
                                TaskId = sendTask.Id,
                                Result = System.Text.RegularExpressions.Regex.Unescape(System.Text.Json.JsonSerializer.Serialize(result)),
                                ResultErrorData = error,
                                ProcessingServices = _channelConfigurationManager.GetConfigurationProcessingServices()
                            };
                            if (result is not null)
                            {
                                #region 处理待同步表数据
                                //移除待同步表数据
                                if (result.ReturnInfo is not null && result.ReturnInfo.Code == "1")
                                    await _waitSendTaskProvinceOtherRepository.RemoveAsync(sendTask, cancellationToken: context.CancellationToken);
                                else
                                {
                                    //修改待同步表数据状态
                                    sendTask.LastTime = DateTime.Now;
                                    sendTask.SendTimes = sendTask.SendTimes + 1;

                                    if (sendTask.FirstTime is null)
                                        sendTask.FirstTime = DateTime.Now;

                                    if (sendTask.SendTimes >= 7)
                                        sendTask.State = EWaitSendTaskState.PushFail;
                                    else
                                        sendTask.State = EWaitSendTaskState.WaitPush;

                                    await _waitSendTaskProvinceOtherRepository.UpdateAsync(sendTask, context.CancellationToken);
                                }
                                #endregion

                                #region 处理推送任务表
                                var sendTaskData = await _sendTaskProvinceOtherRepository.GetAsync(p => p.Id == sendTask.Id, context.CancellationToken);
                                if (sendTaskData != null)
                                {
                                    //处理推送时间
                                    sendTaskData.LastTime = DateTime.Now;
                                    sendTaskData.SendTimes = sendTaskData.SendTimes + 1;

                                    if (sendTaskData.FirstTime is null)
                                        sendTaskData.FirstTime = DateTime.Now;

                                    if (result.ReturnInfo is not null && result.ReturnInfo.Code == "1")
                                    {
                                        sendTaskData.IsSuccess = ESendTaskState.PushSuccess;
                                        dsSendTaskInfo.IsSuccess = true;
                                    }
                                    else
                                        sendTaskData.IsSuccess = ESendTaskState.PushFail;

                                    await _sendTaskProvinceOtherRepository.UpdateAsync(sendTaskData, context.CancellationToken);

                                }
                                #endregion

                                #region 处理回访数据推送时间
                                if (result.ReturnInfo is not null && result.ReturnInfo.Code == "1")
                                {
                                    if (sendTask.TaskType == "SubmitVisitInfo" || sendTask.TaskType == "GetVisitInfoReceive")
                                    {
                                        var visitData = await _dsOrderVisitSendRepository.GetAsync(p => p.ProvinceNo == sendTaskData.ProvinceNo, context.CancellationToken);
                                        if (visitData != null)
                                        {
                                            if (visitData.FirstSendProvinceTime is null)
                                                visitData.FirstSendProvinceTime = DateTime.Now;

                                            visitData.LastSendProvinceTime = DateTime.Now;
                                            await _dsOrderVisitSendRepository.UpdateAsync(visitData, context.CancellationToken);
                                        }
                                    }
                                }
                                #endregion
                            }
                            await _sendTaskDetailInfoRepository.AddAsync(dsSendTaskInfo, context.CancellationToken);
                        }
                    }
                }
            }
        }

        /// <summary>
        /// 附件读取以及附件上传
        /// </summary>
        /// <param name="request"></param>
        /// <param name="fileName"></param>
        /// <param name="fileId"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        private async Task<ProvinceResponse> SendFileData(string request, string fileName, string fileId, CancellationToken cancellationToken)
        {
            //获取配置信息
            var configProvince = _channelConfigurationManager.GetConfigurationProvince();
            var businessFile = _channelConfigurationManager.GetConfigurationBusinessFile();
            byte[] fileContentBytes = null;

            var baseAddress = businessFile.BaseUrl;
            if (!baseAddress.EndsWith('/'))
                baseAddress += "/";
            string url = string.Format("{0}{1}?Source={2}&Id={3}", baseAddress, businessFile.DownloadUrlAddress, "hotline", fileId);
            using (var client = _httpClientFactory.CreateClient())
            using (var response = await client.GetAsync(url))
            {

                if (response.StatusCode == HttpStatusCode.OK)
                {
                    fileName = response.Content.Headers.ContentDisposition.FileNameStar;
                    using var memoryStream = new MemoryStream();
                    await response.Content.CopyToAsync(memoryStream);
                    memoryStream.Seek(0, SeekOrigin.Begin);

                    fileContentBytes = memoryStream.ToArray();
                }
            }
            if (fileContentBytes != null)
            {
                //获取附件上传Token
                string strToken = await _xieTongClient.GetTokenAsync(cancellationToken);
                Dictionary<string, object> dicParam = new()
                    {
                        { "params",  request } // 第一个接口参数，json格式字符串
                    };

                // 构造字典文件数据
                // 接口参数名称为files
                CFormUpload.FileParameter fileParameter = new CFormUpload.FileParameter("files", fileContentBytes, fileName, null);
                dicParam.Add(fileName, fileParameter);

                var baseAddressHuiJu = configProvince.HuiJu;
                if (!baseAddressHuiJu.EndsWith('/'))
                    baseAddressHuiJu += "/";

                string strUrl = baseAddressHuiJu + "get_case_material_info";
                // 上传附件
                string strResult = CFormUpload.MultipartFormDataPost(strUrl, null, dicParam, strToken);

                _logger.LogInformation("省接口上传附件返回：--------------" + strResult);

                if (!string.IsNullOrEmpty(strResult))
                    return JsonConvert.DeserializeObject<ProvinceResponse>(strResult);
            }
            return new ProvinceResponse();

        }

        /// <summary>
        /// 获取接口名称
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        private string GetName(string path)
        {
            string name = "";
            switch (path)
            {
                case "get_case_back_apply":
                    name = "业务协同-退回申请接口";
                    break;
                case "send_supervise_process_info":
                    name = "业务协同-服务工单督办过程接口";
                    break;
                case "send_supervise_result_info":
                    name = "业务协同-服务工单督办结果接口";
                    break;
                case "screen_case_info_send":
                    name = "业务协同-工单发起甄别接口";
                    break;
                case "delay_case_info_send":
                    name = "业务协同-服务工单申请延时接口";
                    break;
                case "submit_case_info":
                    name = "业务汇聚-服务工单受理接口";
                    break;
                case "submit_case_record":
                    name = "业务汇聚-电话记录";
                    break;
                case "get_case_process_receive":
                    name = "业务协同-服务工单交办处理过程接口";
                    break;
                case "submit_case_process":
                    name = "业务汇聚-服务工单处理过程接口";
                    break;
                case "submit_case_total":
                    name = "业务汇聚-统计数据接口";
                    break;
                case "supply_case_info_send":
                    name = "业务协同-上报补充诉求接口";
                    break;
                case "revoke_case_info":
                    name = "业务协同-服务工单撤单接口";
                    break;
                case "remind_case_info":
                    name = "业务协同-服务工单催单接口";
                    break;
                case "get_case_result_receive":
                    name = "业务协同-服务工单交办处理结果接口";
                    break;
                case "zmhd_case_info_public":
                    name = "业务协同-政民互动提交公开";
                    break;
                case "get_knowledge_info_send":
                    name = "业务协同-知识库上报接口";
                    break;
                case "get_knowledge_info_update":
                    name = "业务协同-知识库变更接口";
                    break;
                case "get_knowledge_info_abandon":
                    name = "业务协同-知识库下架接口";
                    break;
                case "sendrealtimestatus":
                    name = "实时服务上报接口";
                    break;
                case "get_visit_info_receive":
                    name = "业务协同-服务工单交办评价接口";
                    break;
                case "submit_visit_info":
                    name = "业务汇聚-服务工单回访评价接口";
                    break;
                case "submit_case_result":
                    name = "业务汇聚-服务工单处理结果接口";
                    break;
                case "submit_case_extends":
                    name = "业务汇聚-服务工单拓展信息接口";
                    break;
                case "send_case_info":
                    name = "业务协同-服务工单上报";
                    break;
                case "get_case_material_info":
                    name = "业务汇聚-材料接口";
                    break;
                default:
                    break;
            }

            return name;
        }

        public void Dispose()
        {

        }
    }
}