Commit f5750eebbe67bb0203b92acce11317199cd15192

Authored by litao
1 parent 37cc84b4fc

增加count

Showing 1 changed file with 8 additions and 1 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java View file @ f5750ee
... ... @@ -117,13 +117,17 @@
117 117 }
118 118  
119 119  
120   - /** 把没有月份的数据设置为0*/
  120 + /** 把没有月份的数据设置为0 并且设置count */
121 121 for (Map<String, Object> map : rest) {
  122 + Integer count = 0;
122 123 for (int i = 1; i < 13; i++) {
123 124 if(!map.containsKey(i + "")) {
124 125 map.put(i + "", 0);
  126 + } else {
  127 + count += Integer.parseInt(map.get(i + "") + "");
125 128 }
126 129 }
  130 + map.put("count", count);
127 131 }
128 132  
129 133 /** 处理其他 */
130 134  
131 135  
... ... @@ -136,12 +140,15 @@
136 140 tempMap.put("area_id", null);
137 141 tempMap.put("area_name", "其他");
138 142 tempMap.put("level", "建册人数");
  143 + Integer count = 0;
139 144 for (int i = 1; i < 13; i++) {
140 145 tempMap.put(i + "", 0);
141 146 }
142 147 for (Map.Entry<Integer, Integer> data : otherDatas) {
143 148 tempMap.put(data.getKey() + "", data.getValue());
  149 + count += Integer.parseInt(data.getValue() + "");
144 150 }
  151 + tempMap.put("count", count);
145 152 rest.add(tempMap);
146 153 /* List<Map<String, Map<Integer, Integer>>> datas = new ArrayList<>();
147 154 Set<Map.Entry<String, Integer>> entries = codeMap.entrySet();