From 8a2bfef1ebf3a1e24f770d3481ff82856f14d9e0 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期五, 24 十一月 2023 15:47:42 +0800
Subject: [PATCH] 设备运行状态
---
ard-work/pom.xml | 19 +++
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/RTU_DATA_YJ_8Service.java | 13 ++
ard-work/src/main/java/com/ruoyi/utils/data/Conn.java | 91 +++++++++++++++
ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/RTU_DATA_YJ_8Mapper.java | 9 +
ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/RTU_DATA_YJ_8.java | 40 ++++++
ard-work/src/main/java/com/ruoyi/utils/forest/SYClient.java | 2
ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java | 15 ++
ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java | 2
ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java | 7 +
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/RTU_DATA_YJ_8MapperServiceImpl.java | 23 +++
ard-work/src/main/java/com/ruoyi/utils/data/Query.java | 85 ++++++++++++++
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java | 6 +
12 files changed, 312 insertions(+), 0 deletions(-)
diff --git a/ard-work/pom.xml b/ard-work/pom.xml
index de2d1f7..1643120 100644
--- a/ard-work/pom.xml
+++ b/ard-work/pom.xml
@@ -184,5 +184,24 @@
<artifactId>commons-discovery</artifactId>
<version>0.5</version>
</dependency>
+<!-- <!– https://mvnrepository.com/artifact/com.oracle.database.jdbc/ojdbc8 –>-->
+ <dependency>
+ <groupId>com.oracle.database.jdbc</groupId>
+ <artifactId>ojdbc8</artifactId>
+ <version>23.3.0.23.09</version>
+ </dependency>
+ <!-- orai18n -->
+ <dependency>
+ <groupId>cn.easyproject</groupId>
+ <artifactId>orai18n</artifactId>
+ <version>12.1.0.2.0</version>
+ </dependency>
+<!-- <dependency>-->
+<!-- <groupId>com.alibaba</groupId>-->
+<!-- <artifactId>druid</artifactId>-->
+<!-- <version>1.2.15</version>-->
+<!-- <scope>compile</scope>-->
+<!-- </dependency>-->
+
</dependencies>
</project>
\ No newline at end of file
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 340b055..9b44f0b 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
@@ -14,6 +14,7 @@
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysUserService;
+import com.ruoyi.utils.data.Query;
import com.ruoyi.utils.pagehelper.JpaPageInfo;
import com.ruoyi.utils.result.Results;
import io.swagger.annotations.Api;
@@ -226,4 +227,10 @@
return AjaxResult.success(jpaPageInfo);
}
+ @GetMapping("/getRTUDataYJ8")
+ @ApiOperation("鏌ヨ璁惧杩愯鐘舵��")
+ public AjaxResult getRTUDataYJ8(String wellId){
+ return AjaxResult.success(Query.getRTUDataYJ8(wellId));
+ }
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/RTU_DATA_YJ_8.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/RTU_DATA_YJ_8.java
new file mode 100644
index 0000000..f83ac65
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/RTU_DATA_YJ_8.java
@@ -0,0 +1,40 @@
+package com.ruoyi.alarmpoints.well.domain;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class RTU_DATA_YJ_8 {
+ private String JH;
+ private Date RQ;
+ private Integer MAT;
+ private Integer TGP;
+ private Integer CPV;
+ private Integer ADL;
+ private Integer ADY;
+ private Integer BDL;
+ private Integer BDY;
+ private Integer CDL;
+ private Integer CDY;
+ private Integer UCV;
+ private Integer DCV;
+ private Integer SLV;
+ private Integer CHC;
+ private Integer BPV;
+ private Integer ZWG;
+ private Integer ZYG;
+ private Integer GYS;
+ private Integer UWL;
+ private Integer DWL;
+ private String TIME;
+ private Date LRSJ;
+ private Integer XT;
+ private Integer SCSJ;
+ private Integer SCSL;
+ private Integer MLV;
+ private Integer DLV;
+ private Integer XY;
+ private Integer NJU;
+ private Integer ZHS;
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/RTU_DATA_YJ_8Mapper.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/RTU_DATA_YJ_8Mapper.java
new file mode 100644
index 0000000..1091235
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/RTU_DATA_YJ_8Mapper.java
@@ -0,0 +1,9 @@
+package com.ruoyi.alarmpoints.well.mapper;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.alarmpoints.well.domain.RTU_DATA_YJ_8;
+
+@DS("orcl")
+public interface RTU_DATA_YJ_8Mapper extends BaseMapper<RTU_DATA_YJ_8> {
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/RTU_DATA_YJ_8Service.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/RTU_DATA_YJ_8Service.java
new file mode 100644
index 0000000..c333dcf
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/RTU_DATA_YJ_8Service.java
@@ -0,0 +1,13 @@
+package com.ruoyi.alarmpoints.well.service;
+
+import com.ruoyi.alarmpoints.well.domain.RTU_DATA_YJ_8;
+
+import java.util.List;
+
+/**
+ * @author Administrator
+ */
+public interface RTU_DATA_YJ_8Service {
+
+ List<RTU_DATA_YJ_8> all();
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/RTU_DATA_YJ_8MapperServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/RTU_DATA_YJ_8MapperServiceImpl.java
new file mode 100644
index 0000000..7e99e66
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/RTU_DATA_YJ_8MapperServiceImpl.java
@@ -0,0 +1,23 @@
+package com.ruoyi.alarmpoints.well.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.ruoyi.alarmpoints.well.domain.RTU_DATA_YJ_8;
+import com.ruoyi.alarmpoints.well.mapper.RTU_DATA_YJ_8Mapper;
+import com.ruoyi.alarmpoints.well.service.RTU_DATA_YJ_8Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@DS("orcl")
+@Service
+public class RTU_DATA_YJ_8MapperServiceImpl implements RTU_DATA_YJ_8Service {
+
+ @Autowired
+ private RTU_DATA_YJ_8Mapper rtu_data_yj_8Mapper;
+
+ @Override
+ public List<RTU_DATA_YJ_8> all() {
+ return rtu_data_yj_8Mapper.selectList(null);
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
index a372488..6d97512 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
@@ -451,4 +451,19 @@
return AjaxResult.success("鑾峰彇鍦板潃鎴愬姛锛�",sysConfigService.selectConfigByKey("threeOneVideo"));
}
+ @PreAuthorize("@ss.hasPermi('sy:syCar:getAlarmHPfmCountDetail')")
+ @PostMapping("getAlarmHPfmCountDetail")
+ @ApiOperation("鏍规嵁杞﹁締鍜屾椂闂存鏌ヨ鎶ヨ鍘嗗彶璁板綍璇︽儏")
+ public AjaxResult getAlarmHPfmCountDetail(@RequestBody Map<String,String> map){
+ String usersId = SecurityUtils.getUserId();
+ ArdSyUser ardSyUser = iArdSyUserService.userById(usersId);
+ String carId = map.get("carId");
+ String startTime = map.get("startTime");
+ String endTime = map.get("endTime");
+ String syURL = sysConfigService.getSYURL();
+ String sessionId = ardSyCarService.getSessionId(syURL,ardSyUser);
+ Map<String, Object> mapDetail = ardSyCarService.getAlarmHPfmCountDetail(sessionId,usersId,carId,startTime,endTime,syURL);
+ return AjaxResult.success(mapDetail);
+ }
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java b/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
index ff834a1..c89042b 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
@@ -159,4 +159,6 @@
List<ArdSyCar> all();
+ Map<String, Object> getAlarmHPfmCountDetail(String sessionId,String usersId,String carId,String startTime,String endTime,String syURL);
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
index 2efbc05..c5d4c27 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
@@ -1222,4 +1222,10 @@
return ardSyCarMapper.selectList(queryWrapper);
}
+ @Override
+ public Map<String, Object> getAlarmHPfmCountDetail(String sessionId, String usersId, String carId, String startTime, String endTime, String syURL) {
+// System.out.println("sessionId------"+sessionId+",usersId-----"+usersId+",carId-----"+carId+",startTime----"+startTime+",endTime----"+endTime+",syURL----"+syURL);
+ return sYClient.getAlarmHPfmCountDetail(syURL,carId,sessionId,startTime,endTime);
+ }
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/data/Conn.java b/ard-work/src/main/java/com/ruoyi/utils/data/Conn.java
new file mode 100644
index 0000000..cc3be10
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/utils/data/Conn.java
@@ -0,0 +1,91 @@
+package com.ruoyi.utils.data;
+
+import java.sql.*;
+
+public class Conn {
+ //jdbc杩炴帴闇�瑕佺敤鍒扮殑涓変釜鍙傛暟
+ private String url="jdbc:oracle:thin:@112.98.126.2:21521:orcl";
+ private String user="c##ard_user";
+ private String pwd="123456";
+
+ //鍒涘缓涓�涓璞� 璁剧疆涓洪潤鎬佺鏈� 锛堝崟渚嬫ā寮忥級
+ private static Conn gc=null;
+
+ //灏嗘瀯閫犲嚱鏁拌涓簆rivate鍨� 闃叉澶栭儴瀹炰緥鍖栧璞� 锛堥�氳繃鍙嶅皠鎴栧弽搴忓垪鍖栧彲浠ョ牬瑙e崟渚嬶級
+ private Conn(){};
+
+ //闈欐�佷唬鐮佸潡锛屽湪绫诲姞杞借繘鍐呭瓨鏃跺氨瀹屾垚瀵瑰璞$殑鐗规畩鐨勫垵濮嬪寲锛堣繖涓姩浣滃彂鐢熷湪绫荤殑鏋勯�犲櫒鎵ц涔嬪墠锛屼篃灏辨槸鍦ㄦ病鏈夊璞″瓨鍦ㄧ殑鎯呭喌涓嬶紝闈欐�佷唬鐮佸氨宸茬粡瀹屾垚浜嗗瀵硅薄鐨勭壒娈婄殑澶勭悊 锛夛紝姝ゅ鐨勪綔鐢ㄦ槸锛屽綋jdbc鐨勯┍鍔ㄥ櫒鍔犺浇鏃讹紝灏辫嚜鍔ㄥ垱寤轰竴涓嚜宸便��
+ static{
+ try {
+ //娉ㄥ唽椹卞姩
+ Class.forName("oracle.jdbc.OracleDriver");
+ } catch (ClassNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ //鍒ゆ柇GetConn瀹炰緥鍖栫殑瀵硅薄鏄惁瀛樺湪 涓嶅瓨鍦ㄥ氨瀹炰緥鍖栦竴涓�
+ //synchronized 绾跨▼閿� 闃叉澶氫釜绾跨▼鎶㈠崰璧勬簮 闃叉姝婚攣
+ public static Conn getGc(){
+ if(gc==null){
+ synchronized (Conn.class) {
+ if(gc==null){
+ gc=new Conn();
+ }
+ }
+ }
+ return gc;
+ }
+
+ //杩斿洖涓�涓狢onnection杩炴帴
+ public Connection getCon() throws SQLException {
+ return DriverManager.getConnection(url, user, pwd);
+ }
+ //閲婃斁璧勬簮
+ public void closeAll(ResultSet rs, Statement st, Connection con){
+ if(rs!=null){
+ try {
+ rs.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }finally{
+ if(st!=null){
+ try {
+ st.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }finally{
+ if(con!=null){
+ try {
+ con.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+ }
+ if(st!=null){
+ try {
+ st.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }finally{
+ if(con!=null){
+ try {
+ con.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/data/Query.java b/ard-work/src/main/java/com/ruoyi/utils/data/Query.java
new file mode 100644
index 0000000..eb69b6d
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/utils/data/Query.java
@@ -0,0 +1,85 @@
+package com.ruoyi.utils.data;
+
+import com.ruoyi.alarmpoints.well.domain.RTU_DATA_YJ_8;
+import lombok.extern.slf4j.Slf4j;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@Slf4j(topic = "orcl")
+public class Query {
+ static Connection conn = null;
+ static Statement st = null;
+ static ResultSet rs = null;
+
+ public static List<RTU_DATA_YJ_8> getRTUDataYJ8(String wellId) {
+ List<RTU_DATA_YJ_8> dataBridgeList = new ArrayList<>();
+ try {
+ //1銆佽幏鍙栬繛鎺ュ璞�
+ conn = Conn.getGc().getCon();
+ //2銆佸垱寤簊tatement绫诲璞★紝鐢ㄦ潵鎵цSQL璇彞
+ st = conn.createStatement();
+ //3銆佸垱寤簊ql鏌ヨ璇彞
+ StringBuilder sbd = new StringBuilder();
+ String sql = "select * from RTU_DATA_YJ_8 where 1=1 ";
+ sbd.append(sql);
+ if (wellId != null) {
+ sbd.append(" and JH ='" + wellId+"'");
+ }
+ //4銆佹墽琛宻ql璇彞骞朵笖鎹㈠洖涓�涓煡璇㈢殑缁撴灉闆�
+ rs = st.executeQuery(sbd.toString());
+ while (rs.next()) { //寰幆閬嶅巻缁撴灉闆�
+ RTU_DATA_YJ_8 rtu_data_yj_8 = new RTU_DATA_YJ_8();
+ rtu_data_yj_8.setJH(rs.getString("JH"));
+ rtu_data_yj_8.setRQ(rs.getDate("RQ"));
+ rtu_data_yj_8.setMAT(rs.getInt("MAT"));
+ rtu_data_yj_8.setTGP(rs.getInt("TGP"));
+ rtu_data_yj_8.setCPV(rs.getInt("CPV"));
+ rtu_data_yj_8.setADL(rs.getInt("ADL"));
+ rtu_data_yj_8.setADY(rs.getInt("ADY"));
+ rtu_data_yj_8.setBDL(rs.getInt("BDL"));
+ rtu_data_yj_8.setBDL(rs.getInt("BDL"));
+ rtu_data_yj_8.setCDL(rs.getInt("CDL"));
+ rtu_data_yj_8.setCDY(rs.getInt("CDY"));
+ rtu_data_yj_8.setUCV(rs.getInt("UCV"));
+ rtu_data_yj_8.setDCV(rs.getInt("DCV"));
+ rtu_data_yj_8.setSLV(rs.getInt("SLV"));
+ rtu_data_yj_8.setCHC(rs.getInt("CHC"));
+ rtu_data_yj_8.setBPV(rs.getInt("BPV"));
+ rtu_data_yj_8.setZWG(rs.getInt("ZWG"));
+ rtu_data_yj_8.setZYG(rs.getInt("ZYG"));
+ rtu_data_yj_8.setGYS(rs.getInt("GYS"));
+ rtu_data_yj_8.setUWL(rs.getInt("UWL"));
+ rtu_data_yj_8.setDWL(rs.getInt("DWL"));
+ rtu_data_yj_8.setTIME(rs.getString("TIME"));
+ rtu_data_yj_8.setLRSJ(rs.getDate("LRSJ"));
+ rtu_data_yj_8.setXT(rs.getInt("XT"));
+ rtu_data_yj_8.setSCSJ(rs.getInt("SCSJ"));
+ rtu_data_yj_8.setSCSL(rs.getInt("SCSL"));
+ rtu_data_yj_8.setMLV(rs.getInt("MLV"));
+ rtu_data_yj_8.setDLV(rs.getInt("DLV"));
+ rtu_data_yj_8.setDLV(rs.getInt("DLV"));
+ rtu_data_yj_8.setXY(rs.getInt("XY"));
+ rtu_data_yj_8.setNJU(rs.getInt("NJU"));
+ rtu_data_yj_8.setZHS(rs.getInt("ZHS"));
+ dataBridgeList.add(rtu_data_yj_8);
+ }
+ return dataBridgeList;
+ } catch (Exception e) {
+ log.error("璁惧杩愯鐘舵�佹煡璇㈠紓甯�:" + e.getMessage());
+ return dataBridgeList;
+ } finally {
+ try {
+ conn.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/forest/SYClient.java b/ard-work/src/main/java/com/ruoyi/utils/forest/SYClient.java
index adf90fd..f0cac0f 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/forest/SYClient.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/forest/SYClient.java
@@ -39,4 +39,6 @@
@Get(url = "${syURL}/gps-web/api/video/realplay.jsp?username=${username}&password=${password}&plate=${plate}&color=${color}")
Map<String,Object> getVideo(@Var("syURL") String syURL, @Var("username") String username,@Var("password") String password,@Var("plate") String plate,@Var("color") Integer color);
+ @Get(url = "${syURL}/gps-web/api/get_alarm_h_pfm_detail.jsp?carId=${carId}&startTime=${startTime}&endTime=${endTime}&typeIds=&speed=&duration=&alarmSrcs=&alarmLevels=1&sessionId=${sessionId}")
+ Map<String,Object> getAlarmHPfmCountDetail(@Var("syURL") String syURL, @Var("carId") String carId,@Var("sessionId") String sessionId,@Var("startTime") String startTime,@Var("endTime") String endTime);
}
--
Gitblit v1.9.3