AdoS8IssueLedgerController.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using Admin.NET.Plugin.AiDOP.Dto.S8;
  2. using Admin.NET.Plugin.AiDOP.Infrastructure;
  3. using Admin.NET.Plugin.AiDOP.Service.S8;
  4. namespace Admin.NET.Plugin.AiDOP.Controllers.S8;
  5. /// <summary>
  6. /// G-06 最小问题台账只读查询接口。仅一个只读 GET,鉴权走现有中间件。
  7. /// state 仅接受 discovered / processing / closed / 空;不接受别名、不兼容 hold / suspend / pending / all。
  8. /// </summary>
  9. [ApiController]
  10. [Route("api/aidop/s8/issues/ledger")]
  11. [NonUnify]
  12. public class AdoS8IssueLedgerController : ControllerBase
  13. {
  14. private readonly S8IssueLedgerService _svc;
  15. private readonly S8TrustedScopeResolver _scope;
  16. public AdoS8IssueLedgerController(S8IssueLedgerService svc, S8TrustedScopeResolver scope)
  17. {
  18. _svc = svc;
  19. _scope = scope;
  20. }
  21. [HttpGet]
  22. public async Task<IActionResult> QueryAsync([FromQuery] AdoS8IssueLedgerQueryDto q)
  23. {
  24. try
  25. {
  26. var scope = await _scope.ResolveAsync();
  27. q.TenantId = scope.TenantId;
  28. q.FactoryId = scope.FactoryId;
  29. var (total, list) = await _svc.QueryAsync(q);
  30. return Ok(new { total, list });
  31. }
  32. catch (S8BizException ex)
  33. {
  34. return BadRequest(new { message = ex.Message });
  35. }
  36. }
  37. }