diff --git a/src/Shentun.Sms.Application.Contracts/SmsTasks/DeleteThirdPartySmsTaskByThirdIdInputDto.cs b/src/Shentun.Sms.Application.Contracts/SmsTasks/DeleteThirdPartySmsTaskByThirdIdInputDto.cs new file mode 100644 index 0000000..c5de9e5 --- /dev/null +++ b/src/Shentun.Sms.Application.Contracts/SmsTasks/DeleteThirdPartySmsTaskByThirdIdInputDto.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Sms.SmsTasks +{ + public class DeleteThirdPartySmsTaskByThirdIdInputDto + { + /// + /// 第三方ID 人员登记ID + /// + public string ThirdId { get; set; } + + /// + /// 短信内容 + /// + public string Content { get; set; } + + } +} diff --git a/src/Shentun.Sms.Application/SmsTasks/SmsTaskAppService.cs b/src/Shentun.Sms.Application/SmsTasks/SmsTaskAppService.cs index 43cb71d..27f3d37 100644 --- a/src/Shentun.Sms.Application/SmsTasks/SmsTaskAppService.cs +++ b/src/Shentun.Sms.Application/SmsTasks/SmsTaskAppService.cs @@ -333,5 +333,25 @@ namespace Shentun.Sms.SmsTasks await _smsSendRepository.InsertManyAsync(smsSendList); } + + /// + /// 移除短信任务 根据人员ID 危急值 + /// + /// + [HttpPost] + public async Task DeleteThirdPartySmsTaskByThirdIdAsync(DeleteThirdPartySmsTaskByThirdIdInputDto input) + { + DataHelper.CheckEntityIsNull(input, "", "参数有误"); + + var smsTaskEnt = await _smsTaskRepository.FirstOrDefaultAsync(f => f.ThirdId == input.ThirdId && f.Content == input.Content); + + var smsSendList = await _smsSendRepository.GetListAsync(m => m.SmsTaskId == smsTaskEnt.Id && m.PlanSendTime > DateTime.Now); + + if (smsSendList.Any()) + { + await _smsSendRepository.DeleteManyAsync(smsSendList); + } + } + } }