/// <summary>
        /// 获取产品销售额、订单数、人数
        /// </summary>
        /// <param name="days"></param>
        /// <returns></returns>
        public EChartData GetProductRepData(int days)
        {
            var data = new EChartData();

            var listPays = _payBusiness.GetIQueryable().Where(x => x.status == 1).ToList();//支付记录
            //var listProduct = new ProductBusiness().GetIQueryable().ToList();//产品清单
            //var listMembers = new membersBusiness().GetIQueryable().ToList();//用户信息
            var listOrders = _orderBusiness.GetIQueryable().Where(x => x.status == 1).ToList().Where(x => listPays.Find(a => a.order_id == x.Id) != null).ToList();//订单 -支付完成的订单

            decimal value   = 0;
            var     nowTime = DateTime.Now.ToCstTime();

            for (int i = days - 1; i >= 0; i--)
            {
                data.xAxisData.Add(nowTime.AddDays(-i).ToString("MM/dd"));

                value += listPays.Where(x => x.pay_time?.ToString("yyyy-MM-dd") == nowTime.AddDays(-i).ToString("yyyy-MM-dd")).Sum(x => x.money);
                data.yAxisDataAmount.Add(value);

                data.yAxisDataOrders.Add(listOrders.Where(x => x.create_time.ToString("yyyy-MM-dd") == nowTime.AddDays(-i).ToString("yyyy-MM-dd")).Count());
                data.yAxisDataPeoples.Add(listOrders.Where(x => x.create_time.ToString("yyyy-MM-dd") == nowTime.AddDays(-i).ToString("yyyy-MM-dd")).Sum(x => x.num));
            }

            return(data);
        }
        /// <summary>
        /// 获取销售渠道
        /// </summary>
        /// <returns></returns>
        public EChartData GetPurchaseChannels(int days)
        {
            var data     = new EChartData();
            var listPays = _payBusiness.GetIQueryable().Where(x => x.status == 1).ToList();                                                                          //支付记录
            //var listProduct = new ProductBusiness().GetIQueryable().ToList();//产品清单
            var listMembers = new membersBusiness().GetIQueryable().ToList();                                                                                        //用户信息
            var listOrders  = _orderBusiness.GetIQueryable().Where(x => x.status == 1).ToList().Where(x => listPays.Find(a => a.order_id == x.Id) != null).ToList(); //订单 -支付完成的订单

            var nowTime = DateTime.Now.ToCstTime();

            for (int i = days - 1; i >= 0; i--)
            {
                data.xAxisData.Add(nowTime.AddDays(-i).ToString("MM/dd"));
                data.yAxisData.Add(listOrders.Where(x => x.share_id.IsNullOrEmpty() && x.create_time.ToString("yyyy-MM-dd") == nowTime.AddDays(-i).ToString("yyyy-MM-dd")).Count());
                data.yAxisData2.Add(listOrders.Where(x => !x.share_id.IsNullOrEmpty() && listMembers.FirstOrDefault(o => o.oppen_id == x.share_id)?.header_status == 1 && x.create_time.ToString("yyyy-MM-dd") == nowTime.AddDays(-i).ToString("yyyy-MM-dd")).Count());
                data.yAxisData3.Add(listOrders.Where(x => !x.share_id.IsNullOrEmpty() && listMembers.FirstOrDefault(o => o.oppen_id == x.share_id)?.header_status == 0 && x.create_time.ToString("yyyy-MM-dd") == nowTime.AddDays(-i).ToString("yyyy-MM-dd")).Count());
            }
            return(data);
        }
        /// <summary>
        /// 获取利润图表数据
        /// </summary>
        /// <returns></returns>
        public EChartData GetProductProfit()
        {
            EChartData eChartData             = new EChartData();
            var        productMarketingModels = _product_marketingBusiness.GetProductAndMarketingList();

            eChartData.xAxisData.Add("全部");
            var obj = CalculateProductProfit(productMarketingModels);

            eChartData.yAxisDataEstimateProfitMargin.Add(obj.EstimateProfitMargin);
            eChartData.yAxisDataActualProfitMargin.Add(obj.ActualProfitMargin);

            //各产品类别预估毛利率
            var productTypeName = productMarketingModels.GroupBy(x => x.pproduct_type_name);

            foreach (var item in productTypeName)
            {
                eChartData.xAxisData.Add(item.Key);
                var o = CalculateProductProfit(item.ToList());
                eChartData.yAxisDataEstimateProfitMargin.Add(o.EstimateProfitMargin);
                eChartData.yAxisDataActualProfitMargin.Add(o.ActualProfitMargin);
            }
            return(eChartData);
        }