From fe2f4cd58d5d69b0ef682cb7f4eae0ae50cdce26 Mon Sep 17 00:00:00 2001 From: liangkun Date: Mon, 27 Dec 2021 14:23:29 +0800 Subject: [PATCH] =?UTF-8?q?ssosystem=20index=E6=94=B9=E4=B8=BA=E6=8B=96?= =?UTF-8?q?=E6=8B=BD=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/SSOSystemController.cs | 315 ++++++++++++++---- 1 file changed, 253 insertions(+), 62 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs index 0685d5bdc..414447cd0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs @@ -113,6 +113,7 @@ namespace Learun.Application.Web.Controllers #endregion public ActionResult Index() { + //判断登录状态码 string account = ""; if (!Request.Headers["account"].IsEmpty()) { @@ -122,63 +123,48 @@ namespace Learun.Application.Web.Controllers var result = helper.IsOnLine(account); if (result.stateCode != 1) { - return Redirect("NoLogin"); } - var userinfo = LoginUserInfo.Get(); - var flowType = dataItemIBLL.GetDetailList("FlowSort", ""); - var flowList = wfSchemeIBLL.GetWfSchemeStart().ToList(); - var allCount = 0; - foreach (var flow in flowType) - { - var count = flowList.Count(a => a.F_Category == flow.F_ItemName); - flow.FlowCount = count; - allCount += count; - - } - - ViewBag.AllCount = allCount; - ViewBag.FlowType = flowType; - ViewBag.FlowList = JsonConvert.SerializeObject(flowList); - - - List list = new List(); - List offenused = LogBLL.GetGroupLog(userinfo.userId).Select(m => m.F_Module).Take(20).ToList(); - var data = moduleIBLL.GetModuleList().Where(m => m.F_EnabledMark == 1 && m.F_DeleteMark == 0 && !string.IsNullOrEmpty(m.F_UrlAddress)); - foreach (var oitem in offenused) - { - ModuleEntity fod = data.FirstOrDefault(m => m.F_FullName == oitem); - if (fod != null) - { - list.Add(fod); - } - } - //常用服务 - ViewBag.Offenused = list.Take(12); - //内部邮件 + //登录用户 + var userInfo = LoginUserInfo.Get(); + ViewBag.UserId = userInfo.userId; + //桌面管理表、卡片块排序管理表增加默认数据 + sSO_Drag_DesktopManageIBLL.AddDefaultData(userInfo.userId, "one"); + //获取桌面、卡片块排序列表 + ViewBag.DesktopList = sSO_Drag_DesktopManageIBLL.GetListByModelCode(userInfo.userId, "one").OrderByDescending(x => x.DefaultFlag).ThenBy(x => x.Sort).ThenBy(x => x.CreateDate); + ViewBag.DesktopListStr = JsonConvert.SerializeObject(ViewBag.DesktopList); + //分页查询条件设置 Pagination paginationobj = new Pagination() { rows = 5, page = 1, sidx = "readflag asc,SENDTIME desc ", sord = "desc" }; - var maildata = sYS_ReceiveMessageIBLL.GetPageList(paginationobj, "{\"userId\":\"" + userinfo.userId + "\"}"); + //邮件-收件箱 + var maildata = sYS_ReceiveMessageIBLL.GetPageList(paginationobj, "{\"userId\":\"" + userInfo.userId + "\"}"); + var maildataAll = sYS_ReceiveMessageIBLL.GetList("{\"userId\":\"" + userInfo.userId + "\"}"); ViewBag.LanMail = maildata; - ViewBag.LanMailUnRead = maildata.Count(m => m.READFLAG == 0); - //办公事项 - paginationobj.sidx = "F_CreateDate"; - //ViewBag.TaskList = wfTaskIBLL.GetActiveList(userinfo, paginationobj, "{}"); - ViewBag.TaskList = nWFProcessIBLL.GetMyTaskPageList(userinfo, paginationobj, "{}"); - + ViewBag.LanMailStr = JsonConvert.SerializeObject(ViewBag.LanMail); + ViewBag.LanMailUnReadCount = maildataAll.Count(m => m.READFLAG == 0); + //邮件-已发送 + paginationobj.sidx = "SENDTIME desc"; + var mailsenddata = sYS_SendMessageIBLL.GetPageList(paginationobj, "{\"userId\":\"" + userInfo.userId + "\"}"); + var mailsenddataAll = sYS_SendMessageIBLL.GetList2("{\"userId\":\"" + userInfo.userId + "\"}"); + ViewBag.LanMailSend = mailsenddata; + ViewBag.LanMailSendStr = JsonConvert.SerializeObject(ViewBag.LanMailSend); + //来往邮件数量 + ViewBag.LanMailTotalNum = maildataAll.Count() + mailsenddataAll.Count(); + //公文 + paginationobj.sidx = "SendTime"; + ViewBag.ReceiveFileList = sys_ReceiveFileIBLL.GetPageList(paginationobj, "{\"ReceiverId\":\"" + userInfo.userId + "\"}"); + ViewBag.ReceiveFileListStr = JsonConvert.SerializeObject(ViewBag.ReceiveFileList); //公告 List outnewslist = new List(); - - paginationobj.rows = 100; - var newsList = newsIBLL.GetList("", userinfo.userId); + var newsList = newsIBLL.GetList("", userInfo.userId); foreach (var newsitemEntity in newsList) { if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId)) { - if (!string.IsNullOrEmpty(userinfo.postIds)) + if (!string.IsNullOrEmpty(userInfo.postIds)) { - if (userinfo.postIds.Contains(",")) + if (userInfo.postIds.Contains(",")) { - foreach (var postid in userinfo.postIds.Split(',')) + foreach (var postid in userInfo.postIds.Split(',')) { if (newsitemEntity.F_SendPostId.Contains(postid)) { @@ -189,7 +175,7 @@ namespace Learun.Application.Web.Controllers } else { - if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds)) + if (newsitemEntity.F_SendPostId.Contains(userInfo.postIds)) { outnewslist.Add(newsitemEntity); } @@ -200,7 +186,7 @@ namespace Learun.Application.Web.Controllers { if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId)) { - if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId)) + if (newsitemEntity.F_SendDeptId.Contains(userInfo.departmentId)) { outnewslist.Add(newsitemEntity); } @@ -211,28 +197,233 @@ namespace Learun.Application.Web.Controllers } } } - //公文 - paginationobj.sidx = "SendTime"; - paginationobj.rows = 5; - ViewBag.ReceiveFileList = sys_ReceiveFileIBLL.GetPageList(paginationobj, "{\"ReceiverId\":\"" + userinfo.userId + "\"}"); - ViewBag.NewsList = outnewslist; - //底部办公事项 - ViewBag.FunctionTypeList = perm_FunctionTypeIBLL.GetListByUserId(userinfo.userId).OrderBy(m => m.FTOrder).Take(7); - var userfunctionlist = perm_FunctionIBLL.GetListByUserId(userinfo.userId); - foreach (var ufitem in userfunctionlist) + ViewBag.NewsList = outnewslist.Take(5); + ViewBag.NewsListStr = JsonConvert.SerializeObject(ViewBag.NewsList); + //宣传报道 + var newsListOfxuanchuan = outnewslist.Where(x => x.F_CategoryId == "15").Take(4); + foreach (var item in newsListOfxuanchuan) { - if (!string.IsNullOrEmpty(ufitem.FImage)) + if (!string.IsNullOrEmpty(item.F_NewsImage)) { - var imagePath = annexesFileIBLL.GetEntityByFolderId(ufitem.FImage)?.F_FilePath; + var imagePath = annexesFileIBLL.GetEntityByFolderId(item.F_NewsImage)?.F_FilePath; if (!string.IsNullOrEmpty(imagePath)) { - ufitem.FImage = imagePath.Substring(imagePath.IndexOf("Resource") - 1); + item.F_NewsImage = imagePath.Substring(imagePath.IndexOf("Resource")); + } + else + { + item.F_NewsImage = "/Content/images/DragSSO/noLogin.png"; } } } - ViewBag.FunctionList = userfunctionlist; - ViewBag.PublicKey = ConfigurationManager.AppSettings["SSOPublicSecret"]; - return View(); + ViewBag.NewsListOfxuanchuan = newsListOfxuanchuan; + ViewBag.NewsListOfxuanchuanStr = JsonConvert.SerializeObject(ViewBag.NewsListOfxuanchuan); + //智慧教育 + ViewBag.NewsListOfzhihui = outnewslist.Where(x => x.F_CategoryId == "16").Take(6); + ViewBag.NewsListOfzhihuiStr = JsonConvert.SerializeObject(ViewBag.NewsListOfzhihui); + //专题推荐 + var newsListOfzhuanti = outnewslist.Where(x => x.F_CategoryId == "17").Take(7); + foreach (var item in newsListOfzhuanti) + { + if (!string.IsNullOrEmpty(item.F_NewsImage)) + { + var imagePath = annexesFileIBLL.GetEntityByFolderId(item.F_NewsImage)?.F_FilePath; + if (!string.IsNullOrEmpty(imagePath)) + { + item.F_NewsImage = imagePath.Substring(imagePath.IndexOf("Resource")); + } + else + { + item.F_NewsImage = "/Content/images/DragSSO/noLogin.png"; + } + } + } + ViewBag.NewsListOfzhuanti = newsListOfzhuanti; + ViewBag.NewsListOfzhuantiStr = JsonConvert.SerializeObject(ViewBag.NewsListOfzhuanti); + //办公事项-待办任务 + paginationobj.sidx = "F_CreateDate"; + paginationobj.rows = 4; + var taskListAll = nWFProcessIBLL.GetMyTaskPageList(userInfo, "{}"); + ViewBag.TaskList = nWFProcessIBLL.GetMyTaskPageList(userInfo, paginationobj, "{}"); + ViewBag.TaskListStr = JsonConvert.SerializeObject(ViewBag.TaskList); + ViewBag.TaskTotalNum = taskListAll.Count(); + //办公事项-已办任务 + var finishTaskListAll = nWFProcessIBLL.GetMyFinishTaskPageList(userInfo, "{}"); + ViewBag.FinishTaskList = nWFProcessIBLL.GetMyFinishTaskPageList(userInfo, paginationobj, "{}"); + ViewBag.FinishTaskListStr = JsonConvert.SerializeObject(ViewBag.FinishTaskList); + ViewBag.FinishTaskTotalNum = finishTaskListAll.Count(); + //办公事项-我发起的 + var myListAll = nWFProcessIBLL.GetMyPageList(userInfo.userId, "{}"); + ViewBag.MyList = nWFProcessIBLL.GetMyPageList(userInfo.userId, paginationobj, "{}"); + ViewBag.MyListStr = JsonConvert.SerializeObject(ViewBag.MyList); + ViewBag.MyListTotalNum = myListAll.Count(); + //常用服务 + List modulelist = new List(); + List offenused = LogBLL.GetGroupLog(userInfo.userId).Select(m => m.F_Module).Take(20).ToList(); + var moduledata = moduleIBLL.GetModuleList().Where(m => m.F_EnabledMark == 1 && m.F_DeleteMark == 0 && !string.IsNullOrEmpty(m.F_UrlAddress) && m.F_IsMenu == 1 && m.F_Target == "iframe" && !string.IsNullOrEmpty(m.F_ParentId)); + foreach (var oitem in offenused) + { + ModuleEntity fod = moduledata.FirstOrDefault(m => m.F_FullName == oitem); + if (fod != null) + { + //找父级 + if (fod.F_ParentId == "0") + { + fod.ParentName = fod.F_FullName; + fod.F_ParentId = fod.F_ModuleId; + } + else + { + var parent1 = moduleIBLL.GetModuleEntity(fod.F_ParentId); + if (parent1 != null) + { + if (parent1.F_ParentId == "0") + { + fod.ParentName = parent1.F_FullName; + fod.F_ParentId = parent1.F_ModuleId; + } + else + { + //下一级 + var parent2 = moduleIBLL.GetModuleEntity(parent1.F_ParentId); + if (parent2 != null) + { + if (parent2.F_ParentId == "0") + { + fod.ParentName = parent2.F_FullName; + fod.F_ParentId = parent2.F_ModuleId; + } + else + { + //下一级 + var parent3 = moduleIBLL.GetModuleEntity(parent2.F_ParentId); + if (parent3 != null) + { + if (parent3.F_ParentId == "0") + { + fod.ParentName = parent3.F_FullName; + fod.F_ParentId = parent3.F_ModuleId; + } + else + { + //下一级 + var parent4 = moduleIBLL.GetModuleEntity(parent3.F_ParentId); + if (parent4 != null) + { + if (parent4.F_ParentId == "0") + { + fod.ParentName = parent4.F_FullName; + fod.F_ParentId = parent4.F_ModuleId; + } + } + } + } + } + } + } + } + } + + modulelist.Add(fod); + } + } + ViewBag.OffenusedAll = modulelist; + + var mm = modulelist.GroupBy(x => x.F_ParentId).Select(x => new ModuleEntity() + { + F_ParentId = x.Key, + ParentName = x.FirstOrDefault().ParentName, + ChildrenList = x.Select(y => new ModuleEntity() + { + F_ModuleId = y.F_ModuleId, + F_FullName = y.F_FullName + }).ToList() + }).ToList(); + ViewBag.OffenusedGroup = mm; + ViewBag.OffenusedGroupStr = JsonConvert.SerializeObject(ViewBag.OffenusedGroup); + //查找服务 + List searchmodulelist = new List(); + foreach (var item in moduledata) + { + if (moduleIBLL.GetColumnList(item.F_ModuleId).Any()) + { + item.FirstLetter = Str.PinYin(item.F_FullName).Substring(0, 1); + searchmodulelist.Add(item); + } + } + ViewBag.SearchModule = searchmodulelist; + //校园总览 + //专业 + var majorData = cdMajorIBLL.GetAllList(); + ViewBag.MajorTotalNum = majorData.Count(); + //班级 + var classInfoData = classInfoIBLL.GetAllClass(); + ViewBag.ClassInfoTotalNum = classInfoData.Count(); + //学生 + var stuInfoData = stuInfoBasicIBLL.GetAllList(); + ViewBag.StuInfoTotalNum = stuInfoData.Count(); + //教师 + var teacherData = empInfoIBLL.GetAllList(); + ViewBag.TeacherTotalNum = teacherData.Count(); + //教室 + var classRoomData = classroomInfoIBLL.GetAllList(); + ViewBag.ClassRoomTotalNum = classRoomData.Count(); + //课程 + var lessonData = lessonInfoIBLL.GetAllList(); + ViewBag.LessonTotalNum = lessonData.Count(); + //专业总览 + //专业学生 + var stuByMajor = stuInfoData.GroupBy(x => x.MajorNo).Select(x => new + { + value = x.Select(y => y.StuId).Count(), + name = cdMajorIBLL.GetCdMajorEntityByMajorNo(x.Key)?.MajorName + }); + ViewBag.StuByMajorStr = JsonConvert.SerializeObject(stuByMajor); + //流程 + var flowType = dataItemIBLL.GetDetailList("FlowSort", ""); + var flowList = wfSchemeIBLL.GetWfSchemeStart().ToList(); + var allCount = 0; + foreach (var flow in flowType) + { + var count = flowList.Count(a => a.F_Category == flow.F_ItemName); + flow.FlowCount = count; + allCount += count; + + } + ViewBag.AllCount = allCount; + ViewBag.FlowType = flowType; + ViewBag.FlowList = JsonConvert.SerializeObject(flowList); + //校园一卡通余额 + ViewBag.StuSaveRecordTotalNum = 0; + var stuSaveRecordList = stuSaverecordIBLL.GetListByAccount(userInfo.account).OrderByDescending(x => x.UPLOADDATE); + if (stuSaveRecordList.Any()) + { + ViewBag.StuSaveRecordTotalNum = stuSaveRecordList.FirstOrDefault().ODDFARE; + } + //红湖付款码余额 + ViewBag.StuConsumptionTotalNum = 0; + var stuConsumptionList = stuConsumptionIBLL.GetListByAccount(userInfo.account); + if (stuConsumptionList.Any()) + { + ViewBag.StuConsumptionTotalNum = stuConsumptionList.Select(x => x.OPFARE.ToDecimal()).Sum(); + } + //常用链接 + var userfunctionlist = perm_FunctionIBLL.GetListByUserId(userInfo.userId); + var ff = userfunctionlist.GroupBy(x => x.FTName).Select(x => new Perm_FunctionEntity() + { + FTName = x.Key, + PFunctionList = x.Select(y => new Perm_FunctionEntity() + { + FId = y.FId, + FTId = y.FTId, + FName = y.FName, + UPId = DESEncrypt.Encrypt(y.FId, ConfigurationManager.AppSettings["SSOPublicSecret"]),//sysid + UserId = DESEncrypt.Encrypt(userInfo.userId, ConfigurationManager.AppSettings["SSOPublicSecret"])//openid + }).Take(8).ToList() + }); + ViewBag.FunctionList = ff; + ViewBag.FunctionListStr = JsonConvert.SerializeObject(ViewBag.FunctionList); + return View("DragModelOne"); } //public ActionResult NoLogin()