public PNRImport2(string pnrContext, string userName, string sign) : base(userName, sign) { // pnrContext = @" //>pn // 1.路晓丝 2.闵书蝶 3.任夜南 4.孙元冬 JNYK42 // 5. MU5818 Y WE30JAN SHAKMG HK4 1610 1940 E T2- // 6.KMG/T KMG-T/0871-8886666/KMG RUYA TICKETS CO.LTD/YU ZHEN ABCDEFG // 7.15110166432 // 8.BY OPT 820 2012/11/23 1711A // 9.TL/1540/24NOV/KMG666 //10.SSR FOID MU HK1 NI152525199012025783/P4 //11.SSR FOID MU HK1 NI152525199012028140/P3 //12.SSR FOID MU HK1 NI152525199012027228/P2 //13.SSR FOID MU HK1 NI15252519901202318X/P1 //14.SSR ADTK 1E BY KMG25NOV12/1711 OR CXL MU5818 Y30JAN //15.OSI MU CTCT 13800138000/P1 //16.OSI MU CTCT 13800138000/P2 //17.OSI MU CTCT 13800138000/P3 //18.OSI MU CTCT 13800138000/P4 //19.RMK TJ AUTH KMG215 //20.RMK CA/NE2PQB + //21.RMK TLWBINSD - //22.KMG666 //> // // 服务器耗时:0毫秒/0毫秒 网络传输总耗时:30毫秒 //>pat:a //>PAT:A //01 Y FARE:CNY1900.00 TAX:CNY50.00 YQ:CNY140.00 TOTAL:2090.00 //>SFC:01 //>"; _pnrContext = ReserveViewConstuctor.GetPnrContent(pnrContext); }
protected override string ExecuteCore() { var pnrContext = Context.GetParameterValue("pnrContent"); var patContent = Context.GetParameterValue("patContent"); _policyId = Context.GetParameterValue("policyId"); _associatePNR = Context.GetParameterValue("associatePNR"); _contact = Context.GetParameterValue("contact"); _orgbatchNo = Context.GetParameterValue("batchNo"); ValidateBusinessParameters(HttpUtility.UrlDecode(pnrContext), HttpUtility.UrlDecode(patContent)); StringBuilder str = new StringBuilder(); var flights = ReserveViewConstuctor.GetQueryFlightView(_pnr.Voyage.Segments, _pnr.Voyage.Type, _pnr.Passengers.First().Type, _pnr.IsTeam); var orderView = GetOrderView(OrderSource.InterfaceOrder, _pnr, new ChinaPay.B3B.DataTransferObject.Common.PNRPair() { BPNR = _associatePNR == "" ? "" : _associatePNR.Split('|')[0], PNR = _associatePNR == "" ? "" : (_associatePNR.Split('|').Count() < 2 ? "" : _associatePNR.Split('|')[1]) }, flights, _contact); var orderInfo = Service.OrderProcessService.ProduceOrder(orderView, _matchedPolicy, Employee, Guid.Empty, false); str.AppendFormat("<id>{0}</id>", orderInfo.Id); str.AppendFormat("<officeNo>{0}</officeNo>", _matchedPolicy.OriginalPolicy == null && _matchedPolicy.NeedAUTH ? _matchedPolicy.OfficeNumber : (_matchedPolicy.OriginalPolicy != null && _matchedPolicy.OriginalPolicy.NeedAUTH ? _matchedPolicy.OriginalPolicy.OfficeCode : "")); str.AppendFormat("<payable>{0}</payable>", _matchedPolicy.ConfirmResource ? 0 : 1); str.Append(ReturnStringUtility.GetOrder(orderInfo)); //清空缓存 ContextCenter.Instance.Remove(_orgbatchNo); return(str.ToString()); }
protected override string ExecuteCore() { var flights = ReserveViewConstuctor.GetQueryFlightView(_pnr.Segments, _pnr.ItineraryType, _pnr.Passenges.First().Value.Type, _pnr.IsTeam); var policyFilterCondition = GetPolicyFilter(flights); PolicyType policyType = queryPolicyType(flights); //匹配政策 List <MatchedPolicy> matchedPolicies = Service.PolicyMatch.PolicyMatchServcie.MatchBunk(policyFilterCondition, _pnr.Passenges.First().Value.Type, 10).ToList(); List <MatchedPolicy> matchedSpeciafPolicies = null; if (policyType != PolicyType.Special) { policyFilterCondition = GetPolicyFilter(flights, PolicyType.Special); matchedSpeciafPolicies = Service.PolicyMatch.PolicyMatchServcie.MatchBunk(policyFilterCondition, _pnr.Passenges.First().Value.Type, 10).ToList(); } StringBuilder str = new StringBuilder(); if (matchedPolicies == null) { throw new InterfaceInvokeException("9", "没有找到相关政策"); } if (policyType != PolicyType.Special) { var list = from item in matchedPolicies let generalPolicy = item.OriginalPolicy as IGeneralPolicy let regulation = item.OriginalPolicy as IHasRegulation select new { Id = item.Id, Type = (int)item.PolicyType, Fare = item.ParValue.TrimInvaidZero(), Rebate = (item.Commission * 100).TrimInvaidZero(), Commission = (item.ParValue - item.SettleAmount).TrimInvaidZero(), Amount = item.SettleAmount, Ticket = (int)(item.OriginalPolicy == null ? TicketType.BSP : item.OriginalPolicy.TicketType), EI = ReplaceEnter((regulation == null ? getEI(flights) : getProvision(regulation))), OfficeNo = item.OriginalPolicy == null && item.NeedAUTH ? item.OfficeNumber : (item.OriginalPolicy != null && item.OriginalPolicy.NeedAUTH ? item.OriginalPolicy.OfficeCode : ""), Condition = item.OriginalPolicy == null ? "" : item.OriginalPolicy.Condition, Confirm = item.ConfirmResource, generalPolicy.ChangePNR, EtdzTime = getTimeRange(item.WorkStart, item.WorkEnd), RefundTime = getTimeRange(item.WorkStart, item.WorkEnd), ScrapTime = getTimeRange(item.RefundStart, item.RefundEnd), EtdzSpeed = item.Speed.ETDZ / 60, RefundSpeed = item.Speed.Refund / 60 }; str.Append("<policies>"); foreach (var item in list) { str.Append("<policy>"); str.AppendFormat("<id>{0}</id>", item.Id); str.AppendFormat("<type>{0}</type>", item.Type); str.AppendFormat("<fare>{0}</fare>", item.Fare); str.AppendFormat("<rebate>{0}</rebate>", item.Rebate); str.AppendFormat("<commission>{0}</commission>", item.Commission); str.AppendFormat("<amount>{0}</amount>", item.Amount); str.AppendFormat("<ticket>{0}</ticket>", item.Ticket); str.AppendFormat("<ei>{0}</ei>", item.EI); //需要授权的office号才有,否则为空字符 str.AppendFormat("<officeNo>{0}</officeNo>", item.OfficeNo); str.AppendFormat("<condition>{0}</condition>", item.Condition); str.AppendFormat("<confirm>{0}</confirm>", item.Confirm); str.AppendFormat("<changePNR>{0}</changePNR>", item.ChangePNR); str.AppendFormat("<etdzTime>{0}</etdzTime>", item.EtdzTime); str.AppendFormat("<refundTime>{0}</refundTime>", item.RefundTime); str.AppendFormat("<scrapTime>{0}</scrapTime>", item.ScrapTime); str.AppendFormat("<etdzSpeed>{0}</etdzSpeed>", item.EtdzSpeed); str.Append("</policy>"); } var queryList = from item in matchedSpeciafPolicies where item != null && item.OriginalPolicy != null let specialPolicy = item.OriginalPolicy as SpecialPolicyInfo let specialPolicyInfo = SpecialProductService.Query(specialPolicy.Type) select new { Id = item.Id, Type = (int)item.PolicyType, Fare = item.ParValue.TrimInvaidZero(), Rebate = (item.Commission * 100).TrimInvaidZero(), Commission = (item.ParValue - item.SettleAmount).TrimInvaidZero(), Amount = item.SettleAmount, Ticket = (int)(item.OriginalPolicy == null ? TicketType.BSP : item.OriginalPolicy.TicketType), EI = ReplaceEnter(getProvision(item.OriginalPolicy as IHasRegulation)), OfficeNo = item.OriginalPolicy == null && item.NeedAUTH ? item.OfficeNumber : (item.OriginalPolicy != null && item.OriginalPolicy.NeedAUTH ? item.OriginalPolicy.OfficeCode : ""), Condition = item.OriginalPolicy == null ? "" : item.OriginalPolicy.Condition, Confirm = item.ConfirmResource, ChangePNR = "", EtdzTime = getTimeRange(item.WorkStart, item.WorkEnd), RefundTime = getTimeRange(item.WorkStart, item.WorkEnd), ScrapTime = getTimeRange(item.RefundStart, item.RefundEnd), EtdzSpeed = item.Speed == null ? 0 : item.Speed.ETDZ / 60, RefundSpeed = item.Speed == null ? 0 : item.Speed.Refund / 60 }; foreach (var item in queryList) { str.Append("<policy>"); str.AppendFormat("<id>{0}</id>", item.Id); str.AppendFormat("<type>{0}</type>", item.Type); str.AppendFormat("<fare>{0}</fare>", item.Fare); str.AppendFormat("<rebate>{0}</rebate>", item.Rebate); str.AppendFormat("<commission>{0}</commission>", item.Commission); str.AppendFormat("<amount>{0}</amount>", item.Amount); str.AppendFormat("<ticket>{0}</ticket>", item.Ticket); str.AppendFormat("<ei>{0}</ei>", item.EI); //需要授权的office号才有,否则为空字符 str.AppendFormat("<officeNo>{0}</officeNo>", item.OfficeNo); str.AppendFormat("<condition>{0}</condition>", item.Condition); str.AppendFormat("<confirm>{0}</confirm>", item.Confirm); str.AppendFormat("<changePNR>{0}</changePNR>", item.ChangePNR); str.AppendFormat("<etdzTime>{0}</etdzTime>", item.EtdzTime); str.AppendFormat("<refundTime>{0}</refundTime>", item.RefundTime); str.AppendFormat("<scrapTime>{0}</scrapTime>", item.ScrapTime); str.AppendFormat("<etdzSpeed>{0}</etdzSpeed>", item.EtdzSpeed); str.Append("</policy>"); } foreach (var item in matchedSpeciafPolicies) { if (!matchedPolicies.Contains(item)) { matchedPolicies.Add(item); } } } else { var queryList = from item in matchedPolicies where item != null && item.OriginalPolicy != null let specialPolicy = item.OriginalPolicy as SpecialPolicyInfo let specialPolicyInfo = SpecialProductService.Query(specialPolicy.Type) select new { Id = item.Id, Type = (int)item.PolicyType, Fare = item.ParValue.TrimInvaidZero(), Rebate = (item.Commission * 100).TrimInvaidZero(), Commission = 0, Amount = item.SettleAmount, Ticket = (int)(item.OriginalPolicy == null ? TicketType.BSP : item.OriginalPolicy.TicketType), EI = ReplaceEnter(getProvision(item.OriginalPolicy as IHasRegulation)), OfficeNo = item.OriginalPolicy == null && item.NeedAUTH ? item.OfficeNumber : (item.OriginalPolicy != null && item.OriginalPolicy.NeedAUTH ? item.OriginalPolicy.OfficeCode : ""), Condition = item.OriginalPolicy == null ? "" : item.OriginalPolicy.Condition, Confirm = item.ConfirmResource, ChangePNR = "", EtdzTime = getTimeRange(item.WorkStart, item.WorkEnd), RefundTime = getTimeRange(item.WorkStart, item.WorkEnd), ScrapTime = getTimeRange(item.RefundStart, item.RefundEnd), EtdzSpeed = item.Speed.ETDZ / 60, RefundSpeed = item.Speed.Refund / 60 }; foreach (var item in queryList) { str.Append("<policy>"); str.AppendFormat("<id>{0}</id>", item.Id); str.AppendFormat("<type>{0}</type>", item.Type); str.AppendFormat("<fare>{0}</fare>", item.Fare); str.AppendFormat("<rebate>{0}</rebate>", item.Rebate); str.AppendFormat("<commission>{0}</commission>", item.Commission); str.AppendFormat("<amount>{0}</amount>", item.Amount); str.AppendFormat("<ticket>{0}</ticket>", item.Ticket); str.AppendFormat("<ei>{0}</ei>", item.EI); //需要授权的office号才有,否则为空字符 str.AppendFormat("<officeNo>{0}</officeNo>", item.OfficeNo); str.AppendFormat("<condition>{0}</condition>", item.Condition); str.AppendFormat("<confirm>{0}</confirm>", item.Confirm); str.AppendFormat("<changePNR>{0}</changePNR>", item.ChangePNR); str.AppendFormat("<etdzTime>{0}</etdzTime>", item.EtdzTime); str.AppendFormat("<refundTime>{0}</refundTime>", item.RefundTime); str.AppendFormat("<scrapTime>{0}</scrapTime>", item.ScrapTime); str.AppendFormat("<etdzSpeed>{0}</etdzSpeed>", item.EtdzSpeed); str.Append("</policy>"); } } str.Append("</policies>"); //将匹配出来的政策存入缓存中 CustomContext context = CustomContext.NewContext(); context[_pnr.Code.BPNR + _pnr.Code.PNR] = matchedPolicies; ContextCenter.Instance.Save(context); str.AppendFormat("<key>{0}</key>", context.Id.ToString()); return(str.ToString()); }
protected void ValidateBusinessParameters(string _pnrContent) { if (string.IsNullOrWhiteSpace(_pnrContent)) { InterfaceInvokeException.ThrowParameterMissException("编码内容"); } try { var result = CommandService.GetReservedPnr(_pnrContent); if (result.Success) { _pnr = result.Result; } } catch (Exception) { InterfaceInvokeException.ThrowParameterErrorException("编码内容"); } if (_pnr == null) { InterfaceInvokeException.ThrowParameterErrorException("编码内容"); } if (DataTransferObject.Common.PNRPair.IsNullOrEmpty(_pnr.PnrPair)) { InterfaceInvokeException.ThrowParameterErrorException("内容中缺少编码"); } if (string.IsNullOrWhiteSpace(_pnr.PnrPair.PNR) && string.IsNullOrWhiteSpace(_pnr.PnrPair.BPNR)) { InterfaceInvokeException.ThrowParameterErrorException("编码信息不全"); } //如果遇到证件号不全体提编码 if (_pnr.Passengers.Any(p => string.IsNullOrEmpty(p.CertificateNumber)) && !PNRPair.IsNullOrEmpty(_pnr.PnrPair)) { var rtResult = CommandService.GetReservedPnr(_pnr.PnrPair, Guid.Empty); if (rtResult.Success && !rtResult.Result.HasCanceled) { _pnr = rtResult.Result; } } _flights = ReserveViewConstuctor.GetQueryFlightView(_pnr.Voyage.Segments, _pnr.Voyage.Type, _pnr.Passengers.First().Type, _pnr.IsTeam).ToList(); if (!_flights.Any()) { InterfaceInvokeException.ThrowCustomMsgException("编码中缺少航班信息"); } _policyType = ReturnStringUtility.QueryPolicyType(_flights, _pnr); var flight = _flights.FirstOrDefault(); if (flight.BunkType != null && flight.BunkType.Value == BunkType.Free) { _patPrices = new List <PriceView> { new PriceView { AirportTax = flight.AirportFee, BunkerAdjustmentFactor = flight.BAF, Fare = 0, Total = flight.AirportFee + flight.BAF } }; } else { //没有传入pat信息 就虚拟一个高价的pat _patPrices = new List <PriceView> { new PriceView { AirportTax = 100000, BunkerAdjustmentFactor = 100000, Fare = 100000, Total = 300000 } }; } //验证 CommandService.ValidatePNR(_pnr, _pnr.Passengers.First().Type); }
protected override void ValidateBusinessParameters() { if (string.IsNullOrWhiteSpace(_pnrContent)) { throw new InterfaceInvokeException("1", "编码"); } if (string.IsNullOrWhiteSpace(_policyId)) { throw new InterfaceInvokeException("1", "政策编号"); } if (!Guid.TryParse(_policyId, out _Id)) { throw new InterfaceInvokeException("1", "政策编号"); } if (string.IsNullOrWhiteSpace(_orgbatchNo)) { throw new InterfaceInvokeException("1", "导入批次号"); } _batchNo = _orgbatchNo.Substring(0, _orgbatchNo.Length - 1); _isNeedPat = _orgbatchNo.Substring(_orgbatchNo.Length - 1, 1); if (_contact.Trim() != "") { if (_contact.Split('|').Count() < 3) { throw new InterfaceInvokeException("1", "联系信息不完整"); } if (_contact.Split('|')[0].Trim() == "") { throw new InterfaceInvokeException("8", "联系信息中姓名"); } if (_contact.Split('|')[1].Trim() == "") { throw new InterfaceInvokeException("8", "联系信息中手机"); } //if (_contact.Split('|')[2].Trim() == "") throw new InterfaceInvokeException("8", "联系信息中邮箱"); } if (_associatePNR != "") { if (!Regex.IsMatch(_associatePNR, "(\\w)+")) { throw new InterfaceInvokeException("1", "关联编码"); } if (_associatePNR.Split('|').Any() && _associatePNR.Split('|')[0] != "" && _associatePNR.Split('|')[0].Length != 6) { throw new InterfaceInvokeException("1", "关联编码"); } if (_associatePNR.Split('|').Count() == 2 && _associatePNR.Split('|')[1] != "" && _associatePNR.Split('|')[1].Length != 6) { throw new InterfaceInvokeException("1", "关联编码"); } } try { var result = CommandService.GetReservedPnr(_pnrContent); if (result.Success) { _pnr = result.Result; } } catch (Exception) { throw new InterfaceInvokeException("1", "编码内容"); } if (_pnr == null) { throw new InterfaceInvokeException("1", "编码内容"); } //如果遇到证件号不全体提编码 if (_pnr.Passengers.Any(p => string.IsNullOrEmpty(p.CertificateNumber)) && !PNRPair.IsNullOrEmpty(_pnr.PnrPair)) { var rtResult = CommandService.GetReservedPnr(_pnr.PnrPair, Guid.Empty); if (rtResult.Success && !rtResult.Result.HasCanceled) { _pnr = rtResult.Result; } } _flights = ReserveViewConstuctor.GetQueryFlightView(_pnr.Voyage.Segments, _pnr.Voyage.Type, _pnr.Passengers.First().Type, _pnr.IsTeam).ToList(); if (!_flights.Any()) { throw new InterfaceInvokeException("9", "编码中缺少航班信息"); } var flight = _flights.FirstOrDefault(); if (flight.BunkType != null && flight.BunkType.Value == BunkType.Free) { _patPrices = new List <DataTransferObject.Command.PNR.PriceView> { new DataTransferObject.Command.PNR.PriceView { AirportTax = flight.AirportFee, BunkerAdjustmentFactor = flight.BAF, Fare = 0, Total = flight.AirportFee + flight.BAF } }; } else { _patPrices = Service.Command.Domain.Utility.Parser.GetPatPrices(_pnrContent); if (_patPrices == null) { throw new InterfaceInvokeException("9", "缺少PAT内容"); } if (_patPrices.Count == 0) { throw new InterfaceInvokeException("9", "缺少PAT内容"); } } if (DataTransferObject.Common.PNRPair.IsNullOrEmpty(_pnr.PnrPair)) { throw new InterfaceInvokeException("9", "内容中缺少编码"); } if (string.IsNullOrWhiteSpace(_pnr.PnrPair.PNR) && string.IsNullOrWhiteSpace(_pnr.PnrPair.BPNR)) { throw new InterfaceInvokeException("9", "编码信息不全"); } //上次导入内容是没有传入pat信息,需要重新匹配政策 if (_isNeedPat == "1") { PNRHelper.SaveImportInfo(_pnr, _pnr.PnrPair, _patPrices.MinOrDefaultElement(item => item.Fare), _pnr.Passengers.First().Type, _patPrices.MaxOrDefaultElement(item => item.Fare), out fdSuccess); var policyFilterCondition = GetPolicyFilter(_flights); //匹配政策 List <MatchedPolicy> matchedPolicies = Service.PolicyMatch.PolicyMatchServcie.MatchBunk(policyFilterCondition, false, _pnr.Passengers.First().Type, 10).ToList(); List <MatchedPolicy> matchedSpeciafPolicies = null; if ((_policyType & PolicyType.Special) != PolicyType.Special && (_policyType & PolicyType.Team) != PolicyType.Team) { policyFilterCondition = GetPolicyFilter(_flights, PolicyType.Special); matchedSpeciafPolicies = Service.PolicyMatch.PolicyMatchServcie.MatchBunk(policyFilterCondition, false, _pnr.Passengers.First().Type, 10).ToList(); if (!matchedPolicies.Any() && !matchedSpeciafPolicies.Any()) { throw new InterfaceInvokeException("9", "没有找到相关政策"); } } if (!matchedPolicies.Any()) { throw new InterfaceInvokeException("9", "没有找到相关政策"); } _matchedPolicy = matchedPolicies.FirstOrDefault(item => item.Id == _Id); if (_matchedPolicy == null) { _matchedPolicy = matchedSpeciafPolicies.FirstOrDefault(item => item.Id == _Id); } if (_matchedPolicy == null && policyFilterCondition.SuitReduce) { throw new InterfaceInvokeException("9", "您选择的政策不支持低打。请重新选择"); } if (_matchedPolicy == null) { throw new InterfaceInvokeException("9", "没有找到相关政策"); } } else { //从缓存中取出政策 _customContext = ContextCenter.Instance[_batchNo]; if (_customContext == null) { throw new InterfaceInvokeException("9", "政策选择超时,请重新导入pnr内容"); } var matchedPolicies = _customContext[_pnr.PnrPair.BPNR + _pnr.PnrPair.PNR] as List <MatchedPolicy>; if (matchedPolicies == null) { throw new InterfaceInvokeException("9", "政策选择超时,请重新导入pnr内容"); } _matchedPolicy = matchedPolicies.FirstOrDefault(item => item.Id == _Id); if (_matchedPolicy == null) { throw new InterfaceInvokeException("9", "没找到对应的政策,请重新导入pnr内容"); } } }
protected override string ExecuteCore() { StringBuilder str = new StringBuilder(); var flights = ReserveViewConstuctor.GetQueryFlightView(_pnr.Voyage.Segments, _pnr.Voyage.Type, _pnr.Passengers.First().Type, _pnr.IsTeam); var orderView = GetOrderView(OrderSource.InterfaceOrder, _pnr, new ChinaPay.B3B.DataTransferObject.Common.PNRPair() { BPNR = _associatePNR == "" ? "" : _associatePNR.Split('|')[0], PNR = _associatePNR == "" ? "" : (_associatePNR.Split('|').Count() < 2 ? "" : _associatePNR.Split('|')[1]) }, flights, _contact); var orderInfo = Service.OrderProcessService.ProduceOrder(orderView, _matchedPolicy, Employee, Guid.Empty, false); str.AppendFormat("<id>{0}</id>", orderInfo.Id); str.AppendFormat("<officeNo>{0}</officeNo>", _matchedPolicy.OriginalPolicy == null && _matchedPolicy.NeedAUTH ? _matchedPolicy.OfficeNumber : (_matchedPolicy.OriginalPolicy != null && _matchedPolicy.OriginalPolicy.NeedAUTH ? _matchedPolicy.OriginalPolicy.OfficeCode : "")); str.AppendFormat("<payable>{0}</payable>", _matchedPolicy.ConfirmResource ? 0 : 1); str.Append(QueryOrder.GetOrder(orderInfo)); //str.Append("<order><title>"); //str.AppendFormat("<id>{0}</id>", orderInfo.Id); //str.AppendFormat("<status>{0}</status>", (int)orderInfo.Status); //str.AppendFormat("<statusDescription>{0}</statusDescription>", orderInfo.Status.GetDescription()); //str.AppendFormat("<product>{0}</product>", (int)orderInfo.Product.ProductType); //str.AppendFormat("<ticket>{0}</ticket>", (int)orderInfo.Product.TicketType); //str.AppendFormat("<associatePNR>{0}</associatePNR>", orderInfo.AssociatePNR == null ? "" : orderInfo.AssociatePNR.BPNR + "|" + orderInfo.AssociatePNR.PNR); //str.AppendFormat("<rebate>{0}</rebate>", orderInfo.Purchaser.Rebate); //str.AppendFormat("<commission>{0}</commission>", orderInfo.Purchaser.Commission); //str.AppendFormat("<amount>{0}</amount>", orderInfo.Purchaser.Amount); //str.AppendFormat("<producedTime>{0}</producedTime>", orderInfo.Purchaser.ProducedTime); //str.AppendFormat("<payTime>{0}</payTime>", orderInfo.Bill.PayBill.Purchaser.Time); //str.AppendFormat("<etdzTime>{0}</etdzTime>", orderInfo.ETDZTime); //str.Append("</title>"); //str.Append("<pnrs>"); //foreach (var pnr in orderInfo.PNRInfos) //{ // str.Append("<pnr>"); str.AppendFormat("<code>{0}</code>", pnr.Code == null ? "" : pnr.Code.BPNR + "|" + pnr.Code.PNR); // str.Append("<passengers>"); // foreach (var person in pnr.Passengers) // { // str.AppendFormat("<p><name>{0}</name><type>{1}</type><credentitals>{2}</credentitals><mobile>{3}</mobile><settleCode>{4}</settleCode><tickets>{5}</tickets></p>", person.Name, (int)person.PassengerType, person.Credentials, person.Phone, person.Tickets.FirstOrDefault().SettleCode, person.Tickets.Join("|", num => num.No)); // } // str.Append("</passengers>"); // str.Append("<flights>"); // foreach (var filght in pnr.Flights) // { // str.AppendFormat("<f><departure>{0}</departure><arrival>{1}</arrival><airline>{2}</airline><flightNo>{3}</flightNo><aircraft>{11}</aircraft><takeoffTime>{4}</takeoffTime><arrivalTime>{5}</arrivalTime><bunk>{6}</bunk><fare>{7}</fare><discount>{8}</discount><airportFee>{9}</airportFee><baf>{10}</baf></f>", filght.Departure.Code + "|" + filght.Departure.City, filght.Arrival.Code + "|" + filght.Arrival.City, filght.Carrier.Code + "|" + filght.Carrier.Name, filght.FlightNo, filght.TakeoffTime, filght.LandingTime, filght.Bunk.Code, filght.Price.Fare, filght.Bunk.Discount, filght.AirportFee, filght.BAF, filght.AirCraft); // } // str.Append("</flights>"); // str.Append("</pnr>"); //} //str.Append("</pnrs>"); //str.Append("<bills>"); //if (orderInfo.Bill.PayBill != null) //{//支付 // str.Append("<b>"); // str.AppendFormat("<type>1</type>"); // str.AppendFormat("<amount>{0}</amount>", orderInfo.Bill.PayBill.Purchaser.Amount); // str.AppendFormat("<tradeNo>{0}</tradeNo>", orderInfo.Bill.PayBill.Tradement.TradeNo); // str.AppendFormat("<time>{0}</time>", orderInfo.Bill.PayBill.Purchaser.Time); // str.Append("</b>"); //} //if (orderInfo.Bill.NormalRefundBills != null) //{//退款 // foreach (var item in orderInfo.Bill.NormalRefundBills) // { // str.Append("<b>"); // str.AppendFormat("<type>2</type>"); // str.AppendFormat("<amount>{0}</amount>", item.Tradement.Amount); // str.AppendFormat("<tradeNo>{0}</tradeNo>", item.Tradement.TradeNo); // str.AppendFormat("<time>{0}</time>", item.Purchaser.Time); // str.Append("</b>"); // } //} //if (orderInfo.Bill.PostponePayBills != null) //{//支付 // foreach (var item in orderInfo.Bill.PostponePayBills) // { // str.Append("<b>"); // str.AppendFormat("<type>1</type>"); // str.AppendFormat("<amount>{0}</amount>", item.Tradement.Amount); // str.AppendFormat("<tradeNo>{0}</tradeNo>", item.Tradement.TradeNo); // str.AppendFormat("<time>{0}</time>", item.Applier.Time); // str.Append("</b>"); // } //} //if (orderInfo.Bill.PostponeRefundBills != null) //{//退款 // foreach (var item in orderInfo.Bill.PostponeRefundBills) // { // str.Append("<b>"); // str.AppendFormat("<type>2</type>"); // str.AppendFormat("<amount>{0}</amount>", item.Tradement.Amount); // str.AppendFormat("<tradeNo>{0}</tradeNo>", item.Tradement.TradeNo); // str.AppendFormat("<time>{0}</time>", item.Applier.Time); // str.Append("</b>"); // } //} //str.Append("</bills></order>"); //清空缓存 ContextCenter.Instance.Remove(_orgbatchNo); return(str.ToString()); }
protected override void ValidateBusinessParameters() { if (string.IsNullOrWhiteSpace(_pnrContent)) { throw new InterfaceInvokeException("8", "编码内容"); } try { var result = CommandService.GetReservedPnr(_pnrContent); if (result.Success) { _pnr = result.Result; } } catch (Exception) { throw new InterfaceInvokeException("1", "编码内容"); } if (_pnr == null) { throw new InterfaceInvokeException("1", "编码内容"); } if (DataTransferObject.Common.PNRPair.IsNullOrEmpty(_pnr.PnrPair)) { throw new InterfaceInvokeException("1", "内容中缺少编码"); } if (string.IsNullOrWhiteSpace(_pnr.PnrPair.PNR) && string.IsNullOrWhiteSpace(_pnr.PnrPair.BPNR)) { throw new InterfaceInvokeException("1", "编码信息不全"); } //如果遇到证件号不全体提编码 if (_pnr.Passengers.Any(p => string.IsNullOrEmpty(p.CertificateNumber)) && !PNRPair.IsNullOrEmpty(_pnr.PnrPair)) { var rtResult = CommandService.GetReservedPnr(_pnr.PnrPair, Guid.Empty); if (rtResult.Success && !rtResult.Result.HasCanceled) { _pnr = rtResult.Result; } } _flights = ReserveViewConstuctor.GetQueryFlightView(_pnr.Voyage.Segments, _pnr.Voyage.Type, _pnr.Passengers.First().Type, _pnr.IsTeam).ToList(); if (!_flights.Any()) { throw new InterfaceInvokeException("9", "编码中缺少航班信息"); } _policyType = queryPolicyType(_flights); var flight = _flights.FirstOrDefault(); if (flight.BunkType != null && flight.BunkType.Value == BunkType.Free) { _patPrices = new List <PriceView> { new PriceView { AirportTax = flight.AirportFee, BunkerAdjustmentFactor = flight.BAF, Fare = 0, Total = flight.AirportFee + flight.BAF } }; } else { _patPrices = Service.Command.Domain.Utility.Parser.GetPatPrices(_pnrContent); if (_patPrices == null) { throw new InterfaceInvokeException("9", "缺少PAT内容"); } if (_patPrices.Count == 0) { throw new InterfaceInvokeException("9", "缺少PAT内容"); } } //if (!_pnr.IsTeam && !_pnr.IsFilled) throw new InterfaceInvokeException("9", "缺口程编码,需要搭桥"); //验证 CommandService.ValidatePNR(_pnr, _pnr.Passengers.First().Type); PNRHelper.SaveImportInfo(_pnr, _pnr.PnrPair, _patPrices.MinOrDefaultElement(item => item.Fare), _pnr.Passengers.First().Type, _patPrices.MaxOrDefaultElement(item => item.Fare), out fdSuccess); }