@@ -110,12 +110,22 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||||
Sys_InformationPushEntity entity = strEntity.ToObject<Sys_InformationPushEntity>(); | Sys_InformationPushEntity entity = strEntity.ToObject<Sys_InformationPushEntity>(); | ||||
if (string.IsNullOrEmpty(keyValue)) | if (string.IsNullOrEmpty(keyValue)) | ||||
{ | { | ||||
var aa = sys_InformationPushIBLL.GetEntityByPushItem(entity.PushItem); | |||||
if (aa != null) | |||||
{ | |||||
return Fail("推送项目已存在!"); | |||||
} | |||||
entity.CreateUserId = userInfo.userId; | entity.CreateUserId = userInfo.userId; | ||||
entity.CreateUserName = userInfo.realName; | entity.CreateUserName = userInfo.realName; | ||||
entity.CreateTime = DateTime.Now; | entity.CreateTime = DateTime.Now; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
var aa = sys_InformationPushIBLL.GetEntityByPushItem(entity.PushItem); | |||||
if (aa != null && aa.Id != keyValue) | |||||
{ | |||||
return Fail("推送项目已存在!"); | |||||
} | |||||
entity.ModifyUserId = userInfo.userId; | entity.ModifyUserId = userInfo.userId; | ||||
entity.ModifyUserName = userInfo.realName; | entity.ModifyUserName = userInfo.realName; | ||||
entity.ModifyTime = DateTime.Now; | entity.ModifyTime = DateTime.Now; | ||||
@@ -102,7 +102,7 @@ var bootstrap = function ($, learun) { | |||||
url: top.$.rootUrl + '/EducationalAdministration/Sys_InformationPush/GetPageList', | url: top.$.rootUrl + '/EducationalAdministration/Sys_InformationPush/GetPageList', | ||||
headData: [ | headData: [ | ||||
{ | { | ||||
label: "推送项目", name: "PushItem", width: 150, align: "left", | |||||
label: "推送项目", name: "PushItem", width: 200, align: "left", | |||||
formatterAsync: function (callback, value, row, op, $cell) { | formatterAsync: function (callback, value, row, op, $cell) { | ||||
learun.clientdata.getAsync('dataItem', { | learun.clientdata.getAsync('dataItem', { | ||||
key: value, | key: value, | ||||
@@ -15,6 +15,7 @@ using Learun.Util.Operat; | |||||
using Microsoft.AspNet.SignalR.Client; | using Microsoft.AspNet.SignalR.Client; | ||||
using Microsoft.Owin.Logging; | using Microsoft.Owin.Logging; | ||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||||
namespace Learun.Application.Web.Areas.LR_OAModule.Controllers | 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 UserRelationIBLL userRelationIBLL = new UserRelationBLL(); | ||||
private DataItemIBLL dataItemIbll = new DataItemBLL(); | private DataItemIBLL dataItemIbll = new DataItemBLL(); | ||||
private DepartmentIBLL departmentIbll = new DepartmentBLL(); | private DepartmentIBLL departmentIbll = new DepartmentBLL(); | ||||
private Sys_InformationPushIBLL sys_InformationPushIBLL = new Sys_InformationPushBLL(); | |||||
#region 视图功能 | #region 视图功能 | ||||
/// <summary> | /// <summary> | ||||
/// 管理页面 | /// 管理页面 | ||||
@@ -285,8 +287,13 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers | |||||
{ | { | ||||
entity.F_NewsContent = WebHelper.HtmlEncode(entity.F_NewsContent); | entity.F_NewsContent = WebHelper.HtmlEncode(entity.F_NewsContent); | ||||
noticeIBLL.SaveEntity(keyValue, entity); | 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) | if (entity.F_IsSendFX.HasValue && entity.F_IsSendFX == true) | ||||
{ | { | ||||
Task.Run(async () => | Task.Run(async () => | ||||
@@ -32,6 +32,7 @@ namespace Learun.Application.WebApi | |||||
private RoleIBLL roleIBLL = new RoleBLL(); | private RoleIBLL roleIBLL = new RoleBLL(); | ||||
private UserRelationIBLL userRelationIBLL = new UserRelationBLL(); | private UserRelationIBLL userRelationIBLL = new UserRelationBLL(); | ||||
private UserIBLL userIBLL = new UserBLL(); | private UserIBLL userIBLL = new UserBLL(); | ||||
private Sys_InformationPushIBLL sys_InformationPushIBLL = new Sys_InformationPushBLL(); | |||||
/// <summary> | /// <summary> | ||||
@@ -59,7 +60,7 @@ namespace Learun.Application.WebApi | |||||
var departmentList = mpEntity.MPDepartment.Split(',').ToList(); | var departmentList = mpEntity.MPDepartment.Split(',').ToList(); | ||||
var UserList = new List<UserEntity>(); | var UserList = new List<UserEntity>(); | ||||
var title = ""; | var title = ""; | ||||
foreach (var departmentId in departmentList) | foreach (var departmentId in departmentList) | ||||
{ | { | ||||
var entityList = userIBLL.GetUserByDepartmentId(departmentId).Where(a => roleUserList.Contains(a.F_UserId) && !hasUploadUsers.Contains(a.F_UserId)).ToList(); | 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) | if (mpEntity.MPType == 0) | ||||
{ | { | ||||
title = "内控检查"; | 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) | else if (mpEntity.MPType == 1) | ||||
{ | { | ||||
title = "绩效跟踪"; | title = "绩效跟踪"; | ||||
FeiXinPush(title, "jx", UserList); | |||||
//读取信息推送管理-内控管理推送(06)的配置 | |||||
var informationPushEntity = sys_InformationPushIBLL.GetEntityByPushItem("06"); | |||||
if (informationPushEntity != null && informationPushEntity.Status == true) | |||||
{ | |||||
//飞星推送 | |||||
FeiXinPush(title, "jx", UserList); | |||||
} | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
title = "质量目标"; | 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("推送成功"); | return Success("推送成功"); | ||||
} | } | ||||
public void FeiXinPush(string title,string code,List<UserEntity> UserList) | |||||
public void FeiXinPush(string title, string code, List<UserEntity> UserList) | |||||
{ | { | ||||
//飞星推送 | //飞星推送 | ||||
Task.Run(async () => | Task.Run(async () => | ||||
@@ -104,7 +126,7 @@ namespace Learun.Application.WebApi | |||||
{ | { | ||||
var hubProxy = hubConnection.CreateHubProxy("SignalRHub"); | var hubProxy = hubConnection.CreateHubProxy("SignalRHub"); | ||||
await hubConnection.Start(); | 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(); | OperateLogModel operateLogModel = new OperateLogModel(); | ||||
@@ -12,6 +12,7 @@ using Learun.Application.Base.SystemModule; | |||||
using Learun.Application.TwoDevelopment.LR_Desktop; | using Learun.Application.TwoDevelopment.LR_Desktop; | ||||
using Microsoft.AspNet.SignalR.Client; | using Microsoft.AspNet.SignalR.Client; | ||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||||
namespace Learun.Application.Message | namespace Learun.Application.Message | ||||
{ | { | ||||
@@ -27,9 +28,10 @@ namespace Learun.Application.Message | |||||
private LR_StrategyInfoService lR_StrategyInfoService = new LR_StrategyInfoService(); | private LR_StrategyInfoService lR_StrategyInfoService = new LR_StrategyInfoService(); | ||||
private UserRelationIBLL userRelationIBLL = new UserRelationBLL(); | private UserRelationIBLL userRelationIBLL = new UserRelationBLL(); | ||||
private UserIBLL userIBLL = new UserBLL(); | private UserIBLL userIBLL = new UserBLL(); | ||||
WeChatConfigIBLL weChatConfigIbll=new WeChatConfigBLL(); | |||||
WeChatConfigIBLL weChatConfigIbll = new WeChatConfigBLL(); | |||||
private WeChatTempletIBLL weChatTempletIbll = new WeChatTempletBLL(); | private WeChatTempletIBLL weChatTempletIbll = new WeChatTempletBLL(); | ||||
private IMSysUserIBLL iMSysUserIBLL = new IMSysUserBLL(); | private IMSysUserIBLL iMSysUserIBLL = new IMSysUserBLL(); | ||||
private Sys_InformationPushIBLL sys_InformationPushIBLL = new Sys_InformationPushBLL(); | |||||
#region 获取数据 | #region 获取数据 | ||||
@@ -37,7 +39,7 @@ namespace Learun.Application.Message | |||||
/// 获取列表数据 | /// 获取列表数据 | ||||
/// <summary> | /// <summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
public IEnumerable<LR_MS_StrategyInfoEntity> GetList( string queryJson ) | |||||
public IEnumerable<LR_MS_StrategyInfoEntity> GetList(string queryJson) | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
@@ -187,7 +189,7 @@ namespace Learun.Application.Message | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
return lR_StrategyInfoService.ExistStrategyCode(keyValue,F_StrategyCode); | |||||
return lR_StrategyInfoService.ExistStrategyCode(keyValue, F_StrategyCode); | |||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
@@ -299,7 +301,12 @@ namespace Learun.Application.Message | |||||
EmailSend(content, list); | EmailSend(content, list); | ||||
break; | break; | ||||
case "2"://微信,调用微信发送方法 | case "2"://微信,调用微信发送方法 | ||||
PushWeixin(list,content, taskMsgEntity); | |||||
//读取信息推送管理-消息策略待办事项提醒推送(07)的配置 | |||||
var informationPushEntity = sys_InformationPushIBLL.GetEntityByPushItem("07"); | |||||
if (informationPushEntity != null && informationPushEntity.Status == true) | |||||
{ | |||||
PushWeixin(list, content, taskMsgEntity); | |||||
} | |||||
break; | break; | ||||
case "3": //短信,调用短信发送方法 | case "3": //短信,调用短信发送方法 | ||||
SMSSend(content, list); | SMSSend(content, list); | ||||
@@ -308,7 +315,12 @@ namespace Learun.Application.Message | |||||
IMSend(content, list); | IMSend(content, list); | ||||
break; | break; | ||||
case "5": //飞星发送 | case "5": //飞星发送 | ||||
PushFeixin(list, content, taskMsgEntity); | |||||
//读取信息推送管理-消息策略待办事项提醒推送(07)的配置 | |||||
var informationPushEntity2 = sys_InformationPushIBLL.GetEntityByPushItem("07"); | |||||
if (informationPushEntity2 != null && informationPushEntity2.Status == true) | |||||
{ | |||||
PushFeixin(list, content, taskMsgEntity); | |||||
} | |||||
break; | break; | ||||
default: | default: | ||||
break; | break; | ||||
@@ -341,7 +353,7 @@ namespace Learun.Application.Message | |||||
/// <param name="content">消息内容</param> | /// <param name="content">消息内容</param> | ||||
/// <param name="list">用户列表信息</param> | /// <param name="list">用户列表信息</param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
public void EmailSend(string content,List<UserEntity> list) | |||||
public void EmailSend(string content, List<UserEntity> list) | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
@@ -402,14 +414,14 @@ namespace Learun.Application.Message | |||||
/// <param name="needpostuserlist"></param> | /// <param name="needpostuserlist"></param> | ||||
/// <param name="content"></param> | /// <param name="content"></param> | ||||
/// <param name="taskentity"></param> | /// <param name="taskentity"></param> | ||||
public void PushWeixin(List<UserEntity> needpostuserlist,string content, NWFTaskMsgEntity taskentity) | |||||
public void PushWeixin(List<UserEntity> needpostuserlist, string content, NWFTaskMsgEntity taskentity) | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
var WeChatConfigentity = weChatConfigIbll.GetEnableEntity(); | var WeChatConfigentity = weChatConfigIbll.GetEnableEntity(); | ||||
string appid = WeChatConfigentity.APPId; | string appid = WeChatConfigentity.APPId; | ||||
string secret = WeChatConfigentity.secret; | string secret = WeChatConfigentity.secret; | ||||
var wechatemplete = weChatTempletIbll.GetWeChatTemplateEntityByCodeConfigId(WeChatConfigentity.ID,"task"); | |||||
var wechatemplete = weChatTempletIbll.GetWeChatTemplateEntityByCodeConfigId(WeChatConfigentity.ID, "task"); | |||||
string weixintaskurl = wechatemplete.TUrl; | string weixintaskurl = wechatemplete.TUrl; | ||||
string weixintasktempid = wechatemplete.TempId; | 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); | 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_OperateType = "weixin"; | ||||
logEntity.F_OperateAccount = "system"; | logEntity.F_OperateAccount = "system"; | ||||
logEntity.F_ExecuteResult = 200; | 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.F_Description = "PC端"; | ||||
logEntity.WriteLog(); | logEntity.WriteLog(); | ||||
foreach (UserEntity userinfo in needpostuserlist) | foreach (UserEntity userinfo in needpostuserlist) | ||||
@@ -443,12 +455,12 @@ namespace Learun.Application.Message | |||||
"\"first\": {\"value\":\"待办事项提醒\",\"color\":\"#173177\"}," + | "\"first\": {\"value\":\"待办事项提醒\",\"color\":\"#173177\"}," + | ||||
"\"keyword1\":{\"value\":\"流程待办 \",\"color\":\"#173177\"}," + | "\"keyword1\":{\"value\":\"流程待办 \",\"color\":\"#173177\"}," + | ||||
"\"keyword2\": {\"value\":\"" + taskentity.F_Title + "\",\"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); | 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(); | logEntity.WriteLog(); | ||||
} | } | ||||
} | } | ||||
@@ -496,7 +508,7 @@ namespace Learun.Application.Message | |||||
/// <param name="list">用户列表</param> | /// <param name="list">用户列表</param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
public void SMSSend(string content, List<UserEntity> list) | public void SMSSend(string content, List<UserEntity> list) | ||||
{ | |||||
{ | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -508,7 +520,8 @@ namespace Learun.Application.Message | |||||
public void IMSend(string content, List<UserEntity> list) | public void IMSend(string content, List<UserEntity> list) | ||||
{ | { | ||||
List<string> userList = new List<string>(); | List<string> userList = new List<string>(); | ||||
foreach (var user in list) { | |||||
foreach (var user in list) | |||||
{ | |||||
userList.Add(user.F_UserId); | userList.Add(user.F_UserId); | ||||
} | } | ||||
iMSysUserIBLL.SendMsg("IMSystem", userList, content); | iMSysUserIBLL.SendMsg("IMSystem", userList, content); | ||||
@@ -522,7 +535,7 @@ namespace Learun.Application.Message | |||||
/// 主键 | /// 主键 | ||||
/// </summary> | /// </summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
public string F_Id { get; set; } | public string F_Id { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 流程进程主键 | /// 流程进程主键 | ||||
@@ -233,24 +233,30 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
this.BaseRepository().Insert(receiveMessageEntity); | this.BaseRepository().Insert(receiveMessageEntity); | ||||
} | } | ||||
this.BaseRepository().Commit(); | this.BaseRepository().Commit(); | ||||
//微信推送 | |||||
try | |||||
//读取信息推送管理-内部邮件推送(03)的配置 | |||||
var informationPushEntity = this.BaseRepository().FindEntity<Sys_InformationPushEntity>(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) | catch (Exception ex) | ||||
{ | { | ||||
@@ -67,6 +67,30 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 获取Sys_InformationPush表实体数据 | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
/// <returns></returns> | |||||
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 | #endregion | ||||
#region 提交数据 | #region 提交数据 | ||||
@@ -27,6 +27,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
/// <param name="keyValue">主键</param> | /// <param name="keyValue">主键</param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
Sys_InformationPushEntity GetSys_InformationPushEntity(string keyValue); | Sys_InformationPushEntity GetSys_InformationPushEntity(string keyValue); | ||||
/// <summary> | |||||
/// 获取Sys_InformationPush表实体数据 | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
/// <returns></returns> | |||||
Sys_InformationPushEntity GetEntityByPushItem(string pushItem); | |||||
#endregion | #endregion | ||||
#region 提交数据 | #region 提交数据 | ||||
@@ -41,7 +41,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
var queryParam = queryJson.ToJObject(); | var queryParam = queryJson.ToJObject(); | ||||
// 虚拟参数 | // 虚拟参数 | ||||
var dp = new DynamicParameters(new { }); | var dp = new DynamicParameters(new { }); | ||||
return this.BaseRepository().FindList<Sys_InformationPushEntity>(strSql.ToString(),dp, pagination); | |||||
return this.BaseRepository().FindList<Sys_InformationPushEntity>(strSql.ToString(), dp, pagination); | |||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
@@ -80,6 +80,30 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 获取Sys_InformationPush表实体数据 | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
/// <returns></returns> | |||||
public Sys_InformationPushEntity GetEntityByPushItem(string pushItem) | |||||
{ | |||||
try | |||||
{ | |||||
return this.BaseRepository().FindEntity<Sys_InformationPushEntity>(x => x.PushItem == pushItem); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
#endregion | #endregion | ||||
#region 提交数据 | #region 提交数据 | ||||
@@ -92,7 +116,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
this.BaseRepository().Delete<Sys_InformationPushEntity>(t=>t.Id == keyValue); | |||||
this.BaseRepository().Delete<Sys_InformationPushEntity>(t => t.Id == keyValue); | |||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
@@ -412,24 +412,30 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
Sys_SendFile.ReceiverId = stringBuilder.ToString().TrimEnd(','); | Sys_SendFile.ReceiverId = stringBuilder.ToString().TrimEnd(','); | ||||
db.Update(Sys_SendFile); | db.Update(Sys_SendFile); | ||||
db.Commit(); | db.Commit(); | ||||
//微信推送 | |||||
try | |||||
//读取信息推送管理-公文下发推送(02)的配置 | |||||
var informationPushEntity = this.BaseRepository().FindEntity<Sys_InformationPushEntity>(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) | catch (Exception ex) | ||||
{ | { | ||||
@@ -507,24 +513,30 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
Sys_ReceiveDocument.ReceiverId = stringBuilder.ToString().TrimEnd(','); | Sys_ReceiveDocument.ReceiverId = stringBuilder.ToString().TrimEnd(','); | ||||
db.Update(Sys_ReceiveDocument); | db.Update(Sys_ReceiveDocument); | ||||
db.Commit(); | db.Commit(); | ||||
//微信推送 | |||||
try | |||||
//读取信息推送管理-公文下发推送(02)的配置 | |||||
var informationPushEntity = this.BaseRepository().FindEntity<Sys_InformationPushEntity>(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) | catch (Exception ex) | ||||
{ | { | ||||
@@ -362,24 +362,30 @@ on a.F_UserId=b.F_UserId where b.F_ObjectId in(" + string.Join(",", ppostid) + | |||||
Sys_SendFile.SendTime = DateTime.Now; | Sys_SendFile.SendTime = DateTime.Now; | ||||
db.Update(Sys_SendFile); | db.Update(Sys_SendFile); | ||||
db.Commit(); | db.Commit(); | ||||
//微信推送 | |||||
try | |||||
//读取信息推送管理-公文下发推送(02)的配置 | |||||
var informationPushEntity = this.BaseRepository().FindEntity<Sys_InformationPushEntity>(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) | catch (Exception ex) | ||||
{ | { | ||||
@@ -403,12 +403,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
LogEntity logEntity = new LogEntity(); | LogEntity logEntity = new LogEntity(); | ||||
logEntity.F_LogId = Guid.NewGuid().ToString(); | logEntity.F_LogId = Guid.NewGuid().ToString(); | ||||
logEntity.F_Module = "Thermography"; | logEntity.F_Module = "Thermography"; | ||||
logEntity.F_ExecuteResultJson = "Thermography Status="+entity.Status; | |||||
logEntity.F_ExecuteResultJson = "Thermography Status=" + entity.Status; | |||||
logEntity.WriteLog(); | logEntity.WriteLog(); | ||||
//体温异常 | //体温异常 | ||||
if (entity.Status == "2") | if (entity.Status == "2") | ||||
{ | { | ||||
//微信推送 | |||||
try | try | ||||
{ | { | ||||
var stuModel = this.BaseRepository("CollegeMIS").FindEntity<StuInfoBasicEntity>(x => x.StuNo == entity.PersonBeingMeasured); | var stuModel = this.BaseRepository("CollegeMIS").FindEntity<StuInfoBasicEntity>(x => x.StuNo == entity.PersonBeingMeasured); | ||||
@@ -420,7 +419,14 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
logEntity.F_ExecuteResultJson = "Thermography stuModelStuNo=" + stuModel.StuNo; | logEntity.F_ExecuteResultJson = "Thermography stuModelStuNo=" + stuModel.StuNo; | ||||
logEntity.WriteLog(); | logEntity.WriteLog(); | ||||
var title = string.Format("{0}({1})", stuModel.StuName, stuModel.StuNo); | var title = string.Format("{0}({1})", stuModel.StuName, stuModel.StuNo); | ||||
PushWeixin(title); | |||||
//读取信息推送管理-班级自诊打卡体温异常学生推送(05)的配置 | |||||
var informationPushEntity = this.BaseRepository().FindEntity<Sys_InformationPushEntity>(x => x.PushItem == "05"); | |||||
if (informationPushEntity != null && informationPushEntity.Status == true) | |||||
{ | |||||
//微信推送 | |||||
PushWeixin(title); | |||||
} | |||||
} | } | ||||
} | } | ||||
catch (Exception e) | catch (Exception e) | ||||
@@ -532,14 +538,20 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
//体温异常 | //体温异常 | ||||
if (entity.Status == "2") | if (entity.Status == "2") | ||||
{ | { | ||||
//微信推送 | |||||
try | try | ||||
{ | { | ||||
var stuModel = db.FindEntity<StuInfoBasicEntity>(x => x.StuNo == entity.PersonBeingMeasured); | var stuModel = db.FindEntity<StuInfoBasicEntity>(x => x.StuNo == entity.PersonBeingMeasured); | ||||
if (stuModel != null) | if (stuModel != null) | ||||
{ | { | ||||
var title = string.Format("{0}({1})", stuModel.StuName, stuModel.StuNo); | var title = string.Format("{0}({1})", stuModel.StuName, stuModel.StuNo); | ||||
PushWeixin(title); | |||||
//读取信息推送管理-班级自诊打卡体温异常学生推送(05)的配置 | |||||
var informationPushEntity = this.BaseRepository().FindEntity<Sys_InformationPushEntity>(x => x.PushItem == "05"); | |||||
if (informationPushEntity != null && informationPushEntity.Status == true) | |||||
{ | |||||
//微信推送 | |||||
PushWeixin(title); | |||||
} | |||||
} | } | ||||
} | } | ||||
catch (Exception e) | catch (Exception e) | ||||
@@ -12,6 +12,7 @@ using Learun.Application.Organization; | |||||
using Learun.Application.TwoDevelopment.LR_Desktop; | using Learun.Application.TwoDevelopment.LR_Desktop; | ||||
using Microsoft.AspNet.SignalR.Client; | using Microsoft.AspNet.SignalR.Client; | ||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||||
namespace Learun.Application.WorkFlow | namespace Learun.Application.WorkFlow | ||||
{ | { | ||||
@@ -492,13 +493,20 @@ namespace Learun.Application.WorkFlow | |||||
wfTaskEntity.Create(); | wfTaskEntity.Create(); | ||||
this.BaseRepository().Insert(wfTaskEntity); | this.BaseRepository().Insert(wfTaskEntity); | ||||
try | |||||
{ | |||||
PushWeixin(wfTaskEntity); | |||||
} | |||||
catch (Exception e) | |||||
//读取信息推送管理-待办流程推送(04)的配置 | |||||
var informationPushEntity = this.BaseRepository().FindEntity<Sys_InformationPushEntity>(x => x.PushItem == "04"); | |||||
if (informationPushEntity != null && informationPushEntity.Status == true) | |||||
{ | { | ||||
//微信推送 | |||||
try | |||||
{ | |||||
PushWeixin(wfTaskEntity); | |||||
} | |||||
catch (Exception e) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
else | else | ||||
@@ -588,9 +596,9 @@ namespace Learun.Application.WorkFlow | |||||
if (userinfo != null && !string.IsNullOrEmpty(userinfo.OpenIdForWeixin) && processinstance != null) | 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)) | if (!string.IsNullOrEmpty(responsejson)) | ||||
{ | { | ||||
var weixintokenobj = JsonConvert.DeserializeObject<dynamic>(responsejson); | var weixintokenobj = JsonConvert.DeserializeObject<dynamic>(responsejson); | ||||
@@ -598,7 +606,7 @@ namespace Learun.Application.WorkFlow | |||||
{ | { | ||||
string access_token = weixintokenobj.access_token; | string access_token = weixintokenobj.access_token; | ||||
string jsondata = "{\"touser\":\"" + userinfo.OpenIdForWeixin + "\"," + | string jsondata = "{\"touser\":\"" + userinfo.OpenIdForWeixin + "\"," + | ||||
"\"template_id\":\""+ weixintasktempid + "\"," + | |||||
"\"template_id\":\"" + weixintasktempid + "\"," + | |||||
"\"url\":\"" + weixintaskurl + "\"," + | "\"url\":\"" + weixintaskurl + "\"," + | ||||
"\"data\":{" + | "\"data\":{" + | ||||
"\"first\": {\"value\":\"" + processinstance.F_SchemeName + "\",\"color\":\"#173177\"}," + | "\"first\": {\"value\":\"" + processinstance.F_SchemeName + "\",\"color\":\"#173177\"}," + | ||||
@@ -609,7 +617,7 @@ namespace Learun.Application.WorkFlow | |||||
//"\"remark\":{\"value\":\"欢迎再次购买!\",\"color\":\"#173177\"}" + | //"\"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); | |||||
} | } | ||||
} | } | ||||
} | } | ||||