From 235a2be052544e41cef217920d4e55fee730995e Mon Sep 17 00:00:00 2001
From: 于紫祥_1901 <email@yuzixiang_1910>
Date: Tue, 23 Jun 2020 09:54:30 +0800
Subject: [PATCH] 净化率,收集率,无组织排放

---
 src/main/java/com/moral/util/MyLatLng.java                         |   27 +
 src/main/resources/mapper/DeviceMapper.xml                         |   11 
 src/main/java/com/moral/util/mapUtils.java                         |   73 +++
 src/main/webapp/img/company_03.png                                 |    0 
 src/main/webapp/img/company_01.png                                 |    0 
 src/main/java/com/moral/service/impl/DeviceServiceImpl.java        |   15 
 src/main/java/com/moral/mapper/MonitorPointMapper.java             |    5 
 src/main/webapp/view/pressureMap.jsp                               |  118 ++++++
 src/main/java/com/moral/service/DeviceService.java                 |    7 
 src/main/webapp/view/purityMap.jsp                                 |  119 ++++++
 src/main/webapp/view/unorganizedMap.jsp                            |  243 ++++++++++++
 src/main/resources/mapper/MonitorPointMapper.xml                   |    9 
 src/main/java/com/moral/mapper/HistoryHourlyMapper.java            |    8 
 src/main/webapp/img/company_02.png                                 |    0 
 src/main/java/com/moral/mapper/DeviceMapper.java                   |    7 
 src/main/java/com/moral/service/MonitorPointService.java           |    8 
 src/main/java/com/moral/service/HistoryHourlyService.java          |    9 
 src/main/resources/mapper/HistoryHourlyMapper.xml                  |   10 
 src/main/java/com/moral/controller/ScreenController.java           |   72 +++
 src/main/java/com/moral/service/impl/HistoryHourlyServiceImpl.java |   15 
 src/main/java/com/moral/service/impl/MonitorPointServiceImpl.java  |  370 +++++++++++++++++++
 21 files changed, 1,126 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/moral/controller/ScreenController.java b/src/main/java/com/moral/controller/ScreenController.java
index ee04af0..030a524 100644
--- a/src/main/java/com/moral/controller/ScreenController.java
+++ b/src/main/java/com/moral/controller/ScreenController.java
@@ -1779,4 +1779,76 @@
             return model;
         }
     }
+
+    @GetMapping("/purify")
+    @ApiOperation(value = "���������������������", notes = "���������������������")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "monitorPointId", value = "������Id", required = true, paramType = "query", dataType = "String"),
+            @ApiImplicitParam(name = "sensorKey", value = "������", required = true, paramType = "query", dataType = "String"),
+            @ApiImplicitParam(name = "time", value = "������(���������2020-03-19-14)", required = true, paramType = "query", dataType = "String")})
+    public ModelAndView PurificationRate(HttpServletRequest request,ModelAndView model){
+        Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
+        String monitPointIdS= (String) parameters.get("monitorPointId");
+        String sensor= (String) parameters.get("sensorKey");
+        String time= (String) parameters.get("time");
+        String YearAndDay = time.substring(0, time.lastIndexOf("-"));
+        String Hour = time.substring(time.lastIndexOf("-") + 1);
+        String Time = YearAndDay + " " + Hour + ":00:00";
+        int monitPointId=Integer.parseInt(monitPointIdS);
+        JSONObject params=monitorPointService.getMonitorPointById(monitPointId,Time,1,sensor);
+        String paramsJson = params.toJSONString();
+        model.addObject("mapParams", paramsJson);
+        model.setViewName("purityMap");
+        return model;
+    }
+
+
+    @GetMapping("/collection")
+    @ApiOperation(value = "���������������������", notes = "���������������������")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "monitorPointId", value = "������Id", required = true, paramType = "query", dataType = "String"),
+            @ApiImplicitParam(name = "time", value = "������(���������2020-03-19-14)", required = true, paramType = "query", dataType = "String")})
+    public ModelAndView collectionRate(HttpServletRequest request,ModelAndView model){
+        Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
+        String monitPointIdS= (String) parameters.get("monitorPointId");
+        String sensor= "";
+        String time= (String) parameters.get("time");
+        String YearAndDay = time.substring(0, time.lastIndexOf("-"));
+        String Hour = time.substring(time.lastIndexOf("-") + 1);
+        String Time = YearAndDay + " " + Hour + ":00:00";
+        int monitPointId=Integer.parseInt(monitPointIdS);
+        //������������������
+        JSONObject params=monitorPointService.getMonitorPointById(monitPointId,Time,2,sensor);
+        model.addObject("params",params);
+        model.setViewName("pressureMap");
+        return model;
+    }
+
+
+
+    @GetMapping("/unorganizedEmissions")
+    @ApiOperation(value = "���������������", notes = "���������������")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "monitorPointId", value = "������Id", required = true, paramType = "query", dataType = "String"),
+            @ApiImplicitParam(name = "sensorKey", value = "������", required = true, paramType = "query", dataType = "String"),
+            // @ApiImplicitParam(name = "sensorKey", value = "���������key,���������������������������", required = true, paramType = "query", dataType = "String"),
+            @ApiImplicitParam(name = "time", value = "������(���������2020-03-19-14)", required = true, paramType = "query", dataType = "String")})
+    public ModelAndView unorganizedEmissions(HttpServletRequest request,ModelAndView model){
+        Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
+        String monitPointIdS= (String) parameters.get("monitorPointId");
+        String sensor= (String) parameters.get("sensorKey");
+        String time= (String) parameters.get("time");
+        String YearAndDay = time.substring(0, time.lastIndexOf("-"));
+        String Hour = time.substring(time.lastIndexOf("-") + 1);
+        String Time = YearAndDay + " " + Hour + ":00:00";
+
+
+        int monitPointId=Integer.parseInt(monitPointIdS);
+        //������������������
+        JSONObject params=monitorPointService.getMonitorPointById(monitPointId,Time,3,sensor);
+        model.addObject("params",params);
+        model.setViewName("unorganizedMap");
+        return model;
+    }
+
 }
diff --git a/src/main/java/com/moral/mapper/DeviceMapper.java b/src/main/java/com/moral/mapper/DeviceMapper.java
index fdd805e..90a7ac3 100644
--- a/src/main/java/com/moral/mapper/DeviceMapper.java
+++ b/src/main/java/com/moral/mapper/DeviceMapper.java
@@ -44,4 +44,11 @@
 	String getLimitDataByDevice(Map<String, Object> parameters);
 
     List<String> getMacsByOrganizationId(@Param("organizationIdList") List<Object> organizationIdList);
+
+	List<Device> getDeviceById1(@Param("id") int id);
+
+	//������������������
+	List<Device> getDeviceById2(@Param("id") int id);
+
+	List<Device> getDeviceById3(@Param("id") int id);
 }
\ No newline at end of file
diff --git a/src/main/java/com/moral/mapper/HistoryHourlyMapper.java b/src/main/java/com/moral/mapper/HistoryHourlyMapper.java
index 2bdc6c9..6c05d9a 100644
--- a/src/main/java/com/moral/mapper/HistoryHourlyMapper.java
+++ b/src/main/java/com/moral/mapper/HistoryHourlyMapper.java
@@ -1,5 +1,7 @@
 package com.moral.mapper;
 
