| | |
| | | Long code = monitorPoint.getAreaCode().longValue();
|
| | | String regionName = areaService.queryFullNameByCode(code);
|
| | | Device device = deviceService.getDeviceByMac(mac, false);
|
| | | Device deviceSecond = deviceService.getDeviceByLongitudeAsc(mac);
|
| | | params.put("sensorInfo", resultMap);
|
| | | params.put("regionCode", code);
|
| | | params.put("regionName", regionName);
|
| | | params.put("monitorPoint", monitorPoint);
|
| | | params.put("device", device);
|
| | | params.put("deviceSecond",deviceSecond);
|
| | | String paramsJson = params.toJSONString();
|
| | | model.addObject("traceabilityParams", paramsJson);
|
| | | model.setViewName("traceability");
|
| | |
| | | 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")
|
| | |
| | | Map<String, Object> map = sensorUnitService.getSensorsByMonitPointId(monitor_point_id);
|
| | | System.out.println("ScreenController-----getSensorByMonitorPointId-----map:"+map);
|
| | | return new ResultBean<Map<String, Object>>(map);
|
| | | }
|
| | | }*/
|
| | |
|
| | | @GetMapping("AIForecast")
|
| | | @ApiOperation(value = "AI预测", notes = "AI预测")
|
| | |
| | | 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, Object> sensorMap = sensorUnitService.getSensorsByMonitPointId(monitor_point_id);
|
| | | Map<String, Map<String, Object>> sensorMap = 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));
|
| | | map.put("value", map.remove(sensorKey));
|
| | | 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;
|
| | | //return new ResultBean<List<Map<String, Object>>>(result);
|
| | | //return null;
|
| | | return new ResultBean<List<Map<String, Object>>>(list);
|
| | | }
|
| | |
|
| | | }
|