public OrderDto CreatePreOrder(SysUser sysUser, [FromForm] ProductPo productPo)
        {
            //1.创建订单号
            string orderSn = OrderUtil.GetOrderCode();

            //2.计算总价
            decimal itemTotalPrice = productPo.ProductCount * productPo.ProductPrice;

            //3.创建订单项
            OrderItemDto orderItemDto = new OrderItemDto();

            orderItemDto.OrderSn        = orderSn;
            orderItemDto.ProductId      = productPo.ProductId;
            orderItemDto.ItemCount      = productPo.ProductCount;
            orderItemDto.ItemPrice      = productPo.ProductPrice;
            orderItemDto.ItemTotalPrice = itemTotalPrice;

            //4.创建订单
            OrderDto orderDto = new OrderDto();

            orderDto.UserId        = sysUser.UserId;
            orderDto.OrderItemDtos = new List <OrderItemDto>()
            {
                orderItemDto
            };
            return(orderDto);
        }
        public PaymentDto CreateOrder(SysUser sysUser, [FromForm] OrderPo orderPo)
        {
            //1.创建订单号
            string orderSn = OrderUtil.GetOrderCode();

            //2.扣减库存
            seckillsClient.SeckillSetStock(orderPo.ProductId, orderPo.ProductCount);

            //3.设置订单
            var configuration = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <OrderPo, Order>();
            });
            IMapper mapper = configuration.CreateMapper();
            Order   order  = mapper.Map <OrderPo, Order>(orderPo);

            order.OrderSn = orderSn;
            order.UserId  = sysUser.UserId;

            //4.设置订单项
            OrderItem orderItem = new OrderItem();

            orderItem.ItemCount      = orderPo.ProductCount;
            orderItem.ItemPrice      = orderPo.OrderTotalPrice;
            orderItem.ItemTotalPrice = orderPo.OrderTotalPrice;
            orderItem.ProductUrl     = orderPo.ProductUrl;
            orderItem.ProductId      = orderPo.ProductId;
            orderItem.OrderSn        = orderSn;

            order.OrderItems = new List <OrderItem>()
            {
                orderItem
            };

            //5.保存订单
            order = orderClient.CreateOrder(order);

            //6.创建支付信息
            PaymentDto paymentDto = new PaymentDto();

            paymentDto.OrderSn         = orderSn;
            paymentDto.UserId          = sysUser.UserId;
            paymentDto.ProductId       = orderPo.ProductId;
            paymentDto.ProductName     = orderPo.ProductName;
            paymentDto.OrderTotalPrice = orderPo.OrderTotalPrice;

            return(paymentDto);
        }