From 7692a76a1fea24a7ab2f4353fab563cf4e23b734 Mon Sep 17 00:00:00 2001 From: liangkun Date: Fri, 24 Dec 2021 11:21:35 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=95=99=E5=B8=88=E6=88=90=E7=BB=A9?= =?UTF-8?q?=E5=8D=95=E7=94=9F=E6=88=90=E5=A2=9E=E5=8A=A0=E6=A0=A1=E5=8C=BA?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EADateArrange/EADateArrangeService.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EADateArrange/EADateArrangeService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EADateArrange/EADateArrangeService.cs index 53e7d68bf..3350aba60 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EADateArrange/EADateArrangeService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EADateArrange/EADateArrangeService.cs @@ -328,18 +328,18 @@ and s.Academicyearno='" + entity.AcademicYearNo + "' and s.Semester='" + entity. //dyy:20190722 //初始化教师成绩单提交表 string sql3 = @"insert into EmpReportCard -(Id, LessonNo, LessonName, ClassNo, ClassName, EmpNo, EmpName, AcademicYearNo, Semester,LessonSortNo, CreateTime, ElectronicStatus, ElectronicTime, PaperStatus, PaperTime) -select NEWID(),LessonNo,LessonName,ClassNo,ClassName,EmpNo,EmpName,AcademicYearNo,Semester,LessonSortNo,GETDATE(),0,null,0,null from +(Id, LessonNo, LessonName, ClassNo, ClassName, EmpNo, EmpName, AcademicYearNo, Semester,LessonSortNo, CreateTime, ElectronicStatus, ElectronicTime, PaperStatus, PaperTime,F_SchoolId) +select NEWID(),LessonNo,LessonName,ClassNo,ClassName,EmpNo,EmpName,AcademicYearNo,Semester,LessonSortNo,GETDATE(),0,null,0,null,F_SchoolId from ( -select distinct s.LessonNo,s.LessonName,s.TeachClassNo as ClassNo,c.ClassName,s.EmpNo,e.EmpName,s.AcademicYearNo,s.Semester,s.LessonSortNo +select distinct s.LessonNo,s.LessonName,s.TeachClassNo as ClassNo,c.ClassName,s.EmpNo,e.EmpName,s.AcademicYearNo,s.Semester,s.LessonSortNo,s.F_SchoolId from stuscore s left join classinfo c on s.teachclassno=c.classno left join empinfo e on s.empno=e.empno where s.lessonsortno='1' ) as bb where bb.EmpNo not in -(select a.EmpNo from EmpReportCard a where a.AcademicYearNo=bb.AcademicYearNo and a.Semester=bb.Semester and a.LessonNo=bb.LessonNo and a.ClassNo=bb.ClassNo and a.LessonSortNo=bb.LessonSortNo and a.LessonSortNo='1' -and a.Academicyearno='" + entity.AcademicYearNo + "' and a.Semester='" + entity.Semester + "') and bb.AcademicYearNo='" + entity.AcademicYearNo + "' and bb.Semester='" + entity.Semester + "' order by bb.EmpNo"; +(select a.EmpNo from EmpReportCard a where a.AcademicYearNo=bb.AcademicYearNo and a.Semester=bb.Semester and a.LessonNo=bb.LessonNo and a.ClassNo=bb.ClassNo and a.LessonSortNo=bb.LessonSortNo and a.LessonSortNo='1' and a.F_SchoolId=bb.F_SchoolId +and a.Academicyearno='" + entity.AcademicYearNo + "' and a.Semester='" + entity.Semester + "') and bb.AcademicYearNo='" + entity.AcademicYearNo + "' and bb.Semester='" + entity.Semester + "' and bb.F_SchoolId='"+entity.F_SchoolId+"' order by bb.EmpNo"; BaseRepository("CollegeMIS").ExecuteBySql(sql3); } //选修课 @@ -364,17 +364,17 @@ and s.Academicyearno='" + entity.AcademicYearNo + "' and s.Semester='" + entity. //初始化教师成绩单提交表【选修课】 string sql3OfElective = @"insert into EmpReportCard -(Id, LessonNo, LessonName, EmpNo, EmpName, AcademicYearNo, Semester,LessonSortNo, LessonSection, ClassRoomNo, ClassRoomName, CreateTime, ElectronicStatus, ElectronicTime, PaperStatus, PaperTime) -select NEWID(),LessonNo,LessonName,EmpNo,EmpName,AcademicYearNo,Semester,LessonSortNo, LessonSection, ClassRoomNo, ClassRoomName,GETDATE(),0,null,0,null from +(Id, LessonNo, LessonName, EmpNo, EmpName, AcademicYearNo, Semester,LessonSortNo, LessonSection, ClassRoomNo, ClassRoomName, CreateTime, ElectronicStatus, ElectronicTime, PaperStatus, PaperTime,F_SchoolId) +select NEWID(),LessonNo,LessonName,EmpNo,EmpName,AcademicYearNo,Semester,LessonSortNo, LessonSection, ClassRoomNo, ClassRoomName,GETDATE(),0,null,0,null,F_SchoolId from ( -select distinct s.LessonNo,s.LessonName,s.EmpNo,e.EmpName,s.AcademicYearNo,s.Semester,s.LessonSortNo,s.LessonSection,s.ClassRoomNo,s.ClassRoomName +select distinct s.LessonNo,s.LessonName,s.EmpNo,e.EmpName,s.AcademicYearNo,s.Semester,s.LessonSortNo,s.LessonSection,s.ClassRoomNo,s.ClassRoomName,s.F_SchoolId from stuscore s left join empinfo e on s.empno=e.empno where s.lessonsortno='2' ) as bb where bb.EmpNo not in -(select a.EmpNo from EmpReportCard a where a.AcademicYearNo=bb.AcademicYearNo and a.Semester=bb.Semester and a.LessonNo=bb.LessonNo and a.LessonSection=bb.LessonSection and a.ClassRoomNo=bb.ClassRoomNo and a.LessonSortNo=bb.LessonSortNo and a.LessonSortNo='2' -and a.Academicyearno='" + entity.AcademicYearNo + "' and a.Semester='" + entity.Semester + "') and bb.AcademicYearNo='" + entity.AcademicYearNo + "' and bb.Semester='" + entity.Semester + "' order by bb.EmpNo"; +(select a.EmpNo from EmpReportCard a where a.AcademicYearNo=bb.AcademicYearNo and a.Semester=bb.Semester and a.LessonNo=bb.LessonNo and a.LessonSection=bb.LessonSection and a.ClassRoomNo=bb.ClassRoomNo and a.LessonSortNo=bb.LessonSortNo and a.LessonSortNo='2' and a.F_SchoolId=bb.F_SchoolId +and a.Academicyearno='" + entity.AcademicYearNo + "' and a.Semester='" + entity.Semester + "') and bb.AcademicYearNo='" + entity.AcademicYearNo + "' and bb.Semester='" + entity.Semester + "' and bb.F_SchoolId='"+entity.F_SchoolId+"' order by bb.EmpNo"; BaseRepository("CollegeMIS").ExecuteBySql(sql3OfElective); } } From efcdc7ded77599c489ff245c78d05b4fc40c20cf Mon Sep 17 00:00:00 2001 From: liangkun Date: Fri, 24 Dec 2021 14:28:47 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A4=A9=E6=B0=94=E9=A2=84=E6=8A=A5?= =?UTF-8?q?=E6=94=B9=E9=98=BF=E5=85=8B=E8=8B=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Learun.Application.Web/Views/Home/AdminDefault.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDefault.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDefault.cshtml index be143f306..d56004641 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDefault.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDefault.cshtml @@ -16,7 +16,7 @@ 经典风格
- +
@*
From 5d576573e2f49d37ac4edd0f65d50a8bb88f88cb Mon Sep 17 00:00:00 2001 From: liangkun Date: Fri, 24 Dec 2021 16:56:46 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=85=AC=E5=91=8A?= =?UTF-8?q?=E5=B8=A6=E6=B5=81=E7=A8=8B=E5=8A=9F=E8=83=BD=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/NoticeController.cs | 201 +---------------- .../LR_OAModule/Views/Notice/FormFlow.js | 81 +++++-- .../LR_OAModule/Views/Notice/FormFlowView.js | 12 +- .../Views/Department/Index.js | 4 +- .../Learun.Application.OA/News/NewsEntity.cs | 2 +- .../Learun.Application.OA/News/NewsService.cs | 4 + .../Learun.Application.WorkFlow.csproj | 5 + .../NodeMethod/OA_NewsMethod.cs | 205 ++++++++++++++++++ 8 files changed, 290 insertions(+), 224 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 692204a20..765af67ac 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 @@ -30,14 +30,7 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers public class NoticeController : MvcControllerBase { private NoticeIBLL noticeIBLL = new NoticeBLL(); - private WeChatConfigIBLL weChatConfigIbll = new WeChatConfigBLL(); - private WeChatTempletIBLL weChatTempletIbll = new WeChatTempletBLL(); - private UserIBLL userIbll = new UserBLL(); - private UserRelationIBLL userRelationIBLL = new UserRelationBLL(); private DataItemIBLL dataItemIbll = new DataItemBLL(); - private DepartmentIBLL departmentIbll = new DepartmentBLL(); - private Sys_InformationPushIBLL sys_InformationPushIBLL = new Sys_InformationPushBLL(); - private MessageRindIBLL messageRindIBLL = new MessageRindBLL(); private DepartmentReleasePermissionsIBLL departmentReleasePermissionsIbll = new DepartmentReleasePermissionsBLL(); @@ -318,113 +311,12 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers { entity.F_NewsContent = WebHelper.HtmlEncode(entity.F_NewsContent); noticeIBLL.SaveEntity(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); - } - } + /// /// 删除表单数据 @@ -438,87 +330,7 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers noticeIBLL.DeleteEntity(keyValue); return Success("删除成功!"); } - 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); - } - - } + #endregion @@ -547,11 +359,8 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers public ActionResult GetFormDataByProcessId(string processId) { NewsEntity OANewsData = noticeIBLL.GetEntityByProcessId(processId); - var jsonData = new - { - OANews = OANewsData, - }; - return Success(jsonData); + OANewsData.F_NewsContent = WebHelper.HtmlDecode(OANewsData.F_NewsContent); + return Success(OANewsData); } #endregion diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlow.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlow.js index 9088563e8..ef1686016 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlow.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlow.js @@ -61,17 +61,21 @@ var bootstrap = function ($, learun) { setFormData = function (processId) { if (!!processId) { $.lrSetForm(top.$.rootUrl + '/LR_OAModule/Notice/GetFormDataByProcessId?processId=' + processId, function (data) { - for (var id in data) { - if (!!data[id] && data[id].length > 0) { - $('#' + id).jfGridSet('refreshdata', data[id]); - } - else { - if (id == 'Sys_ReceiveFile') { - keyValue = data[id].F_DeptRelationId; - } - $('[data-table="' + id + '"]').lrSetFormData(data[id]); - } - } + $('#form').lrSetFormData(data); + setTimeout(function () { + ue.setContent(data.F_NewsContent); + }, 100); + //for (var id in data) { + // if (!!data[id] && data[id].length > 0) { + // $('#' + id).jfGridSet('refreshdata', data[id]); + // } + // else { + // if (id == 'Sys_ReceiveFile') { + // keyValue = data[id].F_DeptRelationId; + // } + // $('[data-table="' + id + '"]').lrSetFormData(data[id]); + // } + //} }); } } @@ -84,17 +88,62 @@ var bootstrap = function ($, learun) { }; // 保存数据 save = function (processId, callBack, i) { + + if (!$('#form').lrValidform()) { + return false; + } var formData = $('body').lrGetFormData(); if (!!processId) { formData.RProcessId = processId; } - $.lrSaveForm(top.$.rootUrl + '/LR_OAModule/Notice/SaveForm?keyValue=' + keyValue, formData, function (res) { - // 保存成功后才回调 - if (!!callBack) { - callBack(res, formData, i); + + learun.clientdata.getAsync('dataItem', + { + key: $("#F_CategoryId").lrselectGet(), + code: 'NoticeCategory', + callback: function (_data) { + $("#F_Category").val(_data.text); + + 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) { + // 保存成功后才回调 + if (!!callBack) { + callBack(res, formData, i); + } + }); + } + }); + //$.lrSaveForm(top.$.rootUrl + '/LR_OAModule/Notice/SaveForm?keyValue=' + keyValue, formData, function (res) { + // // 保存成功后才回调 + // if (!!callBack) { + // callBack(res, formData, i); + // } + //}); + }; + acceptClick = function (callBack) { + if (!$('#form').lrValidform()) { + return false; + } + learun.clientdata.getAsync('dataItem', { + key: $("#F_CategoryId").lrselectGet(), + code: 'NoticeCategory', + callback: function (_data) { + $("#F_Category").val(_data.text); + + 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) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); } }); - }; + } page.init(); } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlowView.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlowView.js index 8b193d7b5..35efdc7f0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlowView.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/FormFlowView.js @@ -60,14 +60,10 @@ var bootstrap = function ($, learun) { setFormData = function (processId, param, callback) { if (!!processId) { $.lrSetForm(top.$.rootUrl + '/LR_OAModule/Notice/GetFormDataByProcessId?processId=' + processId, function (data) { - for (var id in data) { - if (!!data[id] && data[id].length > 0) { - $('#' + id).jfGridSet('refreshdata', data[id]); - } - else { - $('[data-table="' + id + '"]').lrSetFormData(data[id]); - } - } + $('#form').lrSetFormData(data); + setTimeout(function () { + ue.setContent(data.F_NewsContent); + }, 100); }); } callback && callback(); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OrganizationModule/Views/Department/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OrganizationModule/Views/Department/Index.js index 6ea627085..35509d693 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OrganizationModule/Views/Department/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OrganizationModule/Views/Department/Index.js @@ -84,9 +84,7 @@ var bootstrap = function ($, learun) { url: top.$.rootUrl + '/Permission/DepartmentReleasePermissions/Index?departmentId=' + keyValue, width: 700, height: 400, - callBack: function (id) { - return top[id].acceptClick(refreshGirdData); - } + btn:null }); } }); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsEntity.cs index 4c8f43f31..d42108a92 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsEntity.cs @@ -225,7 +225,7 @@ namespace Learun.Application.OA this.F_CreateDate = DateTime.Now; this.F_ReleaseTime = DateTime.Now; this.F_DeleteMark = 0; - this.F_EnabledMark = 1; + this.F_EnabledMark = 0; this.F_PV = 0; UserInfo userInfo = LoginUserInfo.Get(); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsService.cs index 7423b6429..891e3aa9e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsService.cs @@ -184,6 +184,10 @@ namespace Learun.Application.OA if (null != newEntity) { newEntity.F_Status = status.ToString(); + if (status==2) + { + newEntity.F_EnabledMark = 1; + } } this.BaseRepository().Update(newEntity); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Learun.Application.WorkFlow.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Learun.Application.WorkFlow.csproj index baf0102bf..612208381 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Learun.Application.WorkFlow.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Learun.Application.WorkFlow.csproj @@ -77,6 +77,7 @@ + @@ -220,6 +221,10 @@ {81c03609-ae0d-414c-829b-16b990487add} Learun.Ioc + + {ad556b7a-e0d1-41bd-9d5b-18f8502e9f33} + Learun.Util.Operat + {cf8ae293-88ab-436c-9720-a8386ba5d7b7} Learun.Util diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/NodeMethod/OA_NewsMethod.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/NodeMethod/OA_NewsMethod.cs index d3c1fbcf9..8afd64804 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/NodeMethod/OA_NewsMethod.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/NodeMethod/OA_NewsMethod.cs @@ -1,9 +1,19 @@ using System; using System.Collections.Generic; +using System.Configuration; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Web; +using Learun.Application.Base.AuthorizeModule; +using Learun.Application.Base.SystemModule; using Learun.Application.OA; +using Learun.Application.Organization; +using Learun.Application.TwoDevelopment.EducationalAdministration; +using Learun.Application.TwoDevelopment.LR_Desktop; +using Learun.Util.Operat; +using Microsoft.AspNet.SignalR.Client; +using Newtonsoft.Json; namespace Learun.Application.WorkFlow { @@ -11,16 +21,211 @@ namespace Learun.Application.WorkFlow { NewsIBLL newsIBLL=new NewsBLL(); + private NoticeIBLL noticeIBLL = new NoticeBLL(); + private WeChatConfigIBLL weChatConfigIbll = new WeChatConfigBLL(); + private WeChatTempletIBLL weChatTempletIbll = new WeChatTempletBLL(); + private UserIBLL userIbll = new UserBLL(); + private UserRelationIBLL userRelationIBLL = new UserRelationBLL(); + private Sys_InformationPushIBLL sys_InformationPushIBLL = new Sys_InformationPushBLL(); + private MessageRindIBLL messageRindIBLL = new MessageRindBLL(); public void Execute(WfMethodParameter parameter) { if (parameter.code == "agree") { newsIBLL.ChangeStatusByProcessId(parameter.processId, 2); + var entity = noticeIBLL.GetEntityByProcessId(parameter.processId); + //推送通知 + //读取信息推送管理-通知公告推送(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); + } + }); + } } else { newsIBLL.ChangeStatusByProcessId(parameter.processId, 0); } } + + 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); + } + + } } }