ReportService.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using wispro.sp.share;
  6. namespace wispro.sp.web.Services
  7. {
  8. public class ReportService
  9. {
  10. private readonly IHttpService _httpClient;
  11. public ReportService(IHttpService httpClient)
  12. {
  13. _httpClient = httpClient;
  14. }
  15. public async Task<ChartDatas> GetAppealReportData(int type,DateTime? start,DateTime? end,int? userId)
  16. {
  17. //AppealReport(int type, DateTime ? start, DateTime ? end, int ? userId)
  18. string strUrl = $"Report/AppealReport?type={type}";
  19. if (start.HasValue)
  20. {
  21. strUrl = $"{strUrl}&start={start?.ToString("yyyy-MM-dd")}";
  22. }
  23. if (end.HasValue)
  24. {
  25. strUrl = $"{strUrl}&end={end?.ToString("yyyy-MM-dd")}";
  26. }
  27. if (userId.HasValue)
  28. {
  29. strUrl = $"{strUrl}&userId={userId.Value}";
  30. }
  31. var data = await _httpClient.Get<share.ChartDatas>(strUrl);
  32. return data;
  33. }
  34. public async Task<ChartDatas> GetStaticReportData(int iType)
  35. {
  36. int i = 0;
  37. bool isYear = false;
  38. switch (iType)
  39. {
  40. case 0:
  41. i = 0;
  42. break;
  43. case 2:
  44. i = 0;
  45. isYear = true;
  46. break;
  47. case 1:
  48. i = 1;
  49. break;
  50. case 3:
  51. i = 1;
  52. isYear = true;
  53. break;
  54. case 4:
  55. i = 2;
  56. break;
  57. }
  58. string strUrl = $"Report/StaticsReport?type={i}&isYear={isYear}";
  59. var data = await _httpClient.Get<share.ChartDatas>(strUrl);
  60. return data;
  61. }
  62. }
  63. }