• 手机版

    扫码体验手机版

  • 微信公众号

    扫码关注公众号

国内首家协议开发

软芯音视解码保护平台

在线
客服

发布
需求

在线
聊天

天盟
APP

天盟APP下载

关注
微信

微信扫一扫访问
顶部

pio导excel问题,导出数据不对!!!!

我用pio做数据导出表格的功能.但是导出的只是默认显示的前十条数据.查询之后导出的仍然是默认显示的前十条数据.不是查询出来的数据,请问是什么原因!!!!下面是我导出方法的代码
/**         * 导出消费记录         *          * @param params         * @param inParams         * @return         */        @RequestMapping(value = "/exportcustomerOrderList")        public void exportcustomerOrderList(Map params,                        @RequestParam Map inParams,HttpServletResponse response) {                PageBean page = new PageBean();                try {                        page.setPageNum(inParams.get("pageNum") == null ? 1 : Integer                                        .parseInt(inParams.get("pageNum").toString()));                        String customerName = inParams.get("customerName") == null ? ""                                        : inParams.get("customerName").toString();                        String recordName = inParams.get("recordName") == null ? ""                                        : inParams.get("recordName").toString();                        String orderSN = inParams.get("orderSN") == null ? "" : inParams                                        .get("orderSN").toString();                        String orderStatus = inParams.get("orderStatus") == null ? ""                                        : inParams.get("orderStatus").toString();                        String recordAccount = inParams.get("recordAccount") == null ? ""                                        : inParams.get("recordAccount").toString();                        String billStatus = inParams.get("billStatus") == null ? ""                                        : inParams.get("billStatus").toString();                        // ************************时间戳新建功能*********************************                        String startTime = inParams.get("startTime") == null ? ""                                        : inParams.get("startTime").toString();                        System.out.println("startTime++++++++++++++++++++" + startTime);                        String endTime = inParams.get("endTime") == null ? "" : inParams                                        .get("endTime").toString();                        System.out.println("endTime++++++++++++++++++++" + endTime);                        // *******************************************************************                        Map param = new HashMap();                        if (!"".equals(billStatus)) {                                param.put("billStatus", billStatus);                        }                        if (!"".equals(recordAccount)) {                                param.put("recordAccount", recordAccount);                        }                        if (!customerName.equals("")) {                                param.put("customerName", customerName);                        }                        if (!recordName.equals("")) {                                param.put("recordName", recordName);                        }                        if (!orderSN.equals("")) {                                param.put("orderSN", orderSN);                        }                        if (!orderStatus.equals("")) {                                param.put("orderStatus", orderStatus);                        }                        // ************************时间戳新建功能*********************************                        if (!startTime.equals("")) {                                param.put("startTime", startTime);                        }                        if (!endTime.equals("")) {                                param.put("endTime", endTime);                        }                        // *******************************************************************                        if (null != inParams.get("paid")) {                                param.put("paid", true);                        }                        List list = orderService                                        .pagedQueryByParamsForOrderManagement(param, page);                        params.put("statuslist", Arrays.asList(Order.Status.values()));                        if (null != inParams.get("nopaystatus")) {                                params.put("nopaystatus", true);                        }                        params.put("customerOrderList", list);                                                params.put("page", page);                        params.put("customerName", customerName);                        params.put("recordName", recordName);                        if (!"".equals(recordAccount)) {                                params.put("recordName",                                                recordUserService.get(Integer.parseInt(recordAccount))                                                                .getUserName());                        }                        params.put("orderSN", orderSN);                        params.put("orderStatus", orderStatus);                        List dataList=new ArrayList();                        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");                                                for(Order order:list){                                                                Map model=new HashMap();                                model.put("orderSn", order.getOrderSn());                                model.put("createdTime", sdf.format(order.getCreatedTime()));                                //订单时间长度和结算时间                                model.put("budgetMinutes", order.minutesInfo(order.getBudgetMinutes())+"");                                model.put("billMinutes", order.minutesInfo(order.getBillMinutes())+"");                                model.put("customerName", order.getCustomer().getUserName());                                model.put("statusLabel", order.getStatusLabel());                                dataList.add(model);                        }                        ExcelIOUtil excelIOUtil=new ExcelIOUtil();                        excelIOUtil.exportcustomerOrderList(response, dataList);                } catch (Exception e) {                        e.printStackTrace();                }        }        //导出消费表格        public  void exportcustomerOrderList(HttpServletResponse response, List list) {                try {                        String fileName = "消费表格.xls";                        fileName = new String(fileName.getBytes("GBK"), "iso8859-1");                        response.reset();                        response.setHeader("Content-Disposition", "attachment;filename=" + fileName);//指定要输出的文件名                        response.setContentType("application/vnd.ms-excel");                        response.setHeader("Pragma", "no-cache");                        response.setHeader("Cache-Control", "no-cache");                        response.setDateHeader("Expires", 0);                        OutputStream output = response.getOutputStream();                        BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output);                        System.out.println("__________________________________________");                        //工作表名                        String worksheet = "sheet1";                        HSSFWorkbook wb = new HSSFWorkbook();                        HSSFSheet sheet = wb.createSheet(worksheet);                        //创建列标头LIST                        List titleList = new ArrayList();                        //titleList.add("ID");     //visId                          //name                        titleList.add("订单编号");                        titleList.add("创建时间");                        titleList.add("预计时长");                        titleList.add("计算时长");                        titleList.add("客户");                                        titleList.add("处理状态");                        // 创建单元格样式                        HSSFCellStyle cellStyleTitle = wb.createCellStyle();                        // 指定单元格水平居中对齐                        cellStyleTitle.setAlignment(HSSFCellStyle.ALIGN_CENTER);                                                // 指定单元格垂直居中对齐                        cellStyleTitle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);                        // 指定当单元格内容显示不下时自动换行                        cellStyleTitle.setWrapText(true);                        //------------------------------------------------------------------                        HSSFCellStyle cellStyle = wb.createCellStyle();                        // 指定单元格居中对齐                        cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);                        // 指定单元格垂直居中对齐                        cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);                        // 指定当单元格内容显示不下时自动换行                        cellStyle.setWrapText(true);                                                //------------------------------------------------------------------                        // 设置单元格字体                        HSSFFont font = wb.createFont();                        font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);                        font.setFontName("宋体");                        font.setFontHeight((short) 200);                        cellStyleTitle.setFont(font);                        //==================================================================                        //定义第一行                        HSSFRow row = sheet.createRow(0);                        HSSFCell cell = null;                        for (int i = 0; i < titleList.size(); i++) {                                cell = row.createCell((short)i);                                cell.setCellStyle(cellStyleTitle);                                cell.setCellValue(new HSSFRichTextString(titleList.get(i)));                        }                        int rowNumber = 1;                        for (Map map : list) {                                row = sheet.createRow(rowNumber);                                cell.setCellStyle(cellStyle);                                int num=0;                                cell = row.createCell((short)num++);                                cell.setCellValue(new HSSFRichTextString(map.get("orderSn")));                                                                cell = row.createCell((short)num++);                                cell.setCellValue(new HSSFRichTextString(map.get("createdTime")));                                cell = row.createCell((short)num++);                                cell.setCellValue(new HSSFRichTextString(map.get("budgetMinutes")));                                cell = row.createCell((short)num++);                                cell.setCellValue(new HSSFRichTextString(map.get("billMinutes")));                                cell = row.createCell((short)num++);                                cell.setCellValue(new HSSFRichTextString(map.get("customerName")));                                cell = row.createCell((short)num++);                                cell.setCellValue(new HSSFRichTextString(map.get("statusLabel")));                                                                rowNumber++;                        }                                                wb.write(bufferedOutPut);                                                bufferedOutPut.flush();                        bufferedOutPut.close();                        wb.removeSheetAt(0);                } catch (IOException e) {                        e.printStackTrace();                } finally {                        list.clear();                }        }其他就不一一列举了,求大神告知症状所在!!!!!

免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。

版权声明:作者保留权利,不代表天盟立场。

使用道具 举报

全部参与2

还有只到10条数据,是因为查询用的是分页查询和显示,.在导出的方法里重新写个查询条件,把分页查询去掉就可以了

使用道具 举报

问题解决了./关键在于前段获开的form表单值传递给了查询,而我的导出是另外的input标签.没有form传值.解决方法就是把值传给导出的方法.可以用ajax方法传入/或者在jsp界面写个方法,拼字段,把值传给后台导出方法
//导出functionexportModel(){        vartemp=[],                tepString='';$.each($('.form-inlineinput,.form-inlineselect'),function(k,v){                temp.push(v.value);        });tepString='?userName='+temp[0]+'&type'+temp[1];console.log(temp);console.log(tepString);window.location.href="/market/exportcustomerList"+tepString;}类似为这种

使用道具 举报

发新帖

发布任务需求已有1031166位用户正在使用天盟网服务

发布分类: *
任务预算: *
需求内容: *
手机号码: *
任务商家报价为
  • 预算价 :
  • 成交价 :
  • 完工期 :
  • 质保期 :

* 最终任务项目以服务商报价、双方协商为准!