+import org.apache.ibatis.annotations.Param;
+
 import java.util.Map;
 
 public interface HistoryHourlyMapper {
@@ -9,4 +11,10 @@
     Map<String, Object> getPollutionSourceDataByHour(Map<String, Object> parameters);
 
     Map<String, Object> getPollutionSourceDataAll(Map<String, Object> parameters);
+    //������TVOC������
+    String getTVOCByMac(@Param("mac") String mac, @Param("time") String time, @Param("sensor") String sensor);
+    //������������������
+    String getPressureByMac(@Param("mac") String mac,@Param("time") String time);
+    //������������
+    Map<String,Object> getDataByMac(@Param("mac") String mac,@Param("time") String time);
 }
diff --git a/src/main/java/com/moral/mapper/MonitorPointMapper.java b/src/main/java/com/moral/mapper/MonitorPointMapper.java
index 815c197..425cb4b 100644
--- a/src/main/java/com/moral/mapper/MonitorPointMapper.java
+++ b/src/main/java/com/moral/mapper/MonitorPointMapper.java
@@ -3,6 +3,7 @@
 import java.util.List;
 import java.util.Map;
 
+import com.moral.entity.Device;
 import org.apache.ibatis.annotations.Param;
 
 import com.moral.common.mapper.BaseMapper;
@@ -17,4 +18,8 @@
     List<Integer> selectVersionsById(int id);
     Map<String, Object> selectAllById(int id);
     List<Map<String, Object>> getIdByOrganizationId(@Param("organizationIdList") List<Object> organizationIdList);
+    //������monitorPointId������������������������������������
+    List<Device> getDeviceList(@Param("id") int id);
+    //���������������������������id
+    MonitorPoint getMonitorPointById(@Param("id") int id);
 }
\ No newline at end of file
diff --git a/src/main/java/com/moral/service/DeviceService.java b/src/main/java/com/moral/service/DeviceService.java
index 917c31e..39ca627 100644
--- a/src/main/java/com/moral/service/DeviceService.java
+++ b/src/main/java/com/moral/service/DeviceService.java
@@ -61,4 +61,11 @@
 	Device getDeviceByLongitudeAsc(String mac);
 
     List<String> getMacsByOrganizationId(List<Object> organizationIdList);
+
+	//������������������
+	List<Device> getDeviceById1(int id);
+	//������������������
+	List<Device> getDeviceById2(int id);
+	//������������������
+	List<Device> getDeviceById3(int id);
 }
diff --git a/src/main/java/com/moral/service/HistoryHourlyService.java b/src/main/java/com/moral/service/HistoryHourlyService.java
index e6ca84a..ad011f6 100644
--- a/src/main/java/com/moral/service/HistoryHourlyService.java
+++ b/src/main/java/com/moral/service/HistoryHourlyService.java
@@ -12,4 +12,13 @@
     Map<String, Object> getPollutionSourceDataAll(Map<String, Object> parameters) throws Exception;
 
     Point getDirPoint(Map<String, Object> parameters) throws Exception;
+
+    //������TVOC������
+    String getTVOCByMac(String mac,String time,String sensor);
+    //������������������
+    String getPressureByMac(String mac,String time);
+
+    //������historyHourly���������������
+
+    Map<String,Object> getDataByMac(String mac,String time);
 }
diff --git a/src/main/java/com/moral/service/MonitorPointService.java b/src/main/java/com/moral/service/MonitorPointService.java
index 268b7c3..c0fb66d 100644
--- a/src/main/java/com/moral/service/MonitorPointService.java
+++ b/src/main/java/com/moral/service/MonitorPointService.java
@@ -4,7 +4,9 @@
 import java.util.List;
 import java.util.Map;
 
+import com.alibaba.fastjson.JSONObject;
 import com.moral.common.bean.PageBean;
+import com.moral.entity.Device;
 import com.moral.entity.MonitorPoint;
 
 public interface MonitorPointService {
@@ -41,4 +43,10 @@
 	void isCompensateCalculation(Map<String, Object> parameters);
 	
 	Map<String, Object> selectAllById(String id);
+
+    //������monitorPointId������������������������������������
+    List<Device> getDeviceList(int id);
+
+    //���������������������������id
+    JSONObject getMonitorPointById(int id, String Time, int i, String sensor);
 }
diff --git a/src/main/java/com/moral/service/impl/DeviceServiceImpl.java b/src/main/java/com/moral/service/impl/DeviceServiceImpl.java
index cc3ce03..5311f2e 100644
--- a/src/main/java/com/moral/service/impl/DeviceServiceImpl.java
+++ b/src/main/java/com/moral/service/impl/DeviceServiceImpl.java
@@ -635,4 +635,19 @@
     public List<String> getMacsByOrganizationId(List<Object> organizationIdList) {
         return deviceMapper.getMacsByOrganizationId(organizationIdList);
     }
+
+    @Override
+    public List<Device> getDeviceById1(int id) {
+        return deviceMapper.getDeviceById1(id);
+    }
+
+    @Override
+    public List<Device> getDeviceById2(int id) {
+        return deviceMapper.getDeviceById2(id);
+    }
+
+    @Override
+    public List<Device> getDeviceById3(int id) {
+        return deviceMapper.getDeviceById3(id);
+    }
 }
diff --git a/src/main/java/com/moral/service/impl/HistoryHourlyServiceImpl.java b/src/main/java/com/moral/service/impl/HistoryHourlyServiceImpl.java
index 314a26d..bd36de4 100644
--- a/src/main/java/com/moral/service/impl/HistoryHourlyServiceImpl.java
+++ b/src/main/java/com/moral/service/impl/HistoryHourlyServiceImpl.java
@@ -100,6 +100,21 @@
     }
 
     @Override
