| | |
| | | Map<String, Map<String, Double>> last = sumByCity(longRows(type, lastFrom, lastTo), cols); |
| | | |
| | | List<Map<String, Object>> records = new ArrayList<>(); |
| | | // 全省合计行放在最前面(用户要求,放在武汉市之上) |
| | | records.add(outRow(cols, mergeAll(cur), mergeAll(last), TOTAL_CITY)); |
| | | for (String city : RegionUtil.cityList()) { |
| | | records.add(outRow(cols, cur.get(city), last.get(city), city)); |
| | | } |
| | | records.add(outRow(cols, mergeAll(cur), mergeAll(last), TOTAL_CITY)); |
| | | if (recomputeRank) { |
| | | applyRank(records, cols); |
| | | } |
| | |
| | | cell.setCellValue(String.valueOf(columns.get(i).get("label"))); |
| | | cell.setCellStyle(headStyle); |
| | | } |
| | | Font totalFont = wb.createFont(); |
| | | totalFont.setBold(true); |
| | | XSSFCellStyle totalStyle = wb.createCellStyle(); |
| | | totalStyle.setFont(totalFont); |
| | | |
| | | int r = 2; |
| | | for (Map<String, Object> rec : records) { |
| | | boolean isTotal = TOTAL_CITY.equals(rec.get("city")); |
| | | XSSFRow row = sheet.createRow(r++); |
| | | for (int i = 0; i < columns.size(); i++) { |
| | | String prop = String.valueOf(columns.get(i).get("prop")); |
| | |
| | | cell.setCellStyle(colLabel.contains("同比") ? pctStyle : numStyle); |
| | | } else { |
| | | cell.setCellValue(v == null ? "" : String.valueOf(v)); |
| | | if (isTotal) { |
| | | cell.setCellStyle(totalStyle); |
| | | } |
| | | } |
| | | } |
| | | } |