Commit 89fcf590372aa4d662a571c1c7836d57d2a865b1

Authored by liquanyu

Merge remote-tracking branch 'origin/master'

Showing 1 changed file

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/StatisticsController.java View file @ 89fcf59
... ... @@ -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,20 @@
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);
  135 + } else {
  136 + groupRiskDataList.add(0);
126 137 }
127 138 }
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 139 groupRiskSeries.setData(groupRiskDataList);
135 140 groupRiskSeriesList.add(groupRiskSeries);
136 141 groupRiskOption.setSeries(groupRiskSeriesList);
... ... @@ -149,6 +154,7 @@
149 154  
150 155  
151 156  
  157 +
152 158 private Option buildMapOption(String titleText, String subTitle) {
153 159 Option option = new Option();
154 160 Title title = new Title();
155 161  
... ... @@ -206,10 +212,11 @@
206 212 AxisPointer yAxis = new AxisPointer();
207 213 yAxis.setType("category");
208 214 List<Object> dataList = new ArrayList<Object>();
209   - dataList.add("紫色");
210   - dataList.add("红色");
211   - dataList.add("橙色");
  215 + dataList.add("其他");
212 216 dataList.add("黄色");
  217 + dataList.add("橙色");
  218 + dataList.add("红色");
  219 + dataList.add("紫色");
213 220 yAxis.setData(dataList);
214 221 option.setyAxis(yAxis);
215 222 return option;