AdoS8IssueLedgerController.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. var (total, list) = await _svc.QueryAsync(q);
  32. return Ok(new { total, list });
  33. }
  34. catch (S8BizException ex)
  35. {
  36. return BadRequest(new { message = ex.Message });
  37. }
  38. }
  39. }