Commit 9f86455c authored by 罗超's avatar 罗超

新增公告相关推送

parent a2b6745b
......@@ -63,5 +63,23 @@ namespace Edu.Common.Enum.System
/// </summary>
[EnumField("资产入库审核")]
PropertyStokcInAudit = 9,
/// <summary>
/// 公告审批
/// </summary>
[EnumField("公告审批")]
NoticeAuditTips = 10,
/// <summary>
/// 公告审批结果
/// </summary>
[EnumField("公告审批结果")]
NoticeAuditResult = 11,
/// <summary>
/// 公告审批结果
/// </summary>
[EnumField("公告发布")]
NoticePub = 11,
}
}
......@@ -58,6 +58,7 @@ namespace Edu.Common.Message
message.CreateByName,
message.MsgSign,
message.MsgTemplateCode,
message.WorkMsgType,
Status = 0,
CreateTime = DateTime.Now,
AppId = Common.Config.PushAppId,
......
......@@ -31,7 +31,7 @@ namespace Edu.Common.Message
public PushMessageCategoryEnum CategoryId { get; set; }
/// <summary>
/// 推送平台[1-手机端,2-Web端,3-短信,4-邮件]
/// 推送平台[1-手机端,2-Web端,3-短信,4-邮件,5-企业微信]
/// </summary>
public int Platform { get; set; }
......@@ -69,5 +69,10 @@ namespace Edu.Common.Message
/// 短信签名
/// </summary>
public string MsgSign { get; set; }
/// <summary>
/// 企业微信消息类型
/// </summary>
public string WorkMsgType { get; set; }
}
}
......@@ -38,13 +38,22 @@ namespace Edu.Module.User
return accountRepository.GetWorkUserIdRepository(id);
}
/// <summary>
/// 获取指定部门下员工的企业号ID
/// </summary>
/// <param name="departmentIds"></param>
/// <returns></returns>
public string GetWorkUserIdByDepartmentModule(string departmentIds)
{
return accountRepository.GetWorkUserIdByDepartmentRepository(departmentIds);
}
/// <summary>
/// 获取账号列表(批量修改密码专用)
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Account_ViewModel> GetUpdateAccountListRepository(List<RB_Account_ViewModel> query)
/// <summary>
/// 获取账号列表(批量修改密码专用)
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Account_ViewModel> GetUpdateAccountListRepository(List<RB_Account_ViewModel> query)
{
return accountRepository.GetUpdateAccountListRepository(query);
}
......
......@@ -640,7 +640,21 @@ WHERE e.RB_Group_id ={GroupId} AND e.IsLeave =0 AND o.Score =0 GROUP BY e.Employ
var result = ExecuteScalar(sql, null);
return Convert.IsDBNull(result) && !result.Equals(null) ? string.Empty : result.ToString();
return !result.Equals(null)&&Convert.IsDBNull(result) ? string.Empty : result.ToString();
}
/// <summary>
/// 获取指定部门下员工的企业号ID
/// </summary>
/// <param name="departmentIds"></param>
/// <returns></returns>
public string GetWorkUserIdByDepartmentRepository(string departmentIds)
{
string sql = $"select GROUP_CONCAT(WorkUserId SEPARATOR '|') from rb_employee where RB_Department_Id in({departmentIds})";
var result = ExecuteScalar(sql, null);
return !result.Equals(null) && Convert.IsDBNull(result) ? string.Empty : result.ToString();
}
}
}
\ No newline at end of file
......@@ -2182,7 +2182,8 @@ namespace Edu.WebApi.Controllers.Course
Content = markdownContent,
CoverImg = "",
CreateByName = base.UserInfo.AccountName,
JumpUrl = "markdown",
JumpUrl = "",
WorkMsgType = "markdown",
SendTime = DateTime.Now,
SendType = 0,
Title = "主管评论备课通知",
......
......@@ -3,10 +3,12 @@ using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using Edu.AOP;
using Edu.Cache.User;
using Edu.Common;
using Edu.Common.API;
using Edu.Common.Enum.System;
using Edu.Common.Enum.User;
using Edu.Common.Plugin;
using Edu.Model.CacheModel;
......@@ -14,6 +16,7 @@ using Edu.Model.Public;
using Edu.Model.ViewModel.User;
using Edu.Module.User;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
......@@ -49,6 +52,11 @@ namespace Edu.WebApi.Controllers.User
/// </summary>
private readonly DepartmentModule departmentModule = new DepartmentModule();
/// <summary>
/// 账户对象
/// </summary>
private readonly AccountModule accountModule = new AccountModule();
#region 字典管理
/// <summary>
......@@ -240,6 +248,7 @@ namespace Edu.WebApi.Controllers.User
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult GetNoticeInfo()
{
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
......@@ -311,6 +320,35 @@ namespace Edu.WebApi.Controllers.User
bool flag = noticeModule.SetNoticeInfo(demodel);
if (flag)
{
var modelShenhe = attendancemodule.GetDictValueList(userInfo.Group_Id, Config.Notice_BaseKey).FirstOrDefault();
if (modelShenhe != null && !string.IsNullOrEmpty(modelShenhe.Content))
{
var queryTargetWorkId = accountModule.GetWorkUserIdModule(int.Parse(modelShenhe.Content));
//添加推送信息
if (!string.IsNullOrEmpty(queryTargetWorkId))
{
var path = $"/administration/documentApproval";
path = HttpUtility.UrlEncode(path);
string markdownContent = $"##### 你有新的待审批公告 \n>**概要信息** \n>公告标题:{demodel.Title}</font>\n>发 布 人:{userInfo.AccountName}\n>提审时间:<font color='comment'>{DateTime.Now.ToString("MM-dd HH:mm")}</font>\n>\n>接收对象:<font color='info'>{(demodel.To == "-1" ? "全公司" : "指定部门")}</font>\n>请 点 击:[立即审批]({Config.ErpUrl}/autologin?loginId={modelShenhe.Content}&target={path}#target=out)";
Common.Message.PushMessageModel modelWork = new Common.Message.PushMessageModel()
{
CategoryId = PushMessageCategoryEnum.NoticeAuditTips,
Content = markdownContent,
CoverImg = "",
CreateByName = base.UserInfo.AccountName,
JumpUrl = "",
WorkMsgType= "markdown",
SendTime = DateTime.Now,
SendType = 0,
Title = "公告审批提醒",
Platform = 5,
ReceiveId = queryTargetWorkId
};
Common.Message.MessageHelper.SendMessage(modelWork);
}
}
return ApiResult.Success();
}
else
......@@ -412,6 +450,72 @@ namespace Edu.WebApi.Controllers.User
bool flag = noticeModule.UpdateNotice(oldModel, noticeLogModel);
if (flag)
{
var noticeModel = noticeModule.GetNoticeEntity(NoticeId);
if (noticeModel!=null)
{
var queryTargetWorkId = accountModule.GetWorkUserIdModule(noticeModel.CreateBy);
#region 推送审批消息给用户
if (!string.IsNullOrEmpty(queryTargetWorkId))
{
var path = $"/noticeView?NoticeId={NoticeId}";
if (ReviewStatus == 2)
{
path = $"/administration/document";
}
path = HttpUtility.UrlEncode(path);
string markdownContent = $"<font color='{(ReviewStatus == 2 ? "warning" : "info")}'>`审批{(ReviewStatus == 1?"通过":"驳回")}`</font> 公告审批结果\n\n>**概要信息** \n>公告标题:{noticeModel.Title}\n>审 核 人:{userInfo.AccountName}\n>审核时间:<font color='comment'>{DateTime.Now.ToString("MM-dd HH:mm")}</font>\n>\n>请 点 击:[查看详情]({Config.ErpUrl}/autologin?loginId={noticeModel.CreateBy}&target={path}#target=out)";
Common.Message.PushMessageModel modelWork = new Common.Message.PushMessageModel()
{
CategoryId = PushMessageCategoryEnum.NoticeAuditResult,
Content = markdownContent,
CoverImg = "",
CreateByName = base.UserInfo.AccountName,
JumpUrl = "",
WorkMsgType = "markdown",
SendTime = DateTime.Now,
SendType = 0,
Title = "公告审批提醒",
Platform = 5,
ReceiveId = queryTargetWorkId
};
Common.Message.MessageHelper.SendMessage(modelWork);
}
#endregion
#region 批量推送公告用户
if (ReviewStatus == 1)
{
var to = "@all";
if (noticeModel.To != "-1")
{
to = accountModule.GetWorkUserIdByDepartmentModule(noticeModel.To);
}
if (!string.IsNullOrEmpty(to))
{
Common.Message.PushMessageModel modelPubWork = new Common.Message.PushMessageModel()
{
CategoryId = PushMessageCategoryEnum.NoticePub,
Content = noticeModel.Content,
CoverImg = "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1627978081000_321.jpg",
CreateByName = base.UserInfo.AccountName,
JumpUrl = $"{Config.ErpUrl}/noticeView?NoticeId={NoticeId}",
WorkMsgType = "news",
SendTime = DateTime.Now,
SendType = 0,
Title = noticeModel.Title,
Platform = 5,
ReceiveId = to
};
Common.Message.MessageHelper.SendMessage(modelPubWork);
}
}
#endregion
}
return ApiResult.Success();
}
else
......
......@@ -92,11 +92,7 @@
//订单转班流程编号
"OrderTransClassFlowId": 5,
//订单分拆流程编号
<<<<<<< HEAD
"OrderSplitClassFlowId": 6
=======
"OrderSplitClassFlowId": 6,
//是否开启调课数据验证
"IsOpenChangeClassVerify":1,
>>>>>>> fb5d4f946a291685b92721a6797705cd4780dffe
"IsOpenChangeClassVerify":1
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment