StatisticsApiController.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. package com.goafanti.order.controller;
  2. import java.io.IOException;
  3. import java.util.List;
  4. import javax.servlet.http.HttpServletResponse;
  5. import com.goafanti.common.utils.excel.NewExcelUtil;
  6. import com.goafanti.order.bo.*;
  7. import com.goafanti.order.service.OrderStatisticsService;
  8. import com.goafanti.order.service.UserStaticticsService;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.beans.factory.annotation.Value;
  11. import org.springframework.web.bind.annotation.RequestMapping;
  12. import org.springframework.web.bind.annotation.RequestMethod;
  13. import org.springframework.web.bind.annotation.RestController;
  14. import com.goafanti.common.bo.Result;
  15. import com.goafanti.common.controller.CertifyApiController;
  16. import com.goafanti.order.service.ProjectStatisticsService;
  17. @RestController
  18. @RequestMapping(value = "/api/admin/statistis")
  19. public class StatisticsApiController extends CertifyApiController {
  20. @Value(value = "${upload.path}")
  21. private String uploadPath = null;
  22. @Autowired
  23. private ProjectStatisticsService projectStatisticsService;
  24. @Autowired
  25. private OrderStatisticsService orderStatisticsService;
  26. @Autowired
  27. private UserStaticticsService userStaticticsService;
  28. /**
  29. * 项目汇总列表
  30. */
  31. @RequestMapping(value="/selectTaskList" ,method = RequestMethod.GET)
  32. public Result selectTaskList(InputProjectStatistics ps){
  33. Result res=new Result();
  34. res.setData(projectStatisticsService.selectTaskList( ps));
  35. return res;
  36. }
  37. /**
  38. * 项目汇总列表导出xls
  39. * @throws IOException
  40. */
  41. @RequestMapping(value = "/exporTaskList", method = RequestMethod.GET)
  42. public Result exporTaskList(InputProjectStatistics ib,HttpServletResponse response) {
  43. return projectStatisticsService.exporTaskList( ib,response);
  44. }
  45. /**
  46. * 项目省份统计列表
  47. */
  48. @RequestMapping(value="/selectProvincialStatistics" ,method = RequestMethod.GET)
  49. public Result selectProvincialStatistics(InputProvincialStatistics is){
  50. Result res=new Result();
  51. res.setData(projectStatisticsService.selectProvincialStatistics( is));
  52. return res;
  53. }
  54. /**
  55. * 项目省份统计列表导出xls
  56. * @throws IOException
  57. */
  58. @RequestMapping(value = "/exporProvincialList", method = RequestMethod.GET)
  59. public Result exporProvincialList(InputProvincialStatistics ib){
  60. Result res=new Result();
  61. return projectStatisticsService.exporProvincialList( ib);
  62. }
  63. /**
  64. * 订单销售来源统计
  65. */
  66. @RequestMapping(value="/orderSalesSource" ,method = RequestMethod.GET)
  67. public Result orderSalesSource(InputOrderSalesSource in){
  68. Result res=new Result();
  69. res.setData(orderStatisticsService.orderSalesSource( in));
  70. return res;
  71. }
  72. /**
  73. * 订单销售来源统计
  74. */
  75. @RequestMapping(value="/orderSalesSource/export" ,method = RequestMethod.GET)
  76. public Result orderSalesSourceExport(InputOrderSalesSource in){
  77. List<OutOrderSalesSource> list =orderStatisticsService.orderSalesSource( in);
  78. NewExcelUtil<OutOrderSalesSource> excelUtil=new NewExcelUtil<>(OutOrderSalesSource.class);
  79. StringBuffer str=new StringBuffer("搜索条件=》");
  80. if (in.getDepName()!=null)str=str.append("部门:").append(in.getDepName()).append(";");
  81. if(in.getProvinceName()!=null)str=str.append("省份:").append(in.getProvinceName()).append(";");
  82. if (in.getSort()!=null)str=str.append("排序:").append(in.getSort()==1?"签单数":"签单金额").append(";");
  83. if (in.getStartDate()!=null &&in.getEndDate()!=null)str=str.append("时间:").append(in.getStartDate()).append("~")
  84. .append(in.getEndDate()).append(";");
  85. return excelUtil.exportExcel(list,"订单销售来源统计表",uploadPath,str.toString());
  86. }
  87. /**
  88. * 签单客户汇总
  89. */
  90. @RequestMapping(value = "/signSummary",method = RequestMethod.GET)
  91. public Result signSummary(InputSignSummary in){
  92. Result res = new Result();
  93. res.data(userStaticticsService.signSummary(in));
  94. return res;
  95. }
  96. /**
  97. * 签单客户汇总
  98. */
  99. @RequestMapping(value = "/signSummary/export",method = RequestMethod.GET)
  100. public Result signSummaryExport(InputSignSummary in){
  101. List<OutSignSummary> list = userStaticticsService.signSummaryList(in);
  102. NewExcelUtil<OutSignSummary> excelUtil=new NewExcelUtil<>(OutSignSummary.class);
  103. return excelUtil.exportExcel(list,"签单客户汇总表",uploadPath);
  104. }
  105. }