From 60a9ab1441177c4c489f8a2dd12bfb779124e4ea Mon Sep 17 00:00:00 2001
From: zhangnaisong <2434969829@qq.com>
Date: 星期四, 22 二月 2024 11:00:32 +0800
Subject: [PATCH] 查看巡检下最近兴趣点提交
---
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java | 2
ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml | 36 ++++++
ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java | 3
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java | 256 ++++++++++++++++++++++++++++++++++++++++++
ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java | 9 +
5 files changed, 306 insertions(+), 0 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java
index 8925dfe..1ba431f 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java
@@ -248,4 +248,13 @@
return AjaxResult.success(result);
}
+ @GetMapping("/getWellDataByPatrolplanIdAndPosition")
+ @ApiOperation("鏌ヨ鏈�杩戝贰妫�璁惧鍔ㄩ潤鎬佸睘鎬�")
+ public AjaxResult getWellDataByPatrolplanIdAndPosition(@RequestBody Map<String,Object> para){
+ SysConfig config = new SysConfig();
+ config.setConfigKey("3coracle");
+ List<SysConfig> sysConfigResult = sysConfigService.selectConfigList(config);
+ Map<String,Object> result = ardAlarmpointsWellService.getWellDataByPatrolplanIdAndPosition(para,sysConfigResult);
+ return AjaxResult.success(result);
+ }
}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java
index 87e7bd6..5b4d607 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java
@@ -6,6 +6,7 @@
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellDeptVo;
import com.ruoyi.common.annotation.DataScope;
+import org.apache.ibatis.annotations.Param;
/**
@@ -98,4 +99,6 @@
List<ArdAlarmpointsWellDeptVo> wellListDept(List<Long> deptList);
+ ArdAlarmpointsWell getWellDataByPatrolplanIdAndPosition(@Param("patrolplanId") String patrolplanId,@Param("longitude") Double longitude,@Param("latitude") Double latitude);
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
index 8c539e3..ae0f9ae 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
@@ -137,4 +137,6 @@
* 鏌ヨ娌逛簳鍔ㄩ潤鎬佹暟鎹�
*/
Map<String,Object> getWellDataByWellId(String wellId, List<SysConfig> config);
+
+ Map<String,Object> getWellDataByPatrolplanIdAndPosition(Map<String,Object> para,List<SysConfig> sysConfigResult);
}
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 5d1b0f7..6239f13 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,5 +1,6 @@
package com.ruoyi.alarmpoints.well.service.impl;
+import java.math.BigDecimal;
import java.sql.*;
import java.util.ArrayList;
import java.util.HashMap;
@@ -582,6 +583,261 @@
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;
+ }
+ }
+
public int checkTable(String url, String username, String password, String tableName) throws ClassNotFoundException, SQLException {
Connection connection = null;
diff --git a/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml b/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml
index 3a40ea3..e62fd44 100644
--- a/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml
+++ b/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml
@@ -70,6 +70,32 @@
left join sys_user u on u.user_id = c.user_id
</sql>
+ <resultMap type="ArdAlarmpointsWell" id="ArdAlarmpointsWellOnlyResult">
+ <result property="id" column="id"/>
+ <result property="wellId" column="well_id"/>
+ <result property="wellNumber" column="well_number"/>
+ <result property="oilProduction" column="oil_production"/>
+ <result property="wellBlock" column="well_block"/>
+ <result property="productionDate" column="production_date"/>
+ <result property="displacementMode" column="displacement_mode"/>
+ <result property="surroundingEnvironment" column="surrounding_environment"/>
+ <result property="wellType" column="well_type"/>
+ <result property="installedLoad" column="installed_load"/>
+ <result property="meteringStation" column="metering_station"/>
+ <result property="transferStation" column="transfer_station"/>
+ <result property="dehydrationStation" column="dehydration_station"/>
+ <result property="runStatus" column="run_status"/>
+ <result property="longitude" column="longitude"/>
+ <result property="latitude" column="latitude"/>
+ <result property="altitude" column="altitude"/>
+ <result property="deptId" column="dept_id"/>
+ <result property="userId" column="user_id"/>
+ <result property="createBy" column="create_by"/>
+ <result property="createTime" column="create_time"/>
+ <result property="updateBy" column="update_by"/>
+ <result property="updateTime" column="update_time"/>
+ </resultMap>
+
<select id="selectArdAlarmpointsWellList" parameterType="ArdAlarmpointsWell" resultMap="ArdAlarmpointsWellResult">
<include refid="selectArdAlarmpointsWellVo"/>
<where>
@@ -258,4 +284,14 @@
#{item}
</foreach>
</select>
+
+ <select id="getWellDataByPatrolplanIdAndPosition" resultMap="ArdAlarmpointsWellOnlyResult">
+ select aaw.* from ard_app_patrolplan aap
+ inner join ard_app_patrolpoint aap0 on aap.id = aap0.patrolplan_id
+ inner join ard_alarmpoints_well aaw on aap0.alarmpoints_id = aaw.id
+ where del is null and aap.id = #{patrolplanId}
+ and f_compute_distance(cast(#{longitude} as decimal),cast(#{latitude} as decimal),aaw.longitude,aaw.latitude)
+ <= (select cast(sc.config_value as decimal) from sys_config sc where sc.config_key = 'appAlarmPointsDistance')
+ order by f_compute_distance(cast(#{longitude} as decimal),cast(#{latitude} as decimal),aaw.longitude,aaw.latitude) desc limit 1 offset 0
+ </select>
</mapper>
--
Gitblit v1.9.3