Example #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="orderMessage">All information for an order</param>
 public void Send(CardNotify orderMessage)
 {
     // This method does not involve in distributed transaction and optimizes performance using Single type
     base.transactionType = MessageQueueTransactionType.Single;
     base.Send(orderMessage);
 }
Example #2
0
        /// <summary>
        /// 将结果返回到数据库
        /// </summary>
        /// <param name="oclass"></param>
        /// <param name="order"></param>
        /// <param name="notifyUrl"></param>
        /// <param name="times"></param>
        /// <param name="callbacktext"></param>
        /// <param name="success">是否执行成功</param>
        /// <param name="status"></param>
        /// <param name="message"></param>
        /// <param name="statusCode"></param>
        /// <param name="statusDesc"></param>
        private static void InsertToDb(byte oclass, object order, string notifyUrl, int times, string callbacktext, bool success, string status, string message, string statusCode, string statusDesc)
        {
            bool isnotifysucc = false;

            switch (oclass)
            {
            case 1:
            {
                #region 网银通知

                var orderInfo = order as OrderBankInfo;
                if (orderInfo != null)
                {
                    if (success && !string.IsNullOrEmpty(callbacktext))
                    {
                        isnotifysucc = Utility.CheckCallBackIsSuccess(orderInfo.version, callbacktext);
                    }

                    var notify = new Model.Order.Bank.BankNotify()
                    {
                        orderid           = orderInfo.orderid,
                        status            = status,
                        message           = message,
                        httpStatusCode    = statusCode,
                        StatusDescription = statusDesc,
                        againNotifyUrl    = notifyUrl,
                        notifystat        = isnotifysucc ? 2 : 4,
                        notifycontext     = callbacktext,
                        notifytime        = DateTime.Now
                    };

                    BLL.Order.Bank.BankNotify.Instance.Insert(notify);

                    if (orderInfo.notifystat != 2)
                    {
                        viviLib.Logging.LogHelper.Write("orderInfo.notifystat fail=>" + orderInfo.orderid);

                        //没有成功将发送到异常队列 多次通知
                        BanknotifyQueue.Send(orderInfo);

                        #region 系统定时补发
                        //var sysAutoReissueNotifyInfo = new SysAutoReissueInfo
                        //{
                        //    OrderType = 1,
                        //    OrderId = orderInfo.orderid,
                        //    InterfaceVersion = orderInfo.version,
                        //    NotifyUrl = notifyUrl
                        //};

                        //var reissue = new SysAutoReissue();

                        ////5s后重试
                        //var timerReissue = new System.Threading.Timer(reissue.Process, sysAutoReissueNotifyInfo, 5000, 0);
                        //sysAutoReissueNotifyInfo.TimerReissue = timerReissue;
                        #endregion
                    }
                }

                #endregion
            }
            break;

            case 2:
            {
                #region 点卡

                var orderInfo = order as OrderCardInfo;
                if (orderInfo != null)
                {
                    if (success)
                    {
                        isnotifysucc = Card.Utility.CheckCallBackIsSuccess(orderInfo.version, callbacktext);
                    }

                    var notify = new Model.Order.Card.CardNotify()
                    {
                        orderid           = orderInfo.orderid,
                        status            = status,
                        message           = message,
                        httpStatusCode    = statusCode,
                        StatusDescription = statusDesc,
                        againNotifyUrl    = notifyUrl,
                        notifystat        = isnotifysucc ? 2 : 4,
                        notifycontext     = callbacktext,
                        notifytime        = DateTime.Now,
                        InterVersion      = orderInfo.version
                    };

                    BLL.Order.Card.CardNotify.Instance.Insert(notify);

                    if (orderInfo.notifystat != 2)
                    {
                        //没有成功将发送到异常队列 多次通知
                        //  CardnotifyQueue.Send(orderInfo);

                        CardnotifyQueueX.Send(notify);

                        #region 系统定时补发
                        //var sysAutoReissueNotifyInfo = new SysAutoReissueInfo
                        //{
                        //    OrderType = 2,
                        //    OrderId = orderInfo.orderid,
                        //    InterfaceVersion = orderInfo.version,
                        //    NotifyUrl = notifyUrl
                        //};

                        //var reissue = new SysAutoReissue();

                        ////5s后重试
                        //var timerReissue = new System.Threading.Timer(reissue.Process, sysAutoReissueNotifyInfo, 5000, 0);
                        //sysAutoReissueNotifyInfo.TimerReissue = timerReissue;
                        #endregion
                    }
                }

                #endregion
            }
            break;

            case 4:
            {
                #region 点卡

                var orderInfo = order as OrderCardTotal;
                if (orderInfo != null)
                {
                    int notifyStatus = 4;

                    if (success)
                    {
                        isnotifysucc = Card.Utility.CheckCallBackIsSuccess(orderInfo.version, callbacktext);

                        if (isnotifysucc)
                        {
                            notifyStatus = 2;
                        }
                    }

                    var notify = new CardNotify()
                    {
                        orderid           = orderInfo.orderid,
                        status            = status,
                        message           = message,
                        httpStatusCode    = statusCode,
                        StatusDescription = statusDesc,
                        againNotifyUrl    = notifyUrl,
                        notifystat        = isnotifysucc ? 2 : 4,
                        notifycontext     = callbacktext,
                        notifytime        = DateTime.Now,
                        InterVersion      = orderInfo.version
                    };

                    BLL.Order.Card.OrderCardTotal.Instance.Notify(orderInfo.orderid, notifyUrl, notifyStatus);

                    if (isnotifysucc == false)
                    {
                        CardnotifyQueueX.Send(notify);

                        //#region 系统定时补发
                        //var sysAutoReissueNotifyInfo = new SysAutoReissueInfo
                        //{
                        //    OrderType = 4,
                        //    OrderId = orderInfo.orderid,
                        //    InterfaceVersion = orderInfo.version,
                        //    NotifyUrl = notifyUrl
                        //};

                        //var reissue = new SysAutoReissue();

                        ////5s后重试
                        //var timerReissue = new System.Threading.Timer(reissue.Process, sysAutoReissueNotifyInfo, 5000, 0);
                        //sysAutoReissueNotifyInfo.TimerReissue = timerReissue;
                        //#endregion
                    }
                    //BLL.Order.Card.CardNotify.Instance.Insert(notify);

                    //if (orderInfo.notifystat != 2)
                    //{
                    //    //没有成功将发送到异常队列 多次通知
                    //    //CardnotifyQueue.Send(orderInfo);
                    //}
                }

                #endregion
            }
            break;
            }
        }