于紫祥_1901
2020-10-10 1d2b99ce88ff853ac8b84296b942c79bb649b6ee
设备进行排序
1 files modified
40 ■■■■■ changed files
src/main/java/com/moral/controller/ScreenController.java 40 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/controller/ScreenController.java
@@ -1057,6 +1057,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);
    }
@@ -2230,4 +2237,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;
    }
}