This commit is contained in:
2023-05-31 10:19:05 +08:00
parent 1b65a7a9e5
commit 9c621c75cd
238 changed files with 9905 additions and 4034 deletions

View File

@@ -106,7 +106,7 @@ public class SendMessageService : ISendMessageService, IDynamicApiController, IT
{
fullName = b.FullName,
type = a.MessageType,
}).ToListAsync();
}).Distinct().ToListAsync();
}
return PageResult<SendMessageListOutput>.SqlSugarPageResult(list);
}
@@ -115,10 +115,8 @@ public class SendMessageService : ISendMessageService, IDynamicApiController, IT
public async Task<dynamic> GetSendList([FromQuery] MessageTemplateQuery input)
{
var list = await _repository.AsSugarClient().Queryable<MessageSendEntity>()
.Where(a => a.DeleteMark == null)
.Where(a => a.DeleteMark == null && a.EnabledMark == 1 && a.TemplateType == "0")
.WhereIF(input.messageSource.IsNotEmptyOrNull(), a => a.MessageSource == input.messageSource)
.WhereIF(input.templateType.IsNotEmptyOrNull(), a => a.TemplateType == input.templateType)
.WhereIF(input.enabledMark.IsNotEmptyOrNull(), a => a.EnabledMark == input.enabledMark)
.WhereIF(input.keyword.IsNotEmptyOrNull(), a => a.FullName.Contains(input.keyword) || a.EnCode.Contains(input.keyword))
.OrderBy(a => a.SortCode)
.OrderBy(a => a.CreatorTime, OrderByType.Desc)
@@ -251,6 +249,10 @@ public class SendMessageService : ISendMessageService, IDynamicApiController, IT
entity.FullName = string.Format("{0}副本{1}", entity.FullName, random);
entity.EnCode = string.Format("{0}{1}", entity.EnCode, random);
entity.Id = SnowflakeIdHelper.NextId();
entity.EnabledMark = 0;
entity.TemplateType = "0";
entity.LastModifyTime = null;
entity.LastModifyUserId = null;
if (entity.FullName.Length >= 50 || entity.EnCode.Length >= 50)
throw Oops.Oh(ErrorCode.COM1009);
var sendTemplateList = await _repository.AsSugarClient().Queryable<MessageSendTemplateEntity>().Where(x => x.SendConfigId == id && x.DeleteMark == null).ToListAsync();
@@ -460,11 +462,11 @@ public class SendMessageService : ISendMessageService, IDynamicApiController, IT
return errorList.Any() ? string.Join(",", errorList) : string.Empty;
}
public async Task SendMessageDefult(string enCode,List<string> toUser, string taskName, Dictionary<string, object> bodyDic)
public async Task SendMessageDefult(string enCode, List<string> toUser,string creatorUser, string flowName, Dictionary<string, object> bodyDic)
{
var msgTemplateEntity= await _repository.AsSugarClient().Queryable<MessageTemplateEntity>().FirstAsync(x => x.EnCode == enCode && x.TemplateType=="1" && x.DeleteMark == null);
msgTemplateEntity.Title= msgTemplateEntity.Title.Replace("@流程发起人@流程名称", taskName);
msgTemplateEntity.Content = msgTemplateEntity.Content.Replace("@流程发起人@流程名称", taskName);
msgTemplateEntity.Title = msgTemplateEntity.Title.Replace("@流程发起人", creatorUser).Replace("@流程名称", flowName);
msgTemplateEntity.Content = msgTemplateEntity.Content.Replace("@流程发起人", creatorUser).Replace("@流程名称", flowName);
await _messageService.SentMessage(toUser, msgTemplateEntity.Title, msgTemplateEntity.Content, bodyDic);
#region
foreach (var item in toUser)
@@ -482,6 +484,21 @@ public class SendMessageService : ISendMessageService, IDynamicApiController, IT
}
#endregion
}
public async Task SendMessageDelegate(string delegateType, string ToUserId, string flowName)
{
var title = string.Format("{0}已{1}您的{2}流程!", _userManager.User.RealName, delegateType, flowName);
var parameter = new { type = "1" };
var bodyDic = new Dictionary<string, object>();
bodyDic.Add(ToUserId, parameter);
await _messageService.SentMessage(new List<string>() { ToUserId }, title, null, bodyDic, 2, "2");
}
public async Task SendMessageSystem(string enCode)
{
var msgTemplateEntity = await _repository.AsSugarClient().Queryable<MessageTemplateEntity>().FirstAsync(x => x.EnCode == enCode && x.TemplateType == "1" && x.DeleteMark == null);
var bodyDic = new Dictionary<string, object>();
bodyDic.Add(_userManager.UserId, msgTemplateEntity.Content);
await _messageService.SentMessage(new List<string>() { _userManager.UserId }, msgTemplateEntity.Title, msgTemplateEntity.Content, bodyDic, 3);
}
#endregion
#region PrivateMethod
@@ -680,9 +697,13 @@ public class SendMessageService : ISendMessageService, IDynamicApiController, IT
if (text.IsNotEmptyOrNull())
{
// 默认站内信
if (paramDic.ContainsKey("@taskFullName"))
if (paramDic.ContainsKey("@flowFullName"))
{
text = text.Replace("@流程发起人@流程名称", paramDic["@taskFullName"]);
text = text.Replace("@流程名称", paramDic["@flowFullName"]);
}
if (paramDic.ContainsKey("@launchUserName"))
{
text = text.Replace("@流程发起人", paramDic["@launchUserName"]);
}
foreach (var item in paramDic.Keys)
{