@@ -110,12 +110,22 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
Sys_InformationPushEntity entity = strEntity.ToObject<Sys_InformationPushEntity>(); | |||
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; | |||
@@ -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, | |||
@@ -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 视图功能 | |||
/// <summary> | |||
/// 管理页面 | |||
@@ -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 () => | |||
@@ -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(); | |||
/// <summary> | |||
@@ -59,7 +60,7 @@ namespace Learun.Application.WebApi | |||
var departmentList = mpEntity.MPDepartment.Split(',').ToList(); | |||
var UserList = new List<UserEntity>(); | |||
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<UserEntity> UserList) | |||
public void FeiXinPush(string title, string code, List<UserEntity> 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(); | |||
@@ -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 | |||
/// 获取列表数据 | |||
/// <summary> | |||
/// <returns></returns> | |||
public IEnumerable<LR_MS_StrategyInfoEntity> GetList( string queryJson ) | |||
public IEnumerable<LR_MS_StrategyInfoEntity> 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 | |||
/// <param name="content">消息内容</param> | |||
/// <param name="list">用户列表信息</param> | |||
/// <returns></returns> | |||
public void EmailSend(string content,List<UserEntity> list) | |||
public void EmailSend(string content, List<UserEntity> list) | |||
{ | |||
try | |||
{ | |||
@@ -402,14 +414,14 @@ namespace Learun.Application.Message | |||
/// <param name="needpostuserlist"></param> | |||
/// <param name="content"></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 | |||
{ | |||
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 | |||
/// <param name="list">用户列表</param> | |||
/// <returns></returns> | |||
public void SMSSend(string content, List<UserEntity> list) | |||
{ | |||
{ | |||
} | |||
/// <summary> | |||
@@ -508,7 +520,8 @@ namespace Learun.Application.Message | |||
public void IMSend(string content, List<UserEntity> list) | |||
{ | |||
List<string> userList = new List<string>(); | |||
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 | |||
/// 主键 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string F_Id { get; set; } | |||
/// <summary> | |||
/// 流程进程主键 | |||
@@ -233,24 +233,30 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
this.BaseRepository().Insert(receiveMessageEntity); | |||
} | |||
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) | |||
{ | |||
@@ -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 | |||
#region 提交数据 | |||
@@ -27,6 +27,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
Sys_InformationPushEntity GetSys_InformationPushEntity(string keyValue); | |||
/// <summary> | |||
/// 获取Sys_InformationPush表实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
Sys_InformationPushEntity GetEntityByPushItem(string pushItem); | |||
#endregion | |||
#region 提交数据 | |||
@@ -41,7 +41,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
var queryParam = queryJson.ToJObject(); | |||
// 虚拟参数 | |||
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) | |||
{ | |||
@@ -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 | |||
#region 提交数据 | |||
@@ -92,7 +116,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
{ | |||
try | |||
{ | |||
this.BaseRepository().Delete<Sys_InformationPushEntity>(t=>t.Id == keyValue); | |||
this.BaseRepository().Delete<Sys_InformationPushEntity>(t => t.Id == keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -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<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) | |||
{ | |||
@@ -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<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) | |||
{ | |||
@@ -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<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) | |||
{ | |||
@@ -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<StuInfoBasicEntity>(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<Sys_InformationPushEntity>(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<StuInfoBasicEntity>(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<Sys_InformationPushEntity>(x => x.PushItem == "05"); | |||
if (informationPushEntity != null && informationPushEntity.Status == true) | |||
{ | |||
//微信推送 | |||
PushWeixin(title); | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
@@ -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<Sys_InformationPushEntity>(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<dynamic>(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); | |||
} | |||
} | |||
} | |||