package com.xintong.visualinspection.controller;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.xintong.visualinspection.bean.StatisticsBean;
import com.xintong.visualinspection.service.StatisticsService;

/**
 * 文件名：StatisticsController
 * 版本信息：日期：2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
 */
@RestController
@RequestMapping("/file")
public class FileExcelController extends BaseController {

	@Autowired
	private StatisticsService statisticsService;
    
    /**
     * 温馨服务考核情况反馈表（所有员工排名）
     * @return
     * String
     * @exception
     * @since  1.0.0
     */
    @RequestMapping(value = "/employee/order",method=RequestMethod.GET)
    public String getEmployeeOrder(HttpServletRequest req,HttpServletResponse resp,
    		@RequestParam Long dept_id,
    		@RequestParam String start_date,@RequestParam String end_date,
    		@RequestParam String start_score,@RequestParam String end_score){
    	StatisticsBean obj = new StatisticsBean();
    	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss" );
    	try {
			Date start = sdf.parse(start_date);
			Date end = sdf.parse(end_date);
			obj.setDept_id(dept_id);
			obj.setStart_date(start);
			obj.setEnd_date(end);
			obj.setStart_score(start_score);
			obj.setEnd_score(end_score);
		} catch (ParseException e) {
			e.printStackTrace();
		}
    	statisticsService.getEmployeeCheckedInfo(obj, req, resp);
    	return super.returnSuccessResult(null);
    }
    
    /**
     * 温馨服务检查千分考核扣分情况汇总表
     * @param obj
     * @return
     */
    @RequestMapping(value = "/score/info",method=RequestMethod.GET)
    public String getScoreInfo(HttpServletRequest req,HttpServletResponse resp,
    		@RequestParam String start_date,@RequestParam String end_date){
    	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss" );
    	StatisticsBean obj = new StatisticsBean();
    	try {
			Date start = sdf.parse(start_date);
			Date end = sdf.parse(end_date);
			obj.setStart_date(start);
			obj.setEnd_date(end);
		} catch (ParseException e) {
			e.printStackTrace();
		}
    	statisticsService.getFeeStationCheckedScore(obj, req, resp);
    	return super.returnSuccessResult(null);
    }
    
    /**
     * 温馨服务检查情况统计表
     */
    @RequestMapping(value = "/score/item/info",method=RequestMethod.GET)
    public String getScoreItemInfo(HttpServletRequest req,HttpServletResponse resp,
    		@RequestParam String start_date,@RequestParam String end_date){
    	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss" );
    	StatisticsBean obj = new StatisticsBean();
    	try {
			Date start = sdf.parse(start_date);
			Date end = sdf.parse(end_date);
			obj.setStart_date(start);
			obj.setEnd_date(end);
		} catch (ParseException e) {
			e.printStackTrace();
		}
    	statisticsService.getFeeStationCheckItemScore(obj, req, resp);
    	return super.returnSuccessResult(null);
    }
}
