1. 程式人生 > >Excel匯出POI

Excel匯出POI

  CwReportExcleUtils.java 類
 1
package com.bigdata.campus.report.utils; 2 3 import java.util.List; 4 import java.util.Map; 5 6 import org.apache.poi.hssf.usermodel.HSSFWorkbook; 7 import org.apache.poi.ss.usermodel.Cell; 8 import org.apache.poi.ss.usermodel.CellStyle; 9 import org.apache.poi.ss.usermodel.DataFormat;
10 import org.apache.poi.ss.usermodel.Font; 11 import org.apache.poi.ss.usermodel.IndexedColors; 12 import org.apache.poi.ss.usermodel.Row; 13 import org.apache.poi.ss.usermodel.Sheet; 14 import org.apache.poi.ss.usermodel.Workbook; 15 import org.apache.poi.ss.util.CellRangeAddress; 16 17 public
class CwReportExcleUtils { 18 /** 19 * Excel的匯出(自定義表頭) 20 * @describe list 為資料 keys 為需要顯示在excel中的引數對應的值,因為是用map存的,放的都是對應的key</br> 21 * headRange 合併表頭的引數 如new String[] { "0,0,0,2", "0,0,0,2", "3,3,4,4","3,3,5,5" }; 起始行, 終止行, 起始列, 終止列</br> 22 * headRowParam 合併表頭的引數(數量與headRowNum對應)
23 * intRow存放那些行不需要新增背景填充和資料行格式一樣如果不需要則置為空list 24 * @param list 25 * @param keys 26 * @param columnNames 27 * @param headRowNum 28 * @param headRange 29 * @param rowParam 30 * @return 31 */ 32 public static Workbook createCustomWorkBook( 33 List<Map<String, Object>> list, 34 List<String> keys, 35 List<String> headRange, 36 List<List<String>> ListStr, 37 List<Integer> intRow 38 ) { 39 // 建立excel工作簿 40 Workbook wb = new HSSFWorkbook(); 41 // 建立第一個sheet(頁),並命名 42 Sheet sheet = wb.createSheet(list.get(0).get("sheetName").toString()); 43 // 手動設定列寬。第一個引數表示要為第幾列設;,第二個引數表示列的寬度,n為列高的畫素數。 44 for(int i=0;i<keys.size();i++){ 45 sheet.setColumnWidth((short) i, (short) (37.5 * 150)); 46 } 47 // 建立兩種單元格格式 48 CellStyle cs1_title = createCellStyle_title(wb);//標題樣式 49 CellStyle cs1_Head = createCellStyle_Head(wb);//表頭樣式 50 CellStyle cs2_Double = createCellStyle_Double(wb);//Double格式 51 CellStyle cs2_Double_red = createCellStyle_Double_red(wb);//Double格式紅色背景 52 CellStyle cs3_String = createCellStyle_String(wb);//String格式 53 CellStyle cs4_Int = createCellStyle_Int(wb);//int格式 54 CellStyle cs5_left = createCellStyle_left(wb);//居左樣式 55 // 迴圈建立表頭 56 int headRowNum=ListStr.size(); 57 for(int i=0;i<headRowNum;i++){ 58 Row row = sheet.createRow((short) i); 59 if(i==0){//標題 60 row.setHeight((short) (5 * 150)); 61 for(int j=0;j<ListStr.get(i).size();j++){ 62 Cell cell = row.createCell(j); 63 String param=ListStr.get(i).get(j); 64 cell.setCellValue(param); 65 cell.setCellStyle(cs1_title); 66 } 67 }else if(intRow.contains(i)){//表頭 68 row.setHeight((short) (4 * 150)); 69 for(int j=0;j<ListStr.get(i).size();j++){ 70 String param=ListStr.get(i).get(j); 71 Cell cell = row.createCell(j); 72 cell.setCellValue(param); 73 cell.setCellStyle(cs5_left); 74 } 75 }else{//表頭 76 row.setHeight((short) (4 * 150)); 77 for(int j=0;j<ListStr.get(i).size();j++){ 78 String param=ListStr.get(i).get(j); 79 Cell cell = row.createCell(j); 80 cell.setCellValue(param); 81 cell.setCellStyle(cs1_Head); 82 } 83 } 84 } 85 //動態合併單元格 86 for (int i = 0; i < headRange.size(); i++) { 87 String[] temp = headRange.get(i).split(","); 88 Integer startrow = Integer.parseInt(temp[0]); 89 Integer overrow = Integer.parseInt(temp[1]); 90 Integer startcol = Integer.parseInt(temp[2]); 91 Integer overcol = Integer.parseInt(temp[3]); 92 sheet.addMergedRegion(new CellRangeAddress(startrow, overrow,startcol, overcol));// 起始行, 終止行, 起始列, 終止列 93 } 94 //設定每行每列的值 95 for (short i = 1; i < list.size(); i++) { 96 // Row 行,Cell 方格 , Row 和 Cell 都是從0開始計數的 97 // 建立一行,在頁sheet上 98 Row row1 = sheet.createRow((short) i+headRowNum-1); 99 row1.setHeight((short) (3 * 150)); 100 // 在row行上建立一個方格 101 for(short j=0;j<keys.size();j++){ 102 Cell cell = row1.createCell(j); 103 //如果是欠費則填充為紅色 104 if(keys.get(j).equals("oweFee")) { 105 Double d=Double.parseDouble(list.get(i).get(keys.get(j)) == null?"0": list.get(i).get(keys.get(j)).toString()); 106 if(d>0) { 107 cell.setCellValue(d); 108 cell.setCellStyle(cs2_Double_red); 109 }else { 110 cell.setCellValue(d); 111 cell.setCellStyle(cs2_Double); 112 } 113 }else { 114 if(list.get(i).get(keys.get(j)) instanceof Double){ 115 Double d=Double.parseDouble(list.get(i).get(keys.get(j)) == null?"0": list.get(i).get(keys.get(j)).toString()); 116 cell.setCellValue(d); 117 cell.setCellStyle(cs2_Double); 118 }else if(list.get(i).get(keys.get(j)) instanceof Integer){ 119 Integer it=Integer.parseInt(list.get(i).get(keys.get(j)) == null?"0": list.get(i).get(keys.get(j)).toString()); 120 cell.setCellValue(it); 121 cell.setCellStyle(cs4_Int); 122 }else{ 123 cell.setCellValue(list.get(i).get(keys.get(j)) == null?" ": list.get(i).get(keys.get(j)).toString()); 124 cell.setCellType(Cell.CELL_TYPE_STRING); 125 cell.setCellStyle(cs3_String); 126 } 127 } 128 129 } 130 } 131 return wb; 132 } 133 /** 134 * 居左樣式 135 * @param wb 136 * @return 137 */ 138 private static CellStyle createCellStyle_left(Workbook wb) { 139 // 建立單元格格式 140 CellStyle csleft = wb.createCellStyle(); 141 // 建立字型 142 Font f = wb.createFont(); 143 // 建立字型樣式(用於列名) 144 f.setFontHeightInPoints((short) 12); 145 f.setColor(IndexedColors.BLACK.getIndex()); 146 f.setBoldweight(Font.BOLDWEIGHT_BOLD); 147 // 設定單元格的樣式(用於列名) 148 csleft.setFont(f); 149 csleft.setBorderLeft(CellStyle.BORDER_THIN); 150 csleft.setBorderRight(CellStyle.BORDER_THIN); 151 csleft.setBorderTop(CellStyle.BORDER_THIN); 152 csleft.setBorderBottom(CellStyle.BORDER_THIN); 153 csleft.setAlignment(CellStyle.ALIGN_LEFT);//水平居左 154 csleft.setVerticalAlignment(CellStyle.VERTICAL_CENTER);//垂直居中 155 return csleft; 156 } 157 /** 158 * 標題樣式 159 * @param wb 160 * @return 161 */ 162 private static CellStyle createCellStyle_title(Workbook wb) { 163 // 建立單元格格式 164 CellStyle csTitle = wb.createCellStyle(); 165 // 建立字型 166 Font f = wb.createFont(); 167 // 建立字型樣式(用於列名) 168 f.setFontHeightInPoints((short) 18); 169 f.setColor(IndexedColors.BLACK.getIndex()); 170 f.setBoldweight(Font.BOLDWEIGHT_BOLD); 171 // 設定單元格的樣式(用於列名) 172 csTitle.setFont(f); 173 csTitle.setBorderLeft(CellStyle.BORDER_THIN); 174 csTitle.setBorderRight(CellStyle.BORDER_THIN); 175 csTitle.setBorderTop(CellStyle.BORDER_THIN); 176 csTitle.setBorderBottom(CellStyle.BORDER_THIN); 177 csTitle.setAlignment(CellStyle.ALIGN_CENTER);//水平居中 178 csTitle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);//垂直居中 179 return csTitle; 180 } 181 /** 182 * 整型格式樣式 183 * @param wb 184 * @return 185 */ 186 private static CellStyle createCellStyle_Int(Workbook wb) { 187 // 建立單元格格式 188 CellStyle cs4 = wb.createCellStyle(); 189 // 建立字型 190 Font f4 = wb.createFont(); 191 // 建立第二種字型樣式(用於值) 192 f4.setFontHeightInPoints((short) 12); 193 f4.setColor(IndexedColors.BLACK.getIndex()); 194 // 設定第二種單元格的樣式(用於值) 195 cs4.setFont(f4); 196 cs4.setBorderLeft(CellStyle.BORDER_THIN); 197 cs4.setBorderRight(CellStyle.BORDER_THIN); 198 cs4.setBorderTop(CellStyle.BORDER_THIN); 199 cs4.setBorderBottom(CellStyle.BORDER_THIN); 200 cs4.setAlignment(CellStyle.ALIGN_CENTER); 201 cs4.setVerticalAlignment(CellStyle.VERTICAL_CENTER);//垂直居中 202 DataFormat df = wb.createDataFormat(); //此處設定資料格式 203 cs4.setDataFormat(df.getFormat("#0")); //資料格式只顯示整數,如果是小數點後保留兩位,可以寫contentStyle.setDataFormat(df.getFormat("#,#0.00")); 204 return cs4; 205 } 206 /** 207 * 普通文字格式 208 * @param wb 209 * @return 210 */ 211 private static CellStyle createCellStyle_String(Workbook wb) { 212 // 建立單元格格式 213 CellStyle cs3 = wb.createCellStyle(); 214 // 建立字型 215 Font f2 = wb.createFont(); 216 // 建立第二種字型樣式(用於值) 217 f2.setFontHeightInPoints((short) 12); 218 f2.setColor(IndexedColors.BLACK.getIndex()); 219 // 設定第二種單元格的樣式(用於值) 220 cs3.setFont(f2); 221 cs3.setBorderLeft(CellStyle.BORDER_THIN); 222 cs3.setBorderRight(CellStyle.BORDER_THIN); 223 cs3.setBorderTop(CellStyle.BORDER_THIN); 224 cs3.setBorderBottom(CellStyle.BORDER_THIN); 225 cs3.setAlignment(CellStyle.ALIGN_CENTER); 226 cs3.setVerticalAlignment(CellStyle.VERTICAL_CENTER);//垂直居中 227 DataFormat df = wb.createDataFormat(); //此處設定資料格式 228 cs3.setDataFormat(df.getFormat("@")); //資料格式只顯示整數,如果是小數點後保留兩位,可以寫contentStyle.setDataFormat(df.getFormat("#,#0.00")); 229 return cs3; 230 } 231 /** 232 * 數字格式(保留兩位小數) 233 * @param wb 234 * @return 235 */ 236 private static CellStyle createCellStyle_Double(Workbook wb) { 237 // 建立單元格格式 238 CellStyle cs2 = wb.createCellStyle(); 239 // 建立字型 240 Font f2 = wb.createFont(); 241 // 建立第二種字型樣式(用於值) 242 f2.setFontHeightInPoints((short) 12); 243 f2.setColor(IndexedColors.BLACK.getIndex()); 244 // 設定第二種單元格的樣式(用於值) 245 cs2.setFont(f2); 246 cs2.setBorderLeft(CellStyle.BORDER_THIN); 247 cs2.setBorderRight(CellStyle.BORDER_THIN); 248 cs2.setBorderTop(CellStyle.BORDER_THIN); 249 cs2.setBorderBottom(CellStyle.BORDER_THIN); 250 cs2.setAlignment(CellStyle.ALIGN_CENTER); 251 cs2.setVerticalAlignment(CellStyle.VERTICAL_CENTER);//垂直居中 252 DataFormat df = wb.createDataFormat(); //此處設定資料格式 253 cs2.setDataFormat(df.getFormat("#,#0.00")); //資料格式只顯示整數,如果是小數點後保留兩位,可以寫contentStyle.setDataFormat(df.getFormat("#,#0.00")); 254 return cs2; 255 } 256 /** 257 * 數字格式(保留兩位小數)紅色背景 258 * @param wb 259 * @return 260 */ 261 private static CellStyle createCellStyle_Double_red(Workbook wb) { 262 // 建立單元格格式 263 CellStyle cs2 = wb.createCellStyle(); 264 // 建立字型 265 Font f2 = wb.createFont(); 266 // 建立第二種字型樣式(用於值) 267 f2.setFontHeightInPoints((short) 12); 268 f2.setColor(IndexedColors.BLACK.getIndex()); 269 // 設定第二種單元格的樣式(用於值) 270 cs2.setFont(f2); 271 cs2.setBorderLeft(CellStyle.BORDER_THIN); 272 cs2.setBorderRight(CellStyle.BORDER_THIN); 273 cs2.setBorderTop(CellStyle.BORDER_THIN); 274 cs2.setBorderBottom(CellStyle.BORDER_THIN); 275 cs2.setAlignment(CellStyle.ALIGN_CENTER); 276 cs2.setVerticalAlignment(CellStyle.VERTICAL_CENTER);//垂直居中 277 cs2.setFillForegroundColor(IndexedColors.RED.getIndex()); 278 cs2.setFillPattern(CellStyle.SOLID_FOREGROUND); 279 DataFormat df = wb.createDataFormat(); //此處設定資料格式 280 cs2.setDataFormat(df.getFormat("#,#0.00")); //資料格式只顯示整數,如果是小數點後保留兩位,可以寫contentStyle.setDataFormat(df.getFormat("#,#0.00")); 281 return cs2; 282 } 283 /** 284 * 表頭樣式 285 * @param wb 286 * @return 287 */ 288 private static CellStyle createCellStyle_Head(Workbook wb) { 289 // 建立單元格格式 290 CellStyle cs = wb.createCellStyle(); 291 // 建立字型 292 Font f = wb.createFont(); 293 // 建立字型樣式(用於列名) 294 f.setFontHeightInPoints((short) 12); 295 f.setColor(IndexedColors.BLACK.getIndex()); 296 f.setBoldweight(Font.BOLDWEIGHT_BOLD); 297 // 設定單元格的樣式(用於列名) 298 cs.setFont(f); 299 cs.setBorderLeft(CellStyle.BORDER_THIN); 300 cs.setBorderRight(CellStyle.BORDER_THIN); 301 cs.setBorderTop(CellStyle.BORDER_THIN); 302 cs.setBorderBottom(CellStyle.BORDER_THIN); 303 cs.setAlignment(CellStyle.ALIGN_CENTER);//水平居中 304 cs.setVerticalAlignment(CellStyle.VERTICAL_CENTER);//垂直居中 305 cs.setFillForegroundColor(IndexedColors.PALE_BLUE.index); 306 cs.setFillPattern(CellStyle.SOLID_FOREGROUND); 307 return cs; 308 } 309 }

export方法

/**
    * headRowNum 有多少個headRowParam 就必須要有多少組  {"1,2,3,4"} // 1起始行, 2終止行, 3起始列, 4終止列
    * @param response
    * @param fileName
    * @param list
    * @param keys
    * @param headRange {"1,2,3,4"} // 1起始行, 2終止行, 3起始列, 4終止列
    * @param headRowNum
    * @param headRowParam
    * @throws IOException
    */
    private void export(HttpServletResponse response, String fileName, List<Map<String, Object>> list,List<String> keys,List<String> headRange,List<List<String>> headRowParam,List<Integer> intRow) throws IOException {
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        try {
            CwReportExcleUtils.createCustomWorkBook(list,keys,headRange,headRowParam,intRow).write(os);
        } catch (IOException e) {
            e.printStackTrace();
        }
        byte[] content = os.toByteArray();
        InputStream is = new ByteArrayInputStream(content);
        // 設定response引數,可以開啟下載頁面
        response.reset();
        response.setContentType("application/vnd.ms-excel;charset=utf-8");
        response.setHeader("Content-Disposition", "attachment;filename="+ new String((fileName + ".xls").getBytes(), "iso-8859-1"));
        ServletOutputStream out = response.getOutputStream();
        BufferedInputStream bis = null;
        BufferedOutputStream bos = null;
        try {
            bis = new BufferedInputStream(is);
            bos = new BufferedOutputStream(out);
            byte[] buff = new byte[2048];
            int bytesRead;
            // Simple read/write loop.
            while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
                bos.write(buff, 0, bytesRead);
            }
        } catch (final IOException e) {
            throw e;
        } finally {
            if (bis != null)
                bis.close();
            if (bos != null)
                bos.close();
        }
    }

exportClassStudentsFee 類

/**
     * 匯出班級繳費學生繳費明細統計資料
     * @param response
     * @param redirectAttributes
     * @param cwreport
     */
    public Workbook exportClassStudentsFee(HttpServletResponse response, RedirectAttributes redirectAttributes,CWReport cwreport, Boolean isBatch) {
        Workbook workbook = null;
        try {
            String fileName="班級學生繳費明細報表"+DateUtils.getDate("yyyy年MM月dd日 HH時mm分ss秒");
               //填充projects資料製作模板
               List<CWReport> classStuDetailslist = classStuDetailsExport(cwreport);//查詢整體資料
               CWReport classStuCount =sumClassStuDetails(cwreport);//查詢資料求和總計
               List<Map<String,Object>> list=createExcelclassStuDetails(classStuDetailslist,classStuCount);//關聯修改匯出內容
               List< List<String>> listStr=Lists.newArrayList();//表頭的List集合
               List<Integer> intRow=Lists.newArrayList();//存放那些行不需要新增背景填充和資料行格式一樣如果不需要則置為空list
               intRow.add(1);
               //設定表頭資料
               List<String>  li0=Lists.newArrayList();
            List<String>  li1=Lists.newArrayList();
            List<String>  li2=Lists.newArrayList();
            List<String>  li3=Lists.newArrayList();
            //設定需要取值的鍵值
            List<String>  liKey=Lists.newArrayList();
            //設定需要合併的單元格
            List<String>  rli=Lists.newArrayList();
            li0.add("班級學生繳費明細報表");
            
            li1.add(cwreport.getAllsDetail());
            
            li2.add("序號");
            li2.add("繳費日期");
            li2.add("學號");
            li2.add("姓名");
            li2.add("姓別");
            li2.add("學籍狀態資訊");
            li2.add("聯絡方式");
            li2.add("身份證號");
            li2.add("應繳費用/元");
            li2.add("其中/元");
            li2.add("");
            li2.add("");
            
            li3.add("");li3.add("");li3.add("");li3.add("");li3.add("");li3.add("");li3.add("");li3.add("");li3.add("");
            li3.add("貸款金額");
            li3.add("緩交金額");
            li3.add("戶口減免");
            
            liKey.add("orderNumber");
            liKey.add("createTime");
            liKey.add("stuNumber");
            liKey.add("name");
            liKey.add("sex");
            liKey.add("status");
            liKey.add("phone");
            liKey.add("idCard");
            liKey.add("needFee");
            liKey.add("dkFee");
            liKey.add("delayFee");
            liKey.add("jmFee");
            
            rli.add("2,3,0,0");
            rli.add("2,3,1,1");
            rli.add("2,3,2,2");
            rli.add("2,3,3,3");
            rli.add("2,3,4,4");
            rli.add("2,3,5,5");
            rli.add("2,3,6,6");
            rli.add("2,3,7,7");
            rli.add("2,3,8,8");
            rli.add("2,2,9,11");
            int row=0;//記錄多少個明細項,0開始
            Integer row1 = 0;
            if(!classStuDetailslist.isEmpty()){
                li2.add("實繳費用明細/元");//如果查出的資料不為空則顯示明細項列,為空則不顯示繳費明細項列
                if(!classStuDetailslist.get(0).getFeeDetail().isEmpty()){//迴圈明細項新增到list
                    List<CWReportFeeDetails> cw=classStuDetailslist.get(0).getFeeDetail();
                    for (CWReportFeeDetails c :cw) {
                        row++;
                        if(row != 1){
                            li2.add("");
                        }
                        li3.add(c.getFeeTypeName());
                        liKey.add(c.getFeeTypeName());
                    }
                }
                rli.add("2,2,12,"+(12+row-1)+"");
                li2.add("繳費方式/元");
                if (!classStuDetailslist.get(0).getFeesWayList().isEmpty()) {
                    List<ChargeWaySumEntity> feesWayList = classStuDetailslist.get(0).getFeesWayList();
                    for (ChargeWaySumEntity chargeWaySumEntity : feesWayList) {
                        row1 ++;
                        if (row1 != 1) {
                            li2.add("");
                        }
                        li3.add(chargeWaySumEntity.getName());
                        liKey.add(chargeWaySumEntity.getKeyValue());
                    }
                }
                rli.add("2,2," + (12 + row) + "," + (12 + row + row1 - 1));
            }
//            li2.add("");li2.add("");
            li2.add("實繳合計/元");
            li2.add("收款人");
            li2.add("備註");
//            li3.add("現金");
//            li3.add("POS機");
//            li3.add("預繳費用");
            li3.add("");
            li3.add("");
            li3.add("");
            
//            liKey.add("cash");
//            liKey.add("pos");
//            liKey.add("yjFee");
            liKey.add("isFee");
            liKey.add("receivUserName");
            liKey.add("remark");
            
            rli.add("0,0,0,"+(15+row1+row-1)+"");
            rli.add("1,1,0,"+(15+row1+row-1)+"");
//            rli.add("2,2,"+(13+row-1)+","+(15+row-1)+"");
            rli.add("2,3,"+(13+row1+row-1)+","+(13+row1+row-1)+"");
            rli.add("2,3,"+(14+row1+row-1)+","+(14+row1+row-1)+"");
            rli.add("2,3,"+(15+row1+row-1)+","+(15+row1+row-1)+"");
               listStr.add(li0);
               listStr.add(li1);
               listStr.add(li2);
               listStr.add(li3);
           if (isBatch) {
            workbook = exportBatch(fileName, list, liKey, rli, listStr, intRow);
        } else {
            export(response, fileName, list, liKey, rli,listStr,intRow);
        }
        } catch (Exception e) {
           e.printStackTrace();
           System.out.println("哈哈 失敗了");
        }
        return workbook;
    }

 

