public void GetCustomStatExcel() { CheckUrl("Reports/SoftVersionSjqd.aspx"); Dictionary <string, int> tableColumn = new Dictionary <string, int>(); int channelid = Convert.ToInt32(GetPara("Channelid")); int channeltype = Convert.ToInt32(GetPara("Channeltype")); string name = GetPara("channelname"); string plat = GetPara("plat"); net91com.Stat.Core.PeriodOptions period = (net91com.Stat.Core.PeriodOptions)Convert.ToInt32(GetPara("period")); DateTime begintime = Convert.ToDateTime(GetPara("begintime")); DateTime endtime = Convert.ToDateTime(GetPara("endtime")); var listAll = Sjqd_StatUsersByChannelsService.GetInstance().GetAllSonChannelCustomUserCache((ChannelTypeOptions)channeltype, plat, channelid, begintime, endtime, period, CacheTimeOption.TenMinutes); List <DateTime> times = listAll.Select(p => p.StatDate).Distinct().OrderByDescending(p => p).ToList(); var channels = listAll.Select(p => new ChannelCustomers { Name = p.ChannelName, ID = p.ChannelID }).Distinct(new channelComparer()).ToList(); for (int i = 0; i < channels.Count; i++) { tableColumn.Add(channels[i].Name, channels[i].ID); } DataTable dt = MakeChannelIncDataTable(tableColumn); for (int i = 0; i < times.Count; i++) { DataRow dr = dt.NewRow(); dr["日期"] = times[i].ToString("yyyy-MM-dd"); foreach (var item in tableColumn.Keys) { var temp = listAll.Find(p => p.ChannelID == tableColumn[item] && p.StatDate == times[i]); if (temp != null) { dr[item] = temp.NewNum; } } dt.Rows.Add(dr); } HttpResponse resp; resp = HttpContext.Current.Response; resp.ContentEncoding = System.Text.Encoding.UTF8; string filename = string.Empty; filename = name + ".xls"; AddHead(filename); string tablestr = TableHelper.GetTableStrForAllCustomers(dt, true); resp.Write(tablestr); resp.End(); }
protected void BindData() { List <SoftUser> users = Sjqd_StatUsersByChannelsService.GetInstance().GetSoftUserChanelListCache(begintime, endtime, softsid, (int)platformsid, net91com.Stat.Core.PeriodOptions.Daily, ChannelTypeOptions.Customer, channelId, channelName, true, null, CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); if (users.Count != 0) { listAll.Add(users); } if (listAll.Count == 0) { return; } reportTitle = "渠道统计"; //获取时间上的并集 foreach (var item in listAll) { for (int tempindex = 0; tempindex < item.Count; tempindex++) { if (!X_DateTime.Contains(item[tempindex].StatDate)) { X_DateTime.Add(item[tempindex].StatDate); } } } MaxNumCoef = X_DateTime.Count / 16 + 1; //设置x轴上的日期 X_DateTime = X_DateTime.OrderBy(p => p).ToList(); SetxAxisJson(X_DateTime); SeriesJsonStr = JsonConvert.SerializeObject(GetDataJsonList(listAll)); StringBuilder sb = new StringBuilder(); ///传入的tab 序列值 int tabindex = 0; ///形成tablehtml for (int j = 0; j < listAll.Count; j++) { int plat = Convert.ToInt32(listAll[j][0].Platform); if (plat == 0) { tabStr.Add("不区分平台"); } else { tabStr.Add(((MobileOption)plat).GetDescription()); } sb.Append(GetTableString(listAll[j], tabindex)); tabindex++; } tableStr = sb.ToString(); }
private void BindData() { listAll = Sjqd_StatUsersByChannelsService.GetInstance().GetAllSonChannelCustomUserCache((ChannelTypeOptions)customType, inputplatformselect.Value, channelId, begintime, endtime, Period, CacheTimeOption.TenMinutes); List <DateTime> times = listAll.Select(p => p.StatDate).Distinct().OrderByDescending(p => p).ToList(); var channels = listAll.Select(p => new ChannelCustomers { Name = p.ChannelName, ID = p.ChannelID }).Distinct(new channelComparer()).ToList(); for (int i = 0; i < channels.Count; i++) { if (!tableColumn.Keys.Contains(channels[i].Name)) { tableColumn.Add(channels[i].Name, channels[i].ID); } else { tableColumn.Add(channels[i].Name + "[" + i + "]", channels[i].ID); } } DataTable dt = MakeChannelIncDataTable(); for (int i = 0; i < times.Count; i++) { DataRow dr = dt.NewRow(); dr["日期"] = times[i].ToString("yyyy-MM-dd"); foreach (var item in tableColumn.Keys) { var temp = listAll.Find(p => p.ChannelID == tableColumn[item] && p.StatDate == times[i]); if (temp != null) { dr[item] = temp.NewNum; } } dt.Rows.Add(dr); } tableStr = TableHelper.GetTableStrForAllCustomers(dt); }
/// <summary> /// 获取数据加上绑定数据 /// </summary> protected void BindData() { //进入分渠道统计 if (HeadControl1.Channel1.ChannelValues.Count != 0) { QuDao = true; var channels = HeadControl1.Channel1.ChannelValues; if (Period == net91com.Stat.Core.PeriodOptions.TimeOfDay || Period == net91com.Stat.Core.PeriodOptions.Hours) { for (int i = 0; i < channels.Count; i++) { //小时和每小时将其和到一条曲线中去了 //List<SoftUser> users = Sjqd_StatUsersByChannelsService.GetInstance().GetChannelUsersByHoursDataCache( // BeginTime, EndTime, SelectedSofts[0].ID, channels[i].Platform, Period, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), channels[i].ChannelText, loginService,CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService suService = new net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsers; ssUsers = suService.GetStatUsersByHour(SelectedSofts[0].ID, channels[i].Platform, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), (int)Period, BeginTime, EndTime); List <SoftUser> users = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsers) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = SelectedSofts[0].ID; softuser.Platform = channels[i].Platform; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; users.Add(softuser); } users = users.OrderBy(p => p.StatDate).ToList(); if (users.Count != 0) { ListAll.Add(users); QuDaoList.Add(i); } //获取对比曲线 if (HeadControl1.CompareTimeType > 0) { //List<SoftUser> usersCompare = Sjqd_StatUsersByChannelsService.GetInstance().GetChannelUsersByHoursDataCache( //BeginCompareTime, EndCompareTime, SelectedSofts[0].ID, channels[i].Platform, Period, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), channels[i].ChannelText, loginService,CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsersComp; ssUsersComp = suService.GetStatUsersByHour(SelectedSofts[0].ID, channels[i].Platform, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), (int)Period, BeginCompareTime, EndCompareTime); List <SoftUser> usersCompare = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsersComp) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = SelectedSofts[0].ID; softuser.Platform = channels[i].Platform; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; usersCompare.Add(softuser); } usersCompare = usersCompare.OrderBy(p => p.StatDate).ToList(); if (usersCompare != null && usersCompare.Count != 0) { ListAllForCompare.Add(usersCompare); } } } } else { for (int i = 0; i < channels.Count; i++) { List <SoftUser> users = Sjqd_StatUsersByChannelsService.GetInstance().GetSoftUserChanelListCache(BeginTime, EndTime, SelectedSofts[0].ID, channels[i].Platform, Period, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), channels[i].ChannelText, false, loginService, CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); if (users != null && users.Count != 0) { ListAll.Add(users); QuDaoList.Add(i); } //获取对比曲线 if (HeadControl1.CompareTimeType > 0) { List <SoftUser> usersCompare = Sjqd_StatUsersByChannelsService.GetInstance().GetSoftUserChanelListCache(BeginCompareTime, EndCompareTime, SelectedSofts[0].ID, channels[i].Platform, Period, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), channels[i].ChannelText, false, loginService, CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); if (usersCompare != null && usersCompare.Count != 0) { ListAllForCompare.Add(usersCompare); } } } } } else { //选择所筛选的所有软件 for (int softid = 0; softid < SelectedSofts.Count; softid++) { Soft SingleSoftInfo = SelectedSofts[softid]; for (int i = 0; i < SelectedPlatforms.Count; i++) { foreach (MobileOption tempplat in SingleSoftInfo.Platforms) { ///他选出的平台加上和自己支持平台的交集 if (tempplat == SelectedPlatforms[i] || SelectedPlatforms[i] == 0) { List <SoftUser> users = null; if (!SuperPeriod) { users = Sjqd_StatUsersService.GetInstance().GetSoftUserListCache(BeginTime, EndTime, SingleSoftInfo.ID, (int)SelectedPlatforms[i], Period, loginService, CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); } else { //users = StatUsersByHourService.GetInstance().GetHourUserDataCache(SingleSoftInfo.ID, (int)SelectedPlatforms[i], BeginTime, EndTime, Period, loginService,CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService suService = new net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsers; ssUsers = suService.GetStatUsersByHour(SingleSoftInfo.ID, (int)SelectedPlatforms[i], ChannelTypeOptions.Category, 0, (int)Period, BeginTime, EndTime); users = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsers) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = SingleSoftInfo.ID; softuser.Platform = (int)SelectedPlatforms[i]; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; users.Add(softuser); } users = users.OrderBy(p => p.StatDate).ToList(); } if (users != null && users.Count != 0) { ListAll.Add(users); RealSoftLine.Add((int)SelectedPlatforms[i]); } //获取对比曲线 if (HeadControl1.CompareTimeType > 0) { List <SoftUser> usersCompare = null; if (!SuperPeriod) { usersCompare = Sjqd_StatUsersService.GetInstance().GetSoftUserListCache(BeginCompareTime, EndCompareTime, SingleSoftInfo.ID, (int)SelectedPlatforms[i], Period, loginService, CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); } else { //usersCompare = StatUsersByHourService.GetInstance().GetHourUserDataCache(SingleSoftInfo.ID, (int)SelectedPlatforms[i], BeginCompareTime, EndCompareTime, Period, loginService,CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService suService = new net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsers; ssUsers = suService.GetStatUsersByHour(SingleSoftInfo.ID, (int)SelectedPlatforms[i], ChannelTypeOptions.Category, 0, (int)Period, BeginCompareTime, EndCompareTime); usersCompare = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsers) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = SingleSoftInfo.ID; softuser.Platform = (int)SelectedPlatforms[i]; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; usersCompare.Add(softuser); } usersCompare = usersCompare.OrderBy(p => p.StatDate).ToList(); } if (usersCompare != null && usersCompare.Count != 0) { ListAllForCompare.Add(usersCompare); } } break; } } } } HeadControl1.Channel1.SelectedText = "选择渠道"; HeadControl1.Channel1.SelectedValue = ""; } //一条线数据都没有 if (ListAll.Count == 0) { return; } //生成所有的Table GetAllTableHtml(); //生成所有曲线的JSON GetAllLineJson(); }
private List <SoftUser> GetComplexPlatUserData_GetData(HttpContext context) { DateTime begintime = Convert.ToDateTime(context.Request["begintime"]); DateTime endtime = Convert.ToDateTime(context.Request["endtime"]); int soft = Convert.ToInt32(context.Request["soft"]); int plat = Convert.ToInt32(context.Request["platform"]); int modetype = Convert.ToInt32(context.Request["modetype"]); string version = context.Request["version"]; int realplat1 = 1; int realplat2 = 7; if (plat == 4) { realplat1 = 4; realplat2 = 9; } if (1 == modetype) { string channelNames = context.Request["channelnames"]; string channelids = context.Request["channelids"]; //默认加一项进去 var list = new List <ChannelRight>(); string[] channels = channelids.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); string[] channelarray = channelNames.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (channels.Length == 0) { channels = new[] { "Customer_0" }; channelarray = new[] { "不区分渠道" }; } //非渠道选项 if (channels.Length != channelarray.Length) { return(new List <SoftUser>()); } var channelDic = new Dictionary <string, string>(); for (int i = 0; i < channels.Count(); i++) { string[] strs = channels[i].Split(new[] { '_' }, StringSplitOptions.RemoveEmptyEntries); if (strs.Length == 2) { list.Add(new ChannelRight { ChannelType = (ChannelTypeOptions)Enum.Parse(typeof(ChannelTypeOptions), strs[0]), ChannelID = Convert.ToInt32(strs[1]) }); channelDic.Add(channels[i], channelarray[i]); } } Sjqd_StatUsersByChannelsService service = Sjqd_StatUsersByChannelsService.GetInstance(); var lists = new List <SoftUser>(); if (list.Count == 1 && list[0].ChannelID == 0) { List <SoftUser> result = Sjqd_StatUsersService.GetInstance() .GetSoftUserListCache(begintime, endtime, soft, realplat1 , PeriodOptions.Daily, new URLoginService(), CacheTimeOption.TenMinutes) .OrderBy(p => p.StatDate) .ToList(); List <SoftUser> result2 = Sjqd_StatUsersService.GetInstance() .GetSoftUserListCache(begintime, endtime, soft, realplat2, PeriodOptions.Daily, new URLoginService(), CacheTimeOption.TenMinutes) .OrderBy(p => p.StatDate) .ToList(); if (result.Count() != 0) { lists.AddRange(result); } if (result2.Count() != 0) { lists.AddRange(result2); } } else { for (int i = 0; i < list.Count; i++) { List <SoftUser> result = service.GetSoftUserChanelListCache(begintime, endtime, soft, realplat1, PeriodOptions.Daily, list[i].ChannelType, list[i].ChannelID, channelDic[ list[i] .ChannelType + "_" + list[i].ChannelID], false, new URLoginService(), CacheTimeOption.TenMinutes); List <SoftUser> result2 = service.GetSoftUserChanelListCache(begintime, endtime, soft, realplat2, PeriodOptions.Daily, list[i].ChannelType, list[i].ChannelID, channelDic[ list[i] .ChannelType + "_" + list[i].ChannelID], false, new URLoginService(), CacheTimeOption.TenMinutes); if (result.Count() != 0) { lists.AddRange(result); } if (result2.Count() != 0) { lists.AddRange(result2); } } } return (lists.GroupBy(p => p.StatDate) .Select( p => new SoftUser { StatDate = p.Key, NewNum = p.Sum(l => l.NewNum), ActiveNum = p.Sum(l => l.NewNum) + p.Sum(l => l.ActiveNum) }) .ToList()); } else { List <string> lstver = version.Split(',').ToList(); var lst = new List <Sjqd_StatUsers>(); var suService = new StatUsersService(); for (int i = 0; i < lstver.Count; i++) { List <Sjqd_StatUsers> lstverdata1 = suService.GetStatUsersByVersion(soft, realplat1, ChannelTypeOptions.Category, 0, lstver[i], (int)PeriodOptions.Daily, begintime, endtime); if (lstverdata1.Count != 0) { lst.AddRange(lstverdata1); } } //var lstverdata2 = sbv.GetUsersByVersionCache(soft, realplat1, begintime, endtime, PeriodOptions.Daily, lstver, // CacheTimeOption.TenMinutes); for (int i = 0; i < lstver.Count; i++) { List <Sjqd_StatUsers> lstverdata2 = suService.GetStatUsersByVersion(soft, realplat1, ChannelTypeOptions.Category, 0, lstver[i], (int)PeriodOptions.Daily, begintime, endtime); if (lstverdata2.Count != 0) { lst.AddRange(lstverdata2); } } return (lst.GroupBy(p => p.StatDate) .Select( p => new SoftUser { StatDate = p.Key, NewNum = p.Sum(l => l.NewUserCount), ActiveNum = p.Sum(l => l.ActiveUserCount) }) .ToList()); } }
public void GetExcelNewUser() { try { net91com.Stat.Core.PeriodOptions Period = HttpContext.Current.Request["inputzhouqi"].ToEnum <net91com.Stat.Core.PeriodOptions>(net91com.Stat.Core.PeriodOptions.Daily); DateTime begintime = Convert.ToDateTime(HttpContext.Current.Request["inputtimestart"]); DateTime endtime = Convert.ToDateTime(HttpContext.Current.Request["inputtimeend"]); int excelsoft = Convert.ToInt32(HttpContext.Current.Request["excelsoft"]); int channelcate = Convert.ToInt32(HttpContext.Current.Request["channelcate"]); int channeltype = Convert.ToInt32(HttpContext.Current.Request["channeltype"]); ///检查权限 CheckHasRight(excelsoft, "Reports/NewUserReport.aspx"); int excelplatform = Convert.ToInt32(HttpContext.Current.Request["excelplatform"]); SetStandardTime(Period, begintime, endtime); List <SoftUser> users; if (channelcate == -1) { if (Period != net91com.Stat.Core.PeriodOptions.Hours && Period != net91com.Stat.Core.PeriodOptions.TimeOfDay) { users = Sjqd_StatUsersService.GetInstance().GetSoftUserListCache(begintime, endtime, excelsoft, (int)excelplatform, Period, loginService, CacheTimeOption.TenMinutes).OrderByDescending(p => p.StatDate).ToList(); } else { //users = StatUsersByHourService.GetInstance().GetHourUserDataCache(excelsoft, excelplatform, begintime, endtime, Period, loginService,CacheTimeOption.TenMinutes).OrderByDescending(p => p.StatDate).ToList(); net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService suService = new net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsers; ssUsers = suService.GetStatUsersByHour(excelsoft, excelplatform, ChannelTypeOptions.Category, 0, (int)Period, begintime, endtime); users = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsers) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = excelsoft; softuser.Platform = excelplatform; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; users.Add(softuser); } users = users.OrderBy(p => p.StatDate).ToList(); } } else { if (Period != net91com.Stat.Core.PeriodOptions.Hours && Period != net91com.Stat.Core.PeriodOptions.TimeOfDay) { users = Sjqd_StatUsersByChannelsService.GetInstance().GetSoftUserChanelListCache(begintime, endtime, excelsoft, excelplatform, Period, (ChannelTypeOptions)channeltype, channelcate, "", false, loginService, CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); } else { net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService suService = new net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsers; ssUsers = suService.GetStatUsersByHour(excelsoft, excelplatform, (ChannelTypeOptions)channeltype, channelcate, (int)Period, begintime, endtime); users = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsers) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = excelsoft; softuser.Platform = excelplatform; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; users.Add(softuser); } users = users.OrderBy(p => p.StatDate).ToList(); } } HttpResponse resp; resp = HttpContext.Current.Response; resp.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8"); string filename = "新增用户.xls"; AddHead(filename); //是否是内部软件 bool isInternalSoft = AvailableSofts.FirstOrDefault(a => a.ID == excelsoft) != null; resp.Write(TableTemplateHelper.BuildStatUsersTable(excelsoft, (MobileOption)excelplatform, isInternalSoft, channelcate != -1, Period, "new", false, users, true, 0, "")); resp.End(); } catch (Exception) { HttpContext.Current.Response.Write(""); } }
protected void BindData() { List <SoftUser> users; //是否给外部部人看的,自己内部人看,不用乘以系数的结果,给外部要乘 bool isForOut = (usercate.Value == "11"); if (isForOut) { reportTitle = "分渠道统计(外部)"; } else { reportTitle = "分渠道统计(内部)"; } //不区分渠道 if (HeadControl1.Channel1.ChannelValues.Count == 0) { for (int i = 0; i < PlatformsidList.Count; i++) { if (IsSuperPeriod) { //users = // StatUsersByHourService.GetInstance() // .GetHourUserDataCache(softsid, PlatformsidList[i], BeginTime, EndTime, // Period, loginService, // CacheTimeOption.TenMinutes) // .OrderBy(p => p.StatDate) // .ToList(); net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService suService = new net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsers; ssUsers = suService.GetStatUsersByHour(softsid, PlatformsidList[i], ChannelTypeOptions.Category, 0, (int)Period, BeginTime, EndTime); users = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsers) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = softsid; softuser.Platform = PlatformsidList[i]; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; users.Add(softuser); } users = users.OrderBy(p => p.StatDate).ToList(); //获取对比曲线 if (HeadControl1.CompareTimeType > 0) { //List<SoftUser> usersCompare = // StatUsersByHourService.GetInstance() // .GetHourUserDataCache(softsid, PlatformsidList[i], // BeginCompareTime, EndCompareTime, Period, // loginService, // CacheTimeOption.TenMinutes) // .OrderBy(p => p.StatDate).ToList(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsersComp; ssUsersComp = suService.GetStatUsersByHour(softsid, PlatformsidList[i], ChannelTypeOptions.Category, 0, (int)Period, BeginCompareTime, EndCompareTime); List <SoftUser> usersCompare = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsersComp) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = softsid; softuser.Platform = PlatformsidList[i]; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; usersCompare.Add(softuser); } usersCompare = usersCompare.OrderBy(p => p.StatDate).ToList(); if (usersCompare.Count != 0) { ListAllForCompare.Add(usersCompare); } } } else { users = Sjqd_StatUsersService.GetInstance() .GetSoftUserListCache(BeginTime, EndTime, softsid, PlatformsidList[i], Period, loginService, CacheTimeOption.TenMinutes) .OrderBy(p => p.StatDate) .ToList(); //获取计算预测数据 ForeCastUserDatas.AddRange(Sjqd_StatUsersService.GetInstance().GetForecastSoftUserCache( softsid, PlatformsidList[i], Period, loginService, CacheTimeOption.TenMinutes)); //获取对比曲线 if (HeadControl1.CompareTimeType > 0) { List <SoftUser> usersCompare = Sjqd_StatUsersService.GetInstance() .GetSoftUserListCache(BeginCompareTime, EndCompareTime, softsid, PlatformsidList[i], Period, loginService, CacheTimeOption.TenMinutes) .OrderBy(p => p.StatDate) .ToList(); if (usersCompare.Count != 0) { ListAllForCompare.Add(usersCompare); } } } if (users.Count != 0) { ListAll.Add(users); //添加里程碑列表集(若ListAll添加了,里程碑也要添加) //mileStoneDate.Add(Sjqd_MileStoneConfigService.GetInstance() // .GetMileStoneDatesByCache(softsid, PlatformsidList[i], BeginTime, EndTime)); } } } else { QuDao = true; var channels = HeadControl1.Channel1.ChannelValues; if (IsSuperPeriod) { for (int i = 0; i < channels.Count; i++) { //小时和每小时将其和到一条曲线中去了 //users = Sjqd_StatUsersByChannelsService.GetInstance().GetChannelUsersByHoursDataCache( // BeginTime, EndTime, softsid, channels[i].Platform, Period, channels[i].ChannelType, // Convert.ToInt32(channels[i].ChannelValue), channels[i].ChannelText, loginService, // CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService suService = new net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsers; ssUsers = suService.GetStatUsersByHour(softsid, channels[i].Platform, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), (int)Period, BeginTime, EndTime); users = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsers) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = softsid; softuser.Platform = channels[i].Platform; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; users.Add(softuser); } users = users.OrderBy(p => p.StatDate).ToList(); if (users.Count != 0) { //记住有数据渠道的编号 QuDaoList.Add(i); ListAll.Add(users); //添加里程碑列表集(若ListAll添加了,里程碑也要添加) //mileStoneDate.Add(Sjqd_MileStoneConfigService.GetInstance() // .GetMileStoneDatesByCache(softsid, channels[i].Platform, BeginTime, EndTime)); } //获取对比曲线 if (HeadControl1.CompareTimeType > 0) { //List<SoftUser> usersCompare = // Sjqd_StatUsersByChannelsService.GetInstance().GetChannelUsersByHoursDataCache( // BeginCompareTime, EndCompareTime, softsid, channels[i].Platform, Period, // channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), // channels[i].ChannelText, loginService,CacheTimeOption.TenMinutes) // .OrderBy(p => p.StatDate) // .ToList(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsersComp; ssUsersComp = suService.GetStatUsersByHour(softsid, channels[i].Platform, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), (int)Period, BeginCompareTime, EndCompareTime); List <SoftUser> usersCompare = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsersComp) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = softsid; softuser.Platform = channels[i].Platform; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; usersCompare.Add(softuser); } usersCompare = usersCompare.OrderBy(p => p.StatDate).ToList(); if (usersCompare.Count != 0) { ListAllForCompare.Add(usersCompare); } } } } else { for (int i = 0; i < channels.Count; i++) { users = Sjqd_StatUsersByChannelsService.GetInstance() .GetSoftUserChanelListCache(BeginTime, EndTime, softsid, channels[i].Platform , Period, channels[i].ChannelType, Convert.ToInt32( channels[i].ChannelValue), channels[i].ChannelText, isForOut, loginService, CacheTimeOption.TenMinutes) .OrderBy(p => p.StatDate) .ToList(); if (users.Count != 0) { //记住有数据渠道的编号 QuDaoList.Add(i); ListAll.Add(users); //添加里程碑列表集(若ListAll添加了,里程碑也要添加) //mileStoneDate.Add(Sjqd_MileStoneConfigService.GetInstance() // .GetMileStoneDatesByCache(softsid, channels[i].Platform, BeginTime, EndTime)); //if (Period == net91com.Stat.Core.PeriodOptions.Daily) //{ // ForecastSoftUser softUser = Sjqd_StatUsersByChannelsService.GetInstance().GetStatUsersForRealTime(softsid, // channels[i].Platform, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), loginService, CacheTimeOption.TenMinutes); // if (softUser != null) // ForeCastUserDatas.Add(softUser); //} } //获取对比曲线 if (HeadControl1.CompareTimeType > 0) { List <SoftUser> usersCompare = Sjqd_StatUsersByChannelsService.GetInstance() .GetSoftUserChanelListCache(BeginCompareTime, EndCompareTime, softsid, channels[i].Platform, Period, channels[i].ChannelType, Convert.ToInt32( channels[i].ChannelValue), channels[i].ChannelText, isForOut, loginService, CacheTimeOption .TenMinutes) .OrderBy(p => p.StatDate) .ToList(); if (usersCompare.Count != 0) { ListAllForCompare.Add(usersCompare); } } } } } if (ListAll.Count == 0) { return; } GetAllLineJson(); StringBuilder sb = new StringBuilder(); //传入的tab 序列值 int tabindex = 0; //形成tablehtml for (int j = 0; j < ListAll.Count; j++) { string plat = ((MobileOption)ListAll[j][0].Platform).GetDescription(); if ((MobileOption)ListAll[j][0].Platform == MobileOption.None) { plat = "不区分平台"; } string channel = ListAll[j][0].ChannelName; if (string.IsNullOrEmpty(channel)) { channel = "不区分渠道"; } tabStr.Add(plat + "_" + channel); sb.Append(GetTableString(ListAll[j], tabindex)); tabindex++; } tableStr = sb.ToString(); }
/// <summary> /// 获取数据加上绑定数据 /// </summary> protected void BindData() { ///进入分渠道统计 if (HeadControl1.Channel1.ChannelValues.Count != 0) { var channels = HeadControl1.Channel1.ChannelValues; QuDao = true; if (Period == net91com.Stat.Core.PeriodOptions.TimeOfDay || Period == net91com.Stat.Core.PeriodOptions.Hours) { for (int i = 0; i < channels.Count; i++) { //List<SoftUser> users = // Sjqd_StatUsersByChannelsService.GetInstance().GetChannelUsersByHoursDataCache( // BeginTime, EndTime, SelectedSofts[0].ID, channels[i].Platform, Period, // channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), // channels[i].ChannelText, loginService,CacheTimeOption.TenMinutes) // .OrderBy(p => p.StatDate) // .ToList(); net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService suService = new net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsers; ssUsers = suService.GetStatUsersByHour(SelectedSofts[0].ID, channels[i].Platform, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), (int)Period, BeginTime, EndTime); List <SoftUser> users = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsers) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = SelectedSofts[0].ID; softuser.Platform = channels[i].Platform; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; users.Add(softuser); } users = users.OrderBy(p => p.StatDate).ToList(); if (users.Count != 0) { ListAll.Add(users); //添加里程碑列表集(若ListAll添加了,里程碑也要添加) //mileStoneDate.Add(Sjqd_MileStoneConfigService.GetInstance() // .GetMileStoneDatesByCache(SelectedSofts[0].ID, // channels[i].Platform, // BeginTime, EndTime)); QuDaoList.Add(i); } //获取对比曲线 if (HeadControl1.CompareTimeType > 0) { //List<SoftUser> usersCompare = // Sjqd_StatUsersByChannelsService.GetInstance().GetChannelUsersByHoursDataCache( // BeginCompareTime, EndCompareTime, SelectedSofts[0].ID, channels[i].Platform, Period, // channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), // channels[i].ChannelText, loginService,CacheTimeOption.TenMinutes) // .OrderBy(p => p.StatDate) // .ToList(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsersComp; ssUsersComp = suService.GetStatUsersByHour(SelectedSofts[0].ID, channels[i].Platform, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), (int)Period, BeginCompareTime, EndCompareTime); List <SoftUser> usersCompare = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsersComp) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = SelectedSofts[0].ID; softuser.Platform = channels[i].Platform; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; usersCompare.Add(softuser); } usersCompare = usersCompare.OrderBy(p => p.StatDate).ToList(); if (usersCompare != null && usersCompare.Count != 0) { ListAllForCompare.Add(usersCompare); } } } } else { for (int i = 0; i < channels.Count; i++) { List <SoftUser> users = Sjqd_StatUsersByChannelsService.GetInstance() .GetSoftUserChanelListCache(BeginTime, EndTime, SelectedSofts[0].ID, channels[i].Platform, Period, channels[i].ChannelType, Convert.ToInt32( channels[i].ChannelValue), channels[i].ChannelText, false, loginService, CacheTimeOption.TenMinutes) .OrderBy(p => p.StatDate) .ToList(); if (users != null && users.Count != 0) { ListAll.Add(users); ////添加里程碑列表集(若ListAll添加了,里程碑也要添加) //mileStoneDate.Add(Sjqd_MileStoneConfigService.GetInstance() // .GetMileStoneDatesByCache(SelectedSofts[0].ID, channels[i].Platform, BeginTime, EndTime)); QuDaoList.Add(i); //if (Period == net91com.Stat.Core.PeriodOptions.Daily) //{ // ForecastSoftUser softUser = // Sjqd_StatUsersByChannelsService.GetInstance() // .GetStatUsersForRealTime(SelectedSofts[0].ID, // channels[i].Platform, // channels[i].ChannelType, // Convert.ToInt32( // channels[i].ChannelValue), // loginService, // CacheTimeOption.TenMinutes); // if (softUser != null) // ForeCastUserDatas.Add(softUser); //} } //获取对比曲线 if (HeadControl1.CompareTimeType > 0) { List <SoftUser> usersCompare = Sjqd_StatUsersByChannelsService.GetInstance() .GetSoftUserChanelListCache(BeginCompareTime, EndCompareTime, SelectedSofts[0].ID, channels[i].Platform, Period, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), channels[i].ChannelText, false, loginService, CacheTimeOption.TenMinutes) .OrderBy(p => p.StatDate) .ToList(); if (usersCompare != null && usersCompare.Count != 0) { ListAllForCompare.Add(usersCompare); } } } } } else { //选择所筛选的所有软件 for (int softid = 0; softid < SelectedSofts.Count; softid++) { for (int i = 0; i < SelectedPlatforms.Count; i++) { foreach (MobileOption tempplat in SelectedSofts[softid].Platforms) { //他选出的平台加上和自己支持平台的交集 if (tempplat == SelectedPlatforms[i] || SelectedPlatforms[i] == 0) { List <SoftUser> users = null; if (Period != net91com.Stat.Core.PeriodOptions.TimeOfDay && Period != net91com.Stat.Core.PeriodOptions.Hours) { users = Sjqd_StatUsersService.GetInstance() .GetSoftUserListCache(BeginTime, EndTime, SelectedSofts[softid].ID, (int)SelectedPlatforms[i], Period, loginService, CacheTimeOption.TenMinutes) .OrderBy(p => p.StatDate) .ToList(); if (Period == net91com.Stat.Core.PeriodOptions.Daily) { //ForecastSoftUser softUser = // Sjqd_StatUsersService.GetInstance() // .GetStatUsersForRealTime(SelectedSofts[softid].ID, // (int)SelectedPlatforms[i], // loginService, // CacheTimeOption.TenMinutes); //if (softUser != null) // ForeCastUserDatas.Add(softUser); //else ForeCastUserDatas.AddRange( Sjqd_StatUsersService.GetInstance() .GetForecastSoftUserCache( SelectedSofts[softid].ID, (int)SelectedPlatforms[i], Period, loginService, CacheTimeOption.TenMinutes)); } else { //获取计算预测数据 ForeCastUserDatas.AddRange( Sjqd_StatUsersService.GetInstance() .GetForecastSoftUserCache(SelectedSofts[softid].ID, (int)SelectedPlatforms[i], Period, loginService, CacheTimeOption .TenMinutes)); } } else { //users = // StatUsersByHourService.GetInstance() // .GetHourUserDataCache(SelectedSofts[softid].ID, // (int) SelectedPlatforms[i], // BeginTime, EndTime, Period, // loginService, // CacheTimeOption.TenMinutes) // .OrderBy(p => p.StatDate) // .ToList(); net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService suService = new net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsers; ssUsers = suService.GetStatUsersByHour(SelectedSofts[softid].ID, (int)SelectedPlatforms[i], ChannelTypeOptions.Category, 0, (int)Period, BeginTime, EndTime); users = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsers) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = SelectedSofts[softid].ID; softuser.Platform = (int)SelectedPlatforms[i]; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; users.Add(softuser); } users = users.OrderBy(p => p.StatDate).ToList(); } if (users != null && users.Count != 0) { ListAll.Add(users); //添加里程碑列表集(若ListAll添加了,里程碑也要添加) //mileStoneDate.Add(Sjqd_MileStoneConfigService.GetInstance() // .GetMileStoneDatesByCache( // SelectedSofts[softid].ID, // (int)SelectedPlatforms[i], // BeginTime, EndTime)); RealSoftLine.Add((int)SelectedPlatforms[i]); } //获取对比曲线 if (HeadControl1.CompareTimeType > 0) { List <SoftUser> usersCompare = null; if (Period != net91com.Stat.Core.PeriodOptions.TimeOfDay && Period != net91com.Stat.Core.PeriodOptions.Hours) { usersCompare = Sjqd_StatUsersService.GetInstance() .GetSoftUserListCache(BeginCompareTime, EndCompareTime, SelectedSofts[softid].ID, (int)SelectedPlatforms[i], Period, loginService, CacheTimeOption.TenMinutes) .OrderBy(p => p.StatDate) .ToList(); } else { //usersCompare = // StatUsersByHourService.GetInstance() // .GetHourUserDataCache(SelectedSofts[softid].ID, // (int)SelectedPlatforms[i], // BeginCompareTime, EndCompareTime, // Period, loginService, // CacheTimeOption.TenMinutes) // .OrderBy(p => p.StatDate) // .ToList(); net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService suService = new net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsers; ssUsers = suService.GetStatUsersByHour(SelectedSofts[softid].ID, (int)SelectedPlatforms[i], ChannelTypeOptions.Category, 0, (int)Period, BeginCompareTime, EndCompareTime); usersCompare = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsers) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = SelectedSofts[softid].ID; softuser.Platform = (int)SelectedPlatforms[i]; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; usersCompare.Add(softuser); } usersCompare = usersCompare.OrderBy(p => p.StatDate).ToList(); } if (usersCompare != null && usersCompare.Count != 0) { ListAllForCompare.Add(usersCompare); } } break; } } } } } if (ListAll.Count == 0) { return; } //生成所有曲线的JSON GetAllLineJson(); //生成Table的HTML GetAllTableHtml(); }