|  |  |  | 
|---|
|  |  |  | import java.io.ByteArrayInputStream; | 
|---|
|  |  |  | import java.io.InputStream; | 
|---|
|  |  |  | import java.io.InputStreamReader; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.HashMap; | 
|---|
|  |  |  | import java.util.LinkedHashMap; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | 
|---|
|  |  |  | public ResultBean<List<Map<String, Object>>> getMonitorPointOrDeviceAvgData(HttpServletRequest request) throws Exception { | 
|---|
|  |  |  | Map<String, Object> parameters = getParametersStartingWith(request, null); | 
|---|
|  |  |  | parameters.put("type", "month"); | 
|---|
|  |  |  | parameters.put("format", "yyyy-MM"); | 
|---|
|  |  |  | parameters.put("typeFormat", "%Y-%m-%d"); | 
|---|
|  |  |  | parameters.put("monitorPointId", parameters.remove("monitorPoint")); | 
|---|
|  |  |  | String sensorKey = parameters.remove("sensorKey").toString(); | 
|---|
|  |  |  | List<String> sensorKeys = new ArrayList<String>(); | 
|---|
|  |  |  | sensorKeys.add(sensorKey); | 
|---|
|  |  |  | parameters.put("sensorKeys", sensorKeys); | 
|---|
|  |  |  | List<Map<String, Object>> list = historyMinutelyService.getMonitorPointOrDeviceAvgData(parameters); | 
|---|
|  |  |  | String sensorKey = parameters.get("sensorKey").toString(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (Map<String, Object> map : list) { | 
|---|
|  |  |  | String time = map.get("time").toString(); | 
|---|
|  |  |  | time = time.substring(time.length() - 2); | 
|---|
|  |  |  | map.put("time", Integer.valueOf(time)); | 
|---|
|  |  |  | map.put("value", map.get(sensorKey)); | 
|---|
|  |  |  | map.remove(sensorKey); | 
|---|
|  |  |  | map.put("value", map.remove(sensorKey)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return new ResultBean<List<Map<String, Object>>>(list); | 
|---|
|  |  |  | } | 
|---|