Beispiel #1
0
        private List <IShippingRate> RatePackages(List <DomesticPackage> packages)
        {
            var rates = new List <IShippingRate>();

            var req = new DomesticRequest();

            if (!string.IsNullOrWhiteSpace(GlobalSettings.UserId))
            {
                req.UserId = GlobalSettings.UserId;
            }
            req.Packages = packages;

            var svc = new DomesticService();
            var res = svc.ProcessRequest(req);

            if (GlobalSettings.DiagnosticsMode)
            {
                _Logger.LogMessage("US Postal Request: " + svc.LastRequest);
                _Logger.LogMessage("US Postal Response: " + svc.LastResponse);
            }

            var hasErrors = res.Errors.Count > 0;

            foreach (var possibleResponse in DomesticPackageServiceResponse.FindAll())
            {
                var AllPackagesRated = true;
                var totalRate        = 0m;

                foreach (var p in res.Packages)
                {
                    var found =
                        p.Postages.FirstOrDefault(y => y.MailServiceClassId == possibleResponse.XmlClassId);
                    if (found == null)
                    {
                        AllPackagesRated = false;
                        break;
                    }

                    totalRate += found.Rate;
                }

                if (AllPackagesRated && totalRate > 0)
                {
                    // Rate is good to go for all packages
                    rates.Add(new ShippingRate
                    {
                        EstimatedCost = totalRate,
                        ServiceId     = Id,
                        ServiceCodes  = (int)possibleResponse.ServiceType + "-" + possibleResponse.XmlClassId,
                        DisplayName   = "USPS:" + possibleResponse.XmlName
                    });
                }
            }

            return(rates);
        }
        private List <IShippingRate> RatePackages(List <DomesticPackage> packages)
        {
            List <IShippingRate> rates = new List <IShippingRate>();

            DomesticRequest req = new DomesticRequest();

            req.Packages = packages;

            DomesticService  svc = new DomesticService();
            DomesticResponse res = svc.ProcessRequest(req);


            if (this.GlobalSettings.DiagnosticsMode)
            {
                _Logger.LogMessage("US Postal Request: " + svc.LastRequest);
                _Logger.LogMessage("US Postal Response: " + svc.LastResponse);
            }

            bool hasErrors = (res.Errors.Count > 0);

            foreach (DomesticPackageServiceResponse possibleResponse in DomesticPackageServiceResponse.FindAll())
            {
                bool    AllPackagesRated = true;
                decimal totalRate        = 0m;

                foreach (DomesticPackage p in res.Packages)
                {
                    DomesticPostage found = p.Postages.Where(y => y.MailServiceClassId == possibleResponse.XmlClassId).FirstOrDefault();
                    if (found == null)
                    {
                        AllPackagesRated = false;
                        break;
                    }

                    totalRate += found.Rate;
                }

                if (AllPackagesRated && totalRate > 0)
                {
                    // Rate is good to go for all packages
                    rates.Add(new ShippingRate()
                    {
                        EstimatedCost = totalRate, ServiceId = this.Id, ServiceCodes = ((int)possibleResponse.ServiceType).ToString(),
                        DisplayName   = "USPS:" + possibleResponse.XmlName
                    });
                }
            }


            return(rates);
        }
