/// <summary>
 /// 确认收货
 /// </summary>
 /// <param name="evnt"></param>
 /// <returns></returns>
 public Task <AsyncTaskResult> HandleAsync(StoreOrderConfirmExpressedEvent evnt)
 {
     return(_commandService.SendAsync(CreatedNotificationCommand(
                                          evnt.StoreOwnerWalletId,
                                          "订单确认收货",
                                          NotificationType.StoreOrderConfirmDelivered,
                                          evnt.AggregateRootId)));
 }
 public Task <AsyncTaskResult> HandleAsync(StoreOrderConfirmExpressedEvent evnt)
 {
     return(TryUpdateRecordAsync(connection =>
     {
         return connection.UpdateAsync(new
         {
             Status = (int)StoreOrderStatus.Success,
             Version = evnt.Version
         }, new
         {
             Id = evnt.AggregateRootId,
             //Version = evnt.Version - 1
         }, ConfigSettings.StoreOrderTable);
     }));
 }
        /// <summary>
        /// 确认收货,系统给商家结算销售收入
        /// </summary>
        /// <param name="evnt"></param>
        /// <returns></returns>
        public Task <AsyncTaskResult> HandleAsync(StoreOrderConfirmExpressedEvent evnt)
        {
            var tasks = new List <Task>();

            //给商家结算货款
            tasks.Add(_commandService.SendAsync(new CreateCashTransferCommand(
                                                    GuidUtil.NewSequentialId(),
                                                    evnt.StoreOwnerWalletId,
                                                    DateTime.Now.ToSerialNumber(),
                                                    Common.Enums.CashTransferType.StoreSell,
                                                    Common.Enums.CashTransferStatus.Placed,
                                                    evnt.StoreGetAmount,
                                                    0,
                                                    Common.Enums.WalletDirection.In,
                                                    "店铺销售商品"
                                                    )));

            foreach (var orderGoods in evnt.OrderGoodses)
            {
                var highProfitAmount = 0M;
                //高倍产品金额
                if (orderGoods.PayDetailInfo.StoreTotal * 10 <= orderGoods.PayDetailInfo.Total)
                {
                    highProfitAmount = orderGoods.PayDetailInfo.Total;
                }
                //用户者的购物奖励
                tasks.Add(_commandService.SendAsync(new AcceptMyNewSpendingCommand(
                                                        evnt.WalletId,
                                                        orderGoods.PayDetailInfo.Total,
                                                        orderGoods.PayDetailInfo.StoreTotal,
                                                        orderGoods.Benevolence * orderGoods.Quantity,
                                                        highProfitAmount
                                                        )));
                //店铺所有人接受店铺新的销售额
                tasks.Add(_commandService.SendAsync(new AcceptMyStoreNewSaleCommand(
                                                        evnt.StoreOwnerWalletId,
                                                        orderGoods.PayDetailInfo.Total
                                                        )));
            }

            Task.WaitAll(tasks.ToArray());
            return(Task.FromResult(AsyncTaskResult.Success));
        }
Beispiel #4
0
 private void Handle(StoreOrderConfirmExpressedEvent evnt)
 {
     _status = StoreOrderStatus.Success;
 }