Commit 9d25494a2d8a67208a37cc935ed1675da5e699ef

Authored by baohanddd
1 parent 7d03f81a78

add statistics(map) common index

Showing 1 changed file with 16 additions and 11 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/StatisticsController.java View file @ 9d25494
... ... @@ -53,6 +53,12 @@
53 53 @RequestMapping(value = "/total/index", method = RequestMethod.GET)
54 54 public void getTotalIndex(HttpServletResponse response, @RequestParam(value = "type")Integer type, @RequestParam(value = "pid", required = false)String pid) {
55 55 Map<String,Object> result= new HashMap<String, Object>();
  56 + Map<String, String> colormap = new HashMap<>();
  57 + colormap.put("紫色", "#FCC0F6");
  58 + colormap.put("红色", "#FFBDBE");
  59 + colormap.put("橙色", "#FFD6BD");
  60 + colormap.put("黄色", "#FFFEBD");
  61 + colormap.put("其它", "#DEDCE0");
56 62 if (type == 1) {
57 63 // 地图数据
58 64 List<AreaData> provinceRiskList = statisticsService.queryProvinceRisks();
59 65  
60 66  
... ... @@ -116,21 +122,18 @@
116 122 if (mapsData.get(groupName) == null) {
117 123 mapsData.put(groupName,areaData.getVal());
118 124 } else {
119   - mapsData.put(groupName,mapsData.get(groupName)+areaData.getVal());
  125 + mapsData.put(groupName, mapsData.get(groupName) + areaData.getVal());
120 126 }
121 127 }
122 128 List<Object> groupRiskDataList = new ArrayList<>();
123 129 for (Object key:groupRiskOption.getyAxis().getData()) {
124 130 if (mapsData.containsKey(key)) {
125   - groupRiskDataList.add(mapsData.get(key));
  131 + Data data = new Data();
  132 + data.setValue(mapsData.get(key));
  133 + data.setItemStyle(new ItemStyle(new Normal(null,colormap.get(key)),null));
  134 + groupRiskDataList.add(data);
126 135 }
127 136 }
128   - for (String key:mapsData.keySet()) {
129   - if (!groupRiskOption.getyAxis().getData().contains(key)) {
130   - groupRiskOption.getyAxis().getData().add(key);
131   - groupRiskDataList.add(mapsData.get(key));
132   - }
133   - }
134 137 groupRiskSeries.setData(groupRiskDataList);
135 138 groupRiskSeriesList.add(groupRiskSeries);
136 139 groupRiskOption.setSeries(groupRiskSeriesList);
... ... @@ -149,6 +152,7 @@
149 152  
150 153  
151 154  
  155 +
152 156 private Option buildMapOption(String titleText, String subTitle) {
153 157 Option option = new Option();
154 158 Title title = new Title();
155 159  
... ... @@ -206,10 +210,11 @@
206 210 AxisPointer yAxis = new AxisPointer();
207 211 yAxis.setType("category");
208 212 List<Object> dataList = new ArrayList<Object>();
209   - dataList.add("紫色");
210   - dataList.add("红色");
211   - dataList.add("橙色");
  213 + dataList.add("其它");
212 214 dataList.add("黄色");
  215 + dataList.add("橙色");
  216 + dataList.add("红色");
  217 + dataList.add("紫色");
213 218 yAxis.setData(dataList);
214 219 option.setyAxis(yAxis);
215 220 return option;