|
|
@ -7,7 +7,7 @@ using DS.WMS.Core.Op.Interface.TaskInteraction;
|
|
|
|
namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 邮件配置服务
|
|
|
|
/// 邮件模板配置服务
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public class TaskMailService : ServiceBase, ITaskMailService
|
|
|
|
public class TaskMailService : ServiceBase, ITaskMailService
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -27,7 +27,8 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
public async Task<DataResult<List<BusinessTaskMail>>> GetListAsync(PageRequest request)
|
|
|
|
public async Task<DataResult<List<BusinessTaskMail>>> GetListAsync(PageRequest request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var whereList = request.GetConditionalModels(Db);
|
|
|
|
var whereList = request.GetConditionalModels(Db);
|
|
|
|
return await TenantDb.Queryable<BusinessTaskMail>().Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.CC)
|
|
|
|
return await TenantDb.Queryable<BusinessTaskMail>()
|
|
|
|
|
|
|
|
.Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.CC)
|
|
|
|
.Where(whereList).ToQueryPageAsync(request.PageCondition);
|
|
|
|
.Where(whereList).ToQueryPageAsync(request.PageCondition);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -39,7 +40,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
public async Task<DataResult<BusinessTaskMail>> GetAsync(long id)
|
|
|
|
public async Task<DataResult<BusinessTaskMail>> GetAsync(long id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var entity = await TenantDb.Queryable<BusinessTaskMail>()
|
|
|
|
var entity = await TenantDb.Queryable<BusinessTaskMail>()
|
|
|
|
.Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.Attachments).Includes(x => x.CC)
|
|
|
|
.Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.CC).Includes(x => x.Attachments)
|
|
|
|
.Where(x => x.Id == id).FirstAsync();
|
|
|
|
.Where(x => x.Id == id).FirstAsync();
|
|
|
|
|
|
|
|
|
|
|
|
return DataResult<BusinessTaskMail>.Success(entity);
|
|
|
|
return DataResult<BusinessTaskMail>.Success(entity);
|
|
|
@ -53,8 +54,8 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
public async Task<BusinessTaskMail> GetAsync(string name)
|
|
|
|
public async Task<BusinessTaskMail> GetAsync(string name)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return await TenantDb.Queryable<BusinessTaskMail>()
|
|
|
|
return await TenantDb.Queryable<BusinessTaskMail>()
|
|
|
|
.Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.Attachments).Includes(x => x.CC)
|
|
|
|
.Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.CC).Includes(x => x.Attachments)
|
|
|
|
.Where(x => x.Name == name).FirstAsync();
|
|
|
|
.Where(x => x.Name.Contains(name)).FirstAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -73,11 +74,15 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
taskMail.Sender ??= new();
|
|
|
|
taskMail.Sender ??= new();
|
|
|
|
taskMail.CC ??= new();
|
|
|
|
taskMail.CC ??= new();
|
|
|
|
|
|
|
|
|
|
|
|
taskMail = await TenantDb.InsertNav(taskMail).Include(x => x.Receiver).Include(x => x.Sender).ExecuteReturnEntityAsync();
|
|
|
|
taskMail = await TenantDb.InsertNav(taskMail)
|
|
|
|
|
|
|
|
.Include(x => x.Receiver).Include(x => x.Sender).Include(x => x.CC)
|
|
|
|
|
|
|
|
.ExecuteReturnEntityAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await TenantDb.UpdateNav(taskMail).Include(x => x.Receiver).Include(x => x.Sender).ExecuteCommandAsync();
|
|
|
|
await TenantDb.UpdateNav(taskMail)
|
|
|
|
|
|
|
|
.Include(x => x.Receiver).Include(x => x.Sender).Include(x => x.CC)
|
|
|
|
|
|
|
|
.ExecuteCommandAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (taskMail.Attachments?.Count > 0)
|
|
|
|
if (taskMail.Attachments?.Count > 0)
|
|
|
@ -86,8 +91,10 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
foreach (var item in list)
|
|
|
|
foreach (var item in list)
|
|
|
|
item.TaskMailId = taskMail.Id;
|
|
|
|
item.TaskMailId = taskMail.Id;
|
|
|
|
|
|
|
|
|
|
|
|
await TenantDb.Deleteable<BusinessTaskAttachment>().Where(x => x.TaskMailId == taskMail.Id).ExecuteCommandAsync();
|
|
|
|
//await TenantDb.Deleteable<BusinessTaskAttachment>().Where(x => x.TaskMailId == taskMail.Id).ExecuteCommandAsync();
|
|
|
|
await TenantDb.Insertable(taskMail.Attachments).ExecuteCommandAsync();
|
|
|
|
//await TenantDb.Insertable(taskMail.Attachments).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await TenantDb.Storageable(taskMail.Attachments).DefaultAddElseUpdate().ExecuteCommandAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
@ -113,7 +120,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await TenantDb.DeleteNav<BusinessTaskMail>(x => model.Ids.Contains(x.Id))
|
|
|
|
await TenantDb.DeleteNav<BusinessTaskMail>(x => model.Ids.Contains(x.Id))
|
|
|
|
.Include(x => x.Receiver).Include(x => x.Sender).Include(x => x.Attachments)
|
|
|
|
.Include(x => x.Receiver).Include(x => x.Sender).Include(x => x.CC).Include(x => x.Attachments)
|
|
|
|
.ExecuteCommandAsync();
|
|
|
|
.ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
@ -127,6 +134,5 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|