diff --git a/SBF.API/Controllers/TrusteeshipController.cs b/SBF.API/Controllers/TrusteeshipController.cs index 5bcc785..57d4a2a 100644 --- a/SBF.API/Controllers/TrusteeshipController.cs +++ b/SBF.API/Controllers/TrusteeshipController.cs @@ -45,5 +45,15 @@ namespace SBF.API.Controllers { trusteeshipBusiness.CreateTrusteeship(request); } + + /// + /// 停止托管 + /// + /// 任务Id + [HttpPost] + public void StopTrusteeship([FromRoute] long id) + { + trusteeshipBusiness.StopTrusteeship(id); + } } } diff --git a/SBF.Business/TrusteeshipBusiness.cs b/SBF.Business/TrusteeshipBusiness.cs index 1022611..a972118 100644 --- a/SBF.Business/TrusteeshipBusiness.cs +++ b/SBF.Business/TrusteeshipBusiness.cs @@ -256,5 +256,17 @@ namespace SBF.Business fsql.Insert(insertList).ExecuteAffrows(); } + + public void StopTrusteeship(long id) + { + var task = fsql.Select(id).ToOne(); + if (task == null) + throw new BusinessException("托管任务不存在"); + if (task.IsEnd == true) + return; + fsql.Update(id).Set(t => t.IsEnd, true) + .Set(t => t.EndTime, DateTime.Now) + .ExecuteAffrows(); + } } }