diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..359bb53
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..357b45b
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..63574ec
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..4b4cb0e
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..712ab9d
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..6f5230a
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..2b63946
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 905408c..a386647 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,6 +24,12 @@
+
+ com.auth0
+ java-jwt
+ 3.4.0
+
+
org.springframework.boot
spring-boot-starter-web
@@ -108,6 +114,6 @@
spring-boot-maven-plugin
-
+
\ No newline at end of file
diff --git a/src/main/java/com/xydl/service/impl/EiaServiceImpl.java b/src/main/java/com/xydl/service/impl/EiaServiceImpl.java
index 4acda12..6ae87fa 100644
--- a/src/main/java/com/xydl/service/impl/EiaServiceImpl.java
+++ b/src/main/java/com/xydl/service/impl/EiaServiceImpl.java
@@ -146,7 +146,7 @@ public class EiaServiceImpl implements EiaService {
List tableNames = new ArrayList<>();
try {
conn = DataSourceUtils.getConnection();
- String sql = "select DISTINCT table_name from sync_tables_info";
+ String sql = "select table_name from sync_tables_info";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
@@ -189,45 +189,69 @@ public class EiaServiceImpl implements EiaService {
return fieldsMap;
}
- public String getLastRecordTimeSended(String tableName,String deviceId) {
- Connection conn = null;
- PreparedStatement pstmt = null;
- ResultSet rs = null;
- Timestamp timeStamp = null;
- try {
- conn = DataSourceUtils.getConnection();
- String sql = "select field_val2 from sync_records where table_name =? and devid_val=?";
- pstmt = conn.prepareStatement(sql);
- pstmt.setString(1, tableName);
- pstmt.setString(2, deviceId);
- rs = pstmt.executeQuery();
- if(rs.next()){
- timeStamp = rs.getTimestamp("field_val2");
-
- }
- } catch (SQLException e) {
- logger.error("execute sql exception:", e);
- } finally {
- DataSourceUtils.closeResource(rs, pstmt, conn);
- }
-
- return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(timeStamp);
- }
+// public String getLastRecordTimeSended(String tableName,String deviceId) {
+// Connection conn = null;
+// PreparedStatement pstmt = null;
+// ResultSet rs = null;
+// Timestamp timeStamp = null;
+// try {
+// conn = DataSourceUtils.getConnection();
+// String sql = "select field_val2 from sync_records where table_name =? and devid_val=?";
+// pstmt = conn.prepareStatement(sql);
+// pstmt.setString(1, tableName);
+// pstmt.setString(2, deviceId);
+// rs = pstmt.executeQuery();
+// if(rs.next()){
+// timeStamp = rs.getTimestamp("field_val2");
+//
+// }
+// } catch (SQLException e) {
+// logger.error("execute sql exception:", e);
+// } finally {
+// DataSourceUtils.closeResource(rs, pstmt, conn);
+// }
+//
+// return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(timeStamp);
+// }
+
+// public List getDeviceID(String tableName) {
+// Connection conn = null;
+// PreparedStatement pstmt = null;
+// ResultSet rs = null;
+// String sqlExecuting = null ;
+// List deviceIDs = new ArrayList<>();
+// try {
+// conn = DataSourceUtils.getConnection();
+// String sql = "select distinct devid_val from sync_records where table_name =?";
+// pstmt = conn.prepareStatement(sql);
+// pstmt.setString(1, tableName);
+// rs = pstmt.executeQuery();
+// while(rs.next()){
+// deviceIDs.add(rs.getString("devid_val"));
+// }
+// } catch (SQLException e) {
+// logger.error("execute sql exception:", e);
+// } finally {
+// DataSourceUtils.closeResource(rs, pstmt, conn);
+// }
+//
+// return deviceIDs;
+// }
- public List getDeviceID(String tableName) {
+ public Map getDeviceID1(String tableName) {
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sqlExecuting = null ;
- List deviceIDs = new ArrayList<>();
+ Map devIDTimeMap = new HashMap<>();
try {
conn = DataSourceUtils.getConnection();
- String sql = "select distinct devid_val from sync_records where table_name =?";
+ String sql = "select devid_val,field_val2 from sync_records where table_name =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tableName);
rs = pstmt.executeQuery();
while(rs.next()){
- deviceIDs.add(rs.getString("devid_val"));
+ devIDTimeMap.put(rs.getString("devid_val"),rs.getString("field_val2"));
}
} catch (SQLException e) {
logger.error("execute sql exception:", e);
@@ -235,7 +259,7 @@ public class EiaServiceImpl implements EiaService {
DataSourceUtils.closeResource(rs, pstmt, conn);
}
- return deviceIDs;
+ return devIDTimeMap;
}
public String getSQL(String tableName) {
@@ -293,111 +317,177 @@ public class EiaServiceImpl implements EiaService {
}
+// @Scheduled(initialDelay=1000, fixedRate = 1000 * 3600) //通过@Scheduled声明该方法是计划任务,使用fixedRate属性每隔固定时间执行
+// public void reportRecord(){
+// List allTableNames = getAllTableName();
+// Map> tableFieldMap = new HashMap<>();
+// Map>>>> allTableData = new HashMap<>();
+// for(String tablenName : allTableNames){
+// //if用来测试
+// if(!"data_eaif_h".equals(tablenName)){
+// Map fieldMap = getFieldMap(tablenName);
+// tableFieldMap.put(tablenName,fieldMap);
+//
+// String sqlExecuting = getSQL(tablenName);
+// List deviceIDs = getDeviceID(tablenName);
+// List