diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java index 1855364..ee3e700 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java @@ -117,13 +117,17 @@ public class MongoUtil { } - /** 把没有月份的数据设置为0*/ + /** 把没有月份的数据设置为0 并且设置count */ for (Map map : rest) { + Integer count = 0; for (int i = 1; i < 13; i++) { if(!map.containsKey(i + "")) { map.put(i + "", 0); + } else { + count += Integer.parseInt(map.get(i + "") + ""); } } + map.put("count", count); } /** 处理其他 */ @@ -136,12 +140,15 @@ public class MongoUtil { tempMap.put("area_id", null); tempMap.put("area_name", "其他"); tempMap.put("level", "建册人数"); + Integer count = 0; for (int i = 1; i < 13; i++) { tempMap.put(i + "", 0); } for (Map.Entry data : otherDatas) { tempMap.put(data.getKey() + "", data.getValue()); + count += Integer.parseInt(data.getValue() + ""); } + tempMap.put("count", count); rest.add(tempMap); /* List>> datas = new ArrayList<>(); Set> entries = codeMap.entrySet();