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"); } }
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(""); }
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 flights = Context.GetParameterValue("flights"); var passengers = Context.GetParameterValue("passengers"); var contact = Context.GetParameterValue("contact"); var policyType = Context.GetParameterValue("policyType"); Vaild(flights, passengers, contact, policyType, InterfaceSetting); DataTransferObject.Order.OrderView orderView = new DataTransferObject.Order.OrderView(); bindOrderView(flights, passengers, contact, orderView); var pnrh = new PNRHelper(); try { if ((PolicyType)byte.Parse(policyType) != PolicyType.Special) { PNRPair pnr = pnrh.ReserveSeat(loadFlightView(flights, passengers), orderView.Passengers, Employee, Company); orderView.PNR = pnr; } if (pnrh.RequirePat(loadFlightView(flights, passengers), (PolicyType)byte.Parse(policyType))) { orderView.PATPrice = pnrh.Pat(orderView.PNR, loadFlightView(flights, passengers), PassengerType.Adult); } MatchedPolicy policy = QueryPolicies((PolicyType)byte.Parse(policyType), flights, passengers, orderView); if (policy != null) { if (policy.PolicyType == PolicyType.Special) { var p = PolicyManageService.GetSpecialPolicy(policy.Id); if (p != null && p.SynBlackScreen) { PNRPair pnr = pnrh.ReserveSeat(loadFlightView(flights, passengers), orderView.Passengers, Employee, Company); orderView.PNR = pnr; } } orderView.IsTeam = false; orderView.Source = OrderSource.InterfaceReservaOrder; Order order = OrderProcessService.ProduceOrder(orderView, policy, Employee, Guid.Empty, false); if (order.Source == OrderSource.InterfaceReservaOrder && !PNRPair.IsNullOrEmpty(order.ReservationPNR) && !String.IsNullOrWhiteSpace(order.Product.OfficeNo)) { if (policy.NeedAUTH && !string.IsNullOrEmpty(policy.OfficeNumber)) { authorize(order.ReservationPNR, policy.OfficeNumber); } } return("<id>" + order.Id + "</id><payable>" + (policy.ConfirmResource ? 0 : 1) + "</payable>" + ReturnStringUtility.GetOrder(order)); } } catch (Exception ex) { InterfaceInvokeException.ThrowCustomMsgException(ex.Message); } InterfaceInvokeException.ThrowCustomMsgException("生成订单失败,没有对应直达航班!"); 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 applyformId = Context.GetParameterValue("id"); if (string.IsNullOrWhiteSpace(applyformId)) { InterfaceInvokeException.ThrowParameterMissException("id"); } return(PayUtility.GetPayUrl(applyformId, "2", Context.UserName)); }
protected override string ExecuteCore() { var batchNo = Context.GetParameterValue("batchNo"); var airlineCode = Context.GetParameterValue("airlineCode"); var flightNo = Context.GetParameterValue("flightNo"); Guid id = Guid.Empty; id = Vaild(batchNo, airlineCode, flightNo, id); var context = ContextCenter.Instance[batchNo]; if (context == null) { InterfaceInvokeException.ThrowCustomMsgException("查询超时,请重新查询航班"); } var matchedFlights = context[Employee.Id.ToString()] as List <MatchedFlight>; StringBuilder str = new StringBuilder(); str.Append("<bunks>"); foreach (var item in matchedFlights) { var f = item.OriginalFlight; if (f.Airline.ToUpper() == airlineCode.ToUpper() && f.FlightNo == flightNo) { var matchedBunks = Service.PolicyMatch.PolicyMatchServcie.MatchOneWayFlight(f, Company.CompanyId).ToList(); var basicPrice = Service.FoundationService.QueryBasicPrice(f.Airline, f.Departure.Code, f.Arrival.Code, f.FlightDate); var s = (from matchedBunk in matchedBunks where matchedBunk.Policies.Any() from bunkInfo in constructBunkView(matchedBunk, basicPrice) orderby bunkInfo.Amount select bunkInfo); foreach (var b in s) { str.Append("<bunk>"); str.AppendFormat("<code>{0}</code>", b.Code); str.AppendFormat("<count>{0}</count>", b.SeatCount > 9 ? "A" : b.SeatCount.ToString()); str.AppendFormat("<type>{0}</type>", b.BunkType == null ? "" : ((byte)b.BunkType).ToString()); str.AppendFormat("<name>{0}</name>", b.Description); str.AppendFormat("<discount>{0}</discount>", b.Discount); str.AppendFormat("<ei>{0}</ei>", b.EI); str.AppendFormat("<fare>{0}</fare>", b.Fare); str.AppendFormat("<amount>{0}</amount>", b.Amount); str.Append("</bunk>"); } // } } } str.Append("</bunks>"); return(str.ToString()); }
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 MatchedPolicy QueryPolicies(PolicyType policyType, string flights, string passengers, DataTransferObject.Order.OrderView orderView) { PassengerType passengerType = PassengerType.Adult; var policyFilterCondition = new PolicyFilterConditions { PolicyType = policyType, Purchaser = Company.CompanyId }; IEnumerable <VoyageFilterInfo> voyages = getVoyageFilterInfos(flights, passengers); // 特殊票时,只取航班查询处选择的价格 if (policyType == PolicyType.Special) { PolicyView policyView = null; var flightFlight = voyages.FirstOrDefault(); if (flightFlight != null && flightFlight.Bunk == null) { policyFilterCondition.PatPrice = orderView.PATPrice != null ? orderView.PATPrice.Fare : (decimal?)null; } else if (policyView != null && flightFlight != null && flightFlight.Bunk == null) { policyFilterCondition.PublishFare = policyView.PublishFare; } } else { policyFilterCondition.PatPrice = orderView.PATPrice != null ? orderView.PATPrice.Fare : (decimal?)null; } policyFilterCondition.Voyages.AddRange(voyages); policyFilterCondition.VoyageType = VoyageType.OneWay; policyFilterCondition.SuitReduce = hasReduce(voyages, orderView.PATPrice != null ? orderView.PATPrice.Fare : (decimal?)null); policyFilterCondition.NeedSubsidize = true; policyFilterCondition.IsUsePatPrice = false; policyFilterCondition.AllowTicketType = FilterByTime(voyages.Min(f => f.Flight.TakeOffTime)); policyFilterCondition.MaxdRebate = 0; IEnumerable <MatchedPolicy> matchedPolicies = PolicyMatchServcie.MatchBunk(policyFilterCondition, false, passengerType, 1).ToList(); if (!matchedPolicies.Any() || matchedPolicies.FirstOrDefault() == null) { InterfaceInvokeException.ThrowNotFindPolicyException(); } return(matchedPolicies.FirstOrDefault()); }
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)); }
protected override string ExecuteCore() { var pnrContext = Context.GetParameterValue("pnrContent"); var patContext = Context.GetParameterValue("patContent"); ValidateBusinessParameters(HttpUtility.UrlDecode(pnrContext), HttpUtility.UrlDecode(patContext)); 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(); } StringBuilder str = new StringBuilder(); str.Append("<policies>"); ReturnStringUtility.GetPolicy(matchedPolicies, matchedSpeciafPolicies, str, _policyType, _flights, InterfaceSetting); str.Append("</policies>"); //将匹配出来的政策存入缓存中 CustomContext context = CustomContext.NewContext(); context[_pnr.PnrPair.BPNR + _pnr.PnrPair.PNR] = matchedPolicies; ContextCenter.Instance.Save(context); str.AppendFormat("<batchNo>{0}</batchNo>", context.Id + "0"); return(str.ToString()); }
protected override string ExecuteCore() { var airlineCode = Context.GetParameterValue("airlineCode"); var flightNo = Context.GetParameterValue("flightNo"); var flightDate = Context.GetParameterValue("flightDate"); //验证 Vaild(airlineCode, flightNo, flightDate); var AVHInfo = CommandService.GetTransitPoints(airlineCode + flightNo, DateTime.Parse(flightDate), Guid.Empty); if (AVHInfo.Success && AVHInfo.Result.First() != null) { var transitPoint = AVHInfo.Result.First(); var arriveTime = ParseTime(flightDate, transitPoint.ArrivalTime, transitPoint.ArrivalAddDays); var departureTime = ParseTime(flightDate, transitPoint.DepartureTime, transitPoint.DepartureAddDays); if (arriveTime == DateTime.MinValue || departureTime == DateTime.MinValue) { return(""); } StringBuilder str = new StringBuilder(); str.Append("<transits>"); str.AppendFormat("<city>{0}</city>", Service.FoundationService.QueryCityNameByAirportCode(transitPoint.AirportCode)); str.AppendFormat("<code>{0}</code>", transitPoint.AirportCode); str.AppendFormat("<name>{0}</name>", Service.FoundationService.QueryAirportName(transitPoint.AirportCode)); str.AppendFormat("<landingTime>{0}</landingTime>", transitPoint.ArrivalTime.Hour + ":" + transitPoint.ArrivalTime.Minute); str.AppendFormat("<takeoffTime>{0}</takeoffTime>", transitPoint.DepartureTime.Hour + ":" + transitPoint.DepartureTime.Minute); str.AppendFormat("<landingInterval>{0}</landingInterval>", transitPoint.ArrivalAddDays); str.AppendFormat("<takeoffInterval>{0}</takeoffInterval>", transitPoint.DepartureAddDays); str.Append("</transits>"); return(str.ToString()); } else { InterfaceInvokeException.ThrowCustomMsgException("没有查询到经停信息"); } return(""); }
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 override string ExecuteCore() { var orderId = Context.GetParameterValue("id"); var payType = Context.GetParameterValue("payType"); var orderType = Context.GetParameterValue("businessType"); if (string.IsNullOrWhiteSpace(orderId)) { InterfaceInvokeException.ThrowParameterMissException("id"); } if (string.IsNullOrWhiteSpace(payType) || (payType != "0" && payType != "1")) { InterfaceInvokeException.ThrowParameterMissException("payType"); } if (string.IsNullOrWhiteSpace(orderType) || (orderType != "0" && orderType != "1")) { InterfaceInvokeException.ThrowParameterMissException("businessType"); } decimal oid; string msg = ""; if (decimal.TryParse(orderId, out oid)) { decimal amount = 0M; if (orderType == "0") { OrderProcessService.Payable(oid, out msg); if (!string.IsNullOrEmpty(msg)) { InterfaceInvokeException.ThrowCustomMsgException(msg); } var orderInfo = OrderQueryService.QueryOrder(oid); if (orderInfo.Purchaser.CompanyId != Company.CompanyId) { InterfaceInvokeException.ThrowCustomMsgException("暂无此订单"); } amount = orderInfo.Purchaser.Amount; } else if (orderType == "1") { ApplyformProcessService.Payable(oid, out msg); if (!string.IsNullOrEmpty(msg)) { InterfaceInvokeException.ThrowCustomMsgException(msg); } var orderInfo = ApplyformQueryService.QueryPostponeApplyform(oid); if (orderInfo.Purchaser.CompanyId != Company.CompanyId) { InterfaceInvokeException.ThrowCustomMsgException("暂无此订单"); } amount = orderInfo.PayBill.Applier.Amount; } if (AutoPayService.QueryAuto(oid) != null) { InterfaceInvokeException.ThrowCustomMsgException("存在重复的代扣记录"); } var auto = AccountService.GetWithholding((WithholdingAccountType)byte.Parse(payType), Employee.Owner); if (auto == null || auto.Status == WithholdingProtocolStatus.Submitted) { InterfaceInvokeException.ThrowCustomMsgException("该账户还没有进行代扣设置,请先登录平台进行设置!"); } if (payType == "0" && amount > auto.Amount) { InterfaceInvokeException.ThrowCustomMsgException("订单[ " + orderId + " ] 需要支付的金额超过的代扣金额上限!"); } AutoPayService.InsertAutoPay(new ChinaPay.B3B.Service.Order.Domain.AutoPay.AutoPay() { PayAccountNo = auto.AccountNo, PayType = (WithholdingAccountType)byte.Parse(payType), OrderId = oid, OrderType = (OrderType)byte.Parse(orderType), ProcessState = false, Success = false, Time = DateTime.Now }); } else { InterfaceInvokeException.ThrowParameterMissException("orderId"); } return(""); }
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 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); }
private decimal ApplyPostponeOrder(ChinaPay.B3B.Service.Order.Domain.Order order, string passengers, string reason, string voyages) { string pid = ""; 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("当前订单中存在不同的编码"); } break; } } } if (pid == "") { InterfaceInvokeException.ThrowCustomMsgException("当前订单中没有找到对应的乘机人信息"); } if (!_pnrCode.Any()) { InterfaceInvokeException.ThrowCustomMsgException("当前订单中没有找到对应的编码信息"); } var ids = ApplyOrder.getPassengers(pid); var applyformView = new PostponeApplyformView() { PNR = _pnrCode.FirstOrDefault(), Passengers = ids, Reason = reason }; var flightChangeLimit = SystemDictionaryService.Query(SystemDictionaryType.FlightChangeLimit); var limit = LimitItem.Parse(flightChangeLimit); foreach (var item in getPostponeVoyages(voyages, order)) { bool isTodayFlight = DateTime.Today == item.NewFlightDate.Date; foreach (LimitItem l in limit) { if (order.PNRInfos.First().Flights.First().Carrier.Code != l.Carrair.ToUpper()) { continue; } if (item.NewFlightDate >= l.LimitFrom && item.NewFlightDate <= l.LimitTo && (!isTodayFlight || !l.ToTodayEnable)) { var aline = FoundationService.Airlines.FirstOrDefault(p => p.Code.Value == l.Carrair); InterfaceInvokeException.ThrowCustomMsgException("由于[" + aline.ShortName + "]原因,该客票已被航空公司限制改期,无法改期,请让乘机人自行致电航空公司或到航空公司直营柜台办理改期"); } } applyformView.AddItem(item); } string lockErrorMsg = ""; Lock(order.Id, Service.Locker.LockRole.Purchaser, "申请退改签", out lockErrorMsg); if (!string.IsNullOrEmpty(lockErrorMsg)) { InterfaceInvokeException.ThrowCustomMsgException(lockErrorMsg); } var apply = Service.OrderProcessService.Apply(order.Id, applyformView, Employee, Guid.Empty); releaseLock(order.Id); 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(); } } }