From 95345122239a82f6d10c2e5558cd5cc1644f474b Mon Sep 17 00:00:00 2001
From: zhangnaisong <2434969829@qq.com>
Date: 星期日, 28 四月 2024 19:00:26 +0800
Subject: [PATCH] 视频标签数据类型修改提交

---
 ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java | 1011 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 968 insertions(+), 43 deletions(-)

diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
index f28238b..e191920 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
@@ -1,15 +1,23 @@
 package com.ruoyi.alarmpoints.well.service.impl;
 
+import java.awt.geom.Point2D;
+import java.math.BigDecimal;
+import java.sql.*;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
-import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
-import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellParam;
+import com.ruoyi.alarmpoints.well.domain.*;
 import com.ruoyi.alarmpoints.well.mapper.ArdAlarmpointsWellMapper;
+import com.ruoyi.alarmpoints.well.mapper.ArdWellGuideCameraMapper;
 import com.ruoyi.alarmpoints.well.service.IArdAlarmpointsWellService;
 import com.ruoyi.common.annotation.DataScope;
+import com.ruoyi.common.core.domain.entity.SysConfig;
+import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.DateUtils;
@@ -18,6 +26,12 @@
 import com.ruoyi.common.utils.bean.BeanValidators;
 import com.ruoyi.common.utils.spring.SpringUtils;
 import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.device.camera.domain.ArdCameras;
+import com.ruoyi.device.camera.mapper.ArdCamerasMapper;
+import com.ruoyi.system.mapper.SysDeptMapper;
+import com.ruoyi.utils.data.Query;
+import com.ruoyi.utils.gis.GisUtil;
+import com.ruoyi.utils.gps.GeoTools;
 import lombok.ToString;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -39,8 +53,17 @@
     private static final Logger log = LoggerFactory.getLogger(ArdAlarmpointsWellServiceImpl.class);
     @Resource
     private ArdAlarmpointsWellMapper ardAlarmpointsWellMapper;
+    @Resource
+    private ArdWellGuideCameraMapper ardWellGuideCameraMapper;
+    @Resource
+    private ArdCamerasMapper ardCamerasMapper;
+
     @Autowired
     protected Validator validator;
+
+    @Resource
+    protected SysDeptMapper sysDeptMapper;
+
     /**
      * 鏌ヨ浜曠鐞�
      *
@@ -51,6 +74,7 @@
     public ArdAlarmpointsWell selectArdAlarmpointsWellById(String id) {
         return ardAlarmpointsWellMapper.selectArdAlarmpointsWellById(id);
     }
+
     /**
      * 鏌ヨ浜曠鐞�
      *
@@ -69,18 +93,17 @@
      * @return 浜曠鐞�
      */
     @Override
-    @DataScope(deptAlias = "d",userAlias = "u")
+    @DataScope(deptAlias = "d", userAlias = "u")
     public List<ArdAlarmpointsWell> selectArdAlarmpointsWellList(ArdAlarmpointsWell ardAlarmpointsWell) {
         return ardAlarmpointsWellMapper.selectArdAlarmpointsWellList(ardAlarmpointsWell);
     }
 
     /**
-     *
      * @param ardAlarmpointsWell 鎸変簳缂栧彿鏌ヨ
      * @return
      */
     @Override
-    @DataScope(deptAlias = "d",userAlias = "u")
+    @DataScope(deptAlias = "d", userAlias = "u")
     public List<ArdAlarmpointsWell> selectArdAlarmpointsWellByWellIdLike(ArdAlarmpointsWell ardAlarmpointsWell) {
         return ardAlarmpointsWellMapper.selectArdAlarmpointsWellByWellIdLike(ardAlarmpointsWell);
     }
