From bea40f1730775887bd5f583a6cb1d40f9e669035 Mon Sep 17 00:00:00 2001 From: hujiaqi Date: Thu, 9 Feb 2017 16:07:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BAexcel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/facade/BabyStatisticsManagerFacade.java | 55 ++++++++++------------ 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyStatisticsManagerFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyStatisticsManagerFacade.java index b31772c..f4235f6 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyStatisticsManagerFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyStatisticsManagerFacade.java @@ -717,21 +717,25 @@ public class BabyStatisticsManagerFacade { List> list = JdbcUtil.getOracleListDataBySql("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@192.168.1.32:1521:orcl", "LYMS_ODS", "Welcome1", sql); // List> list = new ArrayList<>(); // Map test1 = new HashMap<>(); - // test1.put("EXAMINE_MONTH", 2); - // test1.put("CNT", "2"); // Map test2 = new HashMap<>(); - // test2.put("EXAMINE_MONTH", 3); - // test2.put("CNT", "3"); // Map test3 = new HashMap<>(); - // test3.put("EXAMINE_MONTH", 1); - // test3.put("CNT", "1"); // Map test4 = new HashMap<>(); + // Map test5 = new HashMap<>(); // test4.put("EXAMINE_MONTH", 0); - // test4.put("CNT", "5"); + // test4.put("CNT", "1"); + // test3.put("EXAMINE_MONTH", 1); + // test3.put("CNT", "2"); + // test1.put("EXAMINE_MONTH", 2); + // test1.put("CNT", "3"); + // test2.put("EXAMINE_MONTH", 3); + // test2.put("CNT", "4"); + // test5.put("EXAMINE_MONTH", 12); + // test5.put("CNT", "1"); // list.add(test1); // list.add(test2); // list.add(test3); // list.add(test4); + // list.add(test5); Collections.sort(list, new Comparator>() { @Override @@ -764,35 +768,24 @@ public class BabyStatisticsManagerFacade { ExceptionUtils.catchException("babyStatisticsManagerSelfConversionList list result :" + list); // 从0开始,没有也填充 int index = 0; - for (Integer i = 0; i < 12 /*13*/; i++) { -// try { -// while (!i.toString().equals(list.get(index).get("EXAMINE_MONTH").toString()) && index > Integer.valueOf(list.get(index).get("EXAMINE_MONTH").toString())) { -// index++; -// } -// } catch (Exception e) { -// index++; -// } -// if (CollectionUtils.isEmpty(list) || list.size() /*< */>index || list.get(index) == null || !i.toString().equals(list.get(index).get("EXAMINE_MONTH").toString())) { -// result.add(0); -// } else { -// try { -// result.add(Integer.valueOf(list.get(index).get("CNT").toString())); -// total += Integer.valueOf(list.get(index).get("CNT").toString()); -// index++; -// } catch (Exception e) { -// result.add(0); -// index++; -// } -// } - - if (CollectionUtils.isEmpty(list) || i > list.size() - 1 || list.get(i) == null || null == list.get(i).get("EXAMINE_MONTH")) { + for (Integer i = 0; i < 13; i++) { + try { + while (!i.toString().equals(list.get(index).get("EXAMINE_MONTH").toString()) && i > Integer.valueOf(list.get(index).get("EXAMINE_MONTH").toString())) { + index++; + } + } catch (Exception e) { + index++; + } + if (CollectionUtils.isEmpty(list) || list.size() < index || list.get(index) == null || !i.toString().equals(list.get(index).get("EXAMINE_MONTH").toString())) { result.add(0); } else { try { - result.add(Integer.valueOf(list.get(i).get("CNT").toString())); - total += Integer.valueOf(list.get(i).get("CNT").toString()); + result.add(Integer.valueOf(list.get(index).get("CNT").toString())); + total += Integer.valueOf(list.get(index).get("CNT").toString()); + index++; } catch (Exception e) { result.add(0); + index++; } } } -- 1.8.3.1