+    public String getTVOCByMac(String mac,String time,String sensor) {
+        return historyHourlyMapper.getTVOCByMac(mac,time,sensor);
+    }
+
+    @Override
+    public String getPressureByMac(String mac, String time) {
+        return historyHourlyMapper.getPressureByMac(mac,time);
+    }
+
+    @Override
+    public Map<String,Object> getDataByMac(String mac, String time) {
+        return historyHourlyMapper.getDataByMac(mac,time);
+    }
+
+    @Override
     public Point getDirPoint(Map<String, Object> parameters) throws Exception {
         Map<String, Object> pollutionSourceData = getPollutionSourceDataByHour(parameters);
         if (MapUtils.isEmpty(pollutionSourceData)) {
diff --git a/src/main/java/com/moral/service/impl/MonitorPointServiceImpl.java b/src/main/java/com/moral/service/impl/MonitorPointServiceImpl.java
index 0f8c004..e17994e 100644
--- a/src/main/java/com/moral/service/impl/MonitorPointServiceImpl.java
+++ b/src/main/java/com/moral/service/impl/MonitorPointServiceImpl.java
@@ -1,5 +1,6 @@
 package com.moral.service.impl;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -13,8 +14,14 @@
 import javax.annotation.Resource;
 import javax.validation.constraints.NotNull;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.moral.mapper.DictionaryDataMapper;
 import com.moral.mapper.OrganizationMapper;
+import com.moral.service.HistoryHourlyService;
+import com.moral.util.MyLatLng;
+import com.moral.util.mapUtils;
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
@@ -56,6 +63,9 @@
     
     @Resource
     private OrganizationService organizationService;
+
+    @Resource
+    private HistoryHourlyService historyHourlyService;
     
     private static Class ENTITY_CLASS = MonitorPoint.class;
     @Override
@@ -364,4 +374,364 @@
 		Map<String, Object> map = monitorPointMapper.selectAllById(id2);
 		return map;
 	}
+
+    @Override
+    public List<Device> getDeviceList(int id) {
+        return monitorPointMapper.getDeviceList(id);
+    }
+
+    @Override
+    public JSONObject getMonitorPointById(int id, String Time, int i, String sensor) {
+        JSONObject params = new JSONObject();
+        MonitorPoint monitorPoint = monitorPointMapper.getMonitorPointById(id);
+        if (i == 1) {
+            Double longitude = monitorPoint.getLongitude();
+            Double latitude = monitorPoint.getLatitude();
+
+            Double workshop = 0.0;
+
+            Double flue = 0.0;
+            //������������
+            List<Device> device1 = deviceService.getDeviceById1(id);
+
+            //������������
+            List<Device> device2 = deviceService.getDeviceById2(id);
+
+            //������������
+            List<Device> device3 = deviceService.getDeviceById3(id);
+
+
+            String purificationRate = null;//���������
+
+            if (device3.size() == 0) {
+                purificationRate = "���������������������������������������������";
+                params.put("device2", device2);
+                params.put("device1", device1);
+            } else {
+                params.put("device1", device1);
+                params.put("device2", device2);
+                params.put("device3", device3);
+                for (Device device33 : device3) {
+                    String mac3 = device33.getMac();
+                    String tvoc = historyHourlyService.getTVOCByMac(mac3, Time,sensor);
+                    if (tvoc != null) {
+                        workshop = Double.parseDouble(tvoc);
+                    } else {
+                        workshop = 0.0;
+                    }
+                }
+                if (device1.size() == 0) {
+                    purificationRate = "���������������������������������������������";
+                } else {
+                    for (Device device11 : device1) {
+                        String mac1 = device11.getMac();
+                        flue = Double.parseDouble(historyHourlyService.getTVOCByMac(mac1, Time,sensor));
+                        if (workshop == 0.0) {
+                            purificationRate = "���������������������������������������������������";
+                        } else {
+                            if (flue == 0.0) {
+                                purificationRate = "���������������������������������������������������";
+                            } else {
+                                BigDecimal b = new BigDecimal(((workshop - flue) / workshop) * 100);
+                                double purity2 = b.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
+                                purificationRate = (purity2) + "%";
+                            }
+                        }
+                    }
+                }
+            }
+            params.put("latitude", latitude);
+            params.put("longitude", longitude);
+            params.put("purificationRate", purificationRate);
+        }
+        if (i == 2) {
+            Double longitude = monitorPoint.getLongitude();
+            Double latitude = monitorPoint.getLatitude();
+            //������������
+            List<Device> device1 = deviceService.getDeviceById1(id);
+            //������������
+            List<Device> device2 = deviceService.getDeviceById2(id);
+            //������������
+            List<Device> device3 = deviceService.getDeviceById3(id);
+            String collectionRate = null;//���������
+            Double pressure = 0.0;//������������
+            List<Double> list1 = new ArrayList();
+            if (device3.size() == 0) {
+                collectionRate = "������������������������������������������������";
+                params.put("device1", device1);
+                params.put("device2", device2);
+            } else {
+                params.put("device3", device3);
+                if (device2.size() == 0) {
+                    collectionRate = "������������������������������������������������";
+                    params.put("device1", device1);
+                } else {
+                    params.put("device2", device2);
+                    params.put("device1", device1);
+                    Double sum = 0.0;
+                    for (Device device22 : device2) {
+                        String mac2 = device22.getMac();
+                        String pressure2 = historyHourlyService.getPressureByMac(mac2, Time);
+
+                        System.out.println("pressure2="+pressure2);
+                        if (pressure2 != null) {
+                            pressure = Double.parseDouble(pressure2);
+                            list1.add(pressure);
+                        }else {
+                            collectionRate = "������������������������������������������������������������";
+                        }
+
+                    }
+                    for (Double d : list1) {
+                        sum = sum + d;
+                    }
+                    if (list1.size() != 0) {
+                        pressure = sum / list1.size();
+                    } else {
+                        collectionRate = "������������������������������������������������������������";
+                    }
+                    System.out.println(list1);
+                    Double pressure33 = 0.0;
+                    for (Device device33 : device3) {
+                        String mac3 = device33.getMac();
+                        String pressure3 = historyHourlyService.getPressureByMac(mac3, Time);
+                        if (pressure3 != null) {
+                            pressure33 = Double.parseDouble(pressure3);
+                            BigDecimal b = new BigDecimal((pressure - pressure33 + 3.5) * 20);//���������2.5���������������������������������
+                            double collection = b.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
+                            collectionRate = collection + "%";
+                        }
+                    }
+                }
+            }
+            params.put("latitude", latitude);
+            params.put("longitude", longitude);
+            params.put("collectionRate", collectionRate);
+        }
+
+        if (i == 3) {
+            Double longitudeCompany = monitorPoint.getLongitude();
+            Double latitudeCompany = monitorPoint.getLatitude();
+            Double longitude = 0.0;//������������������������
+            Double latitude = 0.0;//������������������������
+            List<Device> deviceList = deviceService.getDeviceById2(id);
+            //List<Device> deviceList = monitorPointService.getDeviceList(id);
+            List<Map> list = new ArrayList<Map>();//������historyHourly���json������
+            String smac = "";//������������������Mac���
+            List<Map> windList = new ArrayList<Map>();//���������������������������������������
+            Map<String, Object> jsonMap = new HashMap<String, Object>();//���������������������
+            Map<String, Object> deviceMap = null;
+            for (Device device : deviceList) {
+                deviceMap = new HashMap<String, Object>();
+                smac = device.getMac();
+                latitude = device.getLatitude();
+                longitude = device.getLongitude();
+
+                jsonMap = historyHourlyService.getDataByMac(smac, Time);
+                deviceMap.put("longitude", longitude);
+                deviceMap.put("latitude", latitude);
+                if (jsonMap != null) {
+                    deviceMap.put("jsonMap", jsonMap);
+                } else {
+                    deviceMap.put("jsonMap", "������������������������������");
+                }
+
+                list.add(deviceMap);
+            }
+            Map<String, Object> mapData = new HashMap<String, Object>();
+            Map<String, Object> mapDevice;
+            JSONArray windDir;
+            for (Map<String, Object> objectMap : list) {
+                mapDevice = new HashMap<String, Object>();
+                Map<String, Object> map = null;
+                if (!(objectMap.get("jsonMap") instanceof String)) {
+                    mapData = (Map<String, Object>) objectMap.get("jsonMap");
+                    map = (Map) JSON.parseObject((String) mapData.get("json"));
+                    windDir = (JSONArray) JSONArray.toJSON(map.get("e23"));
+                    JSONArray concentration = (JSONArray) JSONArray.toJSON(map.get(sensor));
+
+                    BigDecimal bigDecimal1=new BigDecimal(0);
+                    BigDecimal bigDecimal=new BigDecimal(0);
+                    if (concentration!=null){
+                        if (concentration.get(0) instanceof Integer){
+                            bigDecimal1 =new BigDecimal(concentration.get(0).toString());
+                        }else {
+                            bigDecimal1= (BigDecimal) concentration.get(0);
+                        }
+                        if (windDir!=null){
+                            if (windDir.get(0) instanceof Integer){
+                                bigDecimal =new BigDecimal(windDir.get(0).toString());
+                            }else {
+                                bigDecimal=(BigDecimal) windDir.get(0);
+                            }
+                            mapDevice.put("e23", bigDecimal.doubleValue());
+                            mapDevice.put("sensor", bigDecimal1.doubleValue());
+                            mapDevice.put("longitude", objectMap.get("longitude"));
+                            mapDevice.put("latitude", objectMap.get("latitude"));
+                        }else {
+                            mapDevice.put("noSensor", "���������������");
+                            mapDevice.put("longitude", objectMap.get("longitude"));
+                            mapDevice.put("latitude", objectMap.get("latitude"));
+                        }
+                    }
+                } else {
+                    mapDevice.put("info", objectMap.get("jsonMap"));
+                    mapDevice.put("longitude", objectMap.get("longitude"));
+                    mapDevice.put("latitude", objectMap.get("latitude"));
+                }
+                windList.add(mapDevice);
+            }
+            // if (windDir!=null){}
+            Double differenceNum = 0.0;
+            Map<String, Object> indexMap;
+            List<Map> mapList = new ArrayList<>();
+            for (int j = 0; j < windList.size(); j++) {
+                for (int k = 0; k < windList.size(); k++) {
+                    if (k != j) {
+                        indexMap = new HashMap<String, Object>();
+                        if (windList.get(k).containsKey("e23") && windList.get(j).containsKey("e23")) {
+                            Double e23Numk = (Double) windList.get(k).get("e23");
+                            Double e23Numj = (Double) windList.get(j).get("e23");
+                            Double diff = e23Numk - e23Numj;
+                            BigDecimal b = new BigDecimal(Math.abs(diff));
+
+                            differenceNum = b.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
+                            if (differenceNum > 180) {
+                                differenceNum = 360 - differenceNum;
+                            }
+                            indexMap.put("k", k);
+                            indexMap.put("j", j);
+                            indexMap.put("diff", differenceNum);
+                        } else {
+                            indexMap.put("k", k);
+                            indexMap.put("j", j);
+                            indexMap.put("info", "���������������");
+                        }
+
+//                     indexMap.put("longitude",windList.get(k).get("longitude"));
+//                     indexMap.put("latitude",windList.get(k).get("latitude"));
+                        mapList.add(indexMap);
+                    } else {
+                        continue;
+                    }
+
+                }
+            }
+            Double min = 0.0;
+            int indexMin = 0;
+            if (mapList.size()>0){
+                if (mapList.get(0).containsKey("diff")) {
+                    min = (Double) mapList.get(0).get("diff");
+                    for (int q = 1; q < mapList.size(); q++) {
+                        if (mapList.get(q).containsKey("diff")) {
+                            if (min > (Double) mapList.get(q).get("diff")) {
+                                min = (Double) mapList.get(q).get("diff");
+                                indexMin = q;
+                            }
+                        } else {
+                            indexMin = q;
+                        }
+                    }
+                }
+            }
+
+            Map twoDeviceMap = mapList.get(indexMin);
+            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")) {
+                if (Math.abs((Double) list1.get(0).get("e23") - (Double) list1.get(1).get("e23")) > 180) {
+                    sum = (Double) list1.get(0).get("e23") + (Double) list1.get(1).get("e23");
+                    wind = sum / 2 + 180;
+                    if (wind > 360) {
+                        wind = wind - 360;
+                    }
+                } else {
+                    for (Map map : list1) {
+                        sum += (Double) map.get("e23");
+                    }
+                    wind = sum / 2;
+                }
+            } else {
+                wind = 0.0;
+            }
+            Map<String, Object> longAndLatiMap;
+            List<Map> longAndLatiList = new ArrayList<>();//������������������������������������windList������������������������������������������������������������������
+            List<Map> preAngleDeviceList = new ArrayList<Map>(); //���������������������������������������
+            if (wind != 0.0) {
+                for (int f = 0; f < windList.size(); f++) {
+                    for (int h = 0; h < windList.size(); h++) {
+                        if (f != h) {
+                            longAndLatiMap = new HashMap<String, Object>();
+                            longAndLatiMap.put("h", h);
+                            longAndLatiMap.put("f", f);
+                            Double angle = mapUtils.getAngle(
+                                    new MyLatLng((Double) windList.get(h).get("longitude"),
+                                            (Double) windList.get(h).get("latitude")),
+                                    new MyLatLng((Double) windList.get(f).get("longitude"),
+                                            (Double) windList.get(f).get("latitude")));
+                            Double angleDiff = Math.abs(angle - wind);
+                            longAndLatiMap.put("angle", angleDiff);
+                            longAndLatiList.add(longAndLatiMap);
+                        }
+                    }
+                }
+                Double minAngle = (Double) longAndLatiList.get(0).get("angle");
+                int indexAngle = 0;
+                for (int j = 0; j < longAndLatiList.size(); j++) {
+                    if (minAngle > (Double) longAndLatiList.get(j).get("angle")) {
+                        minAngle = (Double) longAndLatiList.get(j).get("angle");
+                        indexAngle = j;
+                    }
+                }
+                //windList.get((Integer) longAndLatiList.get(indexAngle).get("f"))������������������������
+                preAngleDeviceList.add(windList.get((Integer) longAndLatiList.get(indexAngle).get("h")));
+                preAngleDeviceList.add(windList.get((Integer) longAndLatiList.get(indexAngle).get("f")));
+
+                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 angle = mapUtils.getAngle(
+                        new MyLatLng((Double) preAngleDeviceList.get(0).get("longitude"),
+                                (Double) preAngleDeviceList.get(0).get("latitude")),
+                        new MyLatLng((Double) preAngleDeviceList.get(1).get("longitude"),
+                                (Double) preAngleDeviceList.get(1).get("latitude")));
+
+                params.put("preAngleDeviceList", preAngleDeviceList);
+                params.put("angle", angle);
+                List locationList = new ArrayList();
+                String[] firstLocation = mapUtils.calLocationByDistanceAndLocationAndDirection(angle, (Double) preAngleDeviceList.get(0).get("longitude"),
+                        (Double) preAngleDeviceList.get(0).get("latitude"), subLength);
+                String[] secondLoction = mapUtils.calLocationByDistanceAndLocationAndDirection(angle, Double.parseDouble(firstLocation[0]),
+                        Double.parseDouble(firstLocation[1]), subLength);
+                String[] thirdLocation = mapUtils.calLocationByDistanceAndLocationAndDirection(angle, Double.parseDouble(secondLoction[0]),
+                        Double.parseDouble(secondLoction[1]), subLength);
+                String[] fourthLoction = mapUtils.calLocationByDistanceAndLocationAndDirection(angle, Double.parseDouble(thirdLocation[0]),
+                        Double.parseDouble(thirdLocation[1]), subLength);
+                locationList.add(firstLocation);
+                locationList.add(secondLoction);
+                locationList.add(thirdLocation);
+                locationList.add(fourthLoction);
+                params.put("locationList", locationList);
+
+                String preAngleDeviceString = JSON.toJSON(preAngleDeviceList).toString();
+                params.put("preAngleDeviceString", preAngleDeviceString);//���������������������������
+            } else {
+                params.put("preAngleDeviceString", "");
+            }
+            //String preAngleDeviceString=preAngleDeviceList.
+
+            params.put("wind", wind);
+            params.put("list1", list1);
+            params.put("deviceList", deviceList);
+            params.put("latitudeCompany", latitudeCompany);
+            params.put("longitudeCompany", longitudeCompany);
+        }
+
+        return params;
+    }
+
+
 }
