/// <summary> /// 获取当日数据统计 /// danny-20150422 /// </summary> /// <returns></returns> public HomeCountTitleModel GetCurrentDateModel() { var model = new HomeCountTitleModel(); var statisticsDao = new StatisticsDao(); var currentDateModel = statisticsDao.GetCurrentDateModel(); model.UnfinishedMissionCount = currentDateModel.UnfinishedMissionCount; model.UnGrabMissionCount = currentDateModel.UnGrabMissionCount; model.ActiveBusiness = currentDateModel.ActiveBusiness; //活跃商家 model.ActiveClienter = currentDateModel.ActiveClienter; //活跃骑士 model.OrderPrice = currentDateModel.OrderPrice; // 订单金额 model.MisstionCount = currentDateModel.MisstionCount; // 任务量 model.OrderCount = currentDateModel.OrderCount; // 订单量 model.YsPrice = Math.Round(currentDateModel.YsPrice, 2); // 商户结算金额(应收) model.YfPrice = Math.Round(currentDateModel.YfPrice, 2); // 骑士佣金总计(应付) model.YkPrice = Math.Round(model.YsPrice - model.YfPrice, 2); //盈亏总计:+ model.PubDate = currentDateModel.PubDate; //发布时间 model.RzqsCount = currentDateModel.RzqsCount; // 认证骑士数量 model.DdrzqsCount = currentDateModel.DdrzqsCount; //等待认证骑士 model.BusinessCount = currentDateModel.BusinessCount; //商家总数 model.BusinessAverageOrderCount = ParseHelper.ToDivision(model.OrderCount, model.ActiveBusiness); //商户平均发布订单 model.MissionAverageOrderCount = ParseHelper.ToDivision(model.OrderCount, model.MisstionCount); //任务平均订单量 model.ClienterAverageOrderCount = ParseHelper.ToDivision(model.OrderCount, model.ActiveClienter); //骑士平均完成订单量 model.ZeroSubsidyOrderCount = currentDateModel.ZeroSubsidyOrderCount; model.OneSubsidyOrderCount = currentDateModel.OneSubsidyOrderCount; model.TwoSubsidyOrderCount = currentDateModel.TwoSubsidyOrderCount; model.ThreeSubsidyOrderCount = currentDateModel.ThreeSubsidyOrderCount; model.rechargeTotal = currentDateModel.rechargeTotal; model.incomeTotal = currentDateModel.incomeTotal; model.userTotal = currentDateModel.userTotal; model.clienterTotal = currentDateModel.clienterTotal; return(model); }
/// <summary> /// 获取homecount页的数量 /// 窦海超 /// 2015年3月24日 13:36:34 /// </summary> /// <returns></returns> public HomeCountTitleModel GetHomeCountTitle() { HomeCountTitleModel model = new HomeCountTitleModel(); ClienterDao clienterDao = new ClienterDao(); BusinessDao businessDao = new BusinessDao(); OrderDao orderDao = new OrderDao(); SubsidyDao subsidyDao = new SubsidyDao(); Ets.Dao.Statistics.StatisticsDao statisticsDao = new Ets.Dao.Statistics.StatisticsDao(); HomeCountTitleModel temp = new HomeCountTitleModel(); //获取当天,订单金额:任务量:订单量: //商户结算金额(应收); 骑士佣金总计(应付) string CurrentTime = DateTime.Now.ToString("yyyy-MM-dd"); IList <HomeCountTitleModel> homeCountList = orderDao.GetCurrentDateCountAndMoney(CurrentTime, CurrentTime); IList <HomeCountTitleModel> subsidyOrderCountList = orderDao.GetCurrentDateSubsidyOrderCount(CurrentTime, CurrentTime); #region 获取当天,未完成任务量,未被抢任务量 var unfinish = statisticsDao.GetCurrentUnFinishOrderinfo(); if (unfinish != null) { model.UnfinishedMissionCount = unfinish.UnfinishedMissionCount; //未完成任务量 model.UnGrabMissionCount = unfinish.UnGrabMissionCount; //未抢单任务量 } #endregion #region 获取活跃商家和活跃骑士 unfinish = statisticsDao.GetCurrentActiveBussinessAndClienter(); if (unfinish != null) { model.ActiveBusiness = unfinish.ActiveBusiness; //活跃商家 model.ActiveClienter = unfinish.ActiveClienter; //活跃骑士 } #endregion if (homeCountList != null && homeCountList.Count > 0) { temp = homeCountList[0]; } model.OrderPrice = temp.OrderPrice; // 订单金额 model.MisstionCount = temp.MisstionCount; // 任务量 model.OrderCount = temp.OrderCount; // 订单量 model.YsPrice = Math.Round(temp.YsPrice, 2); // 商户结算金额(应收) model.YfPrice = Math.Round(temp.YfPrice, 2); // 骑士佣金总计(应付) model.YkPrice = Math.Round(model.YsPrice - model.YfPrice, 2); //盈亏总计:+ model.PubDate = temp.PubDate; //发布时间 temp = clienterDao.GetCountAndMoney(model); //获取已申请骑士,通过骑士数量 model.RzqsCount = temp.RzqsCount; // 认证骑士数量 model.DdrzqsCount = temp.DdrzqsCount; //等待认证骑士 temp = businessDao.GetCurrentBusinessCount(model); // 商家总数: model.BusinessCount = temp.BusinessCount; //商家总数 model.BusinessAverageOrderCount = ParseHelper.ToDivision(model.OrderCount, model.ActiveBusiness); //商户平均发布订单 model.MissionAverageOrderCount = ParseHelper.ToDivision(model.OrderCount, model.MisstionCount); //任务平均订单量 model.ClienterAverageOrderCount = ParseHelper.ToDivision(model.OrderCount, model.ActiveClienter); //骑士平均完成订单量 if (subsidyOrderCountList != null && subsidyOrderCountList.Count > 0) { var zeroSubsidyOrderCount = subsidyOrderCountList.Where(t => t.DealCount == 0).ToList(); var oneSubsidyOrderCount = subsidyOrderCountList.Where(t => t.DealCount == 1).ToList(); var twoSubsidyOrderCount = subsidyOrderCountList.Where(t => t.DealCount == 2).ToList(); var threeSubsidyOrderCount = subsidyOrderCountList.Where(t => t.DealCount == 3).ToList(); model.ZeroSubsidyOrderCount = zeroSubsidyOrderCount != null && zeroSubsidyOrderCount.Count > 0 ? zeroSubsidyOrderCount[0].OrderCount : 0; model.OneSubsidyOrderCount = oneSubsidyOrderCount != null && oneSubsidyOrderCount.Count > 0 ? oneSubsidyOrderCount[0].OrderCount : 0; model.TwoSubsidyOrderCount = twoSubsidyOrderCount != null && twoSubsidyOrderCount.Count > 0 ? twoSubsidyOrderCount[0].OrderCount : 0; model.ThreeSubsidyOrderCount = threeSubsidyOrderCount != null && threeSubsidyOrderCount.Count > 0 ? threeSubsidyOrderCount[0].OrderCount : 0; } else { model.ZeroSubsidyOrderCount = 0; model.OneSubsidyOrderCount = 0; model.TwoSubsidyOrderCount = 0; model.ThreeSubsidyOrderCount = 0; } return(model); }
/// <summary> /// 新增统计数据 /// 窦海超 /// 2015年3月26日 15:03:15 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool InsertDataStatistics(HomeCountTitleModel model) { string sql = @" INSERT INTO [dbo].[Statistic] ([InsertTime] ,[BusinessCount] ,[RzqsCount] ,[DdrzqsCount] ,[OrderPrice] ,[MisstionCount] ,[OrderCount] ,[BusinessAverageOrderCount] ,[MissionAverageOrderCount] ,[ClienterAverageOrderCount] ,[YsPrice] ,[YfPrice] ,[YkPrice] ,[ZeroSubsidyOrderCount] ,[OneSubsidyOrderCount] ,[TwoSubsidyOrderCount] ,[ThreeSubsidyOrderCount] ,[ActiveBusiness] ,[ActiveClienter] ,[incomeTotal] ,[rechargeTotal] ,[businessBalance] ,[withdrawBusinessPrice] ) VALUES (@InsertTime ,@BusinessCount ,@RzqsCount ,@DdrzqsCount ,@OrderPrice ,@MisstionCount ,@OrderCount ,@BusinessAverageOrderCount ,@MissionAverageOrderCount ,@ClienterAverageOrderCount ,@YsPrice ,@YfPrice ,@YkPrice ,@ZeroSubsidyOrderCount ,@OneSubsidyOrderCount ,@TwoSubsidyOrderCount ,@ThreeSubsidyOrderCount ,@ActiveBusiness ,@ActiveClienter ,@incomeTotal ,@rechargeTotal ,@businessBalance ,@withdrawBusinessPrice ) "; IDbParameters parm = DbHelper.CreateDbParameters(); parm.AddWithValue("@InsertTime", model.PubDate); parm.AddWithValue("@BusinessCount", model.BusinessCount); parm.AddWithValue("@RzqsCount", model.RzqsCount); parm.AddWithValue("@DdrzqsCount", model.DdrzqsCount); parm.AddWithValue("@OrderPrice", model.OrderPrice); parm.AddWithValue("@MisstionCount", model.MisstionCount); parm.AddWithValue("@OrderCount", model.OrderCount); parm.AddWithValue("@BusinessAverageOrderCount", model.BusinessAverageOrderCount); parm.AddWithValue("@MissionAverageOrderCount", model.MissionAverageOrderCount); parm.AddWithValue("@ClienterAverageOrderCount", model.ClienterAverageOrderCount); parm.AddWithValue("@YsPrice", model.YsPrice); parm.AddWithValue("@YfPrice", model.YfPrice); parm.AddWithValue("@YkPrice", model.YkPrice); parm.AddWithValue("@ZeroSubsidyOrderCount", model.ZeroSubsidyOrderCount); parm.AddWithValue("@OneSubsidyOrderCount", model.OneSubsidyOrderCount); parm.AddWithValue("@TwoSubsidyOrderCount", model.TwoSubsidyOrderCount); parm.AddWithValue("@ThreeSubsidyOrderCount", model.ThreeSubsidyOrderCount); parm.AddWithValue("@ActiveBusiness", model.ActiveBusiness); parm.AddWithValue("@ActiveClienter", model.ActiveClienter); //parm.AddWithValue("@incomeTotal", model.incomeTotal); //parm.AddWithValue("@rechargeTotal", model.rechargeTotal); //parm.AddWithValue("@businessBalance", model.businessBalance); //parm.AddWithValue("@withdrawBusinessPrice", model.withdrawBusinessPrice); parm.Add("incomeTotal", DbType.Decimal, 18).Value = model.incomeTotal; parm.Add("rechargeTotal", DbType.Decimal, 18).Value = model.rechargeTotal; parm.Add("businessBalance", DbType.Decimal, 18).Value = model.businessBalance; parm.Add("withdrawBusinessPrice", DbType.Decimal, 18).Value = model.withdrawBusinessPrice; return(DbHelper.ExecuteNonQuery(SuperMan_Write, sql, parm) > 0 ? true : false); }