Beispiel #3
0
        //匹配扣点
        public List <PolicyCache> DeductionSetting(string code, List <AVHData> avhList, List <PolicyCache> pclist)
        {
            PlatformDeductionParam pfDp = new PlatformDeductionParam();

            foreach (AVHData leg in avhList)
            {
                pfDp.FlyLineList.Add(new FlyLine()
                {
                    CarrayCode   = leg.QueryParam.CarrierCode,
                    FromCityCode = leg.QueryParam.FromCode,
                    ToCityCode   = leg.QueryParam.ToCode
                });
            }
            DomesticService      domesticService  = ObjectFactory.GetInstance <DomesticService>();
            UserRelation         userRealtion     = domesticService.GetUserRealtion(code);
            DeductionGroup       deductionGroup   = userRealtion.deductionGroup;
            List <string>        codeList         = ObjectFactory.GetAllInstances <IPlatform>().Select(p => p.Code).ToList();
            DeductionType        deductionType    = DeductionType.Interface;
            EnumPolicySourceType PolicySourceType = EnumPolicySourceType.Interface;
            //本地运营的下级供应code
            List <string> LocalSupplierCodeList = userRealtion.SupplierList.Where(p => p.CarrierCode == userRealtion.carrier.Code).Select(p => p.Code).ToList();

            for (int i = 0; i < pclist.Count; i++)
            {
                PolicyCache pc = pclist[i];
                if (codeList.Contains(pc.PlatformCode))
                {
                    deductionType    = DeductionType.Interface;
                    PolicySourceType = EnumPolicySourceType.Interface;
                }
                else
                {
                    if (userRealtion.carrier.Code == pc.PlatformCode ||
                        LocalSupplierCodeList.Contains(pc.PlatformCode))
                    {
                        deductionType    = DeductionType.Local;
                        PolicySourceType = EnumPolicySourceType.Local;
                    }
                    else
                    {
                        deductionType    = DeductionType.Share;
                        PolicySourceType = EnumPolicySourceType.Share;
                    }
                }
                pc.Point = domesticService.MatchDeductionRole(PolicyCacheToPolicy(pc, PolicySourceType), pfDp, pc.CarrierCode, deductionGroup, userRealtion, deductionType);
            }
            return(pclist);
        }
