using DataSharing.Province.SendTask.SubmitCaseInfo;
using DataSharing.RawData;
using DataSharing.Share.Dtos.Province.Extend;
using DataSharing.Share.Dtos.Province.HuiJu;
using DataSharing.Share.Dtos.Province.XieTong.Receive;
using DataSharing.Share.Dtos.Province.XieTong.Send;
using DataSharing.Share.Dtos.Statistics;
using DataSharing.Share.Dtos.YiBin.Enterprise;
using DataSharing.Share.Dtos.YiBin.ZzptPlatformsYB;
using Hotline.Share.Dtos.CallCenter;
using Hotline.Share.Dtos.Order;
using Hotline.Share.Dtos.TrCallCenter;
using Hotline.Share.Enums.CallCenter;
using Mapster;

namespace DataSharing.Application.Mappers
{
    public class MapperConfigs : IRegister
    {
        public void Register(TypeAdapterConfig config)
        {
            #region 省对接
            //服务工单受理
            config.ForType<OrderDto, SubmitCaseInfo>()
               .Map(d => d.CaseTitle, x => x.Title)
               .Map(d => d.CaseRegister, x => x.AcceptorName)
               .Map(d => d.CaseRegisterNo, x => x.AcceptorId)
               .Map(d => d.CaseDate, x => Convert.ToDateTime(x.StartTime))
               .Map(d => d.PhoneNumber, x => x.Contact)
               .Map(d => d.AppLicantName, x => x.FromName)
               .Map(d => d.AppLicantAge, x => x.AgeRangeCode)
               .Map(d => d.AppLicantId, x => x.LicenceNo)
               .Map(d => d.CaseAccord, x => x.HotspotId)
               .Map(d => d.CaseContent, x => x.Content)
               .Map(d => d.CaseProcessType, x => Convert.ToInt32(x.ProcessType))
               .Map(d => d.CaseIsSecrect, x => x.IsSecret ? "1" : "0")
               .Map(d => d.CaseIsVisit, x => x.ProcessType == Hotline.Share.Enums.Order.EProcessType.Zhiban ? "0" : "1")
               .Map(d => d.EventDate, x => x.IncidentTime.HasValue ? x.IncidentTime : DateTime.Now)
               .Map(d => d.PushType, x => x.PushTypeCode)
               .Map(d => d.AreaCode, x => x.AreaCode.Length > 6 ? x.AreaCode.Substring(0, 6) : x.AreaCode)
               .Map(d => d.CaseSerial, x => x.ProvinceNo)
               .Map(d => d.CaseSource, x => x.SourceChannelCode)
               .Map(d => d.CaseAddress, x => x.Province + x.City + x.County + x.Street)
               .Map(d => d.CaseType, x => x.AcceptTypeCode)
               .Map(d => d.CliengGuid, x => x.Id)
               .Map(d => d.CaseIsPublic, x => x.IsPublicity == true ? "1" : "0")
               .Map(d => d.TfdBackTimeBf, x => x.ExpiredTime)
               .Map(d => d.CaseGoal, x => x.Title)
              ;

            config.ForType<OrderDto, SendCaseInfo>()
               .Map(d => d.CaseTitle, x => x.Title)
               .Map(d => d.CaseRegister, x => x.AcceptorName)
               .Map(d => d.CaseRegisterNo, x => x.AcceptorId)
               .Map(d => d.CaseDate, x => Convert.ToDateTime(x.StartTime))
               .Map(d => d.PhoneNumber, x => x.Contact)
               .Map(d => d.AppLicantName, x => x.FromName)
               .Map(d => d.AppLicantAge, x => x.AgeRangeCode)
               .Map(d => d.AppLicantId, x => x.LicenceNo)
               .Map(d => d.CaseAccord, x => x.HotspotId)
               .Map(d => d.CaseContent, x => x.Content)
               .Map(d => d.CaseProcessType, x => Convert.ToInt32(x.ProcessType))
               .Map(d => d.CaseIsSecrect, x => x.IsSecret ? "1" : "0")
               .Map(d => d.CaseIsVisit, x => x.ProcessType == Hotline.Share.Enums.Order.EProcessType.Zhiban ? "0" : "1")
                .Map(d => d.EventDate, x => x.IncidentTime.HasValue ? x.IncidentTime : DateTime.Now)
               .Map(d => d.AreaCode, x => x.AreaCode.Length > 6 ? x.AreaCode.Substring(0, 6) : x.AreaCode)
               .Map(d => d.CaseSerial, x => x.ProvinceNo)
               .Map(d => d.CaseSource, x => x.SourceChannelCode)
               .Map(d => d.CaseAddress, x => x.Province + x.City + x.County + x.Street)
               .Map(d => d.CaseType, x => x.AcceptTypeCode)
               .Map(d => d.CaseIsPublic, x => x.IsPublicity == true ? "1" : "0")
               .Map(d => d.CliengGuid, x => x.Id)
                ;

            //服务工单处理过程
            config.ForType<OrderFlowDto, SubmitCaseProcessInfo>()
            .Map(d => d.CaseSerial, x => x.Order.ProvinceNo)
            .Map(d => d.DeptName, x => x.WorkflowTrace.HandlerOrgName)
            .Map(d => d.ProcessTime, x => x.WorkflowTrace.HandleTime)
            .Map(d => d.ProcessName, x => x.WorkflowTrace.HandlerName)
            .Map(d => d.ProcessNote, x => string.IsNullOrEmpty(x.WorkflowTrace.Opinion) == false ? x.WorkflowTrace.Opinion : x.Order.ActualOpinion)
            .Map(d => d.EndAreaCode, x => string.IsNullOrEmpty(x.WorkflowTrace.HandlerOrgAreaCode) == false ? x.WorkflowTrace.HandlerOrgAreaCode : x.Order.AreaCode.Substring(0, 6))
            // .Map(d => d.EndAreaName, x => string.IsNullOrEmpty(x.WorkflowTrace.HandlerOrgAreaName) == false ? x.WorkflowTrace.HandlerOrgAreaName : "宜宾市")// x.WorkflowTrace.HandlerOrgAreaName
            .Map(d => d.CaseId, x => x.WorkflowTrace.Id)
            .Map(d => d.AreaCode, x => x.Order.AreaCode.Length > 6 ? x.Order.AreaCode.Substring(0, 6) : x.Order.AreaCode)
            .Map(d => d.CliengGuid, x => x.WorkflowTrace.Id)
            ;

            //服务工单交办处理过程
            config.ForType<OrderFlowDto, GetCaseProcessReceiveInfo>()
           .Map(d => d.CaseSerial, x => x.Order.ReceiveProvinceNo)
            .Map(d => d.DeptName, x => x.WorkflowTrace.HandlerOrgName)
            .Map(d => d.ProcessTime, x => x.WorkflowTrace.HandleTime)
            .Map(d => d.ProcessName, x => x.WorkflowTrace.HandlerName)
            .Map(d => d.ProcessNote, x => string.IsNullOrEmpty(x.WorkflowTrace.Opinion) == false ? x.WorkflowTrace.Opinion : x.Order.ActualOpinion)
            .Map(d => d.EndAreaCode, x => string.IsNullOrEmpty(x.WorkflowTrace.HandlerOrgAreaCode) == false ? x.WorkflowTrace.HandlerOrgAreaCode : x.Order.AreaCode.Substring(0, 6))
            //.Map(d => d.EndAreaName, x => string.IsNullOrEmpty(x.WorkflowTrace.HandlerOrgAreaName) == false ? x.WorkflowTrace.HandlerOrgAreaName : "宜宾市")// x.WorkflowTrace.HandlerOrgAreaName
           .Map(d => d.TrowGuid, x => x.WorkflowTrace.Id)
           .Map(d => d.AreaCode, x => x.Order.AreaCode.Length > 6 ? x.Order.AreaCode.Substring(0, 6) : x.Order.AreaCode)
            .Map(d => d.CliengGuid, x => x.WorkflowTrace.Id)
           ;

            //服务工单回访评价
            config.ForType<PublishVisitDto, SubmitVisitInfo>()
            .Map(d => d.CaseSerial, x => x.Order.ProvinceNo)
            .Map(d => d.SubjectResultSatify, x => x.SubjectResultSatifyCode)
            .Map(d => d.FirstSatisfaction, x => x.FirstSatisfactionCode)
            ;

            //服务工单交办评价
            config.ForType<PublishVisitDto, GetVisitInfoReceiveInfo>()
            .Map(d => d.CaseSerial, x => x.Order.ReceiveProvinceNo)
            .Map(d => d.SubjectResultSatify, x => x.SubjectResultSatifyCode)
            ;

            //延期申请
            config.ForType<PublishOrderDelayDto, DelayCaseInfoSendInfo>()
            .Map(d => d.ApplyDelaynum, x => x.DelayNum)
            .Map(d => d.ApplyDelayunit, x => (int)x.DelayUnit)
            .Map(d => d.ApplyName, x => x.EmployeeName)
            .Map(d => d.ApplyTime, x => x.ApplyDelayTime)
            .Map(d => d.ApplyOuname, x => x.ApplyOrgName)
            .Map(d => d.ApplyReason, x => x.DelayReason)
            .Map(d => d.CaseSerial, x => x.Order.ReceiveProvinceNo)
            .Map(d => d.AreaCode, x => x.Order.AreaCode.Length > 6 ? x.Order.AreaCode.Substring(0, 6) : x.Order.AreaCode)
            ;

            //接收
            //工单交办
            config.ForType<ReceiveCaseInfoModel, AddOrderDto>()
           .Map(d => d.ReceiveProvinceNo, x => x.CaseSerial)
           .Map(d => d.Title, x => x.CaseTitle)
           //.Map(d => d.AcceptorName, x => x.CaseRegister)
           //.Map(d => d.AcceptorStaffNo, x => x.CaseRegisterNo)
           // .Map(d => d.CreationTime, x => x.CaseDate)
           .Map(d => d.Contact, x => x.PhoneNumber)
           .Map(d => d.FromName, x => x.AppLicantName)
           .Map(d => d.AgeRangeCode, x => x.AppLicantAge)
           .Map(d => d.LicenceNo, x => x.AppLicantId)
           .Map(d => d.HotspotId, x => x.CaseAccord)
           .Map(d => d.Content, x => x.CaseContent)
           .Map(d => d.AcceptTypeCode, x => x.CaseType)
           .Map(d => d.IsSecret, x => x.CaseIsSecrect == "1" ? true : false)
           //  .Map(d => d.IsPublicity, x => x.CaseIsPublic == "1" ? true : false)
           .Map(d => d.ExpiredTimeProvince, x => x.TfdBackTimeBf)
           .Map(d => d.AreaCode, x => x.AreaCode.Length > 6 ? x.AreaCode.Substring(0, 6) : x.AreaCode)
           .Map(d => d.Street, x => x.CaseAddress)
           .Map(d => d.IncidentTime, x => x.EventDate)
           .Map(d => d.SourceChannelCode, x => x.CaseSource)
             ;

            //服务工单处理结果
            config.ForType<OrderFlowDto, SubmitCaseResultInfo>()
           .Map(d => d.CaseSerial, x => x.Order.ProvinceNo)
           .Map(d => d.DeptName, x => x.Order.ActualHandleOrgName)
           .Map(d => d.FinishTime, x => x.Order.FiledTime)
           .Map(d => d.FinishName, x => x.Order.ActualHandlerName)
           .Map(d => d.FinishNote, x => x.Order.ActualOpinion)
           .Map(d => d.EndDept, x => x.Order.ActualHandleOrgName)
           .Map(d => d.EndName, x => x.Order.ActualHandlerName)
           .Map(d => d.SendTime, x => x.Order.ActualHandleStepCreateTime)
           .Map(d => d.FdBack, x => x.Order.ActualOpinion)
           .Map(d => d.AreaCode, x => x.Order.AreaCode.Length > 6 ? x.Order.AreaCode.Substring(0, 6) : x.Order.AreaCode)
           .Map(d => d.EndAreaCode, x => string.IsNullOrEmpty(x.Order.ActualHandleOrgAreaCode) == false ? x.Order.ActualHandleOrgAreaCode : x.Order.AreaCode.Substring(0, 6))
           //.Map(d => d.EndAreaName, x => string.IsNullOrEmpty(x.Order.ActualHandleOrgAreaName) == false ? x.Order.ActualHandleOrgAreaName : "宜宾市")
           .Map(d => d.SignTimeBf, x => x.Order.ExpiredTime)
           .Map(d => d.SignTime, x => x.Order.ActualHandleStepAcceptTime)
           .Map(d => d.FdBackTimeBf, x => x.Order.ExpiredTime)
           .Map(d => d.FdBackTime, x => x.Order.FiledTime)
           .Map(d => d.HandleTimeLong, x => x.Order.ProcessType == Hotline.Share.Enums.Order.EProcessType.Zhiban ? x.Order.CreationTimeHandleDurationWorkday : x.Order.CenterToOrgHandleDurationWorkday)
             ;

            //服务工单交办处理结果
            config.ForType<OrderDto, GetCaseResultReceiveInfo>()
           .Map(d => d.CaseSerial, x => x.ReceiveProvinceNo)
           .Map(d => d.DeptName, x => x.ActualHandleOrgName)
           .Map(d => d.FinishTime, x => x.FiledTime)
           .Map(d => d.FinishName, x => x.ActualHandlerName)
           .Map(d => d.FinishNote, x => x.ActualOpinion)
           .Map(d => d.EndDept, x => x.ActualHandleOrgName)
           .Map(d => d.EndName, x => x.ActualHandlerName)
           .Map(d => d.SendTime, x => x.ActualHandleStepCreateTime)//CenterToOrgTime
           .Map(d => d.FdBack, x => x.ActualOpinion)
           .Map(d => d.AreaCode, x => x.AreaCode.Length > 6 ? x.AreaCode.Substring(0, 6) : x.AreaCode)
           .Map(d => d.EndAreaCode, x => string.IsNullOrEmpty(x.ActualHandleOrgAreaCode) == false ? x.ActualHandleOrgAreaCode : x.AreaCode.Substring(0, 6))
           // .Map(d => d.EndAreaName, x => string.IsNullOrEmpty(x.ActualHandleOrgAreaName) == false ? x.ActualHandleOrgAreaName : "宜宾市")
           .Map(d => d.SignTime, x => x.ActualHandleStepAcceptTime)
           .Map(d => d.FdBackTime, x => x.FiledTime)
           .Map(d => d.HandleTimeLong, x => x.HandleDurationWorkday)
            ;

            //政民互动提交公开
            config.ForType<PublicOrderProvinceZmhdDto, ZmhdCaseInfoPublicInfo>()
           .Map(d => d.CaseSerial, x => x.ProvinceNo)
           .Map(d => d.AnswerTime, x => x.AnswerTime)
           .Map(d => d.AnswerOu, x => x.AnswerOu)
           .Map(d => d.AnswerContent, x => x.AnswerContent)
           .Map(d => d.AuditFirstName, x => x.AuditFirstName)
           .Map(d => d.AuditFirstTime, x => x.AuditFirstTime)
           .Map(d => d.AuditSecondName, x => x.AuditSecondName)
           .Map(d => d.PublishDate, x => x.PublishDate)
           .Map(d => d.PublicOpinion, x => x.PublicOpinion)
            ;

            //通话记录
            config.ForType<TrCallDto, SubmitCaseRecordInfo>()
            .Map(d => d.PhoneNumber, x => x.CPN)
            .Map(d => d.PhoneStatus, x => x.OnState == EOnState.On ? "10" : "20")
            .Map(d => d.IsPhoneCall, x => x.CallDirection == ECallDirection.Out ? "1" : "0")
            .Map(d => d.CallStart, x => x.AnsweredTime)
            .Map(d => d.CallEnd, x => x.OverTime)
            .Map(d => d.InIvr, x => x.BeginIvrTime)
            .Map(d => d.InQueue, x => x.BeginQueueTime)
            .Map(d => d.CallTime, x => x.BeginRingTime)
            .Map(d => d.CallLength, x => x.Duration)
            .Map(d => d.SeatNumber, x => x.TelNo)
            .Map(d => d.AccordUrl, x => x.RecordingFileUrl)
            ;

            //通话记录
            config.ForType<CallNativeDto, SubmitCaseRecordInfo>()
            .Map(d => d.PhoneNumber, x => x.FromNo)
            .Map(d => d.PhoneStatus, x => x.AnsweredTime.HasValue ? "10" : "20")
            .Map(d => d.IsPhoneCall, x => x.Direction == ECallDirection.Out ? "1" : "0")
            .Map(d => d.CallStart, x => x.AnsweredTime)
            .Map(d => d.CallEnd, x => x.EndTime)
            .Map(d => d.InIvr, x => x.BeginIvrTime)
            .Map(d => d.InQueue, x => x.BeginQueueTime)
            .Map(d => d.CallTime, x => x.BeginRingTime)
            .Map(d => d.CallLength, x => x.Duration)
            .Map(d => d.SeatNumber, x => x.StaffNo)
            .Map(d => d.AccordUrl, x => x.AudioFile)
            ;

            //发起甄别
            config.ForType<PublishScreenDto, ScreenCaseInfoSendInfo>()
            .Map(d => d.CaseSerial, x => x.Order.ReceiveProvinceNo)
            .Map(d => d.AreaCode, x => x.Order.AreaCode.Length > 6 ? x.Order.AreaCode.Substring(0, 6) : x.Order.AreaCode)
           .Map(d => d.ApplyName, x => x.Screen.CreatorName)
           .Map(d => d.ApplyTime, x => x.Screen.CreationTime)
           .Map(d => d.ApplyOuName, x => x.Screen.CreatorOrgName)
           .Map(d => d.ApplyReason, x => x.Screen.Content)
           ;

            //服务工单督办过程
            config.ForType<PublishSuperviseDto, SendSuperviseProcessInfo>()
             .Map(d => d.SuperviseSerial, x => x.Supervise.SuperviseSerial)
             .Map(d => d.AreaCode, x => x.Order.AreaCode.Length > 6 ? x.Order.AreaCode.Substring(0, 6) : x.Order.AreaCode)
             .Map(d => d.ReplyName, x => x.Supervise.SignUser)
            .Map(d => d.ReplyTime, x => x.Supervise.SignTime)
            //.Map(d => d.ReplyOpinion, x => x.Supervise.ReplyContent)
            ;

            //服务工单督办结果
            config.ForType<PublishSuperviseDto, SendSuperviseResultInfo>()
            .Map(d => d.SuperviseSerial, x => x.Supervise.SuperviseSerial)
            .Map(d => d.AreaCode, x => x.Order.AreaCode.Length > 6 ? x.Order.AreaCode.Substring(0, 6) : x.Order.AreaCode)
            .Map(d => d.EndName, x => x.Supervise.ReUser)
           .Map(d => d.EndDate, x => x.Supervise.ReplyTime)
           .Map(d => d.EndOpinion, x => x.Supervise.ReplyContent)
           ;

            //服务工单催单
            config.ForType<PublishUrgeDto, RemindCaseInfoModel>()
            .Map(d => d.RemindTime, x => x.Urge.CreationTime)
            .Map(d => d.RemindName, x => x.Urge.CrUser)
            .Map(d => d.RemindReasion, x => x.Urge.ApplyContent)
           .Map(d => d.AreaCode, x => x.Order.AreaCode.Length > 6 ? x.Order.AreaCode.Substring(0, 6) : x.Order.AreaCode)
           .Map(d => d.CaseSerial, x => x.Order.ProvinceNo)
           ;

            //服务工单退回申请
            config.ForType<PublishOrderSendBackModelDto, GetCaseBackApplyInfo>()
            // .Map(d => d.OrderSendBackId, x => x.SendBack.Id)
            .Map(d => d.BackType, x => x.SendBack.Handle)
            .Map(d => d.DealDept, x => x.SendBack.CreatorOrgName)
           .Map(d => d.DealName, x => x.SendBack.CreatorName)
           .Map(d => d.CaseSerial, x => x.Order.ReceiveProvinceNo)
           .Map(d => d.AreaCode, x => x.Order.AreaCode.Length > 6 ? x.Order.AreaCode.Substring(0, 6) : x.Order.AreaCode)
           .Map(d => d.ApplyTime, x => x.SendBack.CreationTime)
           .Map(d => d.BackReason, x => string.IsNullOrEmpty(x.SendBack.AuditOpinion) ? x.SendBack.Content : x.SendBack.AuditOpinion)
           ;

            config.ForType<ScreenCaseResultReceiveModel, ProvinceScreenResult>()
          .Map(d => d.AuditResult, x => x.AuditResult);
            #endregion

            #region 汇聚扩展数据--拓展信息

            //医疗工单
            config.ForType<OrderExtensionDto, FormMedicalInfo>()
            .Map(d => d.MedicalName, x => x.MedName)
            .Map(d => d.MedicalAddr, x => x.MedAddress)
            .Map(d => d.DepartMent, x => x.MedDepartment)
            .Map(d => d.Doctor, x => x.MedDoctor)
            .Map(d => d.PatientName, x => x.MedPatient)
            .Map(d => d.ClinicCardNum, x => x.MedNo)
            .Map(d => d.CardNum, x => x.MedIdNo)
            ;

            //四川政务服务网技术工单
            config.ForType<OrderExtensionDto, FormNetWorktecInfo>()
            .Map(d => d.ZwfwAccount, x => x.ZwfwwAccount)
            .Map(d => d.LinkPeson, x => x.ZwfwwContact)
            ;

            //电视购物及商铺购买退换货工单
            config.ForType<OrderExtensionDto, FormReturnexChangeInfo>()
            .Map(d => d.SubjectName, x => x.ExchTv)
            .Map(d => d.PurchaseTime, x => x.ExchTradeTime)
            .Map(d => d.ProductName, x => x.ExchProduct)
            .Map(d => d.Charge, x => x.ExchAmount)
            .Map(d => d.BusinessName, x => x.ExchName)
            .Map(d => d.BusunessAddr, x => x.ExchAddress)
            .Map(d => d.ReceivePerson, x => x.ExchConsignee)
            .Map(d => d.ReceiveAddr, x => x.ExchConsigneeAddress)
            ;

            //高速公路工单
            config.ForType<OrderExtensionDto, FormExpressWayInfo>()
            .Map(d => d.InWay, x => x.ExpwyEntrance)
            .Map(d => d.OutWay, x => x.ExpwyExit)
            .Map(d => d.OperateDate, x => x.ExpwyTime)
            .Map(d => d.CardNum, x => x.ExpwyNo)
            ;

            //电视台虚假广告工单
            config.ForType<OrderExtensionDto, FormShamPubInfo>()
            .Map(d => d.SubjectName, x => x.AdTv)
            .Map(d => d.ProductName, x => x.AdProduct)
            .Map(d => d.PubContent, x => x.AdContent)
            ;

            //12366热线诉求交办
            config.ForType<OrderExtensionDto, FormTaxationComplaintInfo>()
            .Map(d => d.TaxAuthority, x => x.Location12366Sq)
            .Map(d => d.ComplaintSubject, x => x.Info12366Sq)
            .Map(d => d.ComplaintType, x => x.Type12366Sq)
            ;

            //12366热线咨询交办
            config.ForType<OrderExtensionDto, FormTaxationConsultingInfo>()
            .Map(d => d.TaxAuthority, x => x.Location12366Zx)
            .Map(d => d.ComplaintSubject, x => x.Info12366Zx)
            ;

            //12328服务监督
            config.ForType<OrderExtensionDto, FormTrafficInfo>()
            .Map(d => d.AcceptType, x => x.AcceptType12328)
            .Map(d => d.Customer, x => x.Client12328)
            ;

            //邮政业消费者申诉
            config.ForType<OrderExtensionDto, FormPostInfo>()
            .Map(d => d.AppealName, x => x.MailClaimantName)
            .Map(d => d.AppealNum, x => x.MailClaimantPhone)
            .Map(d => d.AppealEnterprise, x => x.MailClaimantEnterprise)
            .Map(d => d.SenderName, x => x.MailSenderName)
            .Map(d => d.SenderNum, x => x.MailSenderPhone)
            .Map(d => d.SenderAddr, x => x.MailSenderAddress)
            .Map(d => d.AddresseeName, x => x.MailReceiverName)
            .Map(d => d.AddresseeNum, x => x.MailReceiverPhone)
            .Map(d => d.AddresseeAddr, x => x.MailReceiverAddress)
            .Map(d => d.InsuredPrice, x => x.MailAmount)
            .Map(d => d.IsContact, x => x.MailIsContacted == true ? "是" : "否")
            .Map(d => d.OperateResult, x => x.MailResult)
            ;

            //环保举报业务
            config.ForType<OrderExtensionDto, FormEnvironMentInfo>()
            .Map(d => d.ComplaintMailBox, x => x.EpEmail)
            .Map(d => d.PostalAddress, x => x.EpAddress)
            .Map(d => d.ReportObject, x => x.EpObject)
            .Map(d => d.DetailedAddr, x => x.EpObjectAddress)
            .Map(d => d.IndustryType, x => x.EpIndustryType)
            .Map(d => d.KeyPoint, x => x.EpKeyPoint)
            ;

            //12315个性化表单--投诉、举报
            config.ForType<OrderExtensionDto, FormMarketInfo>()
            .Map(d => d.ApplBasQue, x => x.OrderTypeCode == "scjgjjb" ? x.ReportClassifyCode : x.ComplainClassifyCode)
            .Map(d => d.ApplBasQueName, x => x.OrderTypeCode == "scjgjjb" ? x.ReportClassify : x.ComplainClassify)
            .Map(d => d.Zlh, x => x.PatentNo)
            .Map(d => d.Zlqr, x => x.Patentee)
            .Map(d => d.Fmmc, x => x.PatentName)
            .Map(d => d.Zllx, x => x.PatentTypeCode)
            .Map(d => d.ZllxMc, x => x.PatentType)
            .Map(d => d.Accsce, x => x.BusinessPosition != null && x.BusinessPosition.AreaCode != null ? x.BusinessPosition.AreaCode.Substring(0, 6) : "")
            .Map(d => d.Sfdd, x => x.BusinessPosition != null ? x.BusinessPosition.Address + x.BusinessPosition.Street : "")
            .Map(d => d.ControversyTime, x => x.OccurrenceTime)
            .Map(d => d.OBType, x => x.ObjectClassifyCode)
            .Map(d => d.OBTypeName, x => x.ObjectClassify)
            .Map(d => d.MdseName, x => x.ObjectClassify)
            .Map(d => d.SaleMode, x => x.SalesModeCode)
            .Map(d => d.DsptType, x => x.ComplainTargetCode)
            .Map(d => d.DsptCode, x => x.ECommercePlatformCode)
            .Map(d => d.DsptName, x => x.ECommercePlatform)
            .Map(d => d.BrandCode, x => x.BrandCode)
            .Map(d => d.BrandName, x => x.Brand)
            .Map(d => d.BIdNo, x => x.ExternalOrderNo)
            .Map(d => d.InvoAm, x => x.Amount)
            .Map(d => d.Jtqdtype, x => x.SalesChannelCode)
            .Map(d => d.Jtqdname, x => x.SalesChannel)
            .Map(d => d.ProdName, x => x.ProductName)
            .Map(d => d.ProdAppNo, x => x.ApprovalNumber)
            .Map(d => d.ProdPatchNo, x => x.ProductBatchNo)
            .Map(d => d.ProdTypeSpf, x => x.ProductStandard)
            .Map(d => d.ProdFty, x => x.Manufacturer)
            .Map(d => d.ProdSalEnt, x => x.SalesEnterprise)
            .Map(d => d.ProdValid, x => x.ProductExpiredTime.ToString())
            .Map(d => d.ProviderAddr, x => x.ConsumerAddress)
            .Map(d => d.Invopt, x => x.EnterpriseName)
            .Map(d => d.UBindType, x => x.IndustryClassifyCode)
            .Map(d => d.UBindTypeName, x => x.IndustryClassify)
            .Map(d => d.EntType, x => x.MarketTypeCode)
            .Map(d => d.EntTypeName, x => x.MarketType)
            .Map(d => d.Addr, x => x.RegisterAddress)
            .Map(d => d.Sjztlxr, x => x.EnterpriseContact)
            .Map(d => d.Nbxh, x => x.UnifiedSocialCreditCode)
            .Map(d => d.RegNo, x => x.RegisterNumber)
            .Map(d => d.CertType, x => x.LicenceTypeCode)
            .Map(d => d.CertTypeName, x => x.LicenceType)
            .Map(d => d.CertNo, x => x.LicenceNo)
            .Map(d => d.ReveType, x => x.IdentityTypeCode)
            .Map(d => d.ReveTypeName, x => x.IdentityType)
            .Map(d => d.Nationality, x => x.NationalityCode)
            .Map(d => d.NationalityName, x => x.Nationality)
            .Map(d => d.Folk, x => x.NationCode)
            .Map(d => d.FolkName, x => x.Nation)
            .Map(d => d.Peride, x => x.IdentityCode)
            .Map(d => d.PerideName, x => x.Identity)
            .Map(d => d.ProviderMail, x => x.Email)
            .Map(d => d.Qtlxfs, x => x.OtherContact)
            ;

            #endregion

            #region 协同扩展数据--拓展信息

            //   医疗工单
            config.ForType<FormMedicalInfo, OrderExtensionDto>()
            .Map(d => d.MedName, x => x.MedicalName)
            .Map(d => d.MedAddress, x => x.MedicalAddr)
            .Map(d => d.MedDepartment, x => x.DepartMent)
            .Map(d => d.MedDoctor, x => x.Doctor)
            .Map(d => d.MedPatient, x => x.PatientName)
            .Map(d => d.MedNo, x => x.ClinicCardNum)
            .Map(d => d.MedIdNo, x => x.CardNum)
            ;

            // 四川政务服务网技术工单
            config.ForType<FormNetWorktecInfo, OrderExtensionDto>()
            .Map(d => d.ZwfwwAccount, x => x.ZwfwAccount)
            .Map(d => d.ZwfwwContact, x => x.LinkPeson)
            ;

            //      电视购物及商铺购买退换货工单
            config.ForType<FormReturnexChangeInfo, OrderExtensionDto>()
            .Map(d => d.ExchTv, x => x.SubjectName)
            .Map(d => d.ExchTradeTime, x => x.PurchaseTime)
            .Map(d => d.ExchProduct, x => x.ProductName)
            .Map(d => d.ExchAmount, x => x.Charge)
            .Map(d => d.ExchName, x => x.BusinessName)
            .Map(d => d.ExchAddress, x => x.BusunessAddr)
            .Map(d => d.ExchConsignee, x => x.ReceivePerson)
            .Map(d => d.ExchConsigneeAddress, x => x.ReceiveAddr)
            ;

            //   高速公路工单
            config.ForType<FormExpressWayInfo, OrderExtensionDto>()
            .Map(d => d.ExpwyEntrance, x => x.InWay)
            .Map(d => d.ExpwyExit, x => x.OutWay)
            .Map(d => d.ExpwyTime, x => x.OperateDate)
            .Map(d => d.ExpwyNo, x => x.CardNum)
            ;

            //   电视台虚假广告工单
            config.ForType<FormShamPubInfo, OrderExtensionDto>()
            .Ignore(d => d.Id)
            .Map(d => d.AdTv, x => x.SubjectName)
            .Map(d => d.AdProduct, x => x.ProductName)
            .Map(d => d.AdContent, x => x.PubContent)
            ;

            //    12366热线诉求交办
            config.ForType<FormTaxationComplaintInfo, OrderExtensionDto>()
            .Map(d => d.Location12366Sq, x => x.TaxAuthority)
            .Map(d => d.Info12366Sq, x => x.ComplaintSubject)
            .Map(d => d.Type12366Sq, x => x.ComplaintType)
            ;

            //   12366热线咨询交办
            config.ForType<FormTaxationConsultingInfo, OrderExtensionDto>()
            .Map(d => d.Location12366Zx, x => x.TaxAuthority)
            .Map(d => d.Info12366Zx, x => x.ComplaintSubject)
            ;

            //    12328服务监督
            config.ForType<FormTrafficInfo, OrderExtensionDto>()
            .Map(d => d.AcceptType12328, x => x.AcceptType)
            .Map(d => d.Client12328, x => x.Customer)
            ;

            // 邮政业消费者申诉
            config.ForType<FormPostInfo, OrderExtensionDto>()
            .Map(d => d.MailClaimantName, x => x.AppealName)
            .Map(d => d.MailClaimantPhone, x => x.AppealNum)
            .Map(d => d.MailClaimantEnterprise, x => x.AppealEnterprise)
            .Map(d => d.MailSenderName, x => x.SenderName)
            .Map(d => d.MailSenderPhone, x => x.SenderNum)
            .Map(d => d.MailSenderAddress, x => x.SenderAddr)
            .Map(d => d.MailReceiverName, x => x.AddresseeName)
            .Map(d => d.MailReceiverPhone, x => x.AddresseeNum)
            .Map(d => d.MailReceiverAddress, x => x.AddresseeAddr)
            .Map(d => d.MailAmount, x => x.InsuredPrice)
            .Map(d => d.MailIsContacted, x => x.IsContact == "1" ? true : false)
            .Map(d => d.MailResult, x => x.OperateResult)
            ;

            // 环保举报业务
            config.ForType<FormEnvironMentInfo, OrderExtensionDto>()
            .Map(d => d.EpEmail, x => x.ComplaintMailBox)
            .Map(d => d.EpAddress, x => x.PostalAddress)
            .Map(d => d.EpObject, x => x.ReportObject)
            .Map(d => d.EpObjectAddress, x => x.DetailedAddr)
            .Map(d => d.EpIndustryType, x => x.IndustryType)
            .Map(d => d.EpKeyPoint, x => x.KeyPoint)
            ;

            //  12315个性化表单--投诉、举报
            config.ForType<FormMarketInfo, OrderExtensionDto>()
            .Map(d => d.ComplainClassifyCode, x => x.ApplBasQue)
            .Map(d => d.ComplainClassify, x => x.ApplBasQueName)
            .Map(d => d.PatentNo, x => x.Zlh)
            .Map(d => d.Patentee, x => x.Zlqr)
            .Map(d => d.PatentName, x => x.Fmmc)
            .Map(d => d.PatentTypeCode, x => x.Zllx)
            .Map(d => d.PatentType, x => x.ZllxMc)
            .Map(d => d.BusinessPosition.AreaCode, x => x.Accsce)
            .Map(d => d.BusinessPosition.FullAddress, x => x.Sfdd)
            .Map(d => d.OccurrenceTime, x => x.ControversyTime)
            .Map(d => d.ObjectClassifyCode, x => x.OBType)
            .Map(d => d.ObjectClassify, x => x.OBTypeName)
            .Map(d => d.ObjectClassify, x => x.MdseName)
            .Map(d => d.SalesModeCode, x => x.SaleMode)
            .Map(d => d.ComplainTargetCode, x => x.DsptType)
            .Map(d => d.ECommercePlatformCode, x => x.DsptCode)
            .Map(d => d.ECommercePlatform, x => x.DsptName)
            .Map(d => d.BrandCode, x => x.BrandCode)
            .Map(d => d.Brand, x => x.BrandName)
            .Map(d => d.ExternalOrderNo, x => x.BIdNo)
            .Map(d => d.Amount, x => x.InvoAm)
            .Map(d => d.SalesChannelCode, x => x.Jtqdtype)
            .Map(d => d.SalesChannel, x => x.Jtqdname)
            .Map(d => d.ProductName, x => x.ProdName)
            .Map(d => d.ApprovalNumber, x => x.ProdAppNo)
            .Map(d => d.ProductBatchNo, x => x.ProdPatchNo)
            .Map(d => d.ProductStandard, x => x.ProdTypeSpf)
            .Map(d => d.Manufacturer, x => x.ProdFty)
            .Map(d => d.SalesEnterprise, x => x.ProdSalEnt)
            .Map(d => d.ProductExpiredTime, x => x.ProdValid)
            .Map(d => d.ConsumerAddress, x => x.ProviderAddr)
            .Map(d => d.EnterpriseName, x => x.Invopt)
            .Map(d => d.IndustryClassifyCode, x => x.UBindType)
            .Map(d => d.IndustryClassify, x => x.UBindTypeName)
            .Map(d => d.MarketTypeCode, x => x.EntType)
            .Map(d => d.MarketType, x => x.EntTypeName)
            .Map(d => d.RegisterAddress, x => x.Addr)
            .Map(d => d.EnterpriseContact, x => x.Sjztlxr)
            .Map(d => d.UnifiedSocialCreditCode, x => x.Nbxh)
            .Map(d => d.RegisterNumber, x => x.RegNo)
            .Map(d => d.LicenceTypeCode, x => x.CertType)
            .Map(d => d.LicenceType, x => x.CertTypeName)
            .Map(d => d.LicenceNo, x => x.CertNo)
            .Map(d => d.IdentityTypeCode, x => x.ReveType)
            .Map(d => d.IdentityType, x => x.ReveTypeName)
            .Map(d => d.NationalityCode, x => x.Nationality)
            .Map(d => d.Nationality, x => x.NationalityName)
            .Map(d => d.NationCode, x => x.Folk)
            .Map(d => d.Nation, x => x.FolkName)
            .Map(d => d.IdentityCode, x => x.Peride)
            .Map(d => d.Identity, x => x.PerideName)
            .Map(d => d.Email, x => x.ProviderMail)
            .Map(d => d.OtherContact, x => x.Qtlxfs)
            ;

            #endregion

            #region 市州数据交换
            ////市州数据-接受
            //config.ForType<DsCityDataReceive, OrderDto>()
            //   .Ignore(d => d.Id)
            //   .Map(d => d.Title, x => x.Title)
            //   .Map(d => d.ExternalId, x => x.FSHCode)
            //   .Map(d => d.AcceptType, x => x.PurTypeName)
            //   .Map(d => d.HotspotSpliceName, x => x.ConTypeName)
            //   .Map(d => d.FromName, x => x.LinkName)
            //   .Map(d => d.FromGender, x => x.Gender)
            //   .Map(d => d.Contact, x => x.Mobile)
            //   .Map(d => d.Address, x => x.Address)
            //   .Map(d => d.Content, x => x.Content)
            //   .Map(d => d.Source, x => string.IsNullOrEmpty(x.Source) ? Hotline.Share.Enums.Order.ESource.Hotline : Hotline.Share.Enums.Order.ESource.HotlineImport)
            //  ;



            #endregion

            #region 企业服务
            //企业数据推送
            config.ForType<OrderDto, PushWorkOrder>()
                .Map(d => d.EnterpriseCode, x => x.EnterpriseCode)
                .Map(d => d.SpecialTeamCode, x => x.ZhuanBanCode)
               .Map(d => d.WorkOrderTitle, x => x.Title)
               .Map(d => d.WorkOrderNo, x => x.No)
               .Map(d => d.AcceptTime, x => x.CreationTime)
               .Map(d => d.AppealChannel, x => x.SourceChannel)
               .Map(d => d.ContactPhone, x => x.Contact)
               .Map(d => d.ContactName, x => x.FromName)
               .Map(d => d.AppealType, x => x.AcceptType)
               .Map(d => d.HotspotType, x => x.HotspotSpliceName)
               .Map(d => d.AppealContent, x => x.Content)
               .Map(d => d.UrgencyDegree, x => x.EmergencyLevel.ToString())
               .Map(d => d.RegionCode, x => x.AreaCode.Length > 6 ? x.AreaCode.Substring(0, 6) : x.AreaCode)
               .Map(d => d.ExpirationTime, x => x.ExpiredTime)
               .Map(d => d.IncidentTime, x => x.IncidentTime)
              ;

            //企业数据推送
            config.ForType<OrderFlowDto, DsOrderWorkFlow>()
               .Ignore(d => d.Id)
               .Map(d => d.OrderId, x => x.Order.Id)
               .Map(d => d.WorkflowId, x => x.Order.WorkflowId)
              ;
            #endregion

            config.ForType<DsOrderWorkFlow, GetFlowInfoReturnDto>()
            .Map(d => d.AcceptName, x => x.HandlerOrgName)
            .Map(d => d.AcceptUser, x => x.HandlerName)
            .Map(d => d.AcceptContent, x => x.Opinion)
            .Map(d => d.AcceptState, x => "已完成")
            .Map(d => d.AcceptDate, x => x.HandleTime)
            .Map(d => d.AcceptEnd, x => "0")
       ;

            //通话记录----丰窝最新
            config.ForType<CallNativeDto, DsTelCall>()
            .Map(d => d.CallId, x => x.Id)
            .Map(d => d.CPN, x => x.FromNo)
            .Map(d => d.CDPN, x => x.ToNo)
            .Map(d => d.CallDirection, x => x.Direction == ECallDirection.Out ? "1" : "0")
            .Map(d => d.TelNo, x => x.TelNo)
            .Map(d => d.UserId, x => x.UserId)
            .Map(d => d.UserName, x => x.UserName)
            .Map(d => d.BeginIvrTime, x => x.BeginIvrTime)
            .Map(d => d.EndIvrTime, x => x.EndIvrTime)
            .Map(d => d.BeginQueueTime, x => x.BeginQueueTime)
            .Map(d => d.EndQueueTime, x => x.EndQueueTime)
            .Map(d => d.BeginRingTime, x => x.BeginRingTime)
            .Map(d => d.EndRingTimg, x => x.EndRingTime)
            .Map(d => d.AnsweredTime, x => x.AnsweredTime)
            .Map(d => d.OverTime, x => x.EndTime)
            .Map(d => d.Duration, x => x.Duration)
            .Map(d => d.RingTimes, x => x.RingDuration)
            .Map(d => d.QueueTims, x => x.WaitDuration)
            .Map(d => d.OnState, x => x.AnsweredTime.HasValue ? "1" : "2")
            .Map(d => d.RecordingFileUrl, x => x.AudioFile)
            ;

            config.ForType<DsSendTaskSubmitCaseInfo, OrderMatchingCallDto>()
          .Map(d => d.StartTime, x => x.GenerationTime);

        }
    }

}
