private static void Vaild(string departure, string arrival, string flightDate) { if (string.IsNullOrWhiteSpace(departure)) { InterfaceInvokeException.ThrowParameterMissException("departure"); } if (string.IsNullOrWhiteSpace(arrival)) { InterfaceInvokeException.ThrowParameterMissException("arrival"); } if (string.IsNullOrWhiteSpace(flightDate)) { InterfaceInvokeException.ThrowParameterMissException("flightDate"); } if (!Regex.IsMatch(departure, "(\\w{3})")) { InterfaceInvokeException.ThrowParameterErrorException("departure"); } if (!Regex.IsMatch(arrival, "(\\w{3})")) { InterfaceInvokeException.ThrowParameterErrorException("arrival"); } if (!Regex.IsMatch(flightDate, "([0-9]{4}-[0-9]{2}-[0-9]{2})")) { InterfaceInvokeException.ThrowParameterErrorException("flightDate"); } }
private static Guid Vaild(string batchNo, string airlineCode, string flightNo, Guid id) { if (string.IsNullOrWhiteSpace(batchNo)) { InterfaceInvokeException.ThrowParameterMissException("batchNo"); } if (string.IsNullOrWhiteSpace(airlineCode)) { InterfaceInvokeException.ThrowParameterMissException("airlineCode"); } if (string.IsNullOrWhiteSpace(flightNo)) { InterfaceInvokeException.ThrowParameterMissException("flightNo"); } if (!Guid.TryParse(batchNo, out id)) { InterfaceInvokeException.ThrowParameterErrorException("batchNo"); } if (!Regex.IsMatch(airlineCode, "(\\w{2})")) { InterfaceInvokeException.ThrowParameterErrorException("airlineCode"); } if (flightNo.Length >= 6) { InterfaceInvokeException.ThrowParameterErrorException("flightNo"); } return(id); }
protected override string ExecuteCore() { string _id = Context.GetParameterValue("id"); decimal id = 0M; if (decimal.TryParse(_id, out id)) { var orderInfo = OrderQueryService.QueryOrder(id); if (orderInfo == null) { InterfaceInvokeException.ThrowCustomMsgException("暂无此订单"); } if (orderInfo.Purchaser.CompanyId != Company.CompanyId) { InterfaceInvokeException.ThrowCustomMsgException("暂无此订单"); } if (orderInfo.Bill == null) { InterfaceInvokeException.ThrowCustomMsgException("暂无账单信息"); } return(ReturnStringUtility.GetOrder(orderInfo)); } InterfaceInvokeException.ThrowParameterErrorException("订单号"); return(""); }
private static void Vaild(string airlineCode, string flightNo, string flightDate) { if (string.IsNullOrWhiteSpace(airlineCode)) { InterfaceInvokeException.ThrowParameterMissException("airlineCode"); } if (string.IsNullOrWhiteSpace(flightNo)) { InterfaceInvokeException.ThrowParameterMissException("flightNo"); } if (string.IsNullOrWhiteSpace(flightDate)) { InterfaceInvokeException.ThrowParameterMissException("flightDate"); } if (!Regex.IsMatch(airlineCode, "(\\w{2})")) { InterfaceInvokeException.ThrowParameterErrorException("airlineCode"); } if (flightNo.Length >= 6) { InterfaceInvokeException.ThrowParameterErrorException("flightNo"); } if (!Regex.IsMatch(flightDate, "([0-9]{4}-[0-9]{2}-[0-9]{2})")) { InterfaceInvokeException.ThrowParameterErrorException("flightDate"); } }
protected override string ExecuteCore() { var departure = Context.GetParameterValue("departure"); var arrival = Context.GetParameterValue("arrival"); var flightDate = Context.GetParameterValue("flightDate"); Vaild(departure, arrival, flightDate); DateTime fdate; if (DateTime.TryParse(flightDate, out fdate)) { var vailTime = Service.SystemManagement.SystemParamService.FlightValidityMinutes.ToString(); var originalFlights = Service.FlightQueryService.QueryOWFlights(departure, arrival, fdate, "", Guid.Empty); //departure = Service.FoundationService.QueryCityNameByAirportCode(departure); //arrival = Service.FoundationService.QueryCityNameByAirportCode(arrival); if (!originalFlights.Any()) { InterfaceInvokeException.ThrowCustomMsgException(departure.ToUpper() + " 到 " + arrival.ToUpper() + " " + fdate.ToString("yyyy-MM-dd") + " 没有直达航班。"); } var matchedFlights = Service.PolicyMatch.PolicyMatchServcie.MatchOneWayFlights(originalFlights, Company.CompanyId, Employee.Id).ToList(); StringBuilder str = new StringBuilder(); //将匹配出来的航班信息存入缓存中 CustomContext context = CustomContext.NewContext(); context[Employee.Id.ToString()] = matchedFlights; ContextCenter.Instance.Save(context); str.AppendFormat("<batchNo>{0}</batchNo><flights>", context.Id); foreach (var policy in matchedFlights) { var item = policy.OriginalFlight; str.AppendFormat("<airlineCode>{0}</airlineCode>", item.Airline); str.AppendFormat("<airlineName>{0}</airlineName>", item.AirlineName); str.AppendFormat("<flightNo>{0}</flightNo>", item.FlightNo); str.AppendFormat("<aircraft>{0}</aircraft>", item.AirCraft); str.AppendFormat("<hasFood>{0}</hasFood>", item.HasFood ? "1" : "0"); //1:有餐食 0:无餐食 str.AppendFormat("<hasStop>{0}</hasStop>", item.IsStop ? "1" : "0"); //1:有经停 0:无经停 str.AppendFormat("<departure><city>{0}</city><code>{1}</code><name>{2}</name><terminal>{3}</terminal></departure>", item.Departure.City, item.Departure.Code, item.Departure.Name, item.Departure.Terminal); str.AppendFormat("<arrival><city>{0}</city><code>{1}</code><name>{2}</name><terminal>{3}</terminal></arrival>", item.Arrival.City, item.Arrival.Code, item.Arrival.Name, item.Arrival.Terminal); str.AppendFormat("<takeoffTime>{0}</takeoffTime>", item.TakeoffTime.Hour + ":" + item.TakeoffTime.Minute); str.AppendFormat("<landingTime>{0}</landingTime>", item.LandingTime.Hour + ":" + item.LandingTime.Minute); str.AppendFormat("<daysInterval>{0}</daysInterval>", item.DaysInterval); str.AppendFormat("<airportFee>{0}</airportFee>", item.AirportFee); str.AppendFormat("<fuel>{0}</fuel>", item.BAF.Adult); str.AppendFormat("<standardFare>{0}</standardFare>", item.StandardPrice); str.AppendFormat("<amount>{0}</amount>", policy.LowestPrice); } str.Append("</flights>"); return(str.ToString()); } else { InterfaceInvokeException.ThrowParameterErrorException("flightDate"); } return(""); }
protected override string ExecuteCore() { var idText = Context.GetParameterValue("id"); var payInterfaceCode = Context.GetParameterValue("payType"); var businessType = Context.GetParameterValue("businessType"); if (string.IsNullOrWhiteSpace(idText)) { InterfaceInvokeException.ThrowParameterMissException("id"); } if (string.IsNullOrWhiteSpace(payInterfaceCode)) { InterfaceInvokeException.ThrowParameterMissException("payType"); } if (string.IsNullOrWhiteSpace(businessType)) { InterfaceInvokeException.ThrowParameterMissException("businessType"); } decimal id; var url = string.Empty; if (decimal.TryParse(idText, out id)) { string message; if (businessType == "0") { if (Service.OrderProcessService.Payable(id, out message)) { var payInterface = PayUtility.GetPayInterface(payInterfaceCode); url = Service.Tradement.PaymentService.OnlinePayOrder(id, payInterface, Context.ClientIP, Employee.UserName); } else { InterfaceInvokeException.ThrowException("9", message); } } else if (businessType == "1") { if (Service.ApplyformProcessService.Payable(id, out message)) { var payInterface = PayUtility.GetPayInterface(payInterfaceCode); url = Service.Tradement.PaymentService.OnlinePayPostponeFee(id, payInterface, Context.ClientIP, Employee.UserName); } else { InterfaceInvokeException.ThrowException("9", message); } } } else { InterfaceInvokeException.ThrowParameterErrorException("id"); } return("<payUrl>" + HttpUtility.UrlEncode(url) + "</payUrl>"); }
protected override string ExecuteCore() { var orderId = Context.GetParameterValue("orderId"); var passengers = Context.GetParameterValue("passengers"); var voyages = Context.GetParameterValue("voyages"); var refundType = Context.GetParameterValue("refundType"); var reason = Context.GetParameterValue("reason"); if (string.IsNullOrWhiteSpace(orderId)) { InterfaceInvokeException.ThrowParameterMissException("orderId"); } if (string.IsNullOrWhiteSpace(passengers)) { InterfaceInvokeException.ThrowParameterMissException("passengers"); } if (string.IsNullOrWhiteSpace(voyages)) { InterfaceInvokeException.ThrowParameterMissException("voyages"); } if (string.IsNullOrWhiteSpace(refundType)) { InterfaceInvokeException.ThrowParameterMissException("refundType"); } if (string.IsNullOrWhiteSpace(reason)) { InterfaceInvokeException.ThrowParameterMissException("reason"); } decimal id; if (!decimal.TryParse(orderId, out id)) { InterfaceInvokeException.ThrowParameterErrorException("订单号"); } var order = Service.OrderQueryService.QueryOrder(id); if (order == null) { InterfaceInvokeException.ThrowCustomMsgException("暂无此订单"); } if (order.Purchaser.CompanyId != Company.CompanyId) { InterfaceInvokeException.ThrowCustomMsgException("暂无此订单"); } id = ApplyRefundObj(order, refundType, passengers, voyages, reason); var obj = Service.ApplyformQueryService.QueryApplyform(id); return(ReturnStringUtility.GetApplyform(obj)); }
private List <PostponeApplyformView.Item> getPostponeVoyages(string voyages, ChinaPay.B3B.Service.Order.Domain.Order order) { var result = new List <PostponeApplyformView.Item>(); foreach (var item in voyages.Split('^')) { foreach (var o in order.PNRInfos) { var s = item.Split('|'); if (s.Count() != 5) { InterfaceInvokeException.ThrowParameterErrorException("航班信息"); } if (s[0].Length != 6) { InterfaceInvokeException.ThrowParameterErrorException("城市对"); } var departure = s[0].Substring(0, 3).ToUpper(); var arrival = s[0].Substring(3, 3).ToUpper(); var flightNo = s[1]; var flightTime = s[2]; var j = o.Flights.FirstOrDefault(i => i.Departure.Code == departure && i.Arrival.Code == arrival && i.FlightNo == flightNo && i.TakeoffTime.Date == DateTime.Parse(flightTime)); if (j != null) { if (result.FirstOrDefault(f => f.Voyage == j.Id) != null) { InterfaceInvokeException.ThrowCustomMsgException("当前申请的改期存在两个以上的相同航班信息,请核对航班信息"); } result.Add(new PostponeApplyformView.Item() { Voyage = j.Id, NewFlightNo = s[3], NewFlightDate = DateTime.Parse(s[4]) }); break; } else { InterfaceInvokeException.ThrowCustomMsgException("当前订单中不存在[" + item + "]的航班信息,请核对航班信息是否有误"); } } } return(result); }
protected override string ExecuteCore() { string applyformId = Context.GetParameterValue("applyformId"); decimal id; if (!decimal.TryParse(applyformId, out id)) { InterfaceInvokeException.ThrowParameterErrorException("applyformId"); } var obj = Service.ApplyformQueryService.QueryApplyform(id); if (obj == null) { InterfaceInvokeException.ThrowCustomMsgException("暂无此申请单"); } if (obj.Purchaser.CompanyId != Company.CompanyId) { InterfaceInvokeException.ThrowCustomMsgException("暂无此申请单"); } return(ReturnStringUtility.GetApplyform(obj)); }
private static void Vaild(string flights, string passengers, string contact, string policyType, Service.Organization.Domain.ExternalInterfaceSetting setting) { if (string.IsNullOrEmpty(flights)) { InterfaceInvokeException.ThrowParameterMissException("flights"); } if (string.IsNullOrEmpty(passengers)) { InterfaceInvokeException.ThrowParameterMissException("passengers"); } if (string.IsNullOrEmpty(policyType)) { InterfaceInvokeException.ThrowParameterMissException("policyType"); } if (flights.Split('|').Count() != 16) { InterfaceInvokeException.ThrowParameterErrorException("flights"); } foreach (var item in passengers.Split('^')) { if (item.Split('|').Count() != 4) { InterfaceInvokeException.ThrowParameterErrorException("passengers"); } } if (contact != "" && contact.Split('|').Count() != 3) { InterfaceInvokeException.ThrowParameterErrorException("contact"); } if ((setting.PolicyTypes & PolicyType.Bargain) != (PolicyType)byte.Parse(policyType) && (setting.PolicyTypes & PolicyType.Normal) != (PolicyType)byte.Parse(policyType) && (setting.PolicyTypes & PolicyType.Team) != (PolicyType)byte.Parse(policyType) && (setting.PolicyTypes & PolicyType.Special) != (PolicyType)byte.Parse(policyType)) { InterfaceInvokeException.ThrowNoAccessException(); } if (policyType != "2" && policyType != "4" && policyType != "8" && policyType != "16") { InterfaceInvokeException.ThrowParameterErrorException("policyType"); } }
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); }
private decimal ApplyRefundObj(ChinaPay.B3B.Service.Order.Domain.Order order, string refundType, string passengers, string voyages, string reason) { RefundOrScrapApplyformView applyformView = null; if (refundType == "-1") { applyformView = new ScrapApplyformView(); } else { applyformView = new RefundApplyformView() { RefundType = (RefundType)int.Parse(refundType) }; } var app = Service.ApplyformQueryService.QueryApplyforms(order.Id); string pid = ""; string vid = ""; List <PNRPair> _pnrCode = new List <PNRPair>(); foreach (var item in passengers.Split('^')) { foreach (var o in order.PNRInfos) { var j = o.Passengers.FirstOrDefault(i => i.Name == item); if (j != null) { if (pid != "") { pid += "," + j.Id.ToString(); } else { pid += j.Id.ToString(); } _pnrCode.Add(o.Code); if (!_pnrCode.Contains(o.Code)) { InterfaceInvokeException.ThrowCustomMsgException("当前订单中存在不同的编码"); } foreach (var f in voyages.Split('^')) { if (f.Split('|').Count() < 3) { InterfaceInvokeException.ThrowParameterErrorException("航班信息"); } if (f.Split('|')[0].Length != 6) { InterfaceInvokeException.ThrowParameterErrorException("城市对"); } var departure = f.Split('|')[0].Substring(0, 3).ToUpper(); var arrival = f.Split('|')[0].Substring(3, 3).ToUpper(); var flightNo = f.Split('|')[1]; var flightTime = f.Split('|')[2]; var ff = o.Flights.FirstOrDefault(i => i.Departure.Code == departure && i.Arrival.Code == arrival && i.FlightNo == flightNo && i.TakeoffTime.Date == DateTime.Parse(flightTime)); if (ff != null) { if (!vid.Split(',').Contains(ff.Id.ToString())) { if (vid != "") { vid += "," + ff.Id.ToString(); } else { vid += ff.Id.ToString(); } } } } break; } } } if (pid == "") { InterfaceInvokeException.ThrowCustomMsgException("当前订单中没有找到对应的乘机人信息"); } if (vid == "") { InterfaceInvokeException.ThrowCustomMsgException("当前订单中没有找到对应的航班信息"); } if (!_pnrCode.Any()) { InterfaceInvokeException.ThrowCustomMsgException("当前订单中没有找到对应的编码信息"); } applyformView.PNR = _pnrCode.FirstOrDefault(); applyformView.Passengers = ApplyOrder.getPassengers(pid); applyformView.Reason = reason; foreach (var item in ApplyOrder.getRefundVoyages(vid)) { applyformView.AddVoyage(item); } string lockErrorMsg = ""; ReturnStringUtility.Lock(order.Id, Service.Locker.LockRole.Purchaser, Company, Employee, "申请退改签", out lockErrorMsg); if (!string.IsNullOrEmpty(lockErrorMsg)) { InterfaceInvokeException.ThrowCustomMsgException(lockErrorMsg); } var apply = Service.OrderProcessService.Apply(order.Id, applyformView, Employee, Guid.Empty); ReturnStringUtility.releaseLock(order.Id, Company, Employee); return(apply.Id); }
protected void ValidateBusinessParameters(string pnrContent, string patContent) { if (string.IsNullOrWhiteSpace(pnrContent)) { InterfaceInvokeException.ThrowParameterErrorException("编码"); } if (string.IsNullOrWhiteSpace(patContent)) { InterfaceInvokeException.ThrowParameterErrorException("PAT内容"); } if (string.IsNullOrWhiteSpace(_policyId)) { InterfaceInvokeException.ThrowParameterErrorException("政策编号"); } if (!Guid.TryParse(_policyId, out _Id)) { InterfaceInvokeException.ThrowParameterErrorException("政策编号"); } if (string.IsNullOrWhiteSpace(_orgbatchNo)) { InterfaceInvokeException.ThrowParameterErrorException("导入批次号"); } _batchNo = _orgbatchNo.Substring(0, _orgbatchNo.Length - 1); _isNeedPat = _orgbatchNo.Substring(_orgbatchNo.Length - 1, 1); if (_contact.Trim() != "") { if (_contact.Split('|').Count() < 3) { InterfaceInvokeException.ThrowParameterErrorException("联系信息不完整"); } if (_contact.Split('|')[0].Trim() == "") { InterfaceInvokeException.ThrowParameterMissException("联系信息中姓名"); } if (_contact.Split('|')[1].Trim() == "") { InterfaceInvokeException.ThrowParameterMissException("联系信息中手机"); } } if (_associatePNR != "") { if (!Regex.IsMatch(_associatePNR, "(\\w)+")) { InterfaceInvokeException.ThrowParameterErrorException("关联编码"); } if (_associatePNR.Split('|').Any() && _associatePNR.Split('|')[0] != "" && _associatePNR.Split('|')[0].Length != 6) { InterfaceInvokeException.ThrowParameterErrorException("关联编码"); } if (_associatePNR.Split('|').Count() == 2 && _associatePNR.Split('|')[1] != "" && _associatePNR.Split('|')[1].Length != 6) { InterfaceInvokeException.ThrowParameterErrorException("关联编码"); } } try { var result = CommandService.GetReservedPnr(pnrContent); if (result.Success) { _pnr = result.Result; } } catch (Exception) { InterfaceInvokeException.ThrowParameterErrorException("编码内容"); } if (_pnr == null) { 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("编码中缺少航班信息"); } 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(patContent); if (_patPrices == null) { InterfaceInvokeException.ThrowCustomMsgException("缺少PAT内容"); } if (_patPrices.Count == 0) { InterfaceInvokeException.ThrowCustomMsgException("缺少PAT内容"); } } if (DataTransferObject.Common.PNRPair.IsNullOrEmpty(_pnr.PnrPair)) { InterfaceInvokeException.ThrowCustomMsgException("内容中缺少编码"); } if (string.IsNullOrWhiteSpace(_pnr.PnrPair.PNR) && string.IsNullOrWhiteSpace(_pnr.PnrPair.BPNR)) { InterfaceInvokeException.ThrowCustomMsgException("编码信息不全"); } //上次导入内容是没有传入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()) { InterfaceInvokeException.ThrowNotFindPolicyException(); } } if (!matchedPolicies.Any()) { InterfaceInvokeException.ThrowNotFindPolicyException(); } _matchedPolicy = matchedPolicies.FirstOrDefault(item => item.Id == _Id); if (_matchedPolicy == null) { _matchedPolicy = matchedSpeciafPolicies.FirstOrDefault(item => item.Id == _Id); } if (_matchedPolicy == null && policyFilterCondition.SuitReduce) { InterfaceInvokeException.ThrowCustomMsgException("您选择的政策不支持低打。请重新选择"); } if (_matchedPolicy == null) { InterfaceInvokeException.ThrowNotFindPolicyException(); } } else { //从缓存中取出政策 _customContext = ContextCenter.Instance[_batchNo]; if (_customContext == null) { InterfaceInvokeException.ThrowCustomMsgException("政策选择超时,请重新导入pnr内容"); } var matchedPolicies = _customContext[_pnr.PnrPair.BPNR + _pnr.PnrPair.PNR] as List <MatchedPolicy>; if (matchedPolicies == null) { InterfaceInvokeException.ThrowCustomMsgException("政策选择超时,请重新导入pnr内容"); } _matchedPolicy = matchedPolicies.FirstOrDefault(item => item.Id == _Id); if (_matchedPolicy == null) { InterfaceInvokeException.ThrowNotFindPolicyException(); } } }
protected void ValidateBusinessParameters(string pnrContext, string patContext) { if (string.IsNullOrWhiteSpace(pnrContext)) { InterfaceInvokeException.ThrowParameterMissException("编码内容"); } if (string.IsNullOrWhiteSpace(patContext)) { InterfaceInvokeException.ThrowParameterMissException("PAT内容"); } try { var result = CommandService.GetReservedPnr(pnrContext); 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 { _patPrices = Service.Command.Domain.Utility.Parser.GetPatPrices(patContext); if (_patPrices == null) { InterfaceInvokeException.ThrowCustomMsgException("缺少PAT内容"); } if (_patPrices.Count == 0) { InterfaceInvokeException.ThrowCustomMsgException("缺少PAT内容"); } } //if (!_pnr.IsTeam && !_pnr.IsFilled) InterfaceInvokeException.ThrowCustomMsgException( "缺口程编码,需要搭桥"); //验证 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); }