Esempio n. 1
0
 public ApiResult Create(OrderDTO order)
 {
     if (string.IsNullOrEmpty(order.OrgnazitionID))
         order.OrgnazitionID = CurrentOperatorOrgID;
     bll = new OrderService(CurrentOperatorUserID);
     return bll.CreateOrder(order).OrderNo.ToApiResultForObject();
 }
Esempio n. 2
0
        public bool Handle(EventBus.Events.OrderPayCompletedEvent evt)
        {
            try
            {
                if (evt != null && evt.OrderNo != "")
                {
                    XuHos.BLL.OrderService  orderService = new BLL.OrderService("");
                    ConversationRoomService roomService  = new ConversationRoomService();


                    if (evt.OrderType == EnumProductType.ImageText ||
                        evt.OrderType == EnumProductType.video ||
                        evt.OrderType == EnumProductType.Phone ||
                        evt.OrderType == EnumProductType.Consultation)
                    {
                        if (string.IsNullOrEmpty(evt.OrderOutID))
                        {
                            var order = orderService.GetOrder(evt.OrderNo);
                            evt.OrderOutID = order.OrderOutID;
                        }

                        var room = roomService.GetChannelInfo(evt.OrderOutID);

                        if (room != null)
                        {
                            using (XuHos.EventBus.MQChannel mqChannel = new MQChannel())
                            {
                                return(mqChannel.Publish(new EventBus.Events.ChannelCreateEvent()
                                {
                                    ServiceID = room.ServiceID,
                                    ServiceType = room.ServiceType,
                                    ChannelID = room.ChannelID
                                }));
                            }
                        }
                        else
                        {
                            var order = orderService.GetOrder("", evt.OrderOutID);
                            if (order.OrderState == EnumOrderState.Canceled)
                            {
                                return(true);
                            }
                            else
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
            catch (Exception E)
            {
                LogHelper.WriteError(E);
                return(false);
            }

            return(true);
        }
Esempio n. 3
0
        /// <summary>
        /// 微信支付
        /// </summary>
        /// <param name="OrderNo"></param>
        /// <returns></returns>
        public override object GetPaySign(string OrderNo, string SellerID, decimal TotalPrice, EnumPaySignType SignType, string ReturnUrl = "", string OpenId = "")
        {
            BLL.OrderService      orderService = new BLL.OrderService(CurrentOperatorUserID);
            DTO.Platform.OrderDTO order        = orderService.GetOrder(OrderNo);

            if (order != null)
            {
                #region 获取订单说明和描述

                string Subject = "-";
                string Body    = order.OrderType.GetEnumDescript();
                if (order.Details != null && order.Details.Count == 1)
                {
                    Subject = order.Details[0].Subject;
                }
                else if (order.Details != null)
                {
                    Subject = string.Format("共{0}件商品", order.Details.Count);
                }
                else
                {
                    Subject = string.Format("共{0}件商品", 0);
                }

                #endregion

                UnifiedOrder pay = new UnifiedOrder();

                if (SignType == EnumPaySignType.Web)
                {
                    return(pay.GetQRCodeUrlWhenWeb(OrderNo, Subject, Body, TotalPrice.ToString(), SellerID));
                }
                //H5支付方式
                else if (SignType == EnumPaySignType.Wap)
                {
                    return(pay.GetJumpUrlWhenMWeb(OrderNo, Subject, Body, TotalPrice.ToString(), SellerID));
                }
                //JS支付(公众号)
                else if (SignType == EnumPaySignType.Js)
                {
                    var pre_payId = pay.GetPrepayIdWhenJsSdk(OrderNo, Subject, Body, TotalPrice.ToString(), SellerID, OpenId, order.OrderOutID);
                    return(GetJsApiParameters(pre_payId, SellerID));
                }
                else if (SignType == EnumPaySignType.App)
                {
                    var pre_payId = pay.GetPrepayIdWhenApp(OrderNo, Subject, Body, TotalPrice.ToString(), SellerID);
                    return(GetAppApiParamters(pre_payId, SellerID));
                }
                else
                {
                    return(pay.GetQRCodeUrlWhenWeb(OrderNo, Subject, Body, TotalPrice.ToString(), SellerID));
                }
            }
            else
            {
                throw new System.ArgumentException("订单不存在");
            }
        }
Esempio n. 4
0
        public bool Handle(EventBus.Events.OrderCreateEvent evt)
        {
            try
            {
                if (evt == null)
                {
                    return(true);
                }

                if (string.IsNullOrEmpty(evt.OrderOutID))
                {
                    return(true);
                }

                XuHos.BLL.OrderService order = new BLL.OrderService(evt.UserID);
                var result = order.CreateOrder(new XuHos.DTO.Platform.OrderDTO()
                {
                    UserID          = evt.UserID,
                    OrderOutID      = evt.OrderOutID,
                    OrderTime       = evt.OrderTime,
                    OrderType       = evt.OrderType,
                    OrderExpireTime = evt.OrderExpireTime,
                    TotalFee        = evt.TotalFee,
                    OrgnazitionID   = evt.OrgnazitionID,
                    Details         = evt.Details != null?evt.Details.Select(a => new DTO.Platform.OrderDetailDTO()
                    {
                        Body        = a.Body,
                        ProductId   = a.ProductId,
                        ProductType = a.ProductType,
                        Quantity    = a.Quantity,
                        Subject     = a.Subject,
                        UnitPrice   = a.UnitPrice
                    }).ToList():new List <DTO.Platform.OrderDetailDTO>(),
                    Consignee = evt.Consignee != null? new DTO.Platform.OrderConsigneeDTO()
                    {
                        Address       = evt.Consignee.Address,
                        IsHosAddress  = evt.Consignee.IsHosAddress,
                        Name          = evt.Consignee.Name,
                        SendGoodsTime = evt.Consignee.SendGoodsTime,
                        Tel           = evt.Consignee.Tel,
                        Id            = evt.Consignee.Id
                    }:null
                });
                if (result.OrderNo != "")
                {
                    return(true);
                }
            }
            catch (Exception E)
            {
                XuHos.Common.LogHelper.WriteError(E);
            }
            return(false);
        }
Esempio n. 5
0
 public ApiResult Confirm(RequestOrderConfirmDTO request)
 {
     bll = new OrderService(CurrentOperatorUserID);
     EnumApiStatus status = bll.Confirm(request.OrderNo, request);
     if (status == EnumApiStatus.BizOK)
     {
         return bll.GetOrder(request.OrderNo).ToApiResultForObject();
     }
     else
     {
         return status.ToApiResultForApiStatus();
     }
 }
Esempio n. 6
0
        /// <summary>
        /// 阿里支付
        /// </summary>
        /// <param name="OrderNo"></param>
        /// <returns></returns>
        public override object GetPaySign(string OrderNo, string SellerID, decimal TotalPrice, EnumPaySignType SignType, string ReturnUrl = "", string OpenId = "")
        {
            BLL.OrderService      bll   = new BLL.OrderService(CurrentOperatorUserID);
            DTO.Platform.OrderDTO order = bll.GetOrder(OrderNo);

            if (order != null)
            {
                #region 获取订单说明和描述

                string Subject = "-";
                string Body    = order.OrderType.GetEnumDescript();
                if (order.Details != null && order.Details.Count == 1)
                {
                    Subject = order.Details[0].Subject;
                }
                else if (order.Details != null)
                {
                    Subject = string.Format("共{0}件商品", order.Details.Count);
                }
                else
                {
                    Subject = string.Format("共{0}件商品", 0);
                }

                #endregion

                NavivePay pay = new NavivePay(SellerID);

                if (SignType == EnumPaySignType.App)
                {
                    return(pay.GetMobilePayParams(OrderNo, Subject, Body, TotalPrice.ToString(), ReturnUrl));
                }
                else
                {
                    return(pay.GetWapPayParams(OrderNo, Subject, Body, TotalPrice.ToString(), ReturnUrl));
                }
            }
            else
            {
                throw new System.ArgumentException("订单不存在");
            }
        }
Esempio n. 7
0
        public bool Handle(EventBus.Events.OrderPayNotifyEvent evt)
        {
            try
            {
                if (evt == null)
                {
                    return(true);
                }

                XuHos.BLL.OrderService service = new BLL.OrderService("");

                return(service.PayCompleted(evt.OrderNo, evt.TradeNo, evt.PayType, evt.SelllerID));
            }
            catch (Exception E)
            {
                LogHelper.WriteError(E);
            }

            return(false);
        }
Esempio n. 8
0
        public void Execute(IJobExecutionContext context)
        {
            var lockValue = Guid.NewGuid().ToString("N");

            if (typeof(SYNC_UpdateOrderStatus).Name.Lock(lockValue, TimeSpan.FromSeconds(5)))
            {
                try
                {
                    BLL.OrderService OrderService = new BLL.OrderService("");
                    OrderService.BatchRefreshStateAsync();
                }
                catch (Exception E)
                {
                    XuHos.Common.LogHelper.WriteError(E);
                }
                finally
                {
                    typeof(SYNC_UpdateOrderStatus).Name.UnLock(lockValue);
                }
            }
        }
Esempio n. 9
0
 public ApiResult GetOrderListBAT(string startTime, string endTime)
 {
     bll = new OrderService(CurrentOperatorUserID);
     var result = bll.QueryOrderListBAT(DateTime.Parse(startTime), DateTime.Parse(endTime));
     return result.ToApiResultForList();
 }
Esempio n. 10
0
 public ApiResult LogisticWithDelivery(string OrderNo)
 {
     bll = new OrderService(CurrentOperatorUserID);
     return bll.LogisticWithDelivery(OrderNo).ToApiResultForBoolean();
 }
Esempio n. 11
0
 public ApiResult GetOrder(string OrderNo)
 {
     bll = new OrderService(CurrentOperatorUserID);
     return bll.GetOrder(OrderNo).ToApiResultForObject();
 }
Esempio n. 12
0
 public ApiResult Complete(string OrderNo)
 {
     bll = new OrderService(CurrentOperatorUserID);
     return bll.Complete(OrderNo).ToApiResultForBoolean();
 }
Esempio n. 13
0
 public ApiResult Cancel(string OrderNo,string Reason="暂无")
 {
     bll = new OrderService(CurrentOperatorUserID);
     return bll.Cancel(OrderNo, Reason).ToApiResultForBoolean();
 }