package com.goafanti.order.controller; import java.io.IOException; import java.util.List; import javax.servlet.http.HttpServletResponse; import com.goafanti.common.utils.excel.NewExcelUtil; import com.goafanti.order.bo.*; import com.goafanti.order.service.OrderStatisticsService; import com.goafanti.order.service.UserStaticticsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.goafanti.common.bo.Result; import com.goafanti.common.controller.CertifyApiController; import com.goafanti.order.service.ProjectStatisticsService; @RestController @RequestMapping(value = "/api/admin/statistis") public class StatisticsApiController extends CertifyApiController { @Value(value = "${upload.path}") private String uploadPath = null; @Autowired private ProjectStatisticsService projectStatisticsService; @Autowired private OrderStatisticsService orderStatisticsService; @Autowired private UserStaticticsService userStaticticsService; /** * 项目汇总列表 */ @RequestMapping(value="/selectTaskList" ,method = RequestMethod.GET) public Result selectTaskList(InputProjectStatistics ps){ Result res=new Result(); res.setData(projectStatisticsService.selectTaskList( ps)); return res; } /** * 项目汇总列表导出xls * @throws IOException */ @RequestMapping(value = "/exporTaskList", method = RequestMethod.GET) public Result exporTaskList(InputProjectStatistics ib,HttpServletResponse response) { return projectStatisticsService.exporTaskList( ib,response); } /** * 项目省份统计列表 */ @RequestMapping(value="/selectProvincialStatistics" ,method = RequestMethod.GET) public Result selectProvincialStatistics(InputProvincialStatistics is){ Result res=new Result(); res.setData(projectStatisticsService.selectProvincialStatistics( is)); return res; } /** * 项目省份统计列表导出xls * @throws IOException */ @RequestMapping(value = "/exporProvincialList", method = RequestMethod.GET) public Result exporProvincialList(InputProvincialStatistics ib){ Result res=new Result(); return projectStatisticsService.exporProvincialList( ib); } /** * 订单销售来源统计 */ @RequestMapping(value="/orderSalesSource" ,method = RequestMethod.GET) public Result orderSalesSource(InputOrderSalesSource in){ Result res=new Result(); res.setData(orderStatisticsService.orderSalesSource( in)); return res; } /** * 订单销售来源统计 */ @RequestMapping(value="/orderSalesSource/export" ,method = RequestMethod.GET) public Result orderSalesSourceExport(InputOrderSalesSource in){ List list =orderStatisticsService.orderSalesSource( in); NewExcelUtil excelUtil=new NewExcelUtil<>(OutOrderSalesSource.class); StringBuffer str=new StringBuffer("搜索条件=》"); if (in.getDepName()!=null)str=str.append("部门:").append(in.getDepName()).append(";"); if(in.getProvinceName()!=null)str=str.append("省份:").append(in.getProvinceName()).append(";"); if (in.getSort()!=null)str=str.append("排序:").append(in.getSort()==1?"签单数":"签单金额").append(";"); if (in.getStartDate()!=null &&in.getEndDate()!=null)str=str.append("时间:").append(in.getStartDate()).append("~") .append(in.getEndDate()).append(";"); return excelUtil.exportExcel(list,"订单销售来源统计表",uploadPath,str.toString()); } /** * 签单客户汇总 */ @RequestMapping(value = "/signSummary",method = RequestMethod.GET) public Result signSummary(InputSignSummary in){ Result res = new Result(); res.data(userStaticticsService.signSummary(in)); return res; } /** * 签单客户汇总 */ @RequestMapping(value = "/signSummary/export",method = RequestMethod.GET) public Result signSummaryExport(InputSignSummary in){ List list = userStaticticsService.signSummaryList(in); NewExcelUtil excelUtil=new NewExcelUtil<>(OutSignSummary.class); return excelUtil.exportExcel(list,"签单客户汇总表",uploadPath); } }