@@ -95,8 +118,7 @@
     @Transactional
     public int insertArdAlarmpointsWell(ArdAlarmpointsWell ardAlarmpointsWell) {
         boolean wellIdExists = checkWellIdExists(ardAlarmpointsWell);
-        if(wellIdExists)
-        {
+        if (wellIdExists) {
             throw new RuntimeException("浜曞彿宸插瓨鍦�");
         }
         ardAlarmpointsWell.setId(IdUtils.simpleUUID());
@@ -116,13 +138,20 @@
     @Transactional
     public int updateArdAlarmpointsWell(ArdAlarmpointsWell ardAlarmpointsWell) {
         boolean wellIdExists = checkWellIdExists(ardAlarmpointsWell);
-        if(wellIdExists)
-        {
+        if (wellIdExists) {
             throw new RuntimeException("浜曞彿宸插瓨鍦�");
         }
         ardAlarmpointsWell.setUpdateBy(SecurityUtils.getUsername());
         ardAlarmpointsWell.setUpdateTime(DateUtils.getNowDate());
         return ardAlarmpointsWellMapper.updateArdAlarmpointsWell(ardAlarmpointsWell);
+    }
+
+    @Override
+    @Transactional
+    public int updateArdAlarmpointsWellByWellId(ArdAlarmpointsWell ardAlarmpointsWell) {
+        ardAlarmpointsWell.setUpdateBy(SecurityUtils.getUsername());
+        ardAlarmpointsWell.setUpdateTime(DateUtils.getNowDate());
+        return ardAlarmpointsWellMapper.updateArdAlarmpointsWellByWellId(ardAlarmpointsWell);
     }
 
     /**
@@ -148,7 +177,7 @@
     }
 
     @Override
-    public String importUser(List<ArdAlarmpointsWell> ardAlarmpointsWellList, Boolean isUpdateSupport, String operName) {
+    public String importWell(List<ArdAlarmpointsWell> ardAlarmpointsWellList, Boolean isUpdateSupport, String operName) {
         if (StringUtils.isNull(ardAlarmpointsWellList) || ardAlarmpointsWellList.size() == 0) {
             throw new ServiceException("瀵煎叆浜曟暟鎹笉鑳戒负绌猴紒");
         }
@@ -161,9 +190,9 @@
                 //鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛id
                 String userId = SecurityUtils.getUserId();
                 well.setUserId(userId);
-                // 楠岃瘉鏄惁瀛樺湪杩欎釜鐢ㄦ埛
-                ArdAlarmpointsWell u = ardAlarmpointsWellMapper.selectArdAlarmpointsWellByWellId(well.getWellId());
-                if (StringUtils.isNull(u)) {
+                // 楠岃瘉鏄惁瀛樺湪杩欎釜浜�
+                ArdAlarmpointsWell w = ardAlarmpointsWellMapper.selectArdAlarmpointsWellByWellId(well.getWellId());
+                if (StringUtils.isNull(w)) {
                     BeanValidators.validateWithException(validator, well);
                     well.setCreateBy(operName);
                     this.insertArdAlarmpointsWell(well);
@@ -171,10 +200,9 @@
                     successMsg.append("<br/>" + successNum + "銆佷簳鍙� " + well.getWellId() + " 瀵煎叆鎴愬姛");
                 } else if (isUpdateSupport) {
                     BeanValidators.validateWithException(validator, well);
-                    checkWellAllowed(well);
                     checkWellDataScope(well.getUserId());
                     well.setUpdateBy(operName);
-                    this.updateArdAlarmpointsWell(well);
+                    this.updateArdAlarmpointsWellByWellId(well);
                     successNum++;
                     successMsg.append("<br/>" + successNum + "銆佷簳鍙� " + well.getWellId() + " 鏇存柊鎴愬姛");
                 } else {
@@ -203,10 +231,8 @@
      * @param well 浜曚俊鎭�
      */
     @Override
-    public void checkWellAllowed(ArdAlarmpointsWell well)
-    {
-        if (StringUtils.isNotNull(well.getId()))
-        {
+    public void checkWellAllowed(ArdAlarmpointsWell well) {
+        if (StringUtils.isNotNull(well.getId())) {
             throw new ServiceException("涓嶅厑璁告搷浣滀簳");
         }
     }
@@ -217,23 +243,21 @@
      * @param userId 鐢ㄦ埛id
      */
     @Override
-    public void checkWellDataScope(String userId)
-    {
-        if (!SysUser.isAdmin(SecurityUtils.getUserId()))
-        {
+    public void checkWellDataScope(String userId) {
+        if (!SysUser.isAdmin(SecurityUtils.getUserId())) {
             ArdAlarmpointsWell well = new ArdAlarmpointsWell();
             well.setUserId(userId);
             List<ArdAlarmpointsWell> wells = SpringUtils.getAopProxy(this).selectArdAlarmpointsWellList(well);
-            if (StringUtils.isEmpty(wells))
-            {
+            if (StringUtils.isEmpty(wells)) {
                 throw new ServiceException("娌℃湁鏉冮檺璁块棶浜曟暟鎹紒");
             }
         }
     }
+
     /**
      * 鏍稿浜曞彿鏄惁鍞竴
      *
-     * @param wellId 闇�瑕佹牳瀵圭殑浜曞彿
+     * @param well 闇�瑕佹牳瀵圭殑浜�
      * @return 缁撴灉
      */
     @Override
@@ -253,7 +277,7 @@
     @Override
     public List<ArdAlarmpointsWell> wellByDeptList(List<Long> deptList) {
         QueryWrapper<ArdAlarmpointsWell> queryWrapper = new QueryWrapper<>();
-        queryWrapper.in("dept_id",deptList);
+        queryWrapper.in("dept_id", deptList);
         return ardAlarmpointsWellMapper.selectList(queryWrapper);
     }
 
@@ -265,30 +289,931 @@
     @Override
     public List<ArdAlarmpointsWell> wellList(List<Long> deptList) {
         QueryWrapper<ArdAlarmpointsWell> queryWrapper = new QueryWrapper<>();
-        queryWrapper.select("id","well_id","oil_production","longitude","latitude","altitude").in("dept_id",deptList);
+        queryWrapper.select("id", "well_id", "oil_production", "longitude", "latitude", "altitude").in("dept_id", deptList);
         return ardAlarmpointsWellMapper.selectList(queryWrapper);
     }
 
     @Override
-    public PageInfo<ArdAlarmpointsWell> conditionList(ArdAlarmpointsWellParam ardAlarmpointsWellParam){
+    public PageInfo<ArdAlarmpointsWell> conditionList(ArdAlarmpointsWellParam ardAlarmpointsWellParam) {
         Integer pageNum = ardAlarmpointsWellParam.getPageNum();
         Integer pageSize = ardAlarmpointsWellParam.getPageSize();
-        PageHelper.startPage(pageNum,pageSize);
+        PageHelper.startPage(pageNum, pageSize);
         QueryWrapper<ArdAlarmpointsWell> queryWrapper = new QueryWrapper<>();
-        queryWrapper.in("dept_id",ardAlarmpointsWellParam.getDeptList())
-        .like(!StringUtils.isBlank(ardAlarmpointsWellParam.getWellId()),"well_id",ardAlarmpointsWellParam.getWellId());
-//        .eq(!StringUtils.isBlank(ardAlarmpointsWellParam.getWellNumber()),"well_number",ardAlarmpointsWellParam.getWellNumber())
-//        .eq(!StringUtils.isBlank(ardAlarmpointsWellParam.getOilProduction()),"oil_production",ardAlarmpointsWellParam.getOilProduction())
-//        .eq(!StringUtils.isBlank(ardAlarmpointsWellParam.getWellBlock()),"well_block",ardAlarmpointsWellParam.getWellBlock())
-//        .eq(!StringUtils.isBlank(ardAlarmpointsWellParam.getDisplacementMode()),"displacement_mode",ardAlarmpointsWellParam.getDisplacementMode())
-//        .eq(!StringUtils.isBlank(ardAlarmpointsWellParam.getSurroundingEnvironment()),"surrounding_environment",ardAlarmpointsWellParam.getSurroundingEnvironment())
-//        .eq(!StringUtils.isBlank(ardAlarmpointsWellParam.getWellType()),"well_type",ardAlarmpointsWellParam.getWellType())
-//        .eq(!StringUtils.isBlank(ardAlarmpointsWellParam.getInstalledLoad()),"installed_load",ardAlarmpointsWellParam.getInstalledLoad())
-//        .eq(!StringUtils.isBlank(ardAlarmpointsWellParam.getMeteringStation()),"metering_station",ardAlarmpointsWellParam.getMeteringStation())
-//        .eq(!StringUtils.isBlank(ardAlarmpointsWellParam.getTransferStation()),"transfer_station",ardAlarmpointsWellParam.getTransferStation())
-//        .eq(!StringUtils.isBlank(ardAlarmpointsWellParam.getDehydrationStation()),"dehydration_station",ardAlarmpointsWellParam.getDehydrationStation())
-//        .eq(!StringUtils.isBlank(ardAlarmpointsWellParam.getRunStatus()),"run_status",ardAlarmpointsWellParam.getRunStatus());
+        queryWrapper.select("id","altitude","metering_station","displacement_mode","latitude","dehydration_station",
+                "well_type","production_date","well_id","transfer_station","oil_production","run_status","longitude",
+                "installed_load","dept_id","user_id","surrounding_environment","well_number","well_block")
+                .like(!StringUtils.isBlank(ardAlarmpointsWellParam.getWellId()), "well_id", ardAlarmpointsWellParam.getWellId())
+                .in("dept_id", ardAlarmpointsWellParam.getDeptList());
         List<ArdAlarmpointsWell> list = ardAlarmpointsWellMapper.selectList(queryWrapper);
+//        List<ArdAlarmpointsWell> list = ardAlarmpointsWellMapper.conditionList(ardAlarmpointsWellParam.getWellId(),ardAlarmpointsWellParam.getDeptList());
         return new PageInfo<>(list);
     }
+
+    @Override
+    public List<ArdAlarmpointsWellDeptVo> wellListDept(List<Long> deptList) {
+        return ardAlarmpointsWellMapper.wellListDept(deptList);
+    }
+
+    @Override
+    public List<ArdAlarmpointsWell> getNearbyWellList(Double longitudeCenter, Double latitudeCenter, Long deptId, Integer range) {
+        List<ArdAlarmpointsWell> nearbyWellList = new ArrayList<>();
+        try {
+            if (longitudeCenter != null && latitudeCenter != null) {
+                ArdAlarmpointsWell ardAlarmpointsWell = new ArdAlarmpointsWell();
+                ardAlarmpointsWell.setDeptId(deptId);
+                List<ArdAlarmpointsWell> ardAlarmpointsWells = ardAlarmpointsWellMapper.selectArdAlarmpointsWellList(ardAlarmpointsWell);
+                if (ardAlarmpointsWells.size() > 0) {
+                    for (ArdAlarmpointsWell well : ardAlarmpointsWells) {
+                        Double longitude = well.getLongitude();
+                        Double latitude = well.getLatitude();
+                        if (longitude != null && latitude != null) {
+                            double distance = GisUtil.getDistance(new Double[]{longitudeCenter, latitudeCenter}, new Double[]{longitude, latitude});
+                            if (distance <= range) {
+                                nearbyWellList.add(well);
+                            }
+                        }
+                    }
+                }
+            }
+        } catch (Exception ex) {
+            log.error("鑾峰彇闄勮繎浜曞紓甯革細" + ex.getMessage());
+        }
+        return nearbyWellList;
+    }
+
+    @Override
+    public Map<String, Object> getWellDataByWellId(String wellId, List<SysConfig> config) {
+        ArdAlarmpointsWell ardAlarmpointsWell = ardAlarmpointsWellMapper.selectArdAlarmpointsWellByWellId(wellId);
+        Map<String, Object> result = new HashMap();
+        if (ardAlarmpointsWell.getWellId() != null) {
+            result.put("wellId", ardAlarmpointsWell.getWellId());
+        } else {
+            result.put("wellId", "");
+        }
+        if (ardAlarmpointsWell.getWellNumber() != null) {
+            result.put("wellNumber", ardAlarmpointsWell.getWellNumber());
+        } else {
+            result.put("wellNumber", "");
+        }
+        if (ardAlarmpointsWell.getOilProduction() != null) {
+            result.put("oilProduction", ardAlarmpointsWell.getOilProduction());
+        } else {
+            result.put("oilProduction", "");
+        }
+        if (ardAlarmpointsWell.getWellBlock() != null) {
+            result.put("wellBlock", ardAlarmpointsWell.getWellBlock());
+        } else {
+            result.put("wellBlock", "");
+        }
+        if (ardAlarmpointsWell.getProductionDate() != null) {
+            result.put("productionDate", ardAlarmpointsWell.getProductionDate());
+        } else {
+            result.put("productionDate", "");
+        }
+        if (ardAlarmpointsWell.getDisplacementMode() != null) {
+            result.put("displacementMode", ardAlarmpointsWell.getDisplacementMode());
+        } else {
+            result.put("displacementMode", "");
+        }
+        if (ardAlarmpointsWell.getSurroundingEnvironment() != null) {
+            result.put("surroundingEnvironment", ardAlarmpointsWell.getSurroundingEnvironment());
+        } else {
+            result.put("surroundingEnvironment", "");
+        }
+        if (ardAlarmpointsWell.getWellType() != null) {
+            result.put("wellType", ardAlarmpointsWell.getWellType());
+        } else {
+            result.put("wellType", "");
+        }
+        if (ardAlarmpointsWell.getInstalledLoad() != null) {
+            result.put("installedLoad", ardAlarmpointsWell.getInstalledLoad());
+        } else {
+            result.put("installedLoad", "");
+        }
+        if (ardAlarmpointsWell.getMeteringStation() != null) {
+            result.put("meteringStation", ardAlarmpointsWell.getMeteringStation());
+        } else {
+            result.put("meteringStation", "");
+        }
+        if (ardAlarmpointsWell.getTransferStation() != null) {
+            result.put("transferStation", ardAlarmpointsWell.getTransferStation());
+        } else {
+            result.put("transferStation", "");
+        }
+        if (ardAlarmpointsWell.getDehydrationStation() != null) {
+            result.put("dehydrationStation", ardAlarmpointsWell.getDehydrationStation());
+        } else {
+            result.put("dehydrationStation", "");
+        }
+        if (ardAlarmpointsWell.getRunStatus() != null) {
+            result.put("runStatus", ardAlarmpointsWell.getRunStatus());
+        } else {
+            result.put("runStatus", "");
+        }
+        if (ardAlarmpointsWell.getLongitude() != null) {
+            result.put("longitude", ardAlarmpointsWell.getLongitude());
+        } else {
+            result.put("longitude", "");
+        }
+        if (ardAlarmpointsWell.getLatitude() != null) {
+            result.put("latitude", ardAlarmpointsWell.getLatitude());
+        } else {
+            result.put("latitude", "");
+        }
+        if (ardAlarmpointsWell.getAltitude() != null) {
+            result.put("altitude", ardAlarmpointsWell.getAltitude());
+        } else {
+            result.put("altitude", "");
+        }
+        if (ardAlarmpointsWell.getUserId() != null) {
+            result.put("userId", ardAlarmpointsWell.getUserId());
+        } else {
+            result.put("userId", "");
+        }
+        if (ardAlarmpointsWell.getDeptId() != null) {
+            result.put("deptId", ardAlarmpointsWell.getDeptId());
+            SysDept sysDept = sysDeptMapper.selectDeptById(ardAlarmpointsWell.getDeptId());//鏌ヨ鍏磋叮鐐规墍鍦ㄩ儴闂�
+            if (sysDept != null) {
+                result.put("deptName", sysDept.getDeptName());
+            } else {
+                result.put("deptName", "");
+            }
+        } else {
+            result.put("deptId", "");
+            result.put("deptName", "");
+        }
+        if (ardAlarmpointsWell.getCreateBy() != null) {
+            result.put("createBy", ardAlarmpointsWell.getCreateBy());
+        } else {
+            result.put("createBy", "");
+        }
+        if (ardAlarmpointsWell.getCreateTime() != null) {
+            result.put("createTime", ardAlarmpointsWell.getCreateTime());
+        } else {
+            result.put("createTime", "");
+        }
+        if (ardAlarmpointsWell.getUpdateBy() != null) {
+            result.put("updateBy", ardAlarmpointsWell.getUpdateBy());
+        } else {
+            result.put("updateBy", "");
+        }
+        if (ardAlarmpointsWell.getUpdateTime() != null) {
+            result.put("updateTime", ardAlarmpointsWell.getUpdateTime());
+        } else {
+            result.put("updateTime", "");
+        }
+        if (config.size() != 0) {
+            String oracle = config.get(0).getConfigValue();
+            String[] oracleArr = oracle.split(";");
+            if (oracleArr.length == 3) {
+                String url = oracle.split(";")[0];
+                String username = oracle.split(";")[1];
+                String password = oracle.split(";")[2];
+                try {
+                    int checkMark = checkTable(url, username, password, "\'RTU_DATA_YJ_8\'");//涓夊巶琛ㄥ瓨鍦�
+                    if (checkMark == 1) {
+                        Map<String, Object> resultRTU = getRtuDataYjByJH(url, username, password, "RTU_DATA_YJ_8", "\'" + wellId + "\'");
+                        result.putAll(resultRTU);
+                    } else {
+                        result.put("wellRunningState", "n");//娌逛簳杩愯鐘舵��
+                        result.put("totalPowerConsumption", "n");//鎬昏�楃數閲�
+                        result.put("communicationMachine", "n");//璁惧閫氳
+                        result.put("remark", "n");//澶囨敞
+                        result.put("singleWellWaterTemperature", "n");//鍗曚簳鎺烘按娓╁害//
+                        result.put("meteringPlantWaterPressure", "n");//璁¢噺闂存幒姘村帇鍔�//
+                        result.put("torque", "n");//鎵煩
+                        result.put("MAT", "n");//鍥炴补娓╁害
+                        result.put("TGP", "n");//浜曞彛娌瑰帇
+                        result.put("CPV", "n");//浜曞彛濂楀帇
+                        result.put("ADL", "n");//A鐩哥數娴�
+                        result.put("ADY", "n");//A鐩哥數鍘�
+                        result.put("BDL", "n");//B鐩哥數娴�
+                        result.put("BDY", "n");//B鐩哥數鍘�
+                        result.put("CDL", "n");//C鐩哥數娴�
+                        result.put("CDY", "n");//C鐩哥數鍘�
+                        result.put("UCV", "n");//涓婅鐢垫祦
+                        result.put("DCV", "n");//涓嬭鐢垫祦
+                        result.put("SLV", "n");//鍐茬▼
+                        result.put("CHC", "n");//鍐叉
+                        result.put("BPV", "n");//浜曞彛鍥炲帇
+                        result.put("ZWG", "n");//鎬绘棤鍔熷姛鐜�
+                        result.put("ZYG", "n");//鎬绘湁鍔熷姛鐜�
+                        result.put("GYS", "n");//鍔熺巼鍥犳暟
+                        result.put("UWL", "n");//鏈�澶ц浇鑽�
+                        result.put("DWL", "n");//鏈�灏忚浇鑽�
+                        result.put("ZHS", "n");//杞��
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            } else if (oracleArr.length == 4) {
+                String url = oracle.split(";")[0];
+                String username = oracle.split(";")[1];
+                String password = oracle.split(";")[2];
+                String prod = oracle.split(";")[3];
+                try {
+                    //int checkMark = checkTable(url,username,password,"\'RTU_DATA_YJ_8\'");//涓夊巶琛ㄥ瓨鍦�
+                    int checkMark = checkTable(url, username, password, "\'" + prod + ".RTU_DATA_YJ_8\'");//涓夊巶琛ㄥ瓨鍦�
+                    if (checkMark == 1) {
+                        Map<String, Object> resultRTU = getRtuDataYjByJH(url, username, password, prod + ".RTU_DATA_YJ_8", "\'" + wellId + "\'");
+                        result.putAll(resultRTU);
+                    } else {
+                        result.put("wellRunningState", "n");//娌逛簳杩愯鐘舵��
+                        result.put("totalPowerConsumption", "n");//鎬昏�楃數閲�
+                        result.put("communicationMachine", "n");//璁惧閫氳
+                        result.put("remark", "n");//澶囨敞
+                        result.put("singleWellWaterTemperature", "n");//鍗曚簳鎺烘按娓╁害//
+                        result.put("meteringPlantWaterPressure", "n");//璁¢噺闂存幒姘村帇鍔�//
+                        result.put("torque", "n");//鎵煩
+                        result.put("MAT", "n");//鍥炴补娓╁害
+                        result.put("TGP", "n");//浜曞彛娌瑰帇
+                        result.put("CPV", "n");//浜曞彛濂楀帇
+                        result.put("ADL", "n");//A鐩哥數娴�
+                        result.put("ADY", "n");//A鐩哥數鍘�
+                        result.put("BDL", "n");//B鐩哥數娴�
+                        result.put("BDY", "n");//B鐩哥數鍘�
+                        result.put("CDL", "n");//C鐩哥數娴�
+                        result.put("CDY", "n");//C鐩哥數鍘�
+                        result.put("UCV", "n");//涓婅鐢垫祦
+                        result.put("DCV", "n");//涓嬭鐢垫祦
+                        result.put("SLV", "n");//鍐茬▼
+                        result.put("CHC", "n");//鍐叉
+                        result.put("BPV", "n");//浜曞彛鍥炲帇
+                        result.put("ZWG", "n");//鎬绘棤鍔熷姛鐜�
+                        result.put("ZYG", "n");//鎬绘湁鍔熷姛鐜�
+                        result.put("GYS", "n");//鍔熺巼鍥犳暟
+                        result.put("UWL", "n");//鏈�澶ц浇鑽�
+                        result.put("DWL", "n");//鏈�灏忚浇鑽�
+                        result.put("ZHS", "n");//杞��
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        } else {
+            result.put("wellRunningState", "n");//娌逛簳杩愯鐘舵��
+            result.put("totalPowerConsumption", "n");//鎬昏�楃數閲�
+            result.put("communicationMachine", "n");//璁惧閫氳
+            result.put("remark", "n");//澶囨敞
+            result.put("singleWellWaterTemperature", "n");//鍗曚簳鎺烘按娓╁害//
+            result.put("meteringPlantWaterPressure", "n");//璁¢噺闂存幒姘村帇鍔�//
+            result.put("torque", "n");//鎵煩
+            result.put("MAT", "n");//鍥炴补娓╁害
+            result.put("TGP", "n");//浜曞彛娌瑰帇
+            result.put("CPV", "n");//浜曞彛濂楀帇
+            result.put("ADL", "n");//A鐩哥數娴�
+            result.put("ADY", "n");//A鐩哥數鍘�
+            result.put("BDL", "n");//B鐩哥數娴�
+            result.put("BDY", "n");//B鐩哥數鍘�
+            result.put("CDL", "n");//C鐩哥數娴�
+            result.put("CDY", "n");//C鐩哥數鍘�
+            result.put("UCV", "n");//涓婅鐢垫祦
+            result.put("DCV", "n");//涓嬭鐢垫祦
+            result.put("SLV", "n");//鍐茬▼
+            result.put("CHC", "n");//鍐叉
+            result.put("BPV", "n");//浜曞彛鍥炲帇
+            result.put("ZWG", "n");//鎬绘棤鍔熷姛鐜�
+            result.put("ZYG", "n");//鎬绘湁鍔熷姛鐜�
+            result.put("GYS", "n");//鍔熺巼鍥犳暟
+            result.put("UWL", "n");//鏈�澶ц浇鑽�
+            result.put("DWL", "n");//鏈�灏忚浇鑽�
+            result.put("ZHS", "n");//杞��
+        }
+        return result;
+    }
+
+    @Override
+    public Map<String, Object> getWellDataByPatrolplanIdAndPosition(Map<String, Object> para, List<SysConfig> config) {
+        String patrolplanId = (String) para.get("patrolplanId");
+        Double longitude = null;
+        Double latitude = null;
+        try{
+            longitude = (Double) para.get("longitude");
+            latitude = (Double) para.get("latitude");
+        } catch (Exception e){
+            longitude = ((BigDecimal) para.get("longitude")).doubleValue();
+            latitude = ((BigDecimal) para.get("latitude")).doubleValue();
+        }
+        ArdAlarmpointsWell ardAlarmpointsWell = ardAlarmpointsWellMapper.getWellDataByPatrolplanIdAndPosition(patrolplanId,longitude,latitude);
+        if(ardAlarmpointsWell != null){
+            Map<String, Object> result = new HashMap();
+            if (ardAlarmpointsWell.getWellId() != null) {
+                result.put("wellId", ardAlarmpointsWell.getWellId());
+            } else {
+                result.put("wellId", "");
+            }
+            if (ardAlarmpointsWell.getWellNumber() != null) {
+                result.put("wellNumber", ardAlarmpointsWell.getWellNumber());
+            } else {
+                result.put("wellNumber", "");
+            }
+            if (ardAlarmpointsWell.getOilProduction() != null) {
+                result.put("oilProduction", ardAlarmpointsWell.getOilProduction());
+            } else {
+                result.put("oilProduction", "");
+            }
+            if (ardAlarmpointsWell.getWellBlock() != null) {
+                result.put("wellBlock", ardAlarmpointsWell.getWellBlock());
+            } else {
+                result.put("wellBlock", "");
+            }
+            if (ardAlarmpointsWell.getProductionDate() != null) {
+                result.put("productionDate", ardAlarmpointsWell.getProductionDate());
+            } else {
+                result.put("productionDate", "");
+            }
+            if (ardAlarmpointsWell.getDisplacementMode() != null) {
+                result.put("displacementMode", ardAlarmpointsWell.getDisplacementMode());
+            } else {
+                result.put("displacementMode", "");
+            }
+            if (ardAlarmpointsWell.getSurroundingEnvironment() != null) {
+                result.put("surroundingEnvironment", ardAlarmpointsWell.getSurroundingEnvironment());
+            } else {
+                result.put("surroundingEnvironment", "");
+            }
+            if (ardAlarmpointsWell.getWellType() != null) {
+                result.put("wellType", ardAlarmpointsWell.getWellType());
+            } else {
+                result.put("wellType", "");
+            }
+            if (ardAlarmpointsWell.getInstalledLoad() != null) {
+                result.put("installedLoad", ardAlarmpointsWell.getInstalledLoad());
+            } else {
+                result.put("installedLoad", "");
+            }
+            if (ardAlarmpointsWell.getMeteringStation() != null) {
+                result.put("meteringStation", ardAlarmpointsWell.getMeteringStation());
+            } else {
+                result.put("meteringStation", "");
+            }
+            if (ardAlarmpointsWell.getTransferStation() != null) {
+                result.put("transferStation", ardAlarmpointsWell.getTransferStation());
+            } else {
+                result.put("transferStation", "");
+            }
+            if (ardAlarmpointsWell.getDehydrationStation() != null) {
+                result.put("dehydrationStation", ardAlarmpointsWell.getDehydrationStation());
+            } else {
+                result.put("dehydrationStation", "");
+            }
+            if (ardAlarmpointsWell.getRunStatus() != null) {
+                result.put("runStatus", ardAlarmpointsWell.getRunStatus());
+            } else {
+                result.put("runStatus", "");
+            }
+            if (ardAlarmpointsWell.getLongitude() != null) {
+                result.put("longitude", ardAlarmpointsWell.getLongitude());
+            } else {
+                result.put("longitude", "");
+            }
+            if (ardAlarmpointsWell.getLatitude() != null) {
+                result.put("latitude", ardAlarmpointsWell.getLatitude());
+            } else {
+                result.put("latitude", "");
+            }
+            if (ardAlarmpointsWell.getAltitude() != null) {
+                result.put("altitude", ardAlarmpointsWell.getAltitude());
+            } else {
+                result.put("altitude", "");
+            }
+            if (ardAlarmpointsWell.getUserId() != null) {
+                result.put("userId", ardAlarmpointsWell.getUserId());
+            } else {
+                result.put("userId", "");
+            }
+            if (ardAlarmpointsWell.getDeptId() != null) {
+                result.put("deptId", ardAlarmpointsWell.getDeptId());
+                SysDept sysDept = sysDeptMapper.selectDeptById(ardAlarmpointsWell.getDeptId());//鏌ヨ鍏磋叮鐐规墍鍦ㄩ儴闂�
+                if (sysDept != null) {
+                    result.put("deptName", sysDept.getDeptName());
+                } else {
+                    result.put("deptName", "");
+                }
+            } else {
+                result.put("deptId", "");
+                result.put("deptName", "");
+            }
+            if (ardAlarmpointsWell.getCreateBy() != null) {
+                result.put("createBy", ardAlarmpointsWell.getCreateBy());
+            } else {
+                result.put("createBy", "");
+            }
+            if (ardAlarmpointsWell.getCreateTime() != null) {
+                result.put("createTime", ardAlarmpointsWell.getCreateTime());
+            } else {
+                result.put("createTime", "");
+            }
+            if (ardAlarmpointsWell.getUpdateBy() != null) {
+                result.put("updateBy", ardAlarmpointsWell.getUpdateBy());
+            } else {
+                result.put("updateBy", "");
+            }
+            if (ardAlarmpointsWell.getUpdateTime() != null) {
+                result.put("updateTime", ardAlarmpointsWell.getUpdateTime());
+            } else {
+                result.put("updateTime", "");
+            }
+            if (config.size() != 0) {
+                String oracle = config.get(0).getConfigValue();
+                String[] oracleArr = oracle.split(";");
+                if (oracleArr.length == 3) {
+                    String url = oracle.split(";")[0];
+                    String username = oracle.split(";")[1];
+                    String password = oracle.split(";")[2];
+                    try {
+                        int checkMark = checkTable(url, username, password, "\'RTU_DATA_YJ_8\'");//涓夊巶琛ㄥ瓨鍦�
+                        if (checkMark == 1) {
+                            Map<String, Object> resultRTU = getRtuDataYjByJH(url, username, password, "RTU_DATA_YJ_8", "\'" + ardAlarmpointsWell.getWellId() + "\'");
+                            result.putAll(resultRTU);
+                        } else {
+                            result.put("wellRunningState", "n");//娌逛簳杩愯鐘舵��
+                            result.put("totalPowerConsumption", "n");//鎬昏�楃數閲�
+                            result.put("communicationMachine", "n");//璁惧閫氳
+                            result.put("remark", "n");//澶囨敞
+                            result.put("singleWellWaterTemperature", "n");//鍗曚簳鎺烘按娓╁害//
+                            result.put("meteringPlantWaterPressure", "n");//璁¢噺闂存幒姘村帇鍔�//
+                            result.put("torque", "n");//鎵煩
+                            result.put("MAT", "n");//鍥炴补娓╁害
+                            result.put("TGP", "n");//浜曞彛娌瑰帇
+                            result.put("CPV", "n");//浜曞彛濂楀帇
+                            result.put("ADL", "n");//A鐩哥數娴�
+                            result.put("ADY", "n");//A鐩哥數鍘�
+                            result.put("BDL", "n");//B鐩哥數娴�
+                            result.put("BDY", "n");//B鐩哥數鍘�
+                            result.put("CDL", "n");//C鐩哥數娴�
+                            result.put("CDY", "n");//C鐩哥數鍘�
+                            result.put("UCV", "n");//涓婅鐢垫祦
+                            result.put("DCV", "n");//涓嬭鐢垫祦
+                            result.put("SLV", "n");//鍐茬▼
+                            result.put("CHC", "n");//鍐叉
+                            result.put("BPV", "n");//浜曞彛鍥炲帇
+                            result.put("ZWG", "n");//鎬绘棤鍔熷姛鐜�
+                            result.put("ZYG", "n");//鎬绘湁鍔熷姛鐜�
+                            result.put("GYS", "n");//鍔熺巼鍥犳暟
+                            result.put("UWL", "n");//鏈�澶ц浇鑽�
+                            result.put("DWL", "n");//鏈�灏忚浇鑽�
+                            result.put("ZHS", "n");//杞��
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                } else if (oracleArr.length == 4) {
+                    String url = oracle.split(";")[0];
+                    String username = oracle.split(";")[1];
+                    String password = oracle.split(";")[2];
+                    String prod = oracle.split(";")[3];
+                    try {
+                        //int checkMark = checkTable(url,username,password,"\'RTU_DATA_YJ_8\'");//涓夊巶琛ㄥ瓨鍦�
+                        int checkMark = checkTable(url, username, password, "\'" + prod + ".RTU_DATA_YJ_8\'");//涓夊巶琛ㄥ瓨鍦�
+                        if (checkMark == 1) {
+                            Map<String, Object> resultRTU = getRtuDataYjByJH(url, username, password, prod + ".RTU_DATA_YJ_8", "\'" + ardAlarmpointsWell.getWellId() + "\'");
+                            result.putAll(resultRTU);
+                        } else {
+                            result.put("wellRunningState", "n");//娌逛簳杩愯鐘舵��
+                            result.put("totalPowerConsumption", "n");//鎬昏�楃數閲�
+                            result.put("communicationMachine", "n");//璁惧閫氳
+                            result.put("remark", "n");//澶囨敞
+                            result.put("singleWellWaterTemperature", "n");//鍗曚簳鎺烘按娓╁害//
+                            result.put("meteringPlantWaterPressure", "n");//璁¢噺闂存幒姘村帇鍔�//
+                            result.put("torque", "n");//鎵煩
+                            result.put("MAT", "n");//鍥炴补娓╁害
+                            result.put("TGP", "n");//浜曞彛娌瑰帇
+                            result.put("CPV", "n");//浜曞彛濂楀帇
+                            result.put("ADL", "n");//A鐩哥數娴�
+                            result.put("ADY", "n");//A鐩哥數鍘�
+                            result.put("BDL", "n");//B鐩哥數娴�
+                            result.put("BDY", "n");//B鐩哥數鍘�
+                            result.put("CDL", "n");//C鐩哥數娴�
+                            result.put("CDY", "n");//C鐩哥數鍘�
+                            result.put("UCV", "n");//涓婅鐢垫祦
+                            result.put("DCV", "n");//涓嬭鐢垫祦
+                            result.put("SLV", "n");//鍐茬▼
+                            result.put("CHC", "n");//鍐叉
+                            result.put("BPV", "n");//浜曞彛鍥炲帇
+                            result.put("ZWG", "n");//鎬绘棤鍔熷姛鐜�
+                            result.put("ZYG", "n");//鎬绘湁鍔熷姛鐜�
+                            result.put("GYS", "n");//鍔熺巼鍥犳暟
+                            result.put("UWL", "n");//鏈�澶ц浇鑽�
+                            result.put("DWL", "n");//鏈�灏忚浇鑽�
+                            result.put("ZHS", "n");//杞��
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+            } else {
+                result.put("wellRunningState", "n");//娌逛簳杩愯鐘舵��
+                result.put("totalPowerConsumption", "n");//鎬昏�楃數閲�
+                result.put("communicationMachine", "n");//璁惧閫氳
+                result.put("remark", "n");//澶囨敞
+                result.put("singleWellWaterTemperature", "n");//鍗曚簳鎺烘按娓╁害//
+                result.put("meteringPlantWaterPressure", "n");//璁¢噺闂存幒姘村帇鍔�//
+                result.put("torque", "n");//鎵煩
+                result.put("MAT", "n");//鍥炴补娓╁害
+                result.put("TGP", "n");//浜曞彛娌瑰帇
+                result.put("CPV", "n");//浜曞彛濂楀帇
+                result.put("ADL", "n");//A鐩哥數娴�
+                result.put("ADY", "n");//A鐩哥數鍘�
+                result.put("BDL", "n");//B鐩哥數娴�
+                result.put("BDY", "n");//B鐩哥數鍘�
+                result.put("CDL", "n");//C鐩哥數娴�
+                result.put("CDY", "n");//C鐩哥數鍘�
+                result.put("UCV", "n");//涓婅鐢垫祦
+                result.put("DCV", "n");//涓嬭鐢垫祦
+                result.put("SLV", "n");//鍐茬▼
+                result.put("CHC", "n");//鍐叉
+                result.put("BPV", "n");//浜曞彛鍥炲帇
+                result.put("ZWG", "n");//鎬绘棤鍔熷姛鐜�
+                result.put("ZYG", "n");//鎬绘湁鍔熷姛鐜�
+                result.put("GYS", "n");//鍔熺巼鍥犳暟
+                result.put("UWL", "n");//鏈�澶ц浇鑽�
+                result.put("DWL", "n");//鏈�灏忚浇鑽�
+                result.put("ZHS", "n");//杞��
+            }
+            return result;
+        }else{
+            return null;
+        }
+    }
+
+    @Override
+    public ArdAlarmpointsWell getWellById(String id) {
+        ArdAlarmpointsWell result = ardAlarmpointsWellMapper.getWellById(id);
+        return result;
+    }
+
+    @Override
+    public List<Map<String, Object>> getCameraVideoLable(Long deptId, String cameraId, Float p, Float t, Float fHorFieldAngle, Float fVerFieldAngle) {
+        ArdCameras ardCameras = ardCamerasMapper.selectArdCamerasById(cameraId);
+        //灏忎笁瑙掑舰鑵�
+        Double xy = Math.tan(Math.PI/2 - (Math.PI * 2 - Math.PI * t/180) - Math.PI * fVerFieldAngle/180/2)*ardCameras.getAltitude()/Math.cos(Math.PI * fHorFieldAngle/180/2);
+        //澶т笁瑙掑舰鑵�
+        Double dy = Math.tan(Math.PI/2 - (Math.PI * 2 - Math.PI * t/180) + Math.PI * fVerFieldAngle/180/2)*ardCameras.getAltitude()/Math.cos(Math.PI * fHorFieldAngle/180/2);
+
+        if(dy < 0){
+            dy = -1 * dy;
+        }
+
+        if(xy < 0){
+            xy = -1 * xy;
+        }
+
+        Double lonA = ardCameras.getLongitude() + xy * Math.sin((p + fHorFieldAngle/2)* Math.PI / 180) * 180 / ( Math.PI * 6371229 * Math.cos(ardCameras.getLatitude() * Math.PI / 180));
+        Double latA = ardCameras.getLatitude() + xy * Math.cos((p + fHorFieldAngle/2)* Math.PI / 180) / ( Math.PI * 6371229 / 180);
+
+        System.out.println("A鐐圭粡搴�:" + lonA);
+        System.out.println("A鐐圭含搴�:" + latA);
+
+        Double lonB = ardCameras.getLongitude() + xy * Math.sin((p - fHorFieldAngle/2)* Math.PI / 180) * 180 / ( Math.PI * 6371229 * Math.cos(ardCameras.getLatitude() * Math.PI / 180));
+        Double latB = ardCameras.getLatitude() + xy * Math.cos((p - fHorFieldAngle/2)* Math.PI / 180) / ( Math.PI * 6371229 / 180);
+
+        System.out.println("B鐐圭粡搴�:" + lonB);
+        System.out.println("B鐐圭含搴�:" + latB);
+
+        Double lonC = ardCameras.getLongitude() + dy * Math.sin((p + fHorFieldAngle/2)* Math.PI / 180) * 180 / ( Math.PI * 6371229 * Math.cos(ardCameras.getLatitude() * Math.PI / 180));
+        Double latC = ardCameras.getLatitude() + dy * Math.cos((p + fHorFieldAngle/2)* Math.PI / 180) / ( Math.PI * 6371229 / 180);
+
+        System.out.println("C鐐圭粡搴�:" + lonC);
+        System.out.println("C鐐圭含搴�:" + latC);
+
+        Double lonD = ardCameras.getLongitude() + dy * Math.sin((p - fHorFieldAngle/2)* Math.PI / 180) * 180 / ( Math.PI * 6371229 * Math.cos(ardCameras.getLatitude() * Math.PI / 180));
+        Double latD = ardCameras.getLatitude() + dy * Math.cos((p - fHorFieldAngle/2)* Math.PI / 180) / ( Math.PI * 6371229 / 180);
+
+        System.out.println("D鐐圭粡搴�:" + lonD);
+        System.out.println("D鐐圭含搴�:" + latD);
+
+        Double dg = Math.tan(Math.PI/2 - (Math.PI * 2 - Math.PI * t/180) - Math.PI * fVerFieldAngle/180/2)*ardCameras.getAltitude();//澶т笁瑙掑舰楂�
+        Double xg = Math.tan(Math.PI/2 - (Math.PI * 2 - Math.PI * t/180) + Math.PI * fVerFieldAngle/180/2)*ardCameras.getAltitude();//灏忎笁瑙掑舰楂�
+
+        if(dg < 0){
+            dg = -1 * dg;
+        }
+
+        if(xg < 0){
+            xg = -1 * xg;
+        }
+
+        Double mg = xg + 0.5 * (dg - xg);
+
+        Double lonM = ardCameras.getLongitude() + mg * Math.sin(p * Math.PI / 180) * 180 / ( Math.PI * 6371229 * Math.cos(ardCameras.getLatitude() * Math.PI / 180));
+        Double latM = ardCameras.getLatitude() + mg * Math.cos(p * Math.PI / 180) / ( Math.PI * 6371229 / 180);
+        System.out.println("涓偣缁忓害:" + lonM);
+        System.out.println("涓偣绾害:" + latM);
+        //鏍规嵁閮ㄩ棬鍙婂厜杞村湴闈㈡姇褰辩瓑鑵版褰腑鐐硅幏鍙栧叴瓒g偣
+        List<ArdAlarmpointsWell> ardAlarmpointsWellResult = ardAlarmpointsWellMapper.getArdAlarmpointsWellByDeptIdAndDistance(deptId, lonM, latM, lonA, latA, lonB, latB, lonC, latC, lonD, latD);
+
+        //璁剧疆澶氳竟褰�
+        List<Point2D.Double> pts = new ArrayList<Point2D.Double>();
+        pts.add(new Point2D.Double(lonA, latA));
+        pts.add(new Point2D.Double(lonB, latB));
+        pts.add(new Point2D.Double(lonD, latD));
+        pts.add(new Point2D.Double(lonC, latC));
+
+        List<ArdAlarmpointsWell> innerList = new ArrayList();//鏌ユ壘澶氳竟褰㈠唴鍏磋叮鐐�
+        for(ArdAlarmpointsWell ardAlarmpointsWell : ardAlarmpointsWellResult){
+            Point2D.Double point = new Point2D.Double(ardAlarmpointsWell.getLongitude(), ardAlarmpointsWell.getLatitude());
+            if(GeoTools.IsPtInPoly(point, pts)){
+                innerList.add(ardAlarmpointsWell);
+            }
+        }
+
+        List<Map<String,Object>> result = new ArrayList();
+        for(ArdAlarmpointsWell ardAlarmpointsWell : innerList){
+            Map<String,Object> map = new HashMap();
+            double distance_Target = RealDistance(ardCameras.getLongitude(),ardCameras.getLongitude(),ardAlarmpointsWell.getLongitude(), ardAlarmpointsWell.getLatitude());
+
+            double Angle_A = GetAngle(ardCameras.getLongitude(),ardCameras.getLongitude(),ardAlarmpointsWell.getLongitude(), ardAlarmpointsWell.getLatitude());
+            double Angle_E = Math.atan((ardCameras.getAltitude() - 0) / distance_Target) * 180 / Math.PI;
+
+            Angle_A = Angle_A - (p - fHorFieldAngle/2);//瑙嗗満瑙掑唴鏂逛綅
+
+            Angle_E = Angle_E - (360 - t - fVerFieldAngle/2);//瑙嗗満瑙掑唴淇话
+
+            map.put("id",ardAlarmpointsWell.getId());
+            map.put("wellId",ardAlarmpointsWell.getWellId());
+            map.put("horFieldProportion",Angle_A/fHorFieldAngle);//妯悜鍗犳瘮
+            map.put("verFieldProportion",Angle_E/fVerFieldAngle);//绾靛悜鍗犳瘮
+            result.add(map);
+        }
+        return result;
+    }
+
+    public static double RealDistance(double base_pos_longitude,double base_pos_latitude,double tar_pos_longitude,double tar_pos_latitude){
+        double er;
+        double f;
+        double g;
+        double l;
+        double sg;
+        double sl;
+        double sf;
+        double s;
+        double c;
+        double w;
+        double r;
+        double d;
+        double h1;
+        double h2;
+        double fl;
+
+        er = 6378.137;
+        fl = 1 / 298.257;
+        f = (base_pos_latitude + tar_pos_latitude)*Math.PI/360;
+        g = (base_pos_latitude - tar_pos_latitude)*Math.PI/360;
+        l = (base_pos_longitude - tar_pos_longitude)*Math.PI/360;
+
+        sg = Math.sin(g);
+        sl = Math.sin(l);
+        sf = Math.sin(f);
+
+        sg = Math.pow(sg,2);
+        sl = Math.pow(sl,2);
+        sf = Math.pow(sf,2);
+
+        s = sg * (1 - sl) + (1 - sf) * sl;
+        c = (1 - sg) * (1 - sl) + sf * sl;
+
+        w = Math.atan(Math.sqrt(s / c));
+        r = Math.sqrt(s * c) / w;
+        d = 2 * w * er;
+        h1 = (3 * r - 1) / 2 / c;
+        h2 = (3 * r + 1) / 2 / s;
+
+        return 1000*d * (1 + fl * (h1 * sf * (1 - sg) - h2 * (1 - sf) * sg));//84
+    }
+
+    public static double GetAngle(double base_pos_longitude,double base_pos_latitude,double tar_pos_longitude,double tar_pos_latitude){
+        double lat1 = base_pos_latitude * Math.PI / 180;
+        double lon1 = base_pos_longitude * Math.PI / 180;
+        double lat2 = tar_pos_latitude * Math.PI / 180;
+        double lon2 = tar_pos_longitude * Math.PI / 180;
+        double d = Math.sin(lat2)*Math.sin(lat1) + Math.cos(lat2)*Math.cos(lat1)*Math.cos(lon2 - lon1);
+        if (d != 1){
+            d = Math.asin(Math.cos(lat2) * Math.sin(lon2 - lon1) / Math.sqrt(1 - d * d));
+            d = d * 180 / Math.PI;
+        }
+        else {
+            d = 0;
+        }
+        if (lat1>lat2) {
+            d = 180 - d;
+        }
+        else {
+            if (lon1>lon2) {
+                d = 360 + d;
+            }
+        }
+        return d;
+    }
+
+    public int checkTable(String url, String username, String password, String tableName) throws ClassNotFoundException, SQLException {
+        Connection connection = null;
+
+        Statement updateStatement = null;
+
+        Statement queryStatement = null;
+
+        try {
+            Class.forName("oracle.jdbc.OracleDriver");
+            connection = DriverManager.getConnection(url, username, password);
+            //Statement 瀵硅薄 鍙戦�乻ql
+            updateStatement = connection.createStatement();
+            //鏌ヨ
+            queryStatement = connection.createStatement();
+            ResultSet resultSet = queryStatement.executeQuery("select count(*) from user_tables where table_name = upper(" + tableName + ")");
+
+            int result = 0;
+            while (resultSet.next()) {
+                int column = resultSet.getInt(1);
+                result = column;
+            }
+            return result;
+        } catch (SQLException e) {
+            e.printStackTrace();
+            return 0;
+        } finally {
+            if (updateStatement != null) {
+                updateStatement.close();
+            }
+            if (queryStatement != null) {
+                queryStatement.close();
+            }
+            if (connection != null) {
+                connection.close();
+            }
+        }
+    }
+
+    public Map<String, Object> getRtuDataYjByJH(String url, String username, String password, String tableName, String JH) throws ClassNotFoundException, SQLException {
+        Connection connection = null;
+
+        Statement updateStatement = null;
+
+        Statement queryStatement = null;
+
+        try {
+            Class.forName("oracle.jdbc.OracleDriver");
+            connection = DriverManager.getConnection(url, username, password);
+            //Statement 瀵硅薄 鍙戦�乻ql
+            updateStatement = connection.createStatement();
+            //鏌ヨ
+            queryStatement = connection.createStatement();
+            ResultSet resultSet = queryStatement.executeQuery("select rdy0.* from " + tableName + " rdy0 inner join (" +
+                    "select rdy.JH,max(rdy.RQ) as RQ from RTU_DATA_YJ_8 rdy group by rdy.JH" +
+                    ")t on rdy0.JH = t.JH and rdy0.RQ = t.RQ where rdy0.JH = " + JH);
+
+            Map<String, Object> result = new HashMap();
+            while (resultSet.next()) {
+                result.put("wellRunningState", "n");
+                result.put("totalPowerConsumption", "n");//鎬昏�楃數閲�
+                result.put("communicationMachine", "n");//璁惧閫氳
+                result.put("remark", "n");//澶囨敞
+                result.put("singleWellWaterTemperature", "n");//鍗曚簳鎺烘按娓╁害//
+                result.put("meteringPlantWaterPressure", "n");//璁¢噺闂存幒姘村帇鍔�//
+                result.put("torque", "n");//鎵煩
+
+                if (resultSet.getString("MAT") != null) {//鍥炴补娓╁害
+                    result.put("MAT", resultSet.getString("MAT"));
+                } else {
+                    result.put("MAT", "n");
+                }
+                if (resultSet.getString("TGP") != null) {//浜曞彛娌瑰帇
+                    result.put("TGP", resultSet.getString("TGP"));
+                } else {
+                    result.put("TGP", "n");
+                }
+                if (resultSet.getString("CPV") != null) {//浜曞彛濂楀帇
+                    result.put("CPV", resultSet.getString("CPV"));
+                } else {
+                    result.put("CPV", "n");
+                }
+                if (resultSet.getString("ADL") != null) {//A鐩哥數娴�
+                    result.put("ADL", resultSet.getString("ADL"));
+                } else {
+                    result.put("ADL", "n");
+                }
+                if (resultSet.getString("ADY") != null) {//A鐩哥數鍘�
+                    result.put("ADY", resultSet.getString("ADY"));
+                } else {
+                    result.put("ADY", "n");
+                }
+                if (resultSet.getString("BDL") != null) {//B鐩哥數娴�
+                    result.put("BDL", resultSet.getString("BDL"));
+                } else {
+                    result.put("BDL", "n");
+                }
+                if (resultSet.getString("BDY") != null) {//B鐩哥數鍘�
+                    result.put("BDY", resultSet.getString("BDY"));
+                } else {
+                    result.put("BDY", "n");
+                }
+                if (resultSet.getString("CDL") != null) {//C鐩哥數娴�
+                    result.put("CDL", resultSet.getString("CDL"));
+                } else {
+                    result.put("CDL", "n");
+                }
+                if (resultSet.getString("CDY") != null) {//C鐩哥數鍘�
+                    result.put("CDY", resultSet.getString("CDY"));
+                } else {
+                    result.put("CDY", "n");
+                }
+                if (resultSet.getString("UCV") != null) {//涓婅鐢垫祦
+                    result.put("UCV", resultSet.getString("UCV"));
+                } else {
+                    result.put("UCV", "n");
+                }
+                if (resultSet.getString("DCV") != null) {//涓嬭鐢垫祦
+                    result.put("DCV", resultSet.getString("DCV"));
+                } else {
+                    result.put("DCV", "n");
+                }
+                if (resultSet.getString("SLV") != null) {//鍐茬▼
+                    result.put("SLV", resultSet.getString("SLV"));
+                } else {
+                    result.put("SLV", "n");
+                }
+                if (resultSet.getString("CHC") != null) {//鍐叉
+                    result.put("CHC", resultSet.getString("CHC"));
+                } else {
+                    result.put("CHC", "n");
+                }
+                if (resultSet.getString("BPV") != null) {//浜曞彛鍥炲帇
+                    result.put("BPV", resultSet.getString("BPV"));
+                } else {
+                    result.put("BPV", "n");
+                }
+                if (resultSet.getString("ZWG") != null) {//鎬绘棤鍔熷姛鐜�
+                    result.put("ZWG", resultSet.getString("ZWG"));
+                } else {
+                    result.put("ZWG", "n");
+                }
+                if (resultSet.getString("ZYG") != null) {//鎬绘湁鍔熷姛鐜�
+                    result.put("ZYG", resultSet.getString("ZYG"));
+                } else {
+                    result.put("ZYG", "n");
+                }
+                if (resultSet.getString("GYS") != null) {//鍔熺巼鍥犳暟
+                    result.put("GYS", resultSet.getString("GYS"));
+                } else {
+                    result.put("GYS", "n");
+                }
+                if (resultSet.getString("UWL") != null) {//鏈�澶ц浇鑽�
+                    result.put("UWL", resultSet.getString("UWL"));
+                } else {
+                    result.put("UWL", "n");
+                }
+                if (resultSet.getString("DWL") != null) {//鏈�灏忚浇鑽�
+                    result.put("DWL", resultSet.getString("DWL"));
+                } else {
+                    result.put("DWL", "n");
+                }
+                if (resultSet.getString("ZHS") != null) {//杞��
+                    result.put("ZHS", resultSet.getString("ZHS"));
+                } else {
+                    result.put("ZHS", "n");
+                }
+            }
+            if (result.size() == 0) {
+                result.put("wellRunningState", "n");//娌逛簳杩愯鐘舵��
+                result.put("totalPowerConsumption", "n");//鎬昏�楃數閲�
+                result.put("communicationMachine", "n");//璁惧閫氳
+                result.put("remark", "n");//澶囨敞
+                result.put("singleWellWaterTemperature", "n");//鍗曚簳鎺烘按娓╁害//
+                result.put("meteringPlantWaterPressure", "n");//璁¢噺闂存幒姘村帇鍔�//
+                result.put("torque", "n");//鎵煩
+                result.put("MAT", "n");//鍥炴补娓╁害
+                result.put("TGP", "n");//浜曞彛娌瑰帇
+                result.put("CPV", "n");//浜曞彛濂楀帇
+                result.put("ADL", "n");//A鐩哥數娴�
+                result.put("ADY", "n");//A鐩哥數鍘�
+                result.put("BDL", "n");//B鐩哥數娴�
+                result.put("BDY", "n");//B鐩哥數鍘�
+                result.put("CDL", "n");//C鐩哥數娴�
+                result.put("CDY", "n");//C鐩哥數鍘�
+                result.put("UCV", "n");//涓婅鐢垫祦
+                result.put("DCV", "n");//涓嬭鐢垫祦
+                result.put("SLV", "n");//鍐茬▼
+                result.put("CHC", "n");//鍐叉
+                result.put("BPV", "n");//浜曞彛鍥炲帇
+                result.put("ZWG", "n");//鎬绘棤鍔熷姛鐜�
+                result.put("ZYG", "n");//鎬绘湁鍔熷姛鐜�
+                result.put("GYS", "n");//鍔熺巼鍥犳暟
+                result.put("UWL", "n");//鏈�澶ц浇鑽�
+                result.put("DWL", "n");//鏈�灏忚浇鑽�
+                result.put("ZHS", "n");//杞��
+            }
+            return result;
+        } finally {
+            if (updateStatement != null) {
+                updateStatement.close();
+            }
+            if (queryStatement != null) {
+                queryStatement.close();
+            }
+            if (connection != null) {
+                connection.close();
+            }
+        }
+    }
+
 }

--
Gitblit v1.9.3