SMPReportsController.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using Microsoft.AspNetCore.Authorization;
  2. using Microsoft.AspNetCore.Mvc;
  3. using System.Collections.Generic;
  4. using System.Threading.Tasks;
  5. using XYY.Core.Standard.Mvc;
  6. using XYY.Model.Standard.Finance;
  7. using XYY.Service.Standard.Finance;
  8. using static XYY.Api.Finance.Controllers.FinanceController;
  9. namespace XYY.Api.Finance.Controllers
  10. {
  11. [Route("api/[controller]/[action]")]
  12. [ApiController]
  13. public class SMPReportsController : ApiControllerBase
  14. {
  15. private readonly ISMPReportsService _reportsService;
  16. public SMPReportsController(ISMPReportsService reportsService) {
  17. _reportsService = reportsService;
  18. }
  19. [AllowAnonymous]
  20. [HttpPost]
  21. public async Task<List<EFFinanceBill>> GetEFFinanceBillGroup(BillSerach serach)
  22. {
  23. var result = await _reportsService.GetEFFinanceBillGroup(serach.StartDate, serach.EndDate, serach.ChannelId, serach.CustomerId,serach.SalesmanUserId,serach.BranchCompanyId);
  24. return result;
  25. }
  26. [AllowAnonymous]
  27. [HttpPost]
  28. public async Task<List<EFFinanceGroupBill>> GetEFFinanceBillGroupAsCustomer(BillSerach serach)
  29. {
  30. return await _reportsService.CacheGetEFFinanceBillGroupAsCustomer(serach.StartDate, serach.EndDate);
  31. }
  32. [AllowAnonymous]
  33. [HttpPost]
  34. public async Task<List<EFFinanceGroupBill>> GetEFFinanceBillGroupAsChannel(BillSerach serach)
  35. {
  36. return await _reportsService.CacheGetEFFinanceBillGroupAsChannel(serach.StartDate, serach.EndDate);
  37. }
  38. [AllowAnonymous]
  39. [HttpPost]
  40. public async Task<IActionResult> ExportEFFinanceBillGroup(BillSerach serach)
  41. {
  42. var list = await _reportsService.ExportEFFinanceBillGroup(serach.StartDate, serach.EndDate, serach.ChannelId, serach.CustomerId, serach.SalesmanUserId, serach.BranchCompanyId);
  43. return CSVFile("数据透视表.xls", list);
  44. }
  45. }
  46. }