AppPageReportController.java 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. package com.huaxu.controller;
  2. import com.huaxu.dto.MonthRevenueDto;
  3. import com.huaxu.dto.generalView.DeviceWaterSupply;
  4. import com.huaxu.model.AjaxMessage;
  5. import com.huaxu.model.ResultStatus;
  6. import com.huaxu.service.AppPageReportService;
  7. import com.huaxu.service.HomePageReportService;
  8. import com.huaxu.service.RevenueService;
  9. import io.swagger.annotations.Api;
  10. import io.swagger.annotations.ApiOperation;
  11. import io.swagger.annotations.ApiParam;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.web.bind.annotation.RequestMapping;
  14. import org.springframework.web.bind.annotation.RequestMethod;
  15. import org.springframework.web.bind.annotation.RequestParam;
  16. import org.springframework.web.bind.annotation.RestController;
  17. import java.time.LocalDate;
  18. import java.util.ArrayList;
  19. import java.util.List;
  20. /**
  21. * @description
  22. * @auto wangbo
  23. * @data 2021/3/18 10:50
  24. */
  25. @RestController
  26. @RequestMapping("/appPageReport")
  27. @Api(tags = "App总览报表")
  28. public class AppPageReportController {
  29. @Autowired
  30. private AppPageReportService appPageReportService;
  31. @Autowired
  32. private RevenueService revenueService;
  33. /**
  34. * App生产总览数据-本月数据
  35. * @param companyOrgId
  36. * @return
  37. */
  38. @RequestMapping(value = "getProductionDataForSameMonth",method = RequestMethod.GET)
  39. @ApiOperation(value = "App总览——生产数据(本月)")
  40. public AjaxMessage<List<DeviceWaterSupply>> getProductionDataForMonth(
  41. @ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
  42. List<DeviceWaterSupply> result = new ArrayList<DeviceWaterSupply>();
  43. result.addAll(appPageReportService.deviceWaterReportForMonth(companyOrgId,"水源",4,1));
  44. result.addAll(appPageReportService.deviceWaterReportForMonth(companyOrgId,"水厂",3,1));
  45. result.addAll(appPageReportService.deviceSellerWaterReportForMonth(companyOrgId,1));
  46. return new AjaxMessage<>(ResultStatus.OK,result);
  47. }
  48. /**
  49. * App生产总览数据-本年数据
  50. * @param companyOrgId
  51. * @return
  52. */
  53. @RequestMapping(value = "getProductionDataForSameYear",method = RequestMethod.GET)
  54. @ApiOperation(value = "App总览——生产数据(本月)")
  55. public AjaxMessage<List<DeviceWaterSupply>> getProductionDataForSameYear(
  56. @ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
  57. LocalDate localDate = LocalDate.now();
  58. List<DeviceWaterSupply> result = new ArrayList<DeviceWaterSupply>();
  59. result.addAll(appPageReportService.deviceWaterReportForMonth(companyOrgId,"水源",4,localDate.getMonthValue()));
  60. result.addAll(appPageReportService.deviceWaterReportForMonth(companyOrgId,"水厂",3,localDate.getMonthValue()));
  61. result.addAll(appPageReportService.deviceSellerWaterReportForMonth(companyOrgId,localDate.getMonthValue()));
  62. return new AjaxMessage<>(ResultStatus.OK,result);
  63. }
  64. /**
  65. * App生产总览数据-近一年数据
  66. * @param companyOrgId
  67. * @return
  68. */
  69. @RequestMapping(value = "getProductionDataFor12Month",method = RequestMethod.GET)
  70. @ApiOperation(value = "App总览——生产数据(本月)")
  71. public AjaxMessage<List<DeviceWaterSupply>> getProductionDataFor12Month(
  72. @ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
  73. List<DeviceWaterSupply> result = new ArrayList<DeviceWaterSupply>();
  74. result.addAll(appPageReportService.deviceWaterReportForMonth(companyOrgId,"水源",4,12));
  75. result.addAll(appPageReportService.deviceWaterReportForMonth(companyOrgId,"水厂",3,12));
  76. result.addAll(appPageReportService.deviceSellerWaterReportForMonth(companyOrgId,12));
  77. return new AjaxMessage<>(ResultStatus.OK,result);
  78. }
  79. }