ESBController.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using EasyNetQ;
  2. using Microsoft.AspNetCore.Authorization;
  3. using Microsoft.AspNetCore.Mvc;
  4. using Microsoft.AspNetCore.Mvc.RazorPages;
  5. using System.Collections.Generic;
  6. using System.Threading.Tasks;
  7. using XYY.Authentication.Standard;
  8. using XYY.Common.Standard;
  9. using XYY.Core.Standard.Mvc;
  10. using XYY.Model.Standard.First.dto;
  11. using XYY.Model.Standard.First;
  12. using XYY.Service.Standard.First.ESB;
  13. namespace XYY.Api.First.Controllers
  14. {
  15. [Route("api/[controller]/[action]")]
  16. [ApiController]
  17. public class ESBController : ControllerBase
  18. {
  19. IESBService eSBSendService;
  20. public ESBController(IESBService eSBSendService)
  21. {
  22. this.eSBSendService = eSBSendService;
  23. }
  24. public class Req
  25. {
  26. public List<TrackingDto> dtos { get; set; }
  27. }
  28. [HttpPost]
  29. public async Task<ApiJsonModel> Update(Req req)
  30. {
  31. var u = User.GetUserContent();
  32. await eSBSendService.Update(req.dtos, u.CustomerId);
  33. return ApiJsonModel.OK();
  34. }
  35. [AllowAnonymous]
  36. [HttpPost]
  37. public async Task<ApiJsonModel<PageResult<ZZESBTrackingApiInfo>>> QueryPager(QueryModel queueMode)
  38. {
  39. var pagers = await eSBSendService.GetPageResult(queueMode);
  40. return ApiJsonModel<PageResult<ZZESBTrackingApiInfo>>.OK(pagers);
  41. }
  42. [AllowAnonymous]
  43. [HttpPost]
  44. public async Task<ApiJsonModel> Retry(ESBKeyList list)
  45. {
  46. await eSBSendService.Retry(list.Keys);
  47. return ApiJsonModel.OK();
  48. }
  49. [AllowAnonymous]
  50. [HttpPost]
  51. public async Task<IEnumerable<TrackMonitor>> GetTrackPageResult(TrackMonitorQueryParam qm)
  52. {
  53. var pagers = await eSBSendService.GetTrackPageResult(qm);
  54. return pagers;
  55. }
  56. /// <summary>
  57. /// 每天10点调用,推送esb轨迹监控文件
  58. /// </summary>
  59. /// <returns></returns>
  60. [AllowAnonymous]
  61. [HttpGet]
  62. public async Task ESBTrackMonitor()
  63. {
  64. await eSBSendService.PushESBTrackMonitor();
  65. }
  66. }
  67. }