 createExcelclassStuDetails 方法

private List<Map<String, Object>> createExcelclassStuDetails(List<CWReport> classStuDetailslist,CWReport classStuCount) {
        List<Map<String, Object>> listmap = new ArrayList<Map<String, Object>>();
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("sheetName", "sheet1");
        listmap.add(map);
        for (int j = 0; j < classStuDetailslist.size(); j++) {
            CWReport cwrep=classStuDetailslist.get(j);
            if(cwrep != null){
                Map<String, Object> mapValue = new HashMap<String, Object>();
                mapValue.put("orderNumber",j+1);
                mapValue.put("createTime",cwrep.getCreateTime().substring(0, 19));
                mapValue.put("stuNumber",cwrep.getStuNumber());
                mapValue.put("name",cwrep.getName());
                mapValue.put("sex",cwrep.getSex());
                mapValue.put("status",cwrep.getStatus());
                mapValue.put("phone",cwrep.getPhone());
                mapValue.put("idCard",cwrep.getIdCard());
                mapValue.put("needFee",cwrep.getNeedFee());
                mapValue.put("dkFee",cwrep.getDkFee());
                mapValue.put("delayFee",cwrep.getDelayFee());
                mapValue.put("jmFee",cwrep.getJmFee());
                for (CWReportFeeDetails fee : cwrep.getFeeDetail()) {
                        mapValue.put(fee.getFeeTypeName(),fee.getFeeMoney());
                }
                List<ChargeWaySumEntity> feesWayList = cwrep.getFeesWayList();
                for (ChargeWaySumEntity chargeWaySumEntity : feesWayList) {
                    mapValue.put(chargeWaySumEntity.getKeyValue(), chargeWaySumEntity.getMoney());
                    if (chargeWaySumEntity.getKeyValue() == null || "".equals(chargeWaySumEntity.getKeyValue())) {
                        mapValue.put("isFee", chargeWaySumEntity.getMoney());
                    }
                }
//                mapValue.put("cash",cwrep.getCash());
//                mapValue.put("pos",cwrep.getPOS());
//                mapValue.put("yjFee",cwrep.getYjFee());
                mapValue.put("isFee",cwrep.getIsFee());
                mapValue.put("receivUserName",cwrep.getReceivUserName());
                if ("退學".equals(cwrep.getStatus()) || "休學".equals(cwrep.getStatus())) {
                    mapValue.put("remark", cwrep.getStatus());
                } else {
                    mapValue.put("remark", "無");
                }
                listmap.add(mapValue);
            }
        }
        if(classStuCount !=null && null != classStuCount.getStuCode() && !"".equals(classStuCount.getStuCode())){
                Map<String, Object> mapValue = new HashMap<String, Object>();
                mapValue.put("orderNumber","合計");
                mapValue.put("createTime","");
                mapValue.put("stuNumber","");
                mapValue.put("name","");
                mapValue.put("sex","");
                mapValue.put("status","");
                mapValue.put("phone","");
                mapValue.put("idCard","");
                mapValue.put("needFee",classStuCount.getNeedFee());
                mapValue.put("dkFee",classStuCount.getDkFee());
                mapValue.put("delayFee",classStuCount.getDelayFee());
                mapValue.put("jmFee",classStuCount.getJmFee());
                for (CWReportFeeDetails fee : classStuCount.getFeeDetail()) {
                        mapValue.put(fee.getFeeTypeName(),fee.getFeeMoney());
                }
                List<ChargeWaySumEntity> feesWayList = classStuCount.getFeesWayList();
                for (ChargeWaySumEntity chargeWaySumEntity : feesWayList) {
                    mapValue.put(chargeWaySumEntity.getKeyValue(), chargeWaySumEntity.getMoney());
                    if (chargeWaySumEntity.getKeyValue() == null || "".equals(chargeWaySumEntity.getKeyValue())) {
                        mapValue.put("isFee", chargeWaySumEntity.getMoney());
                    }
                }
//                mapValue.put("cash",classStuCount.getCash());
//                mapValue.put("pos",classStuCount.getPOS());
//                mapValue.put("yjFee",classStuCount.getYjFee());
//                mapValue.put("isFee",classStuCount.getIsFee());
                mapValue.put("receivUserName","");
                listmap.add(mapValue);
        }
        return listmap;
    }