Beispiel #4
0
        public void Process(HttpRequest request, HttpResponse writer)
        {
            System.Threading.Thread.Sleep(2000);
            //日志
            StringBuilder sbLog = new StringBuilder();

            try
            {
                sbLog.Append("请求参数:\r\n");
                NameValueCollection nv = new NameValueCollection();
                nv.Add(request.Form);
                nv.Add(request.QueryString);
                foreach (string key in nv.Keys)
                {
                    sbLog.Append(key + "=" + nv[key] + "\r\n");
                }
                sbLog.Append("处理结果:");

                bool          rs = false;
                string        PayWayDiscription = "";
                EnumPayMethod?payMethod         = null;
                string        payWay            = request.QueryString["payWay"];   // 充值方式
                string        bankCode          = request.QueryString["bankCode"]; // 银行Code
                string        orderId           = request.QueryString["orderId"];  //订单编号
                string        payNo             = request.QueryString["payNo"];    //交易号
                string        price             = request.QueryString["price"];    //交易金额
                string        currentTime       = request.QueryString["currentTime"];
                string        isRefund          = request.QueryString["isRefund"]; //退款标志(0=支付1=退款)
                string        signature         = request.QueryString["signature"];
                string        remark            = request.QueryString["remark"];
                if (isRefund == "1" && remark.Contains("SaleOrderRefund_"))
                {
                    /*退票单ID:SaleOrderRefund_xx
                     * 退款单ID:orderID
                     * price:退款金额
                     */
                    int saleorderid = remark.Split('_')[1].ToInt();
                    if (SaleOrderRefund(saleorderid, price, orderId))
                    {
                        writer.WriteLine("success");
                    }
                    return;
                }
                List <string> list = new List <string>();
                list.Add(string.Format("payWay={0}", payWay));
                list.Add(string.Format("bankCode={0}", bankCode));
                list.Add(string.Format("orderId={0}", orderId));
                list.Add(string.Format("payNo={0}", payNo));
                list.Add(string.Format("price={0}", price));
                list.Add(string.Format("currentTime={0}", currentTime));
                list.Add(string.Format("isRefund={0}", isRefund));
                list.Add(string.Format("remark={0}", remark.UrlEncode()));
                var    newlist = list.OrderByDescending(p => p);
                string data    = string.Join("&", newlist);
                string sign    = data.Md5();
                // AliPay = 20,ChinaPnrPay = 21,TenPay = 22,BillPay = 23
                switch (payWay.ToLower())
                {
                case "alipay":
                    payMethod         = EnumPayMethod.AliPay;
                    PayWayDiscription = "支付宝";
                    break;

                //case "ChinaPnrPay":
                //    payWay = 3;
                //    PayWayDiscription = "汇付";
                //    break;
                case "tenpay":
                    payMethod         = EnumPayMethod.TenPay;
                    PayWayDiscription = "财付通";
                    break;

                //case "BillPay":
                //    payWay = 2;
                //    PayWayDiscription = "快钱";
                //    break;
                case "internetbank":
                    payMethod         = EnumPayMethod.Bank;
                    PayWayDiscription = "银行卡";
                    payWay            = bankCode;
                    break;
                }
                if (sign == signature)
                {
                    var order = orderRepository.FindAll(p => p.OrderId == orderId).FirstOrDefault();
                    if (isRefund == "1")//退款
                    {
                        //退款中的状态 修改成 退款结束
                        if (order.OrderStatus == EnumOrderStatus.RepelIssueRefunding || order.OrderStatus == EnumOrderStatus.WaitReimburseWithRepelIssue)
                        {
                            //修改为拒绝出票,订单完成
                            order.ChangeStatus(EnumOrderStatus.RepelIssueAndCompleted);
                            order.WriteLog(new OrderLog()
                            {
                                OperationContent  = "日志来源:通知,订单状态:" + order.OrderStatus.ToEnumDesc() + " 退款交易号:" + payNo + ",退款状态:退款完成,退款方式:" + PayWayDiscription,
                                OperationDatetime = System.DateTime.Now,
                                OperationPerson   = remark,
                                IsShowLog         = true
                            });
                            unitOfWorkRepository.PersistUpdateOf(order);
                            unitOfWork.Commit();
                            sbLog.Append("退款处理\r\n");
                        }
                    }
                    else if (isRefund == "0")//支付
                    {
                        if (order.OrderPay.PayStatus == EnumPayStatus.NoPay &&
                            (order.OrderStatus == EnumOrderStatus.NewOrder || order.OrderStatus == EnumOrderStatus.PaymentInWaiting)
                            )
                        {
                            if (payMethod.HasValue)
                            {
                                order.OrderPay.PayMethod = payMethod.Value;
                            }
                            //订单支付通知
                            order.PayToPaid(remark, order.OrderPay.PayMethod, payWay, payNo, "通知");
                            unitOfWorkRepository.PersistUpdateOf(order);
                            unitOfWork.Commit();
                            //生成接口订单和代付
                            DomesticService domesticService = ObjectFactory.GetInstance <DomesticService>();
                            //支付宝通知回来自动出票
                            if (order.Policy.PolicySourceType != EnumPolicySourceType.Interface)
                            {
                                if (order.OrderPay.PayMethod != null && (order.OrderPay.PayMethod == EnumPayMethod.Bank || order.OrderPay.PayMethod == EnumPayMethod.Platform))
                                {
                                    domesticService.AutoIssue(order.OrderId, order.OrderPay.PayMethod.ToEnumDesc() + "支付", () =>
                                    {
                                        try
                                        {
                                            MessageQueueManager.SendMessage(orderId, 0);
                                        }
                                        catch (Exception e)
                                        {
                                            Logger.WriteLog(LogType.ERROR, string.Format("{0}:写入总表失败", order.OrderId), e);
                                        }
                                    });
                                }
                            }

                            domesticService.CreatePlatformOrderAndPaid(order.OrderId, "系统", "支付通知");
                        }
                        else if (order.OrderPay.PayStatus == EnumPayStatus.NoPay && order.OrderStatus == EnumOrderStatus.OrderCanceled)
                        {
                            order.OrderPay.PayStatus       = EnumPayStatus.OK;
                            order.OrderPay.PaySerialNumber = payNo;
                            order.OrderPay.PayDateTime     = DateTime.Now;
                            order.OrderStatus = EnumOrderStatus.RepelIssueAndCompleted;
                            order.WriteLog(new OrderLog
                            {
                                IsShowLog         = true,
                                OperationContent  = "该订单已过支付时间,退回支付金额",
                                OperationDatetime = DateTime.Now,
                                OperationPerson   = "系统"
                            });
                            unitOfWorkRepository.PersistUpdateOf(order);
                            unitOfWork.Commit();
                            MessageQueueManager.SendMessage(order.OrderId, 2);
                            AutoRefund(order);
                        }
                        sbLog.Append("支付处理\r\n");
                    }
                    else
                    {
                        sbLog.Append("未处理\r\n");
                    }
                    writer.WriteLine("success");
                }
                else
                {
                    sbLog.Append("签名验证失败\r\n");
                }
            }
            catch (Exception ex)
            {
                sbLog.Append(ex.Message + "\r\n");
            }
            finally
            {
                //日志
                WriteLog(sbLog.ToString(), request != null ? request.Url.ToString() : "异常");
            }
        }
        public override object Execute()
        {
            //记录时间
            StringBuilder sbLog = new StringBuilder();
            Stopwatch     watch = new Stopwatch();

            try
            {
                watch.Start();
                string    platformCode = getParame("platformCode").ToString();
                string    policyId     = getParame("policyId").ToString();
                string    operatorName = getParame("operatorName").ToString();
                string    source       = getParame("source").ToString();
                PolicyDto policyUI     = source != "back" ? (getParame("policy") as PolicyDto) : null;

                decimal TotlePaidPirce = 0m;
                OldOutOrderId = order.OutOrderId;
                string          innerPlatformCode = "系统";
                DataBill        databill          = new DataBill();
                DomesticService domesticService   = ObjectFactory.GetInstance <DomesticService>();
                UserRelation    userRealtion      = domesticService.GetUserRealtion(order.BusinessmanCode);
                bool            IspolicyIsNull    = false;

                if (policyUI != null)
                {
                    //赋值
                    order.Policy = PolicyDtoPolicy(policyUI, order.Policy, source);
                }
                else
                {
                    #region 原获取政策
                    PolicyParam policyParam = new PolicyParam();
                    policyParam.code              = order.BusinessmanCode;
                    policyParam.PnrContent        = order.PnrContent;
                    policyParam.OrderId           = order.OrderId;
                    policyParam.OrderType         = order.OrderType;
                    policyParam.OrderSource       = order.OrderSource;
                    policyParam.IsChangePnrTicket = order.IsChangePnrTicket;
                    policyParam.IsDestine         = order.OrderSource == EnumOrderSource.WhiteScreenDestine ? true : false;
                    Passenger pasData = order.Passengers.Where(p => p.PassengerType != EnumPassengerType.Baby).FirstOrDefault();
                    if (pasData != null)
                    {
                        policyParam.defFare   = pasData.SeatPrice.ToString();
                        policyParam.defTAX    = pasData.ABFee.ToString();
                        policyParam.defRQFare = pasData.RQFee.ToString();
                    }
                    if (order.Policy == null)
                    {
                        IspolicyIsNull = true;
                        order.Policy   = new Policy();
                    }
                    Policy         localPolicy   = null;
                    PlatformPolicy policy        = null;
                    PlatformOrder  platformOrder = null;
                    PolicyService  policyService = ObjectFactory.GetInstance <PolicyService>();
                    watch.Stop();
                    sbLog.AppendFormat("初始话变量时间:{0}\r\n", watch.Elapsed.ToString());
                    watch.Restart();

                    if (platformCode != innerPlatformCode)
                    {
                        PnrData pnrData = PnrHelper.GetPnrData(order.PnrContent);
                        policy = PlatformFactory.GetPlatformByCode(platformCode).GetPoliciesByPnrContent(order.PnrContent, order.IsLowPrice, pnrData).Find((p) => p.Id == policyId);
                        watch.Stop();
                        sbLog.AppendFormat("0.调用方法【GetPlatformByCode】用时:{0}\r\n", watch.Elapsed.ToString());
                        watch.Restart();

                        if (policy == null)
                        {
                            localPolicy = GetLocalPolicy(policyParam, policyId, innerPlatformCode, userRealtion, IspolicyIsNull, policyService, localPolicy);
                            watch.Stop();
                            sbLog.AppendFormat("1.调用方法【GetLocalPolicy】用时:{0}\r\n", watch.Elapsed.ToString());
                            watch.Restart();
                            if (localPolicy != null)
                            {
                                order.Policy = localPolicy;
                            }
                            else
                            {
                                throw new OrderCommException("政策发生变动,请重新获取政策!!!");
                            }
                        }
                        else
                        {
                            SetInterface(platformCode, operatorName, source, ref TotlePaidPirce, policy, userRealtion, ref platformOrder, pnrData);
                            watch.Stop();
                            sbLog.AppendFormat("2.调用方法【SetInterface】用时:{0}\r\n", watch.Elapsed.ToString());
                            watch.Restart();
                        }
                    }
                    else
                    {
                        localPolicy = GetLocalPolicy(policyParam, policyId, innerPlatformCode, userRealtion, IspolicyIsNull, policyService, localPolicy);
                        watch.Stop();
                        sbLog.AppendFormat("3.调用方法【GetLocalPolicy】用时:{0}\r\n", watch.Elapsed.ToString());
                        watch.Restart();
                        if (localPolicy == null)
                        {
                            PnrData pnrData = PnrHelper.GetPnrData(order.PnrContent);
                            localPolicy = policyService.GetInterfacePolicy(policyParam, "", userRealtion, pnrData).Find((p) => p.PolicyId == policyId);
                            watch.Stop();
                            sbLog.AppendFormat("4.调用方法【GetInterfacePolicy】用时:{0}\r\n", watch.Elapsed.ToString());
                            watch.Restart();
                            if (localPolicy != null)
                            {
                                policy.AreaCity    = localPolicy.AreaCity;
                                policy.Id          = localPolicy.PolicyId;
                                policy.PolicyPoint = localPolicy.PolicyPoint;
                                if (source != "back")
                                {
                                    policy.PolicyPoint = localPolicy.PaidPoint;
                                }
                                policy.ReturnMoney      = localPolicy.ReturnMoney;
                                policy.IsLow            = localPolicy.IsLow;
                                policy.SeatPrice        = localPolicy.SeatPrice;
                                policy.ABFee            = localPolicy.ABFee;
                                policy.RQFee            = localPolicy.RQFee;
                                policy.Remark           = localPolicy.Remark;
                                policy.IsChangePNRCP    = localPolicy.IsChangePNRCP;
                                policy.IsSp             = localPolicy.IsSp;
                                policy.PolicyType       = localPolicy.PolicyType;
                                policy.WorkTime         = localPolicy.WorkTime;
                                policy.ReturnTicketTime = localPolicy.ReturnTicketTime;
                                policy.AnnulTicketTime  = localPolicy.AnnulTicketTime;
                                policy.CPOffice         = localPolicy.CPOffice;
                                policy.IssueSpeed       = localPolicy.IssueSpeed;
                                TotlePaidPirce          = platformOrder.TotlePaidPirce;

                                SetInterface(platformCode, operatorName, source, ref TotlePaidPirce, policy, userRealtion, ref platformOrder, pnrData);
                                watch.Stop();
                                sbLog.AppendFormat("5.调用方法【GetInterfacePolicy】用时:{0}\r\n", watch.Elapsed.ToString());
                                watch.Restart();
                            }
                            else
                            {
                                if (localPolicy == null)
                                {
                                    throw new OrderCommException("政策发生变动,请重新获取政策!");
                                }
                            }
                        }
                        else
                        {
                            //赋值
                            order.Policy = localPolicy;
                        }
                    }
                    #endregion
                }


                decimal _OrderMoney = 0m;
                if (source != "back")
                {
                    //扣点组类型
                    DeductionType deductionType = order.Policy.PolicySourceType == EnumPolicySourceType.Local ? DeductionType.Local : (order.Policy.PolicySourceType == EnumPolicySourceType.Share ? DeductionType.Share : DeductionType.Interface);
                    if (policyUI != null)
                    {
                        order.Policy.PolicyPoint = order.Policy.PaidPoint;
                    }
                    PlatformDeductionParam pfDp = new PlatformDeductionParam();
                    foreach (SkyWay leg in order.SkyWays)
                    {
                        pfDp.FlyLineList.Add(new FlyLine()
                        {
                            CarrayCode   = leg.CarrayCode,
                            FromCityCode = leg.FromCityCode,
                            ToCityCode   = leg.ToCityCode
                        });
                    }
                    //匹配扣点规则
                    domesticService.MatchDeductionRole(order.Policy, pfDp, order.SkyWays[0].CarrayCode, userRealtion.deductionGroup, userRealtion, deductionType);
                    watch.Stop();
                    sbLog.AppendFormat("6.调用方法【MatchDeductionRole】用时:{0}\r\n", watch.Elapsed.ToString());
                    watch.Restart();

                    //佣金
                    order.Policy.Commission = databill.GetCommission(order.Policy.PolicyPoint, order.Policy.SeatPrice, order.Policy.ReturnMoney);
                    //单人支付金额 根据选择的政策 设置价格
                    for (int i = 0; i < order.Passengers.Count; i++)
                    {
                        Passenger p = order.Passengers[i];
                        if (p.PassengerType != EnumPassengerType.Baby)
                        {
                            p.SeatPrice = order.Policy.SeatPrice;
                            p.ABFee     = order.Policy.ABFee;
                            p.RQFee     = order.Policy.RQFee;
                            p.PayMoney  = databill.GetPayPrice(order.Policy.SeatPrice, order.Policy.ABFee, order.Policy.RQFee, order.Policy.PolicyPoint, order.Policy.ReturnMoney);
                        }
                        else
                        {
                            p.PayMoney = databill.GetPayPrice(p.SeatPrice, p.ABFee, p.RQFee, 0, 0);
                        }
                    }
                    _OrderMoney = order.Passengers.Sum(p => p.PayMoney);
                    order.OrderCommissionTotalMoney = order.Passengers.Sum(p => p.PassengerType != EnumPassengerType.Baby ? databill.GetCommission(order.Policy.PolicyPoint, order.Policy.SeatPrice, order.Policy.ReturnMoney) : 0);
                }

                #region 支付信息
                if (order.OrderPay == null)
                {
                    order.OrderPay = new OrderPay();
                }

                order.OrderPay.OrderId   = order.OrderId;
                order.OrderPay.PaidMoney = TotlePaidPirce;
                if (source != "back")
                {
                    order.OrderPay.PayMoney  = _OrderMoney;
                    order.OrderMoney         = _OrderMoney;
                    order.OrderPay.PayStatus = EnumPayStatus.NoPay;
                }
                order.OrderPay.PaidStatus    = EnumPaidStatus.NoPaid;
                order.OrderPay.TradePoundage = 0m;
                order.OrderPay.SystemFee     = 0m;
                order.CpOffice = order.Policy.CPOffice;
                #endregion


                #region 根据政策扣点明细计算支付分润
                if (source != "back")
                {
                    domesticService.CreateBillDetails(order, userRealtion);
                    watch.Stop();
                    sbLog.AppendFormat("7.调用方法【CreateBillDetails】用时:{0}\r\n", watch.Elapsed.ToString());
                }
                #endregion
                order.WriteLog(new OrderLog()
                {
                    OperationContent  = string.Format("{0}选择政策,政策:{1},编号:{2},订单号:{3},出票速度:{4}", source, order.Policy.PolicyPoint, order.Policy.PolicyId, order.OrderId, order.Policy.IssueSpeed),
                    OperationDatetime = DateTime.Now,
                    OperationPerson   = operatorName,
                    IsShowLog         = false
                });

                order.WriteLog(new OrderLog()
                {
                    OperationContent  = string.Format("选择政策,订单号:{0},出票速度:{1}", order.OrderId, order.Policy.IssueSpeed),
                    OperationDatetime = DateTime.Now,
                    OperationPerson   = operatorName,
                    IsShowLog         = true
                });

                if (source == "back")
                {
                    //order.ChangeStatus(EnumOrderStatus.WaitAndPaid);
                    order.ChangeStatus(EnumOrderStatus.PayWaitCreatePlatformOrder);
                }
                else
                {
                    order.ChangeStatus(EnumOrderStatus.NewOrder);
                }
            }
            finally
            {
                if (sbLog.ToString() != "")
                {
                    new CommLog().WriteLog("NewSelectPolicyBehavior", sbLog.ToString());
                }
            }
            if (order.Policy.PolicySourceType == EnumPolicySourceType.Interface)
            {
                order.Policy.Code        = string.Empty;
                order.Policy.Name        = string.Empty;
                order.Policy.CashbagCode = string.Empty;
            }
            return(null);
        }
