protected override string ExecuteCore() {//待确定 decimal id = 0M; if (decimal.TryParse(_id, out id)) { var orderInfo = OrderQueryService.QueryOrder(id); if (orderInfo == null) { throw new InterfaceInvokeException("9", "暂无此订单"); } if (orderInfo.Bill == null) { throw new InterfaceInvokeException("9", "暂无账单信息"); } if (orderInfo.Purchaser.CompanyId != Company.CompanyId) { throw new InterfaceInvokeException("9", "暂无此订单"); } return(GetOrder(orderInfo)); } else { throw new InterfaceInvokeException("1", "订单号"); } }
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(""); }
void initLazyLoaders() { _operationLoader = new EnumerableLazyLoader <Log.Domain.OrderLog>(() => LogService.QueryApplyformLog(this.Id)); _coordinationLoader = new EnumerableLazyLoader <Coordination>(() => CoordinationService.QueryApplyformCoordinations(this.Id)); _orderLoader = new LazyLoader <Order>(() => OrderQueryService.QueryOrder(this.OrderId)); _purchaserLoader = new LazyLoader <DataTransferObject.Organization.CompanyInfo>(() => Organization.CompanyService.GetCompanyDetail(this.PurchaserId)); _providerLoader = new LazyLoader <DataTransferObject.Organization.CompanyInfo>(() => Organization.CompanyService.GetCompanyDetail(this.ProviderId)); _OemInfoLoader = new LazyLoader <OEMInfo>(() => OEMService.QueryOEMById(OEMID.Value)); }
private void LoadOrderInfoHis(decimal orderId) { var orderInfo = OrderQueryService.QueryOrder(orderId); if (orderInfo == null) { ShowMessage("订单不存在!"); return; } this.lblOrderId.Text = orderId.ToString(); applyFormList.DataSource = orderInfo.FinishedApplyforms; applyFormList.DataBind(); }
/// <summary> /// 支付订单 /// 在线方式支付 /// </summary> /// <param name="orderId">订单号</param> /// <param name="bankInfo">银行信息</param> /// <param name="clientIP">客户端IP</param> /// <param name="operatorAccount">操作员账号</param> public static string OnlinePayOrder(decimal orderId, string bankInfo, string clientIP, string operatorAccount) { var order = OrderQueryService.QueryOrder(orderId); var bankInfoArray = bankInfo.Split('|'); var channelId = int.Parse(bankInfoArray[0]); var bankCode = bankInfoArray[1]; var payAccountNo = getPayAccountNo(order.Purchaser.CompanyId); var payOrderRequest = new PayOrderRequestProcess(orderId, order.Purchaser.Amount, payAccountNo, order.Bill.PayBill.Tradement.PayeeAccount, "支付机票款", order.ReservationPNR == null ? string.Empty : (order.ReservationPNR.PNR ?? order.ReservationPNR.BPNR), TicketOrderPayType + "|" + payAccountNo + "|" + operatorAccount, channelId.ToString(), bankCode); payOrderRequest.Execute(); return(payOrderRequest.PayUrl); }
private void bindOrderLogs(decimal orderId) { var order = OrderQueryService.QueryOrder(orderId); if (order == null) { return; } var orderRole = GetOrderRole(order); var logs = from item in LogService.QueryOrderLog(orderId) where item.IsVisible(orderRole, CurrentCompany.CompanyId) select new { item.Keyword, OperateTime = item.Time.ToString("yyyy-MM-dd<br />HH:mm:ss"), Detail = Detail(item.Content), Operator = getOperator(item), Applyform = item.ApplyformId }; logContent.DataSource = logs; logContent.DataBind(); }
internal static void ProcessTradeRefundemnt(RefundFailedRecord refundInfo) { //if(refundInfo.BusinessType == RefundBusinessType.PayTimeout) { // var order = OrderQueryService.QueryOrder(refundInfo.OrderId); // if(order != null) { // TradeRefund(order, refundInfo.PayTradeNo); // } // return; //} var refundBill = DistributionQueryService.QueryNormalRefundBill(refundInfo.ApplyformId); if (refundBill != null) { var refundResult = TradeRefund(refundBill, refundInfo.BusinessType); if (refundResult != null && refundResult.Success) { DistributionProcessService.NormalRefundSuccess(refundBill, new[] { refundResult }); using (var command = Order.Repository.Factory.CreateCommand()) { command.BeginTransaction(); try { var distributionRepository = Order.Repository.Factory.CreateDistributionRepository(command); distributionRepository.UpdateRefundBillForRefundSuccess(refundBill); command.CommitTransaction(); } catch (Exception ex) { command.RollbackTransaction(); LogService.SaveExceptionLog(ex, "交易退款"); throw; } var order = OrderQueryService.QueryOrder(refundInfo.OrderId); //发取消出票退款成功通知 var notifier = new Order.Notify.OrderNotifier(order); notifier.SendRefundSuccessNotify(); } } } }
protected void Page_Load(object sender, EventArgs e) { RegisterOEMSkins("form.css"); if (!IsPostBack) { setBackButton(); string id = Request.QueryString["id"]; decimal orderId; if (decimal.TryParse(id, out orderId)) { Order order = OrderQueryService.QueryOrder(orderId); if (order != null) { if (order.Status == OrderStatus.Applied || order.Status == OrderStatus.PaidForSupply) { string lockErrorMsg; if (Lock(orderId, LockRole.Supplier, "处理座位", out lockErrorMsg)) { bindOrder(order); setButtons(order); } else { showErrorMessage("锁定订单失败。原因:" + lockErrorMsg); } } else { showErrorMessage("仅待确认座位或待提供座位的订单可做座位处理"); } return; } } showErrorMessage("订单不存在"); } }
private void process() { showMessage("开始下一批处理"); var noPorcess = AutoPayService.QueryNoPorcess(); //var str = Environment.CurrentDirectory; string msg = ""; foreach (var item in noPorcess) { if (!_run) { break; } AccountTradeDTO tradeView = null; //处理订单 if (item.OrderType == OrderType.Order) { OrderProcessService.Payable(item.OrderId, out msg); if (string.IsNullOrEmpty(msg)) { Order order = OrderQueryService.QueryOrder(item.OrderId); tradeView = getPayTradeView(order, getPayAccountNo(item.PayType, order.Purchaser.Amount, order.Purchaser.CompanyId), ""); } } //处理申请单 else if (item.OrderType == OrderType.Postpone) { ApplyformProcessService.Payable(item.OrderId, out msg); if (string.IsNullOrEmpty(msg)) { PostponeApplyform applyform = ApplyformQueryService.QueryPostponeApplyform(item.OrderId); if (applyform.PayBill.Tradement == null) { msg = "申请单:" + item.OrderId + " 不能进行代扣,无支付信息!"; } tradeView = getPayTradeView(applyform, getPayAccountNo(item.PayType, Math.Abs(applyform.PayBill.Applier.Amount), applyform.PurchaserId), ""); } } if (item.PayType == WithholdingAccountType.Alipay) { tradeView.BuyerEmail = item.PayAccountNo; } try { if (string.IsNullOrEmpty(msg)) { global::PoolPay.DomainModel.Trade.PayTrade pay = AutoPayService.AutoPay(tradeView, item.PayType); if (item.PayType == WithholdingAccountType.Poolpay) { //如果是国付通代扣就直接修改订单状态 if (pay != null && pay.Status == global::PoolPay.DataTransferObject.PayStatus.PaySuccess) { NotifyService.PaySuccess(item.OrderId, pay.CustomParameter, pay.Id.ToString(), pay.FillChargeId.ToString(), pay.PayDate.Value, "", (pay.BuyerAccount.Character as global::PoolPay.DomainModel.Accounts.CreditAccount) == null ? "0" : "1", pay.BuyerAccount.AccountNo); } } showMessage("处理成功"); } else { showMessage("处理失败" + Environment.NewLine + "原因:" + msg); } } catch (Exception ex) { showMessage("处理失败" + Environment.NewLine + "原因:" + ex.Message); } AutoPayService.UpdateProcess(item.OrderId); System.Threading.Thread.Sleep(50); } showMessage("当前批次处理结束,共处理 " + noPorcess.Count + " 条"); }
public object CheckRefundCondition(decimal orderId, string passenger, string voyages, int refundType, string pnr, bool DelegageCancelPNR) { var passgners = getPassengers(passenger); var _voyages = getRefundVoyages(voyages); var pnrPair = getPNRPair(pnr); var order = OrderQueryService.QueryOrder(orderId); RefundOrScrapApplyformView applyformView = null; if (refundType == -1) { applyformView = new ScrapApplyformView(); } else { applyformView = new RefundApplyformView(); var view = applyformView as RefundApplyformView; view.RefundType = (RefundType)refundType; applyformView = view; } applyformView.PNR = pnrPair; applyformView.Passengers = passgners; applyformView.Reason = "退票验证"; applyformView.DelegageCancelPNR = DelegageCancelPNR; foreach (var item in getRefundVoyages(voyages)) { applyformView.AddVoyage(item); } OrderProcessService.ApplyValidate(orderId, applyformView, CurrentUser, BasePage.OwnerOEMId); if (order == null) { throw new CustomException("订单不存在!"); } if (!SystemParamService.ValidateRefundCondition) { return(new { PNRCancled = true, TicketUnUse = true, IsNotPrinted = true, IsSameName = true, Successed = true, NeedPlatfromDeal = false, CheckCondition = false }); } var result = OrderProcessService.CheckRefundCondition(order, passgners, _voyages, pnrPair, DelegageCancelPNR, BasePage.OwnerOEMId); if (result.Item5) { return(new { PNRCancled = result.Item1, TicketUnUse = result.Item2, IsNotPrinted = result.Item3, IsSameName = result.Item4, Successed = result.Item1 && result.Item2 && result.Item3 && result.Item4, NeedPlatfromDeal = false, CheckCondition = true }); } Session["NeedPlatformCancelPNR"] = orderId; return(new { PNRCancled = result.Item1, TicketUnUse = false, IsNotPrinted = false, IsSameName = false, Successed = true, NeedPlatfromDeal = true, CheckCondition = true }); }
/// <summary> /// 申请升舱 /// </summary> /// <param name="orderId">订单号</param> /// <param name="pnrCode">编码(小编码|大编码)</param> /// <param name="passengers">乘机人(乘机人id,以','隔开)</param> /// <param name="voyages">航段(航段id|新航班号|新航班日期,以','隔开)</param> /// <param name="originalPNR">原始编码 </param> public object ApplyUpgrade(decimal orderId, string pnrCode, List <PassengerViewEx> passengers, List <FlihgtInfo> voyages, string originalPNR) { try { var pnrPair = originalPNR.Split('|'); if (originalPNR.ToUpper().IndexOf(pnrCode.ToUpper(), StringComparison.Ordinal) > -1) { throw new CustomException("编码与原编码不能相同"); } var flightViews = ImportHelper.AnalysisPNR(pnrCode, HttpContext.Current); if (flightViews.Item2.Count() != passengers.Count) { throw new CustomException("所选乘客与编码中的乘客数量不一致"); } if (flightViews.Item1.Count() != voyages.Count) { throw new CustomException("所选航班与编码中的航班数量不一致"); } var ValidateInfo = passengers.Join(flightViews.Item2, p => p.Name, p => p.Name, (p, q) => 1); if (ValidateInfo.Count() != passengers.Count) { throw new CustomException("编码中的乘客姓名与所选乘客姓名不匹配!"); } var order = OrderQueryService.QueryOrder(orderId); if (order == null) { throw new ArgumentNullException("订单不存在"); } List <Flight> allOrderFlights = new List <Flight>(); foreach (PNRInfo info in order.PNRInfos) { allOrderFlights.AddRange(info.Flights); } var applyformView = new UpgradeApplyformView() { NewPNR = new PNRPair(pnrCode, string.Empty), Passengers = passengers.Select(p => p.PassengerId), PNRSource = OrderSource.CodeImport, PNR = new PNRPair(pnrPair[0], pnrPair[1]) }; foreach (var item in voyages) { var flight = flightViews.Item1.FirstOrDefault(f => f.Departure.Code == item.Departure && f.Arrival.Code == item.Arrival); if (flight == null) { throw new NullReferenceException("所选择的航程与编码提取航程不对应!"); } applyformView.AddItem(new UpgradeApplyformView.Item() { Voyage = item.flightId, Flight = new DataTransferObject.Order.FlightView() { SerialNo = flight.Serial, Airline = flight.AirlineCode, FlightNo = flight.FlightNo, Departure = flight.Departure.Code, Arrival = flight.Arrival.Code, AirCraft = flight.Aircraft, TakeoffTime = flight.Departure.Time, LandingTime = flight.Arrival.Time, YBPrice = flight.YBPrice, Bunk = flight.BunkCode, Type = flight.BunkType == null ? BunkType.Economic : flight.BunkType.Value, Fare = flight.Fare } }); } HttpContext.Current.Session["ApplyformView"] = applyformView; HttpContext.Current.Session["Passengers"] = passengers; HttpContext.Current.Session["ReservedFlights"] = flightViews.Item1; //Service.OrderProcessService.Apply(orderId, applyformView, CurrentUser.UserName); //releaseLock(orderId); return(new { IsSuccess = true, QueryString = string.Format("?source=3&orderId={0}&provider={1}", orderId, order.Provider.CompanyId) }); } catch (Exception ex) { return(new { IsSuccess = false, QueryString = ex.Message }); } }
private void payOrder(decimal orderId) { string source = Request.QueryString["source"]; Order order = OrderQueryService.QueryOrder(orderId); if (order == null) { showErrorMessage("订单 [" + orderId + "] 不存在"); } else { if (order.Source != OrderSource.PlatformOrder) { orderIsImport.Value = "1"; } flights = order.PNRInfos.FirstOrDefault().Flights.ToList(); PNRInfo pnr = order.PNRInfos.First(); ShowTicketPrice.Value = pnr.Flights.First().Bunk is FreeBunk || pnr.Passengers.First().Price.Fare != 0 ? "1" : "0"; // 状态是待申请的,则仅显示订单信息和提示信息 if (order.Status == OrderStatus.Applied) { bindOrder(order, source); divOperations.Visible = false; } else { // 内部机构订单不需要支付 if (order.IsInterior) { Response.Redirect("OrderDetail.aspx?id=" + orderId + "&returnUrl=OrderList.aspx"); } // 其他情况,均要检查是否能支付和状态 string errorMessage; if (OrderProcessService.Payable(orderId, out errorMessage)) { string lockErrorMsg; if (Lock(orderId, LockRole.Purchaser, "订单支付", out lockErrorMsg)) { bindOrder(order, source); bindPayTypes(); } else { showErrorMessage("锁定订单失败。原因:" + lockErrorMsg); } if (!string.IsNullOrEmpty(errorMessage)) { showErrorMessage(errorMessage); } } else { showErrorMessage(errorMessage); } } } }
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(""); }