diff --git a/src/main/java/com/moral/util/MyLatLng.java b/src/main/java/com/moral/util/MyLatLng.java
new file mode 100644
index 0000000..37417f5
--- /dev/null
+++ b/src/main/java/com/moral/util/MyLatLng.java
@@ -0,0 +1,27 @@
+package com.moral.util;
+
+ public class MyLatLng {
+    final static double Rc=6378137;
+    final static double Rj=6356725;
+    double m_LoDeg,m_LoMin,m_LoSec;
+    double m_LaDeg,m_LaMin,m_LaSec;
+    double m_Longitude,m_Latitude;
+    double m_RadLo,m_RadLa;
+    double Ec;
+    double Ed;
+    public MyLatLng(double longitude, double latitude){
+        m_LoDeg=(int)longitude;
+        m_LoMin=(int)((longitude-m_LoDeg)*60);
+        m_LoSec=(longitude-m_LoDeg-m_LoMin/60.)*3600;
+
+        m_LaDeg=(int)latitude;
+        m_LaMin=(int)((latitude-m_LaDeg)*60);
+        m_LaSec=(latitude-m_LaDeg-m_LaMin/60.)*3600;
+
+        m_Longitude=longitude;
+        m_Latitude=latitude;
+        m_RadLo=longitude*Math.PI/180.;
+        m_RadLa=latitude*Math.PI/180.;
+        Ec=Rj+(Rc-Rj)*(90.-m_Latitude)/90.;
+        Ed=Ec*Math.cos(m_RadLa);
+}}
diff --git a/src/main/java/com/moral/util/mapUtils.java b/src/main/java/com/moral/util/mapUtils.java
new file mode 100644
index 0000000..98d66ff
--- /dev/null
+++ b/src/main/java/com/moral/util/mapUtils.java
@@ -0,0 +1,73 @@
+package com.moral.util;
+
+import java.text.DecimalFormat;
+
+public class mapUtils {
+    /**
+     * ������AB������������������������������
+     * @param A  A���������������
+     * @param B  B���������������
+     * @return  AB���������������������������������0~360���
+     */
+    /** 180�� **/
+    private static final DecimalFormat df = new DecimalFormat("0.000000");
+    //������������������
+    private static final double EARTH_RADIUS = 6378137;
+    //�����������������������������
+    private static double rad(double d){
+        return d * Math.PI / 180.0;
+    }
+
+    public static double getDistance(double lng1, double lat1, double lng2, double lat2){
+        double radLat1 = rad(lat1);
+        double radLat2 = rad(lat2);
+        double a = radLat1 - radLat2;
+        double b = rad(lng1) - rad(lng2);
+        double s = 2 * Math.asin(
+                Math.sqrt(
+                        Math.pow(Math.sin(a/2),2)
+                                + Math.cos(radLat1)*Math.cos(radLat2)*Math.pow(Math.sin(b/2),2)
+                )
+        );
+        s = s * EARTH_RADIUS;
+        s = Math.round(s * 10000) / 10000;
+        return s;
+    }
+
+
+    public  static double getAngle(MyLatLng A,MyLatLng B){
+        double dx=(B.m_RadLo-A.m_RadLo)*A.Ed;
+        double dy=(B.m_RadLa-A.m_RadLa)*A.Ec;
+        double angle=0.0;
+        angle=Math.atan(Math.abs(dx/dy))*180./Math.PI;
+        double dLo=B.m_Longitude-A.m_Longitude;
+        double dLa=B.m_Latitude-A.m_Latitude;
+        if(dLo>0&&dLa<=0){
+            angle=(90.-angle)+90;
+        }
+        else if(dLo<=0&&dLa<0){
+            angle=angle+180.;
+        }else if(dLo<0&&dLa>=0){
+            angle= (90.-angle)+270;
+        }
+        return angle;
+    }
+    public static String[] calLocationByDistanceAndLocationAndDirection(double angle, double startLong,double startLat, double distance){
+        String[] result = new String[2];
+        //���������������������������������������
+        double �� = distance/EARTH_RADIUS;
+        // ���������radian���������������������������
+        angle = Math.toRadians(angle);
+        startLong = Math.toRadians(startLong);
+        startLat = Math.toRadians(startLat);
+        double lat = Math.asin(Math.sin(startLat)*Math.cos(��)+Math.cos(startLat)*Math.sin(��)*Math.cos(angle));
+        double lon = startLong + Math.atan2(Math.sin(angle)*Math.sin(��)*Math.cos(startLat),Math.cos(��)-Math.sin(startLat)*Math.sin(lat));
+        // ���������������10���������������
+        lon = Math.toDegrees(lon);
+        lat = Math.toDegrees(lat);
+        result[0] = df.format(lon);
+        result[1] = df.format(lat);
+        return result;
+    }
+
+}
diff --git a/src/main/resources/mapper/DeviceMapper.xml b/src/main/resources/mapper/DeviceMapper.xml
index c2c17b5..5c53568 100644
--- a/src/main/resources/mapper/DeviceMapper.xml
+++ b/src/main/resources/mapper/DeviceMapper.xml
@@ -430,4 +430,15 @@
         AND d.is_delete = '0'
     </select>
 
