diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Sys_InformationPushController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Sys_InformationPushController.cs index 0a252e8d8..6077e45b7 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Sys_InformationPushController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Sys_InformationPushController.cs @@ -110,12 +110,22 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers Sys_InformationPushEntity entity = strEntity.ToObject(); if (string.IsNullOrEmpty(keyValue)) { + var aa = sys_InformationPushIBLL.GetEntityByPushItem(entity.PushItem); + if (aa != null) + { + return Fail("推送项目已存在!"); + } entity.CreateUserId = userInfo.userId; entity.CreateUserName = userInfo.realName; entity.CreateTime = DateTime.Now; } else { + var aa = sys_InformationPushIBLL.GetEntityByPushItem(entity.PushItem); + if (aa != null && aa.Id != keyValue) + { + return Fail("推送项目已存在!"); + } entity.ModifyUserId = userInfo.userId; entity.ModifyUserName = userInfo.realName; entity.ModifyTime = DateTime.Now; diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Sys_InformationPush/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Sys_InformationPush/Index.js index 843cd11ec..8be05dd24 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Sys_InformationPush/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Sys_InformationPush/Index.js @@ -102,7 +102,7 @@ var bootstrap = function ($, learun) { url: top.$.rootUrl + '/EducationalAdministration/Sys_InformationPush/GetPageList', headData: [ { - label: "推送项目", name: "PushItem", width: 150, align: "left", + label: "推送项目", name: "PushItem", width: 200, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('dataItem', { key: value, 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 cbfd94505..86d99a122 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 @@ -15,6 +15,7 @@ using Learun.Util.Operat; using Microsoft.AspNet.SignalR.Client; using Microsoft.Owin.Logging; using Newtonsoft.Json; +using Learun.Application.TwoDevelopment.EducationalAdministration; namespace Learun.Application.Web.Areas.LR_OAModule.Controllers { @@ -34,6 +35,7 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers private UserRelationIBLL userRelationIBLL = new UserRelationBLL(); private DataItemIBLL dataItemIbll = new DataItemBLL(); private DepartmentIBLL departmentIbll = new DepartmentBLL(); + private Sys_InformationPushIBLL sys_InformationPushIBLL = new Sys_InformationPushBLL(); #region 视图功能 /// /// 管理页面 @@ -285,8 +287,13 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers { entity.F_NewsContent = WebHelper.HtmlEncode(entity.F_NewsContent); noticeIBLL.SaveEntity(keyValue, entity); - //推送微信 - Task.Run(async () => { await DoWeixinPush(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 () => diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/MpManagementApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/MpManagementApi.cs index 0edce2901..48fe25f2e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/MpManagementApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/MpManagementApi.cs @@ -32,6 +32,7 @@ namespace Learun.Application.WebApi private RoleIBLL roleIBLL = new RoleBLL(); private UserRelationIBLL userRelationIBLL = new UserRelationBLL(); private UserIBLL userIBLL = new UserBLL(); + private Sys_InformationPushIBLL sys_InformationPushIBLL = new Sys_InformationPushBLL(); /// @@ -59,7 +60,7 @@ namespace Learun.Application.WebApi var departmentList = mpEntity.MPDepartment.Split(',').ToList(); var UserList = new List(); var title = ""; - + foreach (var departmentId in departmentList) { var entityList = userIBLL.GetUserByDepartmentId(departmentId).Where(a => roleUserList.Contains(a.F_UserId) && !hasUploadUsers.Contains(a.F_UserId)).ToList(); @@ -75,19 +76,40 @@ namespace Learun.Application.WebApi if (mpEntity.MPType == 0) { title = "内控检查"; - FeiXinPush(title, "nk", UserList); + //读取信息推送管理-内控管理推送(06)的配置 + var informationPushEntity = sys_InformationPushIBLL.GetEntityByPushItem("06"); + if (informationPushEntity != null && informationPushEntity.Status == true) + { + //飞星推送 + FeiXinPush(title, "nk", UserList); + } + } else if (mpEntity.MPType == 1) { title = "绩效跟踪"; - FeiXinPush(title, "jx", UserList); + //读取信息推送管理-内控管理推送(06)的配置 + var informationPushEntity = sys_InformationPushIBLL.GetEntityByPushItem("06"); + if (informationPushEntity != null && informationPushEntity.Status == true) + { + //飞星推送 + FeiXinPush(title, "jx", UserList); + } + } else { title = "质量目标"; - FeiXinPush(title, "zl", UserList); + //读取信息推送管理-内控管理推送(06)的配置 + var informationPushEntity = sys_InformationPushIBLL.GetEntityByPushItem("06"); + if (informationPushEntity != null && informationPushEntity.Status == true) + { + //飞星推送 + FeiXinPush(title, "zl", UserList); + } + } - + } @@ -95,7 +117,7 @@ namespace Learun.Application.WebApi return Success("推送成功"); } - public void FeiXinPush(string title,string code,List UserList) + public void FeiXinPush(string title, string code, List UserList) { //飞星推送 Task.Run(async () => @@ -104,7 +126,7 @@ namespace Learun.Application.WebApi { var hubProxy = hubConnection.CreateHubProxy("SignalRHub"); await hubConnection.Start(); - await hubProxy.Invoke("PushAnnouncement", "", title+"材料上传", title, code, string.Join(",", UserList.Select(m => m.F_UserId)), ""); + await hubProxy.Invoke("PushAnnouncement", "", title + "材料上传", title, code, string.Join(",", UserList.Select(m => m.F_UserId)), ""); } }); OperateLogModel operateLogModel = new OperateLogModel(); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Message/LR_StrategyInfo/LR_StrategyInfoBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Message/LR_StrategyInfo/LR_StrategyInfoBLL.cs index 4472b18d3..6469a2655 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Message/LR_StrategyInfo/LR_StrategyInfoBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Message/LR_StrategyInfo/LR_StrategyInfoBLL.cs @@ -12,6 +12,7 @@ using Learun.Application.Base.SystemModule; using Learun.Application.TwoDevelopment.LR_Desktop; using Microsoft.AspNet.SignalR.Client; using Newtonsoft.Json; +using Learun.Application.TwoDevelopment.EducationalAdministration; namespace Learun.Application.Message { @@ -27,9 +28,10 @@ namespace Learun.Application.Message private LR_StrategyInfoService lR_StrategyInfoService = new LR_StrategyInfoService(); private UserRelationIBLL userRelationIBLL = new UserRelationBLL(); private UserIBLL userIBLL = new UserBLL(); - WeChatConfigIBLL weChatConfigIbll=new WeChatConfigBLL(); + WeChatConfigIBLL weChatConfigIbll = new WeChatConfigBLL(); private WeChatTempletIBLL weChatTempletIbll = new WeChatTempletBLL(); private IMSysUserIBLL iMSysUserIBLL = new IMSysUserBLL(); + private Sys_InformationPushIBLL sys_InformationPushIBLL = new Sys_InformationPushBLL(); #region 获取数据 @@ -37,7 +39,7 @@ namespace Learun.Application.Message /// 获取列表数据 /// /// - public IEnumerable GetList( string queryJson ) + public IEnumerable GetList(string queryJson) { try { @@ -187,7 +189,7 @@ namespace Learun.Application.Message { try { - return lR_StrategyInfoService.ExistStrategyCode(keyValue,F_StrategyCode); + return lR_StrategyInfoService.ExistStrategyCode(keyValue, F_StrategyCode); } catch (Exception ex) { @@ -299,7 +301,12 @@ namespace Learun.Application.Message EmailSend(content, list); break; case "2"://微信,调用微信发送方法 - PushWeixin(list,content, taskMsgEntity); + //读取信息推送管理-消息策略待办事项提醒推送(07)的配置 + var informationPushEntity = sys_InformationPushIBLL.GetEntityByPushItem("07"); + if (informationPushEntity != null && informationPushEntity.Status == true) + { + PushWeixin(list, content, taskMsgEntity); + } break; case "3": //短信,调用短信发送方法 SMSSend(content, list); @@ -308,7 +315,12 @@ namespace Learun.Application.Message IMSend(content, list); break; case "5": //飞星发送 - PushFeixin(list, content, taskMsgEntity); + //读取信息推送管理-消息策略待办事项提醒推送(07)的配置 + var informationPushEntity2 = sys_InformationPushIBLL.GetEntityByPushItem("07"); + if (informationPushEntity2 != null && informationPushEntity2.Status == true) + { + PushFeixin(list, content, taskMsgEntity); + } break; default: break; @@ -341,7 +353,7 @@ namespace Learun.Application.Message /// 消息内容 /// 用户列表信息 /// - public void EmailSend(string content,List list) + public void EmailSend(string content, List list) { try { @@ -402,14 +414,14 @@ namespace Learun.Application.Message /// /// /// - public void PushWeixin(List needpostuserlist,string content, NWFTaskMsgEntity taskentity) + public void PushWeixin(List needpostuserlist, string content, NWFTaskMsgEntity taskentity) { try { var WeChatConfigentity = weChatConfigIbll.GetEnableEntity(); string appid = WeChatConfigentity.APPId; string secret = WeChatConfigentity.secret; - var wechatemplete = weChatTempletIbll.GetWeChatTemplateEntityByCodeConfigId(WeChatConfigentity.ID,"task"); + 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); @@ -420,7 +432,7 @@ namespace Learun.Application.Message logEntity.F_OperateType = "weixin"; logEntity.F_OperateAccount = "system"; logEntity.F_ExecuteResult = 200; - logEntity.F_ExecuteResultJson ="调取微信tokken:"+ appid+ secret+ weixintasktempid+"responsejson"+ responsejson; + logEntity.F_ExecuteResultJson = "调取微信tokken:" + appid + secret + weixintasktempid + "responsejson" + responsejson; logEntity.F_Description = "PC端"; logEntity.WriteLog(); foreach (UserEntity userinfo in needpostuserlist) @@ -443,12 +455,12 @@ namespace Learun.Application.Message "\"first\": {\"value\":\"待办事项提醒\",\"color\":\"#173177\"}," + "\"keyword1\":{\"value\":\"流程待办 \",\"color\":\"#173177\"}," + "\"keyword2\": {\"value\":\"" + taskentity.F_Title + "\",\"color\":\"#173177\"}," + - "\"keyword3\": {\"value\":\""+ taskentity.F_NodeName + "\",\"color\":\"#173177\"}," + - "\"keyword4\": {\"value\":\""+ content+ "\",\"color\":\"#173177\"}" + + "\"keyword3\": {\"value\":\"" + taskentity.F_NodeName + "\",\"color\":\"#173177\"}," + + "\"keyword4\": {\"value\":\"" + content + "\",\"color\":\"#173177\"}" + "}" + "}"; string pushresult = Util.HttpMethods.HttpPost("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + access_token, jsondata); - logEntity.F_ExecuteResultJson = "推送完成:"+jsondata + pushresult; + logEntity.F_ExecuteResultJson = "推送完成:" + jsondata + pushresult; logEntity.WriteLog(); } } @@ -496,7 +508,7 @@ namespace Learun.Application.Message /// 用户列表 /// public void SMSSend(string content, List list) - { + { } /// @@ -508,7 +520,8 @@ namespace Learun.Application.Message public void IMSend(string content, List list) { List userList = new List(); - foreach (var user in list) { + foreach (var user in list) + { userList.Add(user.F_UserId); } iMSysUserIBLL.SendMsg("IMSystem", userList, content); @@ -522,7 +535,7 @@ namespace Learun.Application.Message /// 主键 /// /// - + public string F_Id { get; set; } /// /// 流程进程主键 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/SYS_SendMessage/SYS_SendMessageService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/SYS_SendMessage/SYS_SendMessageService.cs index adecf9e7a..03001fee6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/SYS_SendMessage/SYS_SendMessageService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/SYS_SendMessage/SYS_SendMessageService.cs @@ -233,24 +233,30 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration this.BaseRepository().Insert(receiveMessageEntity); } this.BaseRepository().Commit(); - //微信推送 - try + //读取信息推送管理-内部邮件推送(03)的配置 + var informationPushEntity = this.BaseRepository().FindEntity(x => x.PushItem == "03"); + if (informationPushEntity != null && informationPushEntity.Status == true) { - PushWeixin(userInfos, messageentity.TITLE); - } - catch (Exception e) - { - } - //飞星推送 - Task.Run(async () => - { - using (var hubConnection = new HubConnection(ConfigurationManager.AppSettings["CommunicationServeraddress"])) + //微信推送 + try + { + PushWeixin(userInfos, messageentity.TITLE); + } + catch (Exception e) { - var hubProxy = hubConnection.CreateHubProxy("SignalRHub"); - await hubConnection.Start(); - await hubProxy.Invoke("PushAnnouncement", messageentity.MESSAGEID, messageentity.TITLE, Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(messageentity.CONTENTS)).Length < 20 ? Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(messageentity.CONTENTS)) : Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(messageentity.CONTENTS)).Substring(0, 20), "mail", string.Join(",", userInfos.Select(m => m.F_UserId)), ""); } - }); + //飞星推送 + Task.Run(async () => + { + using (var hubConnection = new HubConnection(ConfigurationManager.AppSettings["CommunicationServeraddress"])) + { + var hubProxy = hubConnection.CreateHubProxy("SignalRHub"); + await hubConnection.Start(); + await hubProxy.Invoke("PushAnnouncement", messageentity.MESSAGEID, messageentity.TITLE, Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(messageentity.CONTENTS)).Length < 20 ? Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(messageentity.CONTENTS)) : Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(messageentity.CONTENTS)).Substring(0, 20), "mail", string.Join(",", userInfos.Select(m => m.F_UserId)), ""); + } + }); + } + } catch (Exception ex) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_InformationPush/Sys_InformationPushBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_InformationPush/Sys_InformationPushBLL.cs index c34ab799d..a19b5e599 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_InformationPush/Sys_InformationPushBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_InformationPush/Sys_InformationPushBLL.cs @@ -67,6 +67,30 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + /// + /// 获取Sys_InformationPush表实体数据 + /// + /// 主键 + /// + public Sys_InformationPushEntity GetEntityByPushItem(string pushItem) + { + try + { + return sys_InformationPushService.GetEntityByPushItem(pushItem); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + #endregion #region 提交数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_InformationPush/Sys_InformationPushIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_InformationPush/Sys_InformationPushIBLL.cs index 317dd7f3f..87c55dccc 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_InformationPush/Sys_InformationPushIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_InformationPush/Sys_InformationPushIBLL.cs @@ -27,6 +27,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 主键 /// Sys_InformationPushEntity GetSys_InformationPushEntity(string keyValue); + + /// + /// 获取Sys_InformationPush表实体数据 + /// + /// 主键 + /// + Sys_InformationPushEntity GetEntityByPushItem(string pushItem); #endregion #region 提交数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_InformationPush/Sys_InformationPushService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_InformationPush/Sys_InformationPushService.cs index 3581660a2..8390b5fd5 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_InformationPush/Sys_InformationPushService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_InformationPush/Sys_InformationPushService.cs @@ -41,7 +41,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration var queryParam = queryJson.ToJObject(); // 虚拟参数 var dp = new DynamicParameters(new { }); - return this.BaseRepository().FindList(strSql.ToString(),dp, pagination); + return this.BaseRepository().FindList(strSql.ToString(), dp, pagination); } catch (Exception ex) { @@ -80,6 +80,30 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + /// + /// 获取Sys_InformationPush表实体数据 + /// + /// 主键 + /// + public Sys_InformationPushEntity GetEntityByPushItem(string pushItem) + { + try + { + return this.BaseRepository().FindEntity(x => x.PushItem == pushItem); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + #endregion #region 提交数据 @@ -92,7 +116,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration { try { - this.BaseRepository().Delete(t=>t.Id == keyValue); + this.BaseRepository().Delete(t => t.Id == keyValue); } catch (Exception ex) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_ReceiveFile/Sys_ReceiveFileService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_ReceiveFile/Sys_ReceiveFileService.cs index 168a30fbe..6f41043e2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_ReceiveFile/Sys_ReceiveFileService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_ReceiveFile/Sys_ReceiveFileService.cs @@ -412,24 +412,30 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration Sys_SendFile.ReceiverId = stringBuilder.ToString().TrimEnd(','); db.Update(Sys_SendFile); db.Commit(); - //微信推送 - try + //读取信息推送管理-公文下发推送(02)的配置 + var informationPushEntity = this.BaseRepository().FindEntity(x => x.PushItem == "02"); + if (informationPushEntity != null && informationPushEntity.Status == true) { - PushWeixin(teacherlist, Sys_SendFile.Title); - } - catch (Exception e) - { - } - //飞星推送 - Task.Run(async () => - { - using (var hubConnection = new HubConnection(ConfigurationManager.AppSettings["CommunicationServeraddress"])) + //微信推送 + try + { + PushWeixin(teacherlist, Sys_SendFile.Title); + } + catch (Exception e) { - var hubProxy = hubConnection.CreateHubProxy("SignalRHub"); - await hubConnection.Start(); - await hubProxy.Invoke("PushAnnouncement", Sys_SendFile.SenderId, Sys_SendFile.Title, Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Sys_SendFile.Contents)).Length < 20 ? Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Sys_SendFile.Contents)) : Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Sys_SendFile.Contents)).Substring(0, 20), "sendfile", string.Join(",", teacherlist.Select(m => m.F_UserId)), ""); } - }); + //飞星推送 + Task.Run(async () => + { + using (var hubConnection = new HubConnection(ConfigurationManager.AppSettings["CommunicationServeraddress"])) + { + var hubProxy = hubConnection.CreateHubProxy("SignalRHub"); + await hubConnection.Start(); + await hubProxy.Invoke("PushAnnouncement", Sys_SendFile.SenderId, Sys_SendFile.Title, Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Sys_SendFile.Contents)).Length < 20 ? Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Sys_SendFile.Contents)) : Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Sys_SendFile.Contents)).Substring(0, 20), "sendfile", string.Join(",", teacherlist.Select(m => m.F_UserId)), ""); + } + }); + } + } catch (Exception ex) { @@ -507,24 +513,30 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration Sys_ReceiveDocument.ReceiverId = stringBuilder.ToString().TrimEnd(','); db.Update(Sys_ReceiveDocument); db.Commit(); - //微信推送 - try + //读取信息推送管理-公文下发推送(02)的配置 + var informationPushEntity = this.BaseRepository().FindEntity(x => x.PushItem == "02"); + if (informationPushEntity != null && informationPushEntity.Status == true) { - PushWeixin(teacherlist, Sys_ReceiveDocument.RTitle); - } - catch (Exception e) - { - } - //飞星推送 - Task.Run(async () => - { - using (var hubConnection = new HubConnection(ConfigurationManager.AppSettings["CommunicationServeraddress"])) + //微信推送 + try + { + PushWeixin(teacherlist, Sys_ReceiveDocument.RTitle); + } + catch (Exception e) { - var hubProxy = hubConnection.CreateHubProxy("SignalRHub"); - await hubConnection.Start(); - await hubProxy.Invoke("PushAnnouncement", Sys_ReceiveDocument.SenderId, Sys_ReceiveDocument.RTitle, Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Sys_ReceiveDocument.RContent)).Length < 20 ? Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Sys_ReceiveDocument.RContent)) : Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Sys_ReceiveDocument.RContent)).Substring(0, 20), "sendfile", string.Join(",", teacherlist.Select(m => m.F_UserId)), ""); } - }); + //飞星推送 + Task.Run(async () => + { + using (var hubConnection = new HubConnection(ConfigurationManager.AppSettings["CommunicationServeraddress"])) + { + var hubProxy = hubConnection.CreateHubProxy("SignalRHub"); + await hubConnection.Start(); + await hubProxy.Invoke("PushAnnouncement", Sys_ReceiveDocument.SenderId, Sys_ReceiveDocument.RTitle, Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Sys_ReceiveDocument.RContent)).Length < 20 ? Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Sys_ReceiveDocument.RContent)) : Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Sys_ReceiveDocument.RContent)).Substring(0, 20), "sendfile", string.Join(",", teacherlist.Select(m => m.F_UserId)), ""); + } + }); + } + } catch (Exception ex) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_SendFile/Sys_SendFileService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_SendFile/Sys_SendFileService.cs index 0b85f8889..9050ce8ee 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_SendFile/Sys_SendFileService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Sys_SendFile/Sys_SendFileService.cs @@ -362,24 +362,30 @@ on a.F_UserId=b.F_UserId where b.F_ObjectId in(" + string.Join(",", ppostid) + Sys_SendFile.SendTime = DateTime.Now; db.Update(Sys_SendFile); db.Commit(); - //微信推送 - try + //读取信息推送管理-公文下发推送(02)的配置 + var informationPushEntity = this.BaseRepository().FindEntity(x => x.PushItem == "02"); + if (informationPushEntity != null && informationPushEntity.Status == true) { - PushWeixin(needpostuserlist, Sys_SendFile.Title); - } - catch (Exception e) - { - } - //飞星推送 - Task.Run(async () => - { - using (var hubConnection = new HubConnection(ConfigurationManager.AppSettings["CommunicationServeraddress"])) + //微信推送 + try + { + PushWeixin(needpostuserlist, Sys_SendFile.Title); + } + catch (Exception e) { - var hubProxy = hubConnection.CreateHubProxy("SignalRHub"); - await hubConnection.Start(); - await hubProxy.Invoke("PushAnnouncement", Sys_SendFile.SenderId, Sys_SendFile.Title, Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Sys_SendFile.Contents)).Length < 20 ? Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Sys_SendFile.Contents)) : Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Sys_SendFile.Contents)).Substring(0, 20), "sendfile", string.Join(",", needpostuserlist.Select(m => m.F_UserId)), ""); } - }); + //飞星推送 + Task.Run(async () => + { + using (var hubConnection = new HubConnection(ConfigurationManager.AppSettings["CommunicationServeraddress"])) + { + var hubProxy = hubConnection.CreateHubProxy("SignalRHub"); + await hubConnection.Start(); + await hubProxy.Invoke("PushAnnouncement", Sys_SendFile.SenderId, Sys_SendFile.Title, Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Sys_SendFile.Contents)).Length < 20 ? Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Sys_SendFile.Contents)) : Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Sys_SendFile.Contents)).Substring(0, 20), "sendfile", string.Join(",", needpostuserlist.Select(m => m.F_UserId)), ""); + } + }); + } + } catch (Exception ex) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Thermography/ThermographyService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Thermography/ThermographyService.cs index 36c72003c..4c58663af 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Thermography/ThermographyService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Thermography/ThermographyService.cs @@ -403,12 +403,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration LogEntity logEntity = new LogEntity(); logEntity.F_LogId = Guid.NewGuid().ToString(); logEntity.F_Module = "Thermography"; - logEntity.F_ExecuteResultJson = "Thermography Status="+entity.Status; + logEntity.F_ExecuteResultJson = "Thermography Status=" + entity.Status; logEntity.WriteLog(); //体温异常 if (entity.Status == "2") { - //微信推送 try { var stuModel = this.BaseRepository("CollegeMIS").FindEntity(x => x.StuNo == entity.PersonBeingMeasured); @@ -420,7 +419,14 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration logEntity.F_ExecuteResultJson = "Thermography stuModelStuNo=" + stuModel.StuNo; logEntity.WriteLog(); var title = string.Format("{0}({1})", stuModel.StuName, stuModel.StuNo); - PushWeixin(title); + //读取信息推送管理-班级自诊打卡体温异常学生推送(05)的配置 + var informationPushEntity = this.BaseRepository().FindEntity(x => x.PushItem == "05"); + if (informationPushEntity != null && informationPushEntity.Status == true) + { + //微信推送 + PushWeixin(title); + } + } } catch (Exception e) @@ -532,14 +538,20 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration //体温异常 if (entity.Status == "2") { - //微信推送 try { var stuModel = db.FindEntity(x => x.StuNo == entity.PersonBeingMeasured); if (stuModel != null) { var title = string.Format("{0}({1})", stuModel.StuName, stuModel.StuNo); - PushWeixin(title); + //读取信息推送管理-班级自诊打卡体温异常学生推送(05)的配置 + var informationPushEntity = this.BaseRepository().FindEntity(x => x.PushItem == "05"); + if (informationPushEntity != null && informationPushEntity.Status == true) + { + //微信推送 + PushWeixin(title); + } + } } catch (Exception e) diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/WfTask/WfTaskService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/WfTask/WfTaskService.cs index a2e8a9731..3af3f06fe 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/WfTask/WfTaskService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/WfTask/WfTaskService.cs @@ -12,6 +12,7 @@ using Learun.Application.Organization; using Learun.Application.TwoDevelopment.LR_Desktop; using Microsoft.AspNet.SignalR.Client; using Newtonsoft.Json; +using Learun.Application.TwoDevelopment.EducationalAdministration; namespace Learun.Application.WorkFlow { @@ -492,13 +493,20 @@ namespace Learun.Application.WorkFlow wfTaskEntity.Create(); this.BaseRepository().Insert(wfTaskEntity); - try - { - PushWeixin(wfTaskEntity); - } - catch (Exception e) + //读取信息推送管理-待办流程推送(04)的配置 + var informationPushEntity = this.BaseRepository().FindEntity(x => x.PushItem == "04"); + if (informationPushEntity != null && informationPushEntity.Status == true) { + //微信推送 + try + { + PushWeixin(wfTaskEntity); + } + catch (Exception e) + { + } } + } } else @@ -588,9 +596,9 @@ namespace Learun.Application.WorkFlow if (userinfo != null && !string.IsNullOrEmpty(userinfo.OpenIdForWeixin) && processinstance != null) { //执行推送任务 - if (!string.IsNullOrEmpty(appid) && !string.IsNullOrEmpty(secret)&& !string.IsNullOrEmpty(weixintaskurl)&&!string.IsNullOrEmpty(weixintasktempid)) + if (!string.IsNullOrEmpty(appid) && !string.IsNullOrEmpty(secret) && !string.IsNullOrEmpty(weixintaskurl) && !string.IsNullOrEmpty(weixintasktempid)) { - + if (!string.IsNullOrEmpty(responsejson)) { var weixintokenobj = JsonConvert.DeserializeObject(responsejson); @@ -598,7 +606,7 @@ namespace Learun.Application.WorkFlow { string access_token = weixintokenobj.access_token; string jsondata = "{\"touser\":\"" + userinfo.OpenIdForWeixin + "\"," + - "\"template_id\":\""+ weixintasktempid + "\"," + + "\"template_id\":\"" + weixintasktempid + "\"," + "\"url\":\"" + weixintaskurl + "\"," + "\"data\":{" + "\"first\": {\"value\":\"" + processinstance.F_SchemeName + "\",\"color\":\"#173177\"}," + @@ -609,7 +617,7 @@ namespace Learun.Application.WorkFlow //"\"remark\":{\"value\":\"欢迎再次购买!\",\"color\":\"#173177\"}" + "}" + "}"; - string pushresult= Util.HttpMethods.HttpPost("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + access_token, jsondata); + string pushresult = Util.HttpMethods.HttpPost("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + access_token, jsondata); } } }