于紫祥_1901
2020-06-30 d903f312cf6a1d0fc4c5745832a9d6fa681e5141
src/main/java/com/moral/service/impl/MonitorPointServiceImpl.java
@@ -518,6 +518,7 @@
            List<Map> windList = new ArrayList<Map>();//存放每台设备的风向和经纬度
            Map<String, Object> jsonMap = new HashMap<String, Object>();//每台设备的数据
            Map<String, Object> deviceMap = null;
            if (deviceList.size()>1){
            for (Device device : deviceList) {
                deviceMap = new HashMap<String, Object>();
                smac = device.getMac();
@@ -636,6 +637,7 @@
            List<Map> list1 = new ArrayList<Map>();           //存放风向夹角最小的两台设备的经纬度
            list1.add(windList.get((Integer) twoDeviceMap.get("k")));
            list1.add(windList.get((Integer) twoDeviceMap.get("j")));
            Double wind = 0.0;
            Double sum = 0.0;
            if (list1.get(0).containsKey("e23")) {
@@ -690,6 +692,7 @@
                Double length = mapUtils.getDistance((Double) preAngleDeviceList.get(0).get("longitude"), (Double) preAngleDeviceList.get(0).get("latitude"),
                        (Double) preAngleDeviceList.get(1).get("longitude"), (Double) preAngleDeviceList.get(1).get("latitude"));
                Double subLength = length / 5;
                    Double subLength1 = length/6.1;
                Double angle = mapUtils.getAngle(
                        new MyLatLng((Double) preAngleDeviceList.get(0).get("longitude"),
                                (Double) preAngleDeviceList.get(0).get("latitude")),
@@ -707,26 +710,36 @@
                        Double.parseDouble(secondLoction[1]), subLength);
                String[] fourthLoction = mapUtils.calLocationByDistanceAndLocationAndDirection(angle, Double.parseDouble(thirdLocation[0]),
                        Double.parseDouble(thirdLocation[1]), subLength);
                    String[] fivethLoction = mapUtils.calLocationByDistanceAndLocationAndDirection(angle, Double.parseDouble(fourthLoction[0]),
                            Double.parseDouble(fourthLoction[1]), subLength1);
                locationList.add(firstLocation);
                locationList.add(secondLoction);
                locationList.add(thirdLocation);
                locationList.add(fourthLoction);
                    locationList.add(fivethLoction);
                params.put("locationList", locationList);
                String preAngleDeviceString = JSON.toJSON(preAngleDeviceList).toString();
                params.put("preAngleDeviceString", preAngleDeviceString);//两台添加箭头的设备
            } else {
                params.put("preAngleDeviceString", "");
                    params.put("preAngleDeviceString", 0);
            }
            //String preAngleDeviceString=preAngleDeviceList.
            params.put("wind", wind);
            params.put("list1", list1);
                //String preAngleDeviceString=preAngleDeviceList.
            params.put("deviceList", deviceList);
            }else {
                if (deviceList.size()!=0){
                    params.put("deviceList", deviceList.get(0));
                }else {
                    params.put("deviceList","");
                }
                params.put("preAngleDeviceString", 1);
                params.put("locationList", "");
            }
            params.put("latitudeCompany", latitudeCompany);
            params.put("longitudeCompany", longitudeCompany);
        }
        return params;
    }