+	<select id="getDeviceById1" resultType="com.moral.entity.Device">
+		SELECT d.* FROM `device` as d,monitor_point as mp,device_property as dp  where d.monitor_point_id=mp.id and d.id=dp.id and dp.device_tech=1 and d.monitor_point_id=#{id}
+	</select>
+	<select id="getDeviceById2" resultType="com.moral.entity.Device">
+		SELECT d.* FROM `device` as d,monitor_point as mp,device_property as dp  where d.monitor_point_id=mp.id and d.id=dp.id and dp.device_tech=2 and d.monitor_point_id=#{id}
+	</select>
+	<select id="getDeviceById3" resultType="com.moral.entity.Device">
+		SELECT d.* FROM `device` as d,monitor_point as mp,device_property as dp  where d.monitor_point_id=mp.id and d.id=dp.id and dp.device_tech=3 and d.monitor_point_id=#{id}
+	</select>
+
+
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/HistoryHourlyMapper.xml b/src/main/resources/mapper/HistoryHourlyMapper.xml
index 5f6a59c..b428cba 100644
--- a/src/main/resources/mapper/HistoryHourlyMapper.xml
+++ b/src/main/resources/mapper/HistoryHourlyMapper.xml
@@ -52,4 +52,14 @@
         order by time desc
         limit 0,1
     </select>
