| | |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.lang.reflect.Field; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | |
| | |
| | | cellStyle4.setDataFormat(df.getFormat("#,##0.000000")); |
| | | |
| | | // 创建标题 |
| | | String[] title = new String[1 + respVO.getLegend().size() * 3]; |
| | | String[] title = new String[1 + respVO.getLegend().size() * 5]; |
| | | title[0] = "日期时间"; |
| | | for (int i = 0; respVO.getLegend().size() > i; i++) { |
| | | title[i * 3 + 1] = respVO.getLegend().get(i) + ":真实值"; |
| | | title[i * 3 + 2] = respVO.getLegend().get(i) + ":预测值T+N"; |
| | | title[i * 3 + 3] = respVO.getLegend().get(i) + ":预测值T+L"; |
| | | title[i * 3 + 4] = respVO.getLegend().get(i) + ":累计真实值"; |
| | | title[i * 3 + 5] = respVO.getLegend().get(i) + ":累计预测值"; |
| | | } |
| | | HSSFRow rowTitle = sheet.createRow(0); |
| | | HSSFCell hc; |
| | |
| | | Map<String, Object> realDataMap = new HashMap<String, Object>(); |
| | | Map<String, Object> preDataNMap = new HashMap<String, Object>(); |
| | | Map<String, Object> preDataLMap = new HashMap<String, Object>(); |
| | | Map<String, Object> cumulantRealDataMap = new HashMap<String, Object>(); |
| | | Map<String, Object> cumulantPreDataMap = new HashMap<String, Object>(); |
| | | //真实值 |
| | | List<Object[]> realData = viewData.getRealData(); |
| | | if (!CollectionUtils.isEmpty(realData)) { |
| | |
| | | } |
| | | //预测值T+L |
| | | List<Object[]> preDataL = viewData.getPreDataL(); |
| | | |
| | | if (!CollectionUtils.isEmpty(preDataL)) { |
| | | for (Object[] item : preDataL) { |
| | | preDataLMap.put(item[0].toString(), item[1]); |
| | | } |
| | | } |
| | | //累计真实值 |
| | | List<Object[]> cumulantRealData = viewData.getCumulantRealData(); |
| | | if (!CollectionUtils.isEmpty(cumulantRealData)) { |
| | | for (Object[] item : cumulantRealData) { |
| | | cumulantRealDataMap.put(item[0].toString(), item[1]); |
| | | } |
| | | } |
| | | //累计预测值 |
| | | List<Object[]> cumulantPreData = viewData.getCumulantPreData(); |
| | | if (!CollectionUtils.isEmpty(cumulantPreData)) { |
| | | for (Object[] item : cumulantPreData) { |
| | | cumulantPreDataMap.put(item[0].toString(), item[1]); |
| | | } |
| | | } |
| | | |
| | |
| | | hc = rowBody.createCell(j * 3 + 3); |
| | | hc.setCellValue(preDataLMap.get(respVO.getCategories().get(i)).toString()); |
| | | } |
| | | if (cumulantRealDataMap.get(respVO.getCategories().get(i)) != null) { |
| | | hc = rowBody.createCell(j * 3 + 4); |
| | | hc.setCellValue(cumulantRealDataMap.get(respVO.getCategories().get(i)).toString()); |
| | | } |
| | | if (cumulantPreDataMap.get(respVO.getCategories().get(i)) != null) { |
| | | hc = rowBody.createCell(j * 3 + 5); |
| | | hc.setCellValue(cumulantPreDataMap.get(respVO.getCategories().get(i)).toString()); |
| | | } |
| | | } |
| | | |
| | | j++; |