package com.goafanti.order.controller;



import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
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.bo.InputProjectStatistics;
import com.goafanti.order.bo.InputProvincialStatistics;
import com.goafanti.order.service.ProjectStatisticsService;

@RestController
@RequestMapping(value = "/api/admin/statistis")
public class ProjectStatisticsApiController extends CertifyApiController {
	
	@Autowired
	private ProjectStatisticsService	projectStatisticsService;
	
	
	
	/**
	 * 	项目汇总列表
	 */
	@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(HttpServletResponse response,InputProjectStatistics ib) throws IOException{
		Result res=new Result();
		try {
			projectStatisticsService.exporTaskList( response, ib);
		} catch (Exception e) {
			res.getError().add(buildError("格式不正确"));
			e.printStackTrace();
			return res;
		}
     res.data(1); 
	return res;
		
	}
	
	
	/**
	 * 	项目省份统计列表
	 */
	@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(HttpServletResponse response,InputProvincialStatistics ib) throws IOException{
		Result res=new Result();
		try {
			projectStatisticsService.exporProvincialList( response, ib);
		} catch (Exception e) {
			res.getError().add(buildError("格式不正确"));
			e.printStackTrace();
			return res;
		}
     res.data(1); 
	return res;
		
	}
	
	
	
}