+
+    <select id="getTVOCByMac" resultType="java.lang.String">
+        select json->'$.${sensor}[0]' as e17 from history_hourly where mac=#{mac} and time=#{time}
+    </select>
+    <select id="getPressureByMac" resultType="java.lang.String">
+        select json->'$.e28[0]' as e28 from history_hourly where mac=#{mac} and time=#{time}
+    </select>
+    <select id="getDataByMac" resultType="java.util.Map">
+                select json  from history_hourly where mac=#{mac} and time=#{time}
+    </select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/MonitorPointMapper.xml b/src/main/resources/mapper/MonitorPointMapper.xml
index 1ecd9d7..8b59ad0 100644
--- a/src/main/resources/mapper/MonitorPointMapper.xml
+++ b/src/main/resources/mapper/MonitorPointMapper.xml
@@ -156,4 +156,13 @@
 	            	#{organizationId}  
 	        	</foreach>
 	</select>
+
+	<select id="getDeviceList" resultType="com.moral.entity.Device">
+		SELECT d.* FROM `device` as d,monitor_point as mp
+		where d.monitor_point_id=mp.id
+		and mp.id=#{id}
+	</select>
+	<select id="getMonitorPointById" resultType="com.moral.entity.MonitorPoint">
+		select * from monitor_point where id=#{id}
+	</select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/webapp/img/company_01.png b/src/main/webapp/img/company_01.png
new file mode 100644
index 0000000..62e2926
--- /dev/null
+++ b/src/main/webapp/img/company_01.png
Binary files differ
diff --git a/src/main/webapp/img/company_02.png b/src/main/webapp/img/company_02.png
new file mode 100644
index 0000000..39eaaeb
--- /dev/null
+++ b/src/main/webapp/img/company_02.png
Binary files differ
diff --git a/src/main/webapp/img/company_03.png b/src/main/webapp/img/company_03.png
new file mode 100644
index 0000000..c6c3a5a
--- /dev/null
+++ b/src/main/webapp/img/company_03.png
Binary files differ
diff --git a/src/main/webapp/view/pressureMap.jsp b/src/main/webapp/view/pressureMap.jsp
new file mode 100644
index 0000000..a5039c3
--- /dev/null
+++ b/src/main/webapp/view/pressureMap.jsp
@@ -0,0 +1,118 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@page isELIgnored="false" %>
+
+<!DOCTYPE html>
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+    <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
+    <style type="text/css">
+        body, html, #allmap {
+            width: 100%;
+            height: 100%;
+            overflow: hidden;
+            margin: 0;
+            font-family: "������������";
+        }
+        #box {
+            width:300px;
+            height:500px;
+            top:80px;
+            right:30px;
+            position:absolute;
+            z-index:1;
+            border:2px solid red;
+            background-color:gainsboro;
+            opacity: 0.8;
+        }
+    </style>
+    <script type="text/javascript"
+            src="http://api.map.baidu.com/api?v=2.0&ak=rER1sgBIcQxkfNSlm2wmBGZGgEERrooM"></script>
+    <script type="text/javascript" src="/js/jquery.min.js"></script>
+    <script type="text/javascript" src="/js/utils.js"></script>
+    <script type="text/javascript">
+        if (typeof (JSON) == 'undefined') {
+            $.getScript("js/json2.js");
+        }
+    </script>
+    <script type="text/javascript" src="/js/paging.js"></script>
+    <title>������������</title>
+</head>
+<body>
+<div id="allmap" style="z-index: 0" ;>
+</div>
+<div id="box">
+    <p>
+       <img src="/img/company_01.png" style="width: 30px;height: 30px;margin-left: 15px;"/> <span style="position: relative;top: -9px;">&nbsp;&nbsp;--->������</span>
+    </p>
+    <p>
+        <img src="/img/company_02.png" style="width: 30px;height: 30px;margin-left: 15px;"/> <span style="position: relative;top: -9px;">&nbsp;&nbsp;--->������</span>
+    </p>
+    <p>
+        <img src="/img/company_03.png" style="width: 30px;height: 30px;margin-left: 15px;"/> <span style="position: relative;top: -9px;">&nbsp;&nbsp;--->������</span>
+        <br/>
+        <br/>
+    </p>
+    <div id="purify">
+    </div>
+</div>
+<div id="mapParams" style="display: none;">
+    ${requestScope.params}
+</div>
+</body>
+
+</html>
+<script type="text/javascript">
+    // ������������API������
+    var map = new BMap.Map("allmap");    // ������Map������
+    map.enableScrollWheelZoom(true);     //������������������������
+    var params = $.parseJSON($("#mapParams").html());
+    var longitude = params["longitude"];
+    var latitude = params["latitude"];
+    map.centerAndZoom(new BMap.Point(longitude, latitude), 17);  // ���������������,������������������������������������
+             // ���������������������������
+
+    $("#purify").append("<p style='margin-left: 15px;'>������������" + params["collectionRate"] + "</p>");
+   /* var infoWindow = new BMap.InfoWindow("<p style='font-size:14px;'>" + text + "</p>");
+    mark4.addEventListener("click", function () {
+        this.openInfoWindow(infoWindow);
+    });*/
+
+    var device1 = params["device1"];
+    if (device1 != null) {
+        for (var i = 0; i < device1.length; i++) {
+            var icon1 = new BMap.Icon("/img/company_01.png", new BMap.Size(48, 48));
+            var mark1 = new BMap.Marker(new BMap.Point(device1[i].longitude, device1[i].latitude), {icon: icon1});
+            map.addOverlay(mark1);
+        }
+    }
+
+    var device2 = params["device2"];
+    if (device2 != null) {
+        for (var i = 0; i < device2.length; i++) {
+            var icon2 = new BMap.Icon("/img/company_02.png", new BMap.Size(48, 48));
+            var mark2 = new BMap.Marker(new BMap.Point(device2[i].longitude, device2[i].latitude), {icon: icon2});
+            map.addOverlay(mark2);
+        }
+    }
+
+    var device3 = params["device3"];
+    if (device3 != null) {
+        for (var i = 0; i < device3.length; i++) {
+            var icon3 = new BMap.Icon("/img/company_03.png", new BMap.Size(48, 48));
+            var mark3 = new BMap.Marker(new BMap.Point(device3[i].longitude, device3[i].latitude), {icon: icon3});
+            map.addOverlay(mark3);
+        }
+    }
+
+
+    //������������������������
+    map.addControl(new BMap.MapTypeControl({
+        mapTypes: [
+            BMAP_NORMAL_MAP,
+            BMAP_HYBRID_MAP
+        ]
+    }));
+</script>
+
diff --git a/src/main/webapp/view/purityMap.jsp b/src/main/webapp/view/purityMap.jsp
new file mode 100644
index 0000000..4276a75
--- /dev/null
+++ b/src/main/webapp/view/purityMap.jsp
@@ -0,0 +1,119 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@page isELIgnored="false" %>
+
+<!DOCTYPE html>
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+    <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
+    <style type="text/css">
+        body, html, #allmap {
+            width: 100%;
+            height: 100%;
+            overflow: hidden;
+            margin: 0;
+            font-family: "������������";
+        }
+        #box {
+            width:300px;
+            height:500px;
+            top:80px;
+            right:30px;
+            position:absolute;
+            z-index:1;
+            border:2px solid red;
+            background-color:gainsboro;
+            opacity: 0.8;
+        }
+    </style>
+    <script type="text/javascript"
+            src="http://api.map.baidu.com/api?v=2.0&ak=rER1sgBIcQxkfNSlm2wmBGZGgEERrooM"></script>
+    <script type="text/javascript" src="/js/jquery.min.js"></script>
+    <script type="text/javascript" src="/js/utils.js"></script>
+    <script type="text/javascript">
+        if (typeof (JSON) == 'undefined') {
+            $.getScript("js/json2.js");
+        }
+    </script>
+    <script type="text/javascript" src="/js/paging.js"></script>
+    <title>������������</title>
+</head>
+<body>
+<div id="allmap" style="z-index: 0" ;>
+</div>
+<div id="box">
+    <p>
+       <img src="/img/company_01.png" style="width: 30px;height: 30px;margin-left: 15px;"/> <span style="position: relative;top: -9px;">&nbsp;&nbsp;--->������</span>
+    </p>
+    <p>
+        <img src="/img/company_02.png" style="width: 30px;height: 30px;margin-left: 15px;"/> <span style="position: relative;top: -9px;">&nbsp;&nbsp;--->������</span>
+    </p>
+    <p>
+        <img src="/img/company_03.png" style="width: 30px;height: 30px;margin-left: 15px;"/> <span style="position: relative;top: -9px;">&nbsp;&nbsp;--->������</span>
+        <br/>
+        <br/>
+    </p>
+    <div id="purify">
+    </div>
+    <p style="margin-left: 22px;margin-top: 130px; color: red;font-size: 14px"><--������������������������������������������90%--></p>
+</div>
+<div id="mapParams" style="display: none;">
+    ${requestScope.mapParams}
+</div>
+</body>
+
+</html>
+<script type="text/javascript">
+    // ������������API������
+    var map = new BMap.Map("allmap");    // ������Map������
+    map.enableScrollWheelZoom(true);     //������������������������
+    var params = $.parseJSON($("#mapParams").html());
+    var longitude = params["longitude"];
+    var latitude = params["latitude"];
+    map.centerAndZoom(new BMap.Point(longitude, latitude), 17);  // ���������������,������������������������������������
+             // ���������������������������
+
+    $("#purify").append("<p style='margin-left: 15px;'>������������" + params["purificationRate"] + "</p>");
+   /* var infoWindow = new BMap.InfoWindow("<p style='font-size:14px;'>" + text + "</p>");
+    mark4.addEventListener("click", function () {
+        this.openInfoWindow(infoWindow);
+    });*/
+
+    var device1 = params["device1"];
+    if (device1 != null) {
+        for (var i = 0; i < device1.length; i++) {
+            var icon1 = new BMap.Icon("/img/company_01.png", new BMap.Size(48, 48));
+            var mark1 = new BMap.Marker(new BMap.Point(device1[i].longitude, device1[i].latitude), {icon: icon1});
+            map.addOverlay(mark1);
+        }
+    }
+
+    var device2 = params["device2"];
+    if (device2 != null) {
+        for (var i = 0; i < device2.length; i++) {
+            var icon2 = new BMap.Icon("/img/company_02.png", new BMap.Size(48, 48));
+            var mark2 = new BMap.Marker(new BMap.Point(device2[i].longitude, device2[i].latitude), {icon: icon2});
+            map.addOverlay(mark2);
+        }
+    }
+
+    var device3 = params["device3"];
+    if (device3 != null) {
+        for (var i = 0; i < device3.length; i++) {
+            var icon3 = new BMap.Icon("/img/company_03.png", new BMap.Size(48, 48));
+            var mark3 = new BMap.Marker(new BMap.Point(device3[i].longitude, device3[i].latitude), {icon: icon3});
+            map.addOverlay(mark3);
+        }
+    }
+
+
+    //������������������������
+    map.addControl(new BMap.MapTypeControl({
+        mapTypes: [
+            BMAP_NORMAL_MAP,
+            BMAP_HYBRID_MAP
+        ]
+    }));
+</script>
+
diff --git a/src/main/webapp/view/unorganizedMap.jsp b/src/main/webapp/view/unorganizedMap.jsp
new file mode 100644
index 0000000..f74b10e
--- /dev/null
+++ b/src/main/webapp/view/unorganizedMap.jsp
@@ -0,0 +1,243 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@page isELIgnored="false" %>
+
+<!DOCTYPE html>
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+    <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
+    <style type="text/css">
+        body, html, #allmap {
+            width: 100%;
+            height: 100%;
+            overflow: hidden;
+            margin: 0;
+            font-family: "������������";
+        }
+        #box {
+            width:300px;
+            height:100px;
+            top:80px;
+            left:30px;
+            position:absolute;
+            z-index:1;
+            border:0px solid red;
+            background-color:#f5f3f0;
+            opacity: 0.8;
+        }
+        #cpm {
+            width: 300px;
+            height: 100px;
+            position: absolute;
+            background-color: #ffffff;
+            display: none;
+            left: 50%;
+            top: 50%;
+            margin-left: -150px;
+            margin-top: -50px;
+            z-index: 11;
+            color: #000000;
+            border: 2px solid #FF7F50;
+            font-size: 14px;
+            line-height: 100px;
+            text-align: center;
+        }
+    </style>
+    <script type="text/javascript"
+            src="http://api.map.baidu.com/api?v=2.0&ak=rER1sgBIcQxkfNSlm2wmBGZGgEERrooM"></script>
+    <script type="text/javascript" src="/js/jquery.min.js"></script>
+    <script type="text/javascript" src="/js/utils.js"></script>
+    <script type="text/javascript">
+        if (typeof (JSON) == 'undefined') {
+            $.getScript("js/json2.js");
+        }
+    </script>
+    <script type="text/javascript" src="/js/paging.js"></script>
+    <title>������������</title>
+</head>
+<body>
+<div id="cpm">������������������������������������������������������</div>
+<div id="allmap" style="z-index: 0" ;>
+</div>
+<div id="box">
+    <p style="text-indent: 2em;line-height: 25px;color: red">������������������������������������������������������������������������������������������������������������</p>
+</div>
+<div id="mapParams" style="display: none;">
+    ${requestScope.params}
+</div>
+</body>
+
+</html>
+<script type="text/javascript">
+    // ������������API������
+    var map = new BMap.Map("allmap",{minZoom:14,maxZoom:19});    // ������Map������
+    map.enableScrollWheelZoom(true);     //������������������������
+    var params = $.parseJSON($("#mapParams").html());
+    var longitude = params["longitudeCompany"];
+    var latitude = params["latitudeCompany"];
+    var point=new BMap.Point(longitude, latitude);
+    map.centerAndZoom(point, 18.5);  // ���������������,������������������������������������
+    var device1 = params["deviceList"];
+    var preAngleDeviceString = params["preAngleDeviceString"];
+    var wind = params["wind"];
+    var devices=[];
+    var locationList=params["locationList"];
+
+    var color;
+    if (preAngleDeviceString!=""){
+        var preAngleDeviceList=JSON.parse(preAngleDeviceString);
+        var diff=preAngleDeviceList[0].sensor-preAngleDeviceList[1].sensor;
+        if (diff>0){
+            var polyline = new BMap.Polyline([
+                new BMap.Point(preAngleDeviceList[0].longitude, preAngleDeviceList[0].latitude),
+                new BMap.Point(locationList[0][0],locationList[0][1])
+            ], {strokeColor:"red", strokeWeight:8, strokeOpacity:0.5});   //������������
+            map.addOverlay(polyline);   //������������
+            var polyline1 = new BMap.Polyline([
+                new BMap.Point(locationList[0][0],locationList[0][1]),
+                new BMap.Point(locationList[1][0],locationList[1][1])
+            ], {strokeColor:"Tomato", strokeWeight:8, strokeOpacity:0.5});   //������������
+            map.addOverlay(polyline1);   //������������
+            var polyline2 = new BMap.Polyline([
+                new BMap.Point(locationList[1][0],locationList[1][1]),
+                new BMap.Point(locationList[2][0],locationList[2 ][1])
+            ], {strokeColor:"Coral", strokeWeight:8, strokeOpacity:0.5});   //������������
+            map.addOverlay(polyline2);   //������������
+            var polyline3 = new BMap.Polyline([
+                new BMap.Point(locationList[2][0],locationList[2][1]),
+                new BMap.Point(locationList[3][0],locationList[3][1])
+            ], {strokeColor:"Orange", strokeWeight:8, strokeOpacity:0.5});   //������������
+            map.addOverlay(polyline3);   //������������
+            var polyline4 = new BMap.Polyline([
+                new BMap.Point(locationList[3][0],locationList[3][1]),
+                new BMap.Point(preAngleDeviceList[1].longitude, preAngleDeviceList[1].latitude)
+            ], {strokeColor:"Gold", strokeWeight:8, strokeOpacity:0.5});   //������������
+            map.addOverlay(polyline4);   //������������
+            var arrowLineList = new Array();//������������������������
+            color="Gold";
+            arrowLineList[arrowLineList.length] = addArrow(polyline4,30,Math.PI/7,color);//������������������������
+        } else {
+            var polyline = new BMap.Polyline([
+                new BMap.Point(preAngleDeviceList[0].longitude, preAngleDeviceList[0].latitude),
+                new BMap.Point(locationList[0][0],locationList[0][1])
+            ], {strokeColor:"Gold", strokeWeight:8, strokeOpacity:0.5});   //������������
+            map.addOverlay(polyline);   //������������
+            var polyline1 = new BMap.Polyline([
+                new BMap.Point(locationList[0][0],locationList[0][1]),
+                new BMap.Point(locationList[1][0],locationList[1][1])
+            ], {strokeColor:"Orange", strokeWeight:8, strokeOpacity:0.5});   //������������
+            map.addOverlay(polyline1);   //������������
+            var polyline2 = new BMap.Polyline([
+                new BMap.Point(locationList[1][0],locationList[1][1]),
+                new BMap.Point(locationList[2][0],locationList[2 ][1])
+            ], {strokeColor:"Coral", strokeWeight:8, strokeOpacity:0.5});   //������������
+            map.addOverlay(polyline2);   //������������
+            var polyline3 = new BMap.Polyline([
+                new BMap.Point(locationList[2][0],locationList[2][1]),
+                new BMap.Point(locationList[3][0],locationList[3][1])
+            ], {strokeColor:"Tomato", strokeWeight:8, strokeOpacity:0.5});   //������������
+            map.addOverlay(polyline3);   //������������
+            var polyline4 = new BMap.Polyline([
+                new BMap.Point(locationList[3][0],locationList[3][1]),
+                new BMap.Point(preAngleDeviceList[1].longitude, preAngleDeviceList[1].latitude)
+            ], {strokeColor:"red", strokeWeight:8, strokeOpacity:0.5});   //������������
+            map.addOverlay(polyline4);   //������������
+            var arrowLineList = new Array();//������������������������
+            color="red";
+            arrowLineList[arrowLineList.length] = addArrow(polyline4,28,Math.PI/7,color);//������������������������
+        }
+    }else {
+        document.getElementById("cpm").style.display = 'block';
+    }
+
+    if (device1 != null) {
+        for (var i = 0; i < device1.length; i++) {
+            var icon1 = new BMap.Icon("/img/ico_co00.png", new BMap.Size(48, 48));
+            var mark1 = new BMap.Marker(new BMap.Point(device1[i].longitude, device1[i].latitude), {icon: icon1});
+            devices.push( new BMap.Point(device1[i].longitude, device1[i].latitude));
+            map.addOverlay(mark1);
+        }
+    }
+       /* var polygon = new BMap.Polygon(devices, {strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5});  //���������������
+        map.addOverlay(polygon);   //���������������*/
+
+
+
+
+
+
+    //������������������������
+    map.addControl(new BMap.MapTypeControl({
+        mapTypes: [
+            BMAP_NORMAL_MAP,
+            BMAP_HYBRID_MAP
+        ]
+    }));
+
+
+
+    //arrowLineList[arrowLineList.length] = addArrow(polyline,18,Math.PI/7);//������������������������
+    function addArrow(polyline,length,angleValue,color){ //���������������������
+        var linePoint=polyline.getPath();//���������������
+        var arrowCount=linePoint.length;
+        for(var i =1;i<arrowCount;i++){ //������������������������
+            var pixelStart=map.pointToPixel(linePoint[i-1]);
+            var pixelEnd=map.pointToPixel(linePoint[i]);
+            var angle=angleValue;//������������������������
+            var r=length; // r/Math.sin(angle)������������������
+            var delta=0; //���������������������������������
+            var param=0; //������������������
+            var pixelTemX,pixelTemY;//���������������
+            var pixelX,pixelY,pixelX1,pixelY1;//���������������
+            if(pixelEnd.x-pixelStart.x==0){ //���������������������
+                pixelTemX=pixelEnd.x;
+                if(pixelEnd.y>pixelStart.y)
+                {
+                    pixelTemY=pixelEnd.y-r;
+                }
+                else
+                {
+                    pixelTemY=pixelEnd.y+r;
+                }
+                //���������������������������������������������������������������������������������������
+                pixelX=pixelTemX-r*Math.tan(angle);
+                pixelX1=pixelTemX+r*Math.tan(angle);
+                pixelY=pixelY1=pixelTemY;
+            }
+            else  //���������������
+            {
+                delta=(pixelEnd.y-pixelStart.y)/(pixelEnd.x-pixelStart.x);
+                param=Math.sqrt(delta*delta+1);
+
+                if((pixelEnd.x-pixelStart.x)<0) //������������������
+                {
+                    pixelTemX=pixelEnd.x+ r/param;
+                    pixelTemY=pixelEnd.y+delta*r/param;
+                }
+                else//������������������
+                {
+                    pixelTemX=pixelEnd.x- r/param;
+                    pixelTemY=pixelEnd.y-delta*r/param;
+                }
+                //���������������������������������������������������������������������������������������
+                pixelX=pixelTemX+ Math.tan(angle)*r*delta/param;
+                pixelY=pixelTemY-Math.tan(angle)*r/param;
+
+                pixelX1=pixelTemX- Math.tan(angle)*r*delta/param;
+                pixelY1=pixelTemY+Math.tan(angle)*r/param;
+            }
+
+            var pointArrow=map.pixelToPoint(new BMap.Pixel(pixelX,pixelY));
+            var pointArrow1=map.pixelToPoint(new BMap.Pixel(pixelX1,pixelY1));
+            var Arrow = new BMap.Polyline([
+                pointArrow,
+                linePoint[i],
+                pointArrow1
+            ], {strokeColor: color, strokeWeight: 6, strokeOpacity: 0.5});
+            map.addOverlay(Arrow);
+            return Arrow;
+        }
+    }
+</script>
+

--
Gitblit v1.8.0