public List <SelectSumAppUserList> GetSelectSumAppUserList2(RouteSumAppUser2 request) { if (AdcdHelper.GetByAdcdRole(request.adcd) == "省级") { return(GetProvinceList2(request.adcd, request.adcdName)); //userSql += " and a.adcd like '33%'"; //appSql += " and b.adcd like '33%'"; } return(null); }
public ActionResult LeaderAppUserList() { var session = base.SessionAs <Model.Common.UserSession>(); ViewData["leaderName"] = session.yhRealName; ViewData["orgname"] = session.orgname; ViewData["headpicture"] = session.headpicture; ViewData["adcd"] = adcd; ViewData["role"] = AdcdHelper.GetByAdcdRole(adcd); return(View()); }
/// <summary> /// 获取大事件的列表 /// </summary> /// <param name="request"></param> /// <returns></returns> public BsTableDataSource <AppSumEventModel> GetSumEventUI(RouteSearchEventModel request) { using (var db = DbFactory.Open()) { string role = AdcdHelper.GetByAdcdRole(adcd); var whereLamda = db.From <AppWarnEvent>(); whereLamda.LeftJoin <AppWarnEvent, ADCDInfo>((x, y) => x.adcd == y.adcd); if (role == "省级") { if (request.CityAdcd == null) { whereLamda.And(x => x.adcd.StartsWith("33")); } else { whereLamda.And(x => x.adcd.StartsWith(request.CityAdcd.Substring(0, 4))); } } if (role == "市级") { whereLamda.And(x => x.adcd.StartsWith(adcd.Substring(0, 4))); } if (role == "县级") { whereLamda.And(x => x.adcd.StartsWith(adcd.Substring(0, 6))); } if (role == "镇级") { whereLamda.And(x => x.adcd == adcd); } if (request.CountryAdcd != null) { whereLamda.And(x => x.adcd == request.CountryAdcd); } whereLamda.And(x => x.StartTime >= Convert.ToDateTime(DateTime.Now.ToString("yyyy-01-01"))); if (!string.IsNullOrEmpty(request.EventName)) { whereLamda.And(x => x.EventName.Contains(request.EventName)); } whereLamda.OrderByDescending(x => x.StartTime); var total = db.Count(whereLamda); var PageSize = request.PageSize == 0 ? 15 : request.PageSize; var PageIndex = request.PageIndex == 0 ? 0 : (request.PageIndex) * PageSize; whereLamda.Limit(PageIndex, PageSize); var list = db.Select <AppSumEventModel>(whereLamda); return(new BsTableDataSource <AppSumEventModel> { total = total, rows = list }); } }
public List <AdcdSelectModel> GetCityAdcdSelectList(string adcd) { using (var db = DbFactory.Open()) { List <AdcdSelectModel> list = new List <AdcdSelectModel>(); if (AdcdHelper.GetByAdcdRole(adcd) == "省级") { list = db.SqlList <AdcdSelectModel>("select adcd,adnm from ADCDInfo where parentId in (select Id from ADCDInfo where adcd='" + adcd + "')"); } if (AdcdHelper.GetByAdcdRole(adcd) == "市级") { list = db.SqlList <AdcdSelectModel>("select adcd,adnm from ADCDInfo where adcd='" + adcd + "'"); } return(list); } }
/// <summary> /// 统计用户增加已录入的信息 /// </summary> /// <param name="allList"></param> /// <param name="appList"></param> /// <param name="adcd"></param> /// <returns></returns> private List <SelectSumAppUserList> GetSumAppUserList(List <SelectSumAppUserList> allList, List <SelectSumAppUserList> appList, string adcd) { foreach (var item in appList) { var userItem = allList.Find(x => x.adcd == item.adcd); userItem.appcount = item.appcount; } if (AdcdHelper.GetByAdcdRole(adcd) == "县级" && allList.Count > 0) { allList[0].parentId = 0; } if (AdcdHelper.GetByAdcdRole(adcd) == "镇级" && allList.Count > 0) { allList[0].parentId = 0; } return(allList); }
/// <summary> /// 统计为注册人的信息 /// </summary> /// <param name="request"></param> /// <returns></returns> public BsTableDataSource <Model.SumAppUser.SumAppUser> GetSumAppUserList(RouteNoAppUser request) { using (var db = DbFactory.Open()) { string userSql = "select a.adcd,a.adcdId,b.adnm,b.parentId,a.phone,a.UserName from AppAllUserView a left join ADCDInfo b on a.adcdId=b.Id where a.adcdId is not null and a.adcd is not null and RIGHT(a.adcd, 11)!= '00000000000' "; string appSql = "select b.adcd,a.adcdId,b.adnm,b.parentId,a.Mobile as phone,a.UserName from AppGetReg a left join ADCDInfo b on a.adcdId=b.Id where a.adcdId is not null and RIGHT(b.adcd, 11)!= '00000000000' "; if (AdcdHelper.GetByAdcdRole(request.adcd) == "省级") { userSql += " and a.adcd like '33%'"; appSql += " and b.adcd like '33%'"; } if (AdcdHelper.GetByAdcdRole(request.adcd) == "市级") { userSql += " and a.adcd like '" + request.adcd.Substring(0, 4) + "%'"; appSql += " and b.adcd like '" + request.adcd.Substring(0, 4) + "%'"; } if (AdcdHelper.GetByAdcdRole(request.adcd) == "县级") { userSql += " and a.adcd like '" + request.adcd.Substring(0, 6) + "%'"; appSql += " and b.adcd like '" + request.adcd.Substring(0, 6) + "%'"; } if (AdcdHelper.GetByAdcdRole(request.adcd) == "镇级") { userSql += " and a.adcd like '" + request.adcd.Substring(0, 9) + "%'"; appSql += " and b.adcd like '" + request.adcd.Substring(0, 9) + "%'"; } if (AdcdHelper.GetByAdcdRole(request.adcd) == "村级") { userSql += " and a.adcd like '" + request.adcd + "%'"; appSql += " and b.adcd like '" + request.adcd + "%'"; } userSql += " group by a.adcd,a.adcdId,b.adnm,b.parentId,a.phone,a.UserName order by a.adcdId"; appSql += " group by b.adcd,a.adcdId,b.adnm,b.parentId,a.Mobile,a.UserName order by a.adcdId"; List <Model.SumAppUser.SumAppUser> allList = db.SqlList <Model.SumAppUser.SumAppUser>(userSql); List <Model.SumAppUser.SumAppUser> appList = db.SqlList <Model.SumAppUser.SumAppUser>(appSql); var list = GetUserList(allList, appList); var pageList = list.Skip(request.PageSize * (request.PageIndex - 1)) .Take(request.PageSize).ToList(); return(new BsTableDataSource <Model.SumAppUser.SumAppUser> { total = list.Count(), rows = pageList }); } }
/// <summary> /// 获取注册情况统计 /// </summary> /// <param name="request"></param> /// <returns></returns> public List <SelectSumAppUserList> GetSelectSumAppUserList(RouteSumAppUser request) { using (var db = DbFactory.Open()) { string userSql = "select COUNT(*) as userCount,a.adcd,a.adcdId,b.adnm,b.parentId from AppAllUserView a left join ADCDInfo b on a.adcdId=b.Id where a.adcdId is not null and a.adcd is not null and RIGHT(a.adcd, 11)!= '00000000000' "; string appSql = "select COUNT(*) as appcount,b.adcd,a.adcdId,b.adnm,b.parentId from AppGetReg a left join ADCDInfo b on a.adcdId=b.Id where a.adcdId is not null and RIGHT(b.adcd, 11)!= '00000000000' "; if (AdcdHelper.GetByAdcdRole(request.adcd) == "省级") { return(GetProvinceList(request.adcd, request.adcdName, db)); //userSql += " and a.adcd like '33%'"; //appSql += " and b.adcd like '33%'"; } if (AdcdHelper.GetByAdcdRole(request.adcd) == "市级") { return(GetCityList(request.adcd, request.adcdName, db)); } if (AdcdHelper.GetByAdcdRole(request.adcd) == "县级") { return(GetCountryList(request.adcd, request.adcdName, db)); //userSql += " and a.adcd like '" + request.adcd.Substring(0, 6) + "%'"; //appSql += " and b.adcd like '" + request.adcd.Substring(0, 6) + "%'"; } if (AdcdHelper.GetByAdcdRole(request.adcd) == "镇级") { return(GetTownList(request.adcd, request.adcdName, db)); //userSql += " and a.adcd like '" + request.adcd.Substring(0, 9) + "%'"; //appSql += " and b.adcd like '" + request.adcd.Substring(0, 9) + "%'"; } if (request.adcdName != null && request.adcdName != "") { userSql += " and b.adnm like '%" + request.adcdName + "%'"; appSql += " and b.adnm like '%" + request.adcdName + "%'"; } userSql += " group by a.adcd,a.adcdId,b.adnm,b.parentId order by a.adcdId"; appSql += " group by b.adcd,a.adcdId,b.adnm,b.parentId order by a.adcdId"; List <SelectSumAppUserList> allList = db.SqlList <SelectSumAppUserList>(userSql); List <SelectSumAppUserList> appList = db.SqlList <SelectSumAppUserList>(appSql); return(GetSumAppUserList(allList, appList, request.adcd)); } }
public List <SumMessagePersonReadModel> GetMessageReadStateListSum(RouteGetMessageReadStateListSum model, IDbConnection db) { //县级 List <SumMessagePersonReadTypeModel> countryMessageList = db.SqlList <SumMessagePersonReadTypeModel>("exec SumCountryMessageReadTable '" + model.warnEventId + "'"); List <SumMessagePersonReadModel> sendList = db.SqlList <SumMessagePersonReadModel>(" select distinct a.Id,parentId,adnm,adcd as ReciveAdcd,b.SendMessage from ADCDInfo a right join AppSendMessage b on a.adcd = b.SendAdcd and b.SendAdcd = b.ReciveAdcd where adcd like '" + model.adcd.Substring(0, 6) + "%' and b.AppWarnEventId = '" + model.warnEventId + "' order by id"); List <SumMessagePersonReadModel> resList = db.SqlList <SumMessagePersonReadModel>("select Id,parentId,adnm,adcd as reciveAdcd from ADCDInfo where adcd like '" + model.adcd.Substring(0, 6) + "%' order by id"); //将排序以后的县级的父亲节点id变为0 if (resList != null) { resList[0].parentId = 0; } int i = 0; foreach (var item in resList) { if (AdcdHelper.GetByAdcdRole(item.reciveAdcd) == "镇级") { item.parentId = 0; } item.noReadCount = countryMessageList.FindAll(x => x.reciveAdcd == item.reciveAdcd && x.readtype == 0).Sum(x => x.messageCount); item.readCount = countryMessageList.FindAll(x => x.reciveAdcd == item.reciveAdcd && x.readtype == 1).Sum(x => x.messageCount); var sendMessage = sendList.Find(x => x.reciveAdcd == item.reciveAdcd); if (sendMessage != null) { item.sendMessage = countryMessageList.FindLast(x => x.reciveAdcd == item.reciveAdcd).sendMessage; } else { item.sendMessage = "<span style='color:red'>未进行转发</span>"; } i++; } return(resList); }
//任务列表 public ActionResult AppWarnList() { ViewData["adcd"] = adcd; ViewData["role"] = AdcdHelper.GetByAdcdRole(adcd); return(View()); }
public ActionResult AppNoRegister(string adcd) { ViewData["adcd"] = adcd; ViewData["role"] = AdcdHelper.GetByAdcdRole(adcd); return(View()); }
public ActionResult CheckUser() { ViewData["adcd"] = adcd; ViewData["role"] = AdcdHelper.GetByAdcdRole(adcd); return(View()); }
/// <summary> /// 获取大事件的列表 /// </summary> /// <param name="request"></param> /// <returns></returns> public BsTableDataSource <AppSumEventModel> GetSumEventUI(RouteSearchEventModel request) { using (var db = DbFactory.Open()) { string role = AdcdHelper.GetByAdcdRole(adcd); List <AppSumTownModel> townList = db.SqlList <AppSumTownModel>("select a.SendMessageByUserName,a.ReceiveDateTime,a.SendMessage, a.AppWarnEventId, b.adnm, b.adcd from AppSendMessage a left join ADCDInfo b on a.SendAdcd = b.adcd where a.SendAdcd = '" + adcd + "' and a.SendMessagePhone = a.ReceiveUserPhone "); var whereLamda = db.From <AppWarnEvent>(); whereLamda.LeftJoin <AppWarnEvent, ADCDInfo>((x, y) => x.adcd == y.adcd); if (role == "省级") { if (request.CityAdcd == null) { whereLamda.And(x => x.adcd.StartsWith("33")); } else { whereLamda.And(x => x.adcd.StartsWith(request.CityAdcd.Substring(0, 4))); } } if (role == "市级") { whereLamda.And(x => x.adcd.StartsWith(adcd.Substring(0, 4))); } if (role == "县级") { whereLamda.And(x => x.adcd.StartsWith(adcd.Substring(0, 6))); } if (request.CountryAdcd != null) { whereLamda.And(x => x.adcd == request.CountryAdcd); } //whereLamda.And(x => x.StartTime>=Convert.ToDateTime(DateTime.Now.ToString("yyyy-01-01"))); if (!string.IsNullOrEmpty(request.EventName)) { whereLamda.And(x => x.EventName.Contains(request.EventName)); } whereLamda.OrderByDescending(x => x.StartTime); var total = db.Count(whereLamda); var townTotal = townList.Count(); var PageSize = request.PageSize == 0 ? 15 : request.PageSize; var PageIndex = request.PageIndex == 0 ? 0 : (request.PageIndex) * PageSize; whereLamda.Limit(PageIndex, PageSize); townList.Skip(PageSize * (PageIndex - 1)).Take(PageSize); var list = db.Select <AppSumEventModel>(whereLamda); if (role == "镇级") { total = townTotal; list = new List <AppSumEventModel>(); if (!string.IsNullOrEmpty(request.EventName)) { townList = townList.FindAll(x => x.sendMessage.Contains(request.EventName)); } foreach (var item in townList) { AppSumEventModel model = new AppSumEventModel(); model.Id = item.appWarnEventId; model.adcd = item.adcd; model.adnm = item.adnm; model.EventName = item.sendMessage; model.StartTime = item.receiveDateTime; model.UserName = item.sendMessageByUserName; list.Add(model); } } return(new BsTableDataSource <AppSumEventModel> { total = total, rows = list }); } }