| | |
| | | return new ResultBean<Map<String, Object>>(map);
|
| | | }*/
|
| | |
|
| | | /*@GetMapping("getSensorByMonitorPointId")
|
| | | @GetMapping("getSensorByMonitorPointId")
|
| | | @ApiOperation(value = "返回单位", notes = "返回单位")
|
| | | @ApiImplicitParams(value = {
|
| | | @ApiImplicitParam(name = "monitor_point_id", value = "监测站点id", required = true, paramType = "query", dataType = "String")
|
| | | })
|
| | | public ResultBean<Map<String, Object>> getSensorByMonitorPointId(HttpServletRequest request) throws Exception {
|
| | | public ResultBean<List<Map<String, Object>>> getSensorByMonitorPointId(HttpServletRequest request) throws Exception {
|
| | | Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
|
| | | String monitor_point_id = (String) parameters.get("monitor_point_id");
|
| | | System.out.println("ScreenController-----getSensorByMonitorPointId-----monitor_point_id:"+monitor_point_id);
|
| | | Map<String, Object> map = sensorUnitService.getSensorsByMonitPointId(monitor_point_id);
|
| | | System.out.println("ScreenController-----getSensorByMonitorPointId-----map:"+map);
|
| | | return new ResultBean<Map<String, Object>>(map);
|
| | | }*/
|
| | | List<Map<String, Object>> map = sensorUnitService.getSensorsByMonitPointId2(monitor_point_id);
|
| | | return new ResultBean<List<Map<String, Object>>>(map);
|
| | | }
|
| | |
|
| | | @GetMapping("AIForecast")
|
| | | @ApiOperation(value = "AI预测", notes = "AI预测")
|
| | |
| | | })
|
| | | 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);
|
| | | |
| | | //获取单位信息
|
| | | Map<String, Map<String, Object>> sensorMap = sensorUnitService.getSensorsByMonitPointId(monitor_point_id);
|
| | | |
| | | if(sensorMap!=null && !sensorMap.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));
|
| | | map.put("value", map.remove(sensorKey));
|
| | | String sensor = map.get("sensorKey").toString();
|
| | | if(sensorMap.get(sensor)!=null) {
|
| | | map.put("unit", sensorMap.get("unit"));
|
| | | map.put("name", sensorMap.get("name"));
|
| | | map.put("rules", sensorMap.get("rules"));
|
| | | }else {
|
| | | map.put("unit", null);
|
| | | map.put("name", null);
|
| | | map.put("rules", null);
|
| | | }
|
| | | }
|
| | | }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", null);
|
| | | map.put("name", null);
|
| | | map.put("rules", null);
|
| | | }
|
| | | }
|
| | | //return null;
|
| | | parameters.put("monitorPointId", parameters.remove("monitorPoint"));
|
| | | String[] sensorKeys = parameters.remove("sensorKey").toString().split(",");
|
| | | parameters.put("sensors", Arrays.asList(sensorKeys));
|
| | | // monitorPointService.isCompensateCalculation(parameters);
|
| | | List<Map<String, Object>> list = historyMinutelyService.getMonitorPointOrDeviceAvgData(parameters);
|
| | | |
| | | //获取单位信息
|
| | | Map<String, Map<String, Object>> sensorUnitMap = sensorUnitService.getSensorsByMonitPointId(monitor_point_id);
|
| | |
|
| | | 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);
|
| | | }
|
| | | System.out.println("ScreenController-----AIForecast-----list:"+list);
|
| | | return new ResultBean<List<Map<String, Object>>>(list);
|
| | | }
|
| | |
|