AdoS8IssueLedgerController.cs 1.4 KB

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