| | |
| | | })
|
| | | public ResultBean<List<Map<String, Object>>> AIForecast (HttpServletRequest request) throws Exception {
|
| | | Map<String, Object> parameters = getParametersStartingWith(request, null);
|
| | | ParameterUtils.getTimeType4Time(parameters);
|
| | | ParameterUtils.getTimeType4Time(parameters);
|
| | | String monitor_point_id = (String) parameters.get("monitorPoint");
|
| | | parameters.put("monitorPointId", parameters.remove("monitorPoint"));
|
| | | Object sensorKey = parameters.remove("sensorKey");
|
| | | parameters.put("sensors", Arrays.asList(sensorKey));
|
| | | List<Map<String, Object>> list = historyMinutelyService.getMonitorPointOrDeviceAvgData(parameters);
|
| | | System.out.println("ScreenController-----AIForecast-----list:"+list);
|
| | | parameters.put("monitorPointId", parameters.remove("monitorPoint"));
|
| | | String[] sensorKeys = parameters.remove("sensorKey").toString().split(",");
|
| | | System.out.println("ScreenController-----AIForecast-----sensorKeys:"+sensorKeys.toString());
|
| | | parameters.put("sensors", Arrays.asList(sensorKeys));
|
| | | // monitorPointService.isCompensateCalculation(parameters);
|
| | | List<Map<String, Object>> list = historyMinutelyService.getMonitorPointOrDeviceAvgData(parameters);
|
| | | System.out.println("ScreenController-----AIForecast-----list:"+list);
|
| | | |
| | | //获取单位信息
|
| | | Map<String, Map<String, Object>> sensorUnitMap = sensorUnitService.getSensorsByMonitPointId(monitor_point_id);
|
| | | |
| | | /*if(sensorUnitMap!=null && !sensorUnitMap.isEmpty()) {
|
| | | for (Map<String, Object> map : list) {
|
| | | String time = map.get("time").toString();
|
| | | time = time.substring(time.length() - 2);
|
| | | map.put("time", Integer.valueOf(time));
|
| | | List<Number> values = new ArrayList<Number>();
|
| | | for (String string : sensorKeys) {
|
| | | values.add((Number) map.remove(string));
|
| | | }
|
| | | map.put("values", values);
|
| | | }
|
| | | }else {
|
| | | for (Map<String, Object> map : list) {
|
| | | String time = map.get("time").toString();
|
| | | time = time.substring(time.length() - 2);
|
| | | map.put("time", Integer.valueOf(time));
|
| | | List<Number> values = new ArrayList<Number>();
|
| | | for (String string : sensorKeys) {
|
| | | values.add((Number) map.remove(string));
|
| | | }
|
| | | map.put("values", values);
|
| | | }
|
| | | }*/
|
| | |
|
| | | for (Map<String, Object> map : list) {
|
| | | String time = map.get("time").toString();
|
| | | time = time.substring(time.length() - 2);
|
| | | map.put("time", Integer.valueOf(time));
|
| | | List<Number> values = new ArrayList<Number>();
|
| | | List<String> units = new ArrayList<String>();
|
| | | for (String string : sensorKeys) {
|
| | | if(sensorUnitMap!=null && !sensorUnitMap.isEmpty()) {
|
| | | if(sensorUnitMap.get(string)!=null) {
|
| | | units.add(sensorUnitMap.get(string).get("name").toString());
|
| | | }else {
|
| | | Map<String, Object> sensorMap = sensorService.getSensorBySensorKey(string);
|
| | | units.add(sensorMap.get("unit").toString());
|
| | | }
|
| | | }else {
|
| | | Map<String, Object> sensorMap = sensorService.getSensorBySensorKey(string);
|
| | | units.add(sensorMap.get("unit").toString());
|
| | | }
|
| | | values.add((Number) map.remove(string));
|
| | | }
|
| | | map.put("values", values);
|
| | | map.put("units", units);
|
| | | }
|
| | |
|
| | | //获取单位信息
|
| | | Map<String, Map<String, Object>> sensorMap = sensorUnitService.getSensorsByMonitPointId(monitor_point_id);
|
| | |
|
| | | /*
|
| | | if(sensorMap!=null && !sensorMap.isEmpty()) {
|
| | | for (Map<String, Object> map : list) {
|
| | | System.out.println("ScreenController-----AIForecast-----map:"+map);
|
| | |
| | | map.put("unit", "mg/m³");
|
| | | }
|
| | | }
|
| | | }else {
|
| | | 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.remove(sensorKey));
|
| | | map.put("unit", "mg/m³");
|
| | | }
|
| | | }
|
| | | }*/
|
| | | //return null;
|
| | | System.out.println("ScreenController-----AIForecast-----list:"+list);
|
| | | return new ResultBean<List<Map<String, Object>>>(list);
|
| | | }
|
| | |
|