From ac721d301cb218f08244009f7953db45028ee0e6 Mon Sep 17 00:00:00 2001
From: 于紫祥_1901 <email@yuzixiang_1910>
Date: Sat, 10 Oct 2020 11:05:00 +0800
Subject: [PATCH] update

---
 src/main/java/com/moral/controller/ScreenController.java |   85 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 72 insertions(+), 13 deletions(-)

diff --git a/src/main/java/com/moral/controller/ScreenController.java b/src/main/java/com/moral/controller/ScreenController.java
index 547446e..5078ce8 100644
--- a/src/main/java/com/moral/controller/ScreenController.java
+++ b/src/main/java/com/moral/controller/ScreenController.java
@@ -159,6 +159,9 @@
     @Resource
     private QualityDailyService qualityDailyService;
 
+    @Resource
+    private DeviceRoadService deviceRoadService;
+
 
     /**
      * Screen login. ������������
@@ -675,28 +678,43 @@
         return new ResultBean<List<MonitorPoint>>(monitorPoints);
     }
 
+
+    /*
+    * ���������monitorPoint=368&mac=p5dnd7a0392018&sensorKey=e92&time=2020-08-11
+    * ���������������������������
+    * */
     @GetMapping("report_avg_datas")
     public ResultBean<List<Map<String, Object>>> getMonitorPointOrDeviceAvgData(HttpServletRequest request)
             throws Exception {
         Map<String, Object> parameters = getParametersStartingWith(request, null);
+        //������������������������������������������������
         ParameterUtils.getTimeType4Time(parameters);
-        parameters.put("monitorPointId", parameters.remove("monitorPoint"));
-        Object sensorKey = parameters.remove("sensorKey");
-        parameters.put("sensors", Arrays.asList(sensorKey));
-        // monitorPointService.isCompensateCalculation(parameters);
-        List<Map<String, Object>> list = historyMinutelyService.getMonitorPointOrDeviceAvgData(parameters);
-
-        for (Map<String, Object> map : list) {
-            String time = map.get("time").toString();
-            time = time.substring(time.length() - 2);
-            map.put("time", Integer.valueOf(time));
-            if(parameters.get("type").equals("day")){
-                map.put("time", Integer.valueOf(time)+1);
+        String time1= (String) parameters.get("time");
+        String mac1= (String) parameters.get("mac");
+        List<Map<String, Object>> list=null;
+            if (mac1!=null && mac1.equals("p5dnd7a0392018") && time1.substring(0,4).equals("2019") ){
+                list=null;
+            }else {
+            parameters.put("monitorPointId", parameters.remove("monitorPoint"));
+            Object sensorKey = parameters.remove("sensorKey");
+            parameters.put("sensors", Arrays.asList(sensorKey));
+            // monitorPointService.isCompensateCalculation(parameters);
+            list = historyMinutelyService.getMonitorPointOrDeviceAvgData(parameters);
+            for (Map<String, Object> map : list) {
+                String time = map.get("time").toString();
+                time = time.substring(time.length() - 2);
+                map.put("time", Integer.valueOf(time));
+                if (parameters.get("type").equals("day")) {
+                    map.put("time", Integer.valueOf(time) + 1);
+                }
+                map.put("value", map.remove(sensorKey));
             }
-            map.put("value", map.remove(sensorKey));
         }
         return new ResultBean<List<Map<String, Object>>>(list);
     }
+
+
+
 
     @GetMapping("report_alarm_datas")
     public ResultBean<List<Map<String, Object>>> getAlarmData(HttpServletRequest request) throws Exception {
@@ -1042,6 +1060,13 @@
             throws Exception {
         Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
         List<MonitorPoint> monitorPoints = monitorPointService.getMonitorPointsAndDevicesByRegion(parameters);
+        //������������monitorPoint������������������device.getName()������������
+        for (MonitorPoint monitorPoint : monitorPoints) {
+            List<Device> deviceList=monitorPoint.getDevices();
+            deviceList.sort((Device o1, Device o2) -> {
+                    return o1.getName().compareTo(o2.getName());
+            });
+        }
         return new ResultBean<List<MonitorPoint>>(monitorPoints);
     }
 
@@ -1599,6 +1624,7 @@
     @RequestMapping(value = "/newMap-page", method = RequestMethod.GET)
     public ModelAndView newMap(ModelAndView model, @RequestParam("areaCode") long code,
                                @RequestParam("accountId") int accountId) {
+
         Account account = accountService.getAccountById(accountId);
         List<MonitorPoint> monitorPointList = monitorPointService.getMonitorPointListByAccountId(accountId);
         String regionName = areaService.queryFullNameByCode(code);
@@ -2214,4 +2240,37 @@
         //System.out.println(list);
         return new ResultBean<List<Map<String, Object>>>(list);
     }
+
+    @GetMapping("/getAlarm")
+    @ResponseBody
+    public List<DeviceRoad> getAlarm(@Param("windData") String windData,@Param("code") String code,@Param("mac") String mac,@Param("speedLevel")String speedLevel){
+        List<DeviceRoad> alarmData = deviceRoadService.getAlarmData(windData, code, mac, speedLevel);
+        return alarmData;
+}
+
+    @GetMapping("/lianxian")
+    @ApiOperation(value = "������", notes = "������" )
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "lonAndLat", value = "���������", required = true, paramType = "query", dataType = "String")})
+    public ModelAndView lianxian(HttpServletRequest request,ModelAndView model) throws Exception {
+        Map<String, Object> parameters = getParametersStartingWith(request, null);
+        String mac= (String) parameters.get("lonAndLat");
+        String[] ll= mac.split(",");
+
+        JSONObject params = new JSONObject();
+        params.put("ll",ll);
+        Double[] array= {116.885217,38.299148};
+        Double[] array1= {116.87061,38.322828};
+        Double[] array2= {116.855206,38.325162};
+        Double distance1=mapUtils.getDistance(Double.parseDouble(ll[0]),Double.parseDouble(ll[1]),116.885217,38.299148);
+        Double distance2=mapUtils.getDistance(Double.parseDouble(ll[0]),Double.parseDouble(ll[1]),116.87061,38.322828);
+        Double distance3=mapUtils.getDistance(Double.parseDouble(ll[0]),Double.parseDouble(ll[1]),116.855206,38.325162);
+
+        params.put("mt",distance1);
+        params.put("mt1",distance2);
+        params.put("mt2",distance3);
+        model.addObject("params", params);
+        model.setViewName("lianxian");
+        return model;
+    }
 }

--
Gitblit v1.8.0