Commit bea40f1730775887bd5f583a6cb1d40f9e669035

Authored by hujiaqi
1 parent de8b96e7e2

导出excel

Showing 1 changed file with 24 additions and 31 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyStatisticsManagerFacade.java View file @ bea40f1
... ... @@ -717,21 +717,25 @@
717 717 List<Map<String, Object>> list = JdbcUtil.getOracleListDataBySql("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@192.168.1.32:1521:orcl", "LYMS_ODS", "Welcome1", sql);
718 718 // List<Map<String, Object>> list = new ArrayList<>();
719 719 // Map<String, Object> test1 = new HashMap<>();
720   - // test1.put("EXAMINE_MONTH", 2);
721   - // test1.put("CNT", "2");
722 720 // Map<String, Object> test2 = new HashMap<>();
723   - // test2.put("EXAMINE_MONTH", 3);
724   - // test2.put("CNT", "3");
725 721 // Map<String, Object> test3 = new HashMap<>();
726   - // test3.put("EXAMINE_MONTH", 1);
727   - // test3.put("CNT", "1");
728 722 // Map<String, Object> test4 = new HashMap<>();
  723 + // Map<String, Object> test5 = new HashMap<>();
729 724 // test4.put("EXAMINE_MONTH", 0);
730   - // test4.put("CNT", "5");
  725 + // test4.put("CNT", "1");
  726 + // test3.put("EXAMINE_MONTH", 1);
  727 + // test3.put("CNT", "2");
  728 + // test1.put("EXAMINE_MONTH", 2);
  729 + // test1.put("CNT", "3");
  730 + // test2.put("EXAMINE_MONTH", 3);
  731 + // test2.put("CNT", "4");
  732 + // test5.put("EXAMINE_MONTH", 12);
  733 + // test5.put("CNT", "1");
731 734 // list.add(test1);
732 735 // list.add(test2);
733 736 // list.add(test3);
734 737 // list.add(test4);
  738 + // list.add(test5);
735 739  
736 740 Collections.sort(list, new Comparator<Map<String, Object>>() {
737 741 @Override
738 742  
739 743  
... ... @@ -764,35 +768,24 @@
764 768 ExceptionUtils.catchException("babyStatisticsManagerSelfConversionList list result :" + list);
765 769 // 从0开始,没有也填充
766 770 int index = 0;
767   - for (Integer i = 0; i < 12 /*13*/; i++) {
768   -// try {
769   -// while (!i.toString().equals(list.get(index).get("EXAMINE_MONTH").toString()) && index > Integer.valueOf(list.get(index).get("EXAMINE_MONTH").toString())) {
770   -// index++;
771   -// }
772   -// } catch (Exception e) {
773   -// index++;
774   -// }
775   -// if (CollectionUtils.isEmpty(list) || list.size() /*< */>index || list.get(index) == null || !i.toString().equals(list.get(index).get("EXAMINE_MONTH").toString())) {
776   -// result.add(0);
777   -// } else {
778   -// try {
779   -// result.add(Integer.valueOf(list.get(index).get("CNT").toString()));
780   -// total += Integer.valueOf(list.get(index).get("CNT").toString());
781   -// index++;
782   -// } catch (Exception e) {
783   -// result.add(0);
784   -// index++;
785   -// }
786   -// }
787   -
788   - if (CollectionUtils.isEmpty(list) || i > list.size() - 1 || list.get(i) == null || null == list.get(i).get("EXAMINE_MONTH")) {
  771 + for (Integer i = 0; i < 13; i++) {
  772 + try {
  773 + while (!i.toString().equals(list.get(index).get("EXAMINE_MONTH").toString()) && i > Integer.valueOf(list.get(index).get("EXAMINE_MONTH").toString())) {
  774 + index++;
  775 + }
  776 + } catch (Exception e) {
  777 + index++;
  778 + }
  779 + if (CollectionUtils.isEmpty(list) || list.size() < index || list.get(index) == null || !i.toString().equals(list.get(index).get("EXAMINE_MONTH").toString())) {
789 780 result.add(0);
790 781 } else {
791 782 try {
792   - result.add(Integer.valueOf(list.get(i).get("CNT").toString()));
793   - total += Integer.valueOf(list.get(i).get("CNT").toString());
  783 + result.add(Integer.valueOf(list.get(index).get("CNT").toString()));
  784 + total += Integer.valueOf(list.get(index).get("CNT").toString());
  785 + index++;
794 786 } catch (Exception e) {
795 787 result.add(0);
  788 + index++;
796 789 }
797 790 }
798 791 }