Browse Source

停止监控

trusteeshipTask
sanji 2 years ago
parent
commit
8d36b1f8f4
  1. 10
      SBF.API/Controllers/TrusteeshipController.cs
  2. 12
      SBF.Business/TrusteeshipBusiness.cs

10
SBF.API/Controllers/TrusteeshipController.cs

@ -45,5 +45,15 @@ namespace SBF.API.Controllers
{
trusteeshipBusiness.CreateTrusteeship(request);
}
/// <summary>
/// 停止托管
/// </summary>
/// <param name="id">任务Id</param>
[HttpPost]
public void StopTrusteeship([FromRoute] long id)
{
trusteeshipBusiness.StopTrusteeship(id);
}
}
}

12
SBF.Business/TrusteeshipBusiness.cs

@ -256,5 +256,17 @@ namespace SBF.Business
fsql.Insert(insertList).ExecuteAffrows();
}
public void StopTrusteeship(long id)
{
var task = fsql.Select<Sbf_TrusteeshipTask>(id).ToOne();
if (task == null)
throw new BusinessException("托管任务不存在");
if (task.IsEnd == true)
return;
fsql.Update<Sbf_TrusteeshipTask>(id).Set(t => t.IsEnd, true)
.Set(t => t.EndTime, DateTime.Now)
.ExecuteAffrows();
}
}
}

Loading…
Cancel
Save