Beispiel #6
0
        public void PayToPaid(string operatorName, EnumPayMethod?payMethod, string PayMethodCode, string serialNumber, string isNotify)
        {
            DomesticService domesticService = ObjectFactory.GetInstance <DomesticService>();

            //支付成功后,修改日志。改变状态,进行代付
            this.OrderPay.PayDateTime     = DateTime.Now;
            this.OrderPay.PaySerialNumber = serialNumber;
            this.OrderPay.PayMethod       = payMethod.Value;
            this.OrderPay.PayMethodCode   = PayMethodCode;
            this.OrderPay.PayStatus       = EnumPayStatus.OK;
            this.ChangeStatus(EnumOrderStatus.PayWaitCreatePlatformOrder);
            //this.ChangeStatus(EnumOrderStatus.WaitAndPaid);
            //domesticService.SetInsuranceStatus(this.OrderId, EnumInsuranceStatus.PayOK);//设置保险单状态
            this.WriteLog(new OrderLog()
            {
                OperationPerson   = operatorName,
                OperationDatetime = DateTime.Now,
                OperationContent  = "支付方式:" + payMethod.ToEnumDesc() + ",支付成功",
                IsShowLog         = true
            });
            StringBuilder sbLog = new StringBuilder();

            try
            {
                sbLog.AppendFormat("支付到代付 时间:{0} OrderId={1} serialNumber={2} isNotify={3} 支付方式:{4} operatorName={5}\r\n",
                                   System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), this.OrderId, serialNumber, isNotify, payMethod.ToEnumDesc(), operatorName);
                //设置其他相同PNR订单无效
                domesticService.SetOrderStatusInvalid(operatorName, this.PnrCode, this.OrderId);
                #region 代付
                //接口的单子进行代付
                if (this.Policy.PolicySourceType == EnumPolicySourceType.Interface)
                {
                    //没有支付成功也没有代付成功 再调用代付接口
                    //if (this.OrderPay.PayStatus == EnumPayStatus.OK
                    //    && this.OrderPay.PaidStatus == EnumPaidStatus.NoPaid)
                    //{
                    //    //调用代付
                    //    var behavior = this.State.GetBehaviorByCode("PaidOrder");
                    //    behavior.SetParame("areaCity", this.Policy.AreaCity);
                    //    behavior.SetParame("PlatformCode", this.Policy.PlatformCode);
                    //    behavior.SetParame("operatorName", operatorName);
                    //    behavior.SetParame("isNotify", isNotify);
                    //    behavior.Execute();
                    //}
                }
                else
                {
                    //修改为已支付 等待出票
                    this.ChangeStatus(EnumOrderStatus.WaitIssue);
                    BPiaoBao.Common.WebMessageManager.GetInstance().Send(EnumMessageCommand.PayWaitIssueTicket, this.Policy.Code, string.Format("订单{0}已支付完成,请及时出票", this.OrderId));
                }
                #endregion
            }
            catch (Exception ex)
            {
                sbLog.Append(" 异常信息=" + ex.Message + "\r\n");
            }
            finally
            {
                Logger.WriteLog(LogType.INFO, sbLog.ToString());
            }
        }