From 8d36b1f8f418b9f0d667895a3855532075a97e29 Mon Sep 17 00:00:00 2001 From: sanji Date: Thu, 30 Nov 2023 17:17:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=81=9C=E6=AD=A2=E7=9B=91=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SBF.API/Controllers/TrusteeshipController.cs | 10 ++++++++++ SBF.Business/TrusteeshipBusiness.cs | 12 ++++++++++++ 2 files changed, 22 insertions(+) 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(); + } } }