码迷,mamicode.com
首页 > 其他好文 > 详细

导出数据为Excel文件---Controller

时间:2017-06-30 23:52:08      阅读:362      评论:0      收藏:0      [点我收藏+]

标签:color   exp   ram   ring   data   esc   ati   index   and   

@Controller
@RequestMapping("/vehmileage")
public class VehMileageController extends BaseController{
    private static final Logger LOG=Logger.getLogger(VehMileageController.class);
    private static final String FILE_NAME="里程导出";
    private static final String FILE_TAIL=".csv";
    private static final String SHEET_NAME="里程数据";
    private static final String HEADER_NAME="车牌号,所属机构,总里程,阶段里程";
    private static final String DATE_TYPE="DAY";
    @RequestMapping(value="/index",method=RequestMethod.GET)
    public @ResponseBody ModelAndView index(){
        LOG.info("Inside mileageManagement Page");
        ModelAndView mv=new ModelAndView("Transportation/mileageManagement");
        return mv;
    }
    @RequestMapping(value="/export",method=RequestMethod.GET,produces="text/html;charset=UTF-8")
    public void exportVehMileage(HttpServletRequest request,HttpServletResponse response){
        LOG.info("Inside mileageManagement");
        ExportVehMileageModel EVMModel =new ExportVehMileageModel();
        EVMModel.setUser(getCurrentUser());
        EVMModel.setVehiclePlate(request.getParameter("vehiclePlate"));
        EVMModel.setInstatutionId(request.getParameter("instatutionId"));
        EVMModel.setTimeLowBound(request.getParameter("timeLowBound"));
        EVMModel.setTimeUpBound(request.getParameter("timeUpBound"));
        EVMModel.setFileName(request.getParameter("fileName"));
        EVMModel.setSheetName(request.getParameter("sheetName"));
        EVMModel.setLicensePlate(request.getParameter("licensePlate"));
        EVMModel.setOrganition(request.getParameter("organition"));
        EVMModel.setTotalmileage(request.getParameter("totalmileage"));
        EVMModel.setPhasemileage(request.getParameter("phasemileage"));
        try{
            ExportVehMileageClient client=(ExportVehMileageClient)getWSClient(GET_EXPORTVEHMILEAGE_CLIENT);
            List<String> data=client.export(EVMModel);
            ExportVehMileagesClient client2=(ExportVehMileagesClient)getWSClient(GET_EXPORTVEHMILEAGES_CLIENT);
            List<VehicleModel> vehicles=client2.export(EVMModel);
            String vehiclePlate=request.getParameter("vehiclePlate")
            String instatutionId=request.getParameter("instatutionId")
            String timeLowBound=request.getParameter("timeLowBound")
            String timeUpBound=request.getParameter("timeUpBound")
            SimpleDateFormat sdf=new SimpleDateFormat(EtruckContants.DATE_FORMAT_Y);
            SimpleDateFormat ddf=new SimpleDateFormat(EtruckContants.DATE_FORMAT_Y);
            if(instatutionId==null || "".equals(instatutionId)){
                instatutionId=getCurrentUser().getInstatutionId().toString();
            }
            StringTokenizer st=new StringTokenizer(vehiclePlate,",");
            ArrayList<String> vehiclePlates=new ArrayList<>();
            while(st.hasMoreElements()){
                String vpn=(String)st.nextElement();
            }
        }catch (Exception e) {
            // TODO: handle exception
        }
    }
}

 

导出数据为Excel文件---Controller

标签:color   exp   ram   ring   data   esc   ati   index   and   

原文地址:http://www.cnblogs.com/shen199103/p/7100883.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!