Переглянути джерело

feat: add submit/approve/reject-verification endpoints to S8 controller

YY968XX 6 місяців тому
батько
коміт
28d41d0193

+ 43 - 0
server/Plugins/Admin.NET.Plugin.AiDOP/Controllers/S8/AdoS8ExceptionsController.cs

@@ -112,6 +112,49 @@ public class AdoS8ExceptionsController : ControllerBase
         catch (S8BizException ex) { return BadRequest(new { message = ex.Message }); }
     }
 
+    [HttpPost("{id:long}/submit-verification")]
+    public async Task<IActionResult> SubmitVerificationAsync(long id,
+        [FromQuery] long tenantId = 1, [FromQuery] long factoryId = 1,
+        [FromQuery] long currentUserId = 0,
+        [FromBody] AdoS8SubmitVerificationDto? body = null)
+    {
+        try
+        {
+            var e = await _taskFlowSvc.SubmitVerificationAsync(
+                id, tenantId, factoryId, currentUserId, body?.VerifierId ?? 0, body?.Remark);
+            return Ok(new { id = e.Id, status = e.Status, verifierId = e.VerifierId });
+        }
+        catch (S8BizException ex) { return BadRequest(new { message = ex.Message }); }
+    }
+
+    [HttpPost("{id:long}/approve-verification")]
+    public async Task<IActionResult> ApproveVerificationAsync(long id,
+        [FromQuery] long tenantId = 1, [FromQuery] long factoryId = 1,
+        [FromQuery] long currentUserId = 0,
+        [FromBody] AdoS8ApproveVerificationDto? body = null)
+    {
+        try
+        {
+            var e = await _taskFlowSvc.ApproveVerificationAsync(id, tenantId, factoryId, currentUserId, body?.Remark);
+            return Ok(new { id = e.Id, status = e.Status });
+        }
+        catch (S8BizException ex) { return BadRequest(new { message = ex.Message }); }
+    }
+
+    [HttpPost("{id:long}/reject-verification")]
+    public async Task<IActionResult> RejectVerificationAsync(long id,
+        [FromQuery] long tenantId = 1, [FromQuery] long factoryId = 1,
+        [FromQuery] long currentUserId = 0,
+        [FromBody] AdoS8RejectVerificationDto? body = null)
+    {
+        try
+        {
+            var e = await _taskFlowSvc.RejectVerificationAsync(id, tenantId, factoryId, currentUserId, body?.Remark ?? string.Empty);
+            return Ok(new { id = e.Id, status = e.Status });
+        }
+        catch (S8BizException ex) { return BadRequest(new { message = ex.Message }); }
+    }
+
     [HttpPost("{id:long}/comment")]
     public async Task<IActionResult> CommentAsync(long id, [FromBody] AdoS8CommentDto? body = null)
     {