From 94ea60f0ce0b11d39703b5879a0368fdd2370add Mon Sep 17 00:00:00 2001 From: liangkun Date: Mon, 27 Dec 2021 14:23:29 +0800 Subject: [PATCH 1/4] =?UTF-8?q?ssosystem=20index=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E6=8B=96=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() From 92194f9181e57691f03162e98e7ee99021092c24 Mon Sep 17 00:00:00 2001 From: liangkun Date: Mon, 27 Dec 2021 15:34:12 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E9=A3=9E=E6=89=AC=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=85=AC=E5=91=8A=E9=87=8D=E5=8F=A0=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/Home/AdminDesktopTop.cshtml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktopTop.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktopTop.cshtml index 4993ddef0..fc3f7fb2b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktopTop.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktopTop.cshtml @@ -617,6 +617,13 @@ border-bottom: 1px solid #E5E5E5; cursor: pointer } + .lr-list-line .text{ + width: 75%; + overflow: hidden; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } .lr-list-line .date { position: absolute; From e4dc8f6d7582c5bc59194cd6a1a5704089b226c1 Mon Sep 17 00:00:00 2001 From: liangkun Date: Mon, 27 Dec 2021 17:00:09 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=85=AC=E5=91=8A?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=9B=B4=E6=8E=A5=E5=8F=91=E5=B8=83=E4=B8=8D?= =?UTF-8?q?=E8=B5=B0=E6=B5=81=E7=A8=8B=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/NoticeController.cs | 201 +++++++++++++++++- .../Areas/LR_OAModule/Views/Notice/Form.js | 2 +- .../Learun.Application.OA/Notice/NoticeBLL.cs | 19 ++ .../Notice/NoticeIBLL.cs | 1 + .../Notice/NoticeService.cs | 30 +++ 5 files changed, 251 insertions(+), 2 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/NoticeController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/NoticeController.cs index 765af67ac..0b992dc31 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/NoticeController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/NoticeController.cs @@ -31,6 +31,12 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers { private NoticeIBLL noticeIBLL = new NoticeBLL(); private DataItemIBLL dataItemIbll = new DataItemBLL(); + private Sys_InformationPushIBLL sys_InformationPushIBLL = new Sys_InformationPushBLL(); + private MessageRindIBLL messageRindIBLL = new MessageRindBLL(); + private WeChatConfigIBLL weChatConfigIbll = new WeChatConfigBLL(); + private WeChatTempletIBLL weChatTempletIbll = new WeChatTempletBLL(); + private UserIBLL userIbll = new UserBLL(); + private UserRelationIBLL userRelationIBLL = new UserRelationBLL(); private DepartmentReleasePermissionsIBLL departmentReleasePermissionsIbll = new DepartmentReleasePermissionsBLL(); @@ -316,7 +322,200 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers return Success("保存成功!"); } - + [HttpPost, ValidateAntiForgeryToken, AjaxOnly, ValidateInput(false)] + public ActionResult SaveFormAndSubmit(string keyValue, NewsEntity entity) + { + entity.F_NewsContent = WebHelper.HtmlEncode(entity.F_NewsContent); + noticeIBLL.SaveFormAndSubmit(keyValue, entity); + //推送通知 + //读取信息推送管理-通知公告推送(01)的配置 + var informationPushEntity = sys_InformationPushIBLL.GetEntityByPushItem("01"); + if (informationPushEntity != null && informationPushEntity.Status == true) + { + //推送微信 + Task.Run(async () => { await DoWeixinPush(entity); }); + } + if (entity.F_IsSendFX.HasValue && entity.F_IsSendFX == true) + { + Task.Run(async () => + { + using (var hubConnection = new HubConnection(ConfigurationManager.AppSettings["CommunicationServeraddress"])) + { + var hubProxy = hubConnection.CreateHubProxy("SignalRHub"); + await hubConnection.Start(); + await hubProxy.Invoke("PushAnnouncement", entity.F_NewsId, entity.F_FullHead, Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(entity.F_NewsContent)).Length < 20 ? Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(entity.F_NewsContent)) : Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(entity.F_NewsContent)).Substring(0, 20), "news", entity.F_SendPostId, entity.F_SendDeptId); + } + }); + } + return Success("保存成功!"); + } + Task DoWeixinPush(NewsEntity entity) + { + //微信推送 + try + { + var allteacherlist = userIbll.GetAllList().Where(m => + m.F_DeleteMark != 1 && m.F_EnabledMark == 1 && m.F_Description == "教师"); + var userralationlist = userRelationIBLL.GetUserIdList("2"); + var needpostuserlist = new List(); + if (!string.IsNullOrEmpty(entity.F_SendDeptId)) + { + if (!entity.F_SendDeptId.Contains(",")) + { + var departteacherlist = allteacherlist.Where(m => entity.F_SendDeptId == m.F_DepartmentId); + needpostuserlist.AddRange(departteacherlist.ToList()); + if (!string.IsNullOrEmpty(entity.F_SendPostId)) + { + var newpostuserlist = new List(); + foreach (var uuitem in needpostuserlist) + { + var postids = userralationlist?.Count(m => m.F_UserId == uuitem.F_UserId && entity.F_SendPostId.Contains(m.F_ObjectId)); + if (postids > 0) + { + newpostuserlist.Add(uuitem); + } + } + needpostuserlist = newpostuserlist; + } + } + else + { + foreach (var senddeptid in entity.F_SendDeptId.Split(',')) + { + var departteacherlist = allteacherlist.Where(m => senddeptid == m.F_DepartmentId); + needpostuserlist.AddRange(departteacherlist.ToList()); + if (!string.IsNullOrEmpty(entity.F_SendPostId)) + { + var newpostuserlist = new List(); + foreach (var uuitem in needpostuserlist) + { + var postids = userralationlist?.Count(m => m.F_UserId == uuitem.F_UserId && entity.F_SendPostId.Contains(m.F_ObjectId)); + if (postids > 0) + { + newpostuserlist.Add(uuitem); + } + } + needpostuserlist = newpostuserlist; + } + } + } + } + else + { + if (!string.IsNullOrEmpty(entity.F_SendPostId)) + { + //岗位下发 + var newpostuserlist = new List(); + foreach (var uuitem in allteacherlist) + { + var postids = userralationlist?.Count(m => m.F_UserId == uuitem.F_UserId && entity.F_SendPostId.Contains(m.F_ObjectId)); + if (postids > 0) + { + newpostuserlist.Add(uuitem); + } + } + needpostuserlist = newpostuserlist; + } + else + { + //全员下发 + needpostuserlist = allteacherlist.ToList(); + } + } + PushWeixin(needpostuserlist, entity.F_FullHead); + + //消息提醒表 + PushMessageRemind(needpostuserlist, entity); + return Task.CompletedTask; + } + catch (Exception e) + { + return Task.FromException(e); + } + } + + public void PushWeixin(List needpostuserlist, string title) + { + var WeChatConfigentity = weChatConfigIbll.GetEnableEntity(); + string appid = WeChatConfigentity.APPId; + string secret = WeChatConfigentity.secret; + var wechatemplete = weChatTempletIbll.GetWeChatTemplateEntityByCodeConfigId(WeChatConfigentity.ID, "task"); + string weixintaskurl = wechatemplete.TUrl; + string weixintasktempid = wechatemplete.TempId; + var responsejson = Util.HttpMethods.HttpGet("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + secret); + + OperateLogModel operateLogModel = new OperateLogModel(); + operateLogModel.title = title; + operateLogModel.type = OperationType.Other; + operateLogModel.url = "NoticeController"; + operateLogModel.sourceObjectId = "002"; + operateLogModel.sourceContentJson = responsejson; + OperatorHelper.Instance.WriteOperateLog(operateLogModel); + + foreach (UserEntity userinfo in needpostuserlist) + { + if (userinfo != null && !string.IsNullOrEmpty(userinfo.OpenIdForWeixin)) + { + //执行推送任务 + if (!string.IsNullOrEmpty(appid) && !string.IsNullOrEmpty(secret) && !string.IsNullOrEmpty(weixintaskurl) && !string.IsNullOrEmpty(weixintasktempid)) + { + if (!string.IsNullOrEmpty(responsejson)) + { + var weixintokenobj = JsonConvert.DeserializeObject(responsejson); + if (string.IsNullOrEmpty(weixintokenobj.errcode)) + { + string access_token = weixintokenobj.access_token; + string jsondata = "{\"touser\":\"" + userinfo.OpenIdForWeixin + "\"," + + "\"template_id\":\"" + weixintasktempid + "\"," + + "\"url\":\"" + weixintaskurl + "\"," + + "\"data\":{" + + "\"first\": {\"value\":\"您有新的未读通知公告\",\"color\":\"#173177\"}," + + "\"keyword1\":{\"value\":\"未读通知公告\",\"color\":\"#173177\"}," + + "\"keyword2\": {\"value\":\"" + title + "\",\"color\":\"#173177\"}," + + "\"keyword3\": {\"value\":\"待查看\",\"color\":\"#173177\"}," + + "\"keyword4\": {\"value\":\"您有新的未读通知公告【" + title + "】\",\"color\":\"#173177\"}" + + "}" + + "}"; + string pushresult = Util.HttpMethods.HttpPost("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + access_token, jsondata); + + operateLogModel.title = title; + operateLogModel.type = OperationType.Other; + operateLogModel.url = "NoticeController"; + operateLogModel.sourceObjectId = "002"; + operateLogModel.sourceContentJson = pushresult; + OperatorHelper.Instance.WriteOperateLog(operateLogModel); + } + } + } + } + } + } + + /// + /// 消息提醒 + /// + /// + /// + public void PushMessageRemind(List needpostuserlist, NewsEntity model) + { + foreach (UserEntity userinfo in needpostuserlist) + { + MessageRemindEntity entity = new MessageRemindEntity(); + entity.ReceiptId = userinfo.F_UserId; + entity.ReceiptName = userinfo.F_RealName; + entity.SenderId = model.F_CreateUserId; + entity.SenderName = model.F_CreateUserName; + entity.TheTitle = "通知公告"; + entity.TheContent = model.F_FullHead; + entity.InstanceId = model.F_NewsId; + entity.ConnectionUrl = "/Utility/ListContentIndex?id="; + entity.SendTime = DateTime.Now; + entity.ReadSigns = false; + messageRindIBLL.SaveEntity("", entity); + } + + } + /// /// 删除表单数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/Form.js index 82580f68f..2ad166355 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/Form.js @@ -56,7 +56,7 @@ var bootstrap = function ($, learun) { var postData = $('#form').lrGetFormData(keyValue); postData["F_NewsContent"] = ue.getContent(null, null, true); - $.lrSaveForm(top.$.rootUrl + '/LR_OAModule/Notice/SaveForm?keyValue=' + keyValue, postData, function (res) { + $.lrSaveForm(top.$.rootUrl + '/LR_OAModule/Notice/SaveFormAndSubmit?keyValue=' + keyValue, postData, function (res) { // 保存成功后才回调 if (!!callBack) { callBack(); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeBLL.cs index 5f56621d9..2c40de9f2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeBLL.cs @@ -181,6 +181,25 @@ namespace Learun.Application.OA } } + public void SaveFormAndSubmit(string keyValue, NewsEntity entity) + { + try + { + noticeService.SaveFormAndSubmit(keyValue, entity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + #endregion } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeIBLL.cs index c42b9fa5a..379dae654 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeIBLL.cs @@ -55,5 +55,6 @@ namespace Learun.Application.OA void ChangeStatusById(string keyValue, int i, string processId); NewsEntity GetEntityByProcessId(string processId); + void SaveFormAndSubmit(string keyValue, NewsEntity entity); } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeService.cs index 7222f1de3..88da9ca7f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeService.cs @@ -218,5 +218,35 @@ namespace Learun.Application.OA } } } + + public void SaveFormAndSubmit(string keyValue, NewsEntity entity) + { + try + { + entity.F_TypeId = 2; + if (!string.IsNullOrEmpty(keyValue)) + { + entity.Modify(keyValue); + this.BaseRepository().Update(entity); + } + else + { + entity.Create(); + entity.F_EnabledMark = 1; + this.BaseRepository().Insert(entity); + } + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } } } From 5459d7bfb5759df847420e91141ad3c8ef7bcf8a Mon Sep 17 00:00:00 2001 From: liangkun Date: Tue, 28 Dec 2021 11:49:26 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=BA=E4=BA=8B?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=B8=8B=E6=8B=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EducationalAdministration/Views/EmpInfo/Form.js | 7 +++++-- .../EducationalAdministration/Views/EmpInfo/Index.js | 9 ++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/EmpInfo/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/EmpInfo/Form.js index c57720db2..ef6d678c7 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/EmpInfo/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/EmpInfo/Form.js @@ -135,8 +135,11 @@ var bootstrap = function ($, learun) { //$('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' }); //$('#PostRank').lrDataSourceSelect({ code: 'BCdTitleOfTechPost', value: 'titleoftechpostno', text: 'titleoftechpost' }); $('#Photo').lrUploader(); - $('#HighestRecord').lrDataSourceSelect({ code: 'BCdCultureDegree', value: 'culturedegreeno', text: 'culturedegree' }); - $('#ObtainWayOfHighestRecord').lrDataItemSelect({ code: 'ObtainWay' }); + //$('#HighestRecord').lrDataSourceSelect({ code: 'BCdCultureDegree', value: 'culturedegreeno', text: 'culturedegree' }); + $('#HighestRecord').lrDataItemSelect({ code: 'HighestEducation'}); + + //$('#ObtainWayOfHighestRecord').lrDataItemSelect({ code: 'ObtainWay' }); + $('#ObtainWayOfHighestRecord').lrDataItemSelect({ code: 'HighestEducationAcquisitionMode' }); $('#InitialDegree').lrDataSourceSelect({ code: 'BCdDegree', value: 'degreeno', text: 'degreename' }); $('#ObtainWayOfInitialDegree').lrDataItemSelect({ code: 'ObtainWayOfDegree' }); $('#ObtainWayOfHighestDegree').lrDataItemSelect({ code: 'ObtainWayOfDegree' }); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/EmpInfo/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/EmpInfo/Index.js index f1079443f..a233a937a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/EmpInfo/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/EmpInfo/Index.js @@ -50,7 +50,7 @@ var bootstrap = function ($, learun) { //政治面貌 $('#PartyFaceNo').lrDataSourceSelect({ code: 'BCdPartyFace', value: 'partyfaceno', text: 'partyface' }); //最高学历 - $('#HighestRecord').lrDataSourceSelect({ code: 'BCdCultureDegree', value: 'culturedegreeno', text: 'culturedegree' }); + $('#HighestRecord').lrDataItemSelect({ code: 'HighestEducation'}); //民族 @@ -464,12 +464,11 @@ var bootstrap = function ($, learun) { { label: "最高学历", name: "HighestRecord", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { - learun.clientdata.getAsync('custmerData', { - url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'BCdCultureDegree', + learun.clientdata.getAsync('dataItem', { key: value, - keyId: 'culturedegreeno', + code: 'HighestEducation', callback: function (_data) { - callback(_data['culturedegree']); + callback(